新增清除缓存时同时清理聊天记录缓存;新增打包编译文件用时间戳维护
This commit is contained in:
parent
4a5d005600
commit
4381520f3c
@ -16,7 +16,8 @@ import { vLoading } from '@/components/x-loading/index.js'
|
|||||||
import messagePopup from '@/components/x-message/useMessagePopup'
|
import messagePopup from '@/components/x-message/useMessagePopup'
|
||||||
import pageAnimation from '@/components/page-animation/index.vue'
|
import pageAnimation from '@/components/page-animation/index.vue'
|
||||||
import * as plugins from './plugins'
|
import * as plugins from './plugins'
|
||||||
import { useDialogueStore, useTalkStore, useUserStore } from '@/store'
|
import { useDialogueStore, useTalkStore, useUserStore, useDialogueListStore } from '@/store'
|
||||||
|
import {uniStorage} from "@/utils/uniStorage.js"
|
||||||
|
|
||||||
const { showMessage } = messagePopup()
|
const { showMessage } = messagePopup()
|
||||||
dayjs.locale('zh-cn')
|
dayjs.locale('zh-cn')
|
||||||
@ -92,6 +93,9 @@ export function createApp() {
|
|||||||
|
|
||||||
//处理OA、墨册强制刷新时,聊天同步强制刷新
|
//处理OA、墨册强制刷新时,聊天同步强制刷新
|
||||||
window.doLocationRefresh = () => {
|
window.doLocationRefresh = () => {
|
||||||
|
//同时先清除聊天记录缓存
|
||||||
|
useDialogueListStore().dialogueList.value = []
|
||||||
|
uniStorage.removeItem('dialogueList')
|
||||||
location.reload(true)
|
location.reload(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,10 +15,14 @@ export default defineConfig({
|
|||||||
resolve: {
|
resolve: {
|
||||||
alias: [
|
alias: [
|
||||||
{
|
{
|
||||||
find: "@",
|
find: '@',
|
||||||
replacement: resolve(process.cwd(), 'src')
|
replacement: resolve(process.cwd(), 'src'),
|
||||||
}
|
},
|
||||||
]
|
{
|
||||||
|
find: '@/static',
|
||||||
|
replacement: resolve(__dirname, 'src/static'),
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
host: '0.0.0.0', // 监听所有网络接口
|
host: '0.0.0.0', // 监听所有网络接口
|
||||||
@ -28,9 +32,9 @@ export default defineConfig({
|
|||||||
'/pag': {
|
'/pag': {
|
||||||
target: 'https://cdn.tmui.design',
|
target: 'https://cdn.tmui.design',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (path) => path.replace(/^\/api/, '/api')
|
rewrite: (path) => path.replace(/^\/api/, '/api'),
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
Uni(),
|
Uni(),
|
||||||
@ -44,39 +48,69 @@ export default defineConfig({
|
|||||||
'useDialog',
|
'useDialog',
|
||||||
'useMessage',
|
'useMessage',
|
||||||
'useNotification',
|
'useNotification',
|
||||||
'useLoadingBar'
|
'useLoadingBar',
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}),
|
}),
|
||||||
Components({
|
Components({
|
||||||
resolvers: [NaiveUiResolver()]
|
resolvers: [NaiveUiResolver()],
|
||||||
})
|
}),
|
||||||
],
|
],
|
||||||
build: {
|
build: {
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
output: {
|
output: {
|
||||||
// 输出重构 打包编译后的js文件名称,添加时间戳
|
entryFileNames(chunkInfo) {
|
||||||
entryFileNames: `js/[name].${timestamp}.js`,
|
return `static/js/${chunkInfo.name}.${timestamp}.js`
|
||||||
chunkFileNames: `js/[name].${timestamp}.js`,
|
},
|
||||||
assetFileNames: `[ext]/[name].${timestamp}.[ext]`,
|
//需要注释掉 @dcloudio/uni-h5-vite/dist/plugin/config.js 中的同名方法,不然不会生效
|
||||||
// 确保 Vue 文件编译后的 JS 文件也添加时间戳
|
chunkFileNames: (chunkInfo) => {
|
||||||
manualChunks: {
|
const facadeModuleId = chunkInfo.facadeModuleId
|
||||||
'vue': ['vue']
|
? chunkInfo.facadeModuleId.split('/')
|
||||||
}
|
: []
|
||||||
}
|
//console.log(facadeModuleId);
|
||||||
}
|
if (chunkInfo.facadeModuleId?.length) {
|
||||||
|
const fileName = `pages-${
|
||||||
|
facadeModuleId[facadeModuleId.length - 2]
|
||||||
|
}-${facadeModuleId[facadeModuleId.length - 1]}`
|
||||||
|
console.log('正在打包' + fileName)
|
||||||
|
return `static/js/${fileName}.${timestamp}.js`
|
||||||
|
} else {
|
||||||
|
console.log('正在打包', `static/js/[name].${timestamp}.js`)
|
||||||
|
return `static/js/[name].${timestamp}.js`
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 资源文件像 字体,图片等
|
||||||
|
assetFileNames: (assetInfo) => {
|
||||||
|
if (
|
||||||
|
assetInfo.name &&
|
||||||
|
assetInfo.type === 'asset' &&
|
||||||
|
/\.(jpe?g|png|gif|svg)$/i.test(assetInfo.name)
|
||||||
|
) {
|
||||||
|
return 'static/images/[name].[hash].[ext]'
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
assetInfo.name &&
|
||||||
|
assetInfo.type === 'asset' &&
|
||||||
|
/\.(ttf|woff|woff2|eot)$/i.test(assetInfo.name)
|
||||||
|
) {
|
||||||
|
return 'static/fonts/[name].[hash].[ext]'
|
||||||
|
}
|
||||||
|
return 'static/[ext]/[name]-[hash].[ext]'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
css: {
|
css: {
|
||||||
extract: {
|
extract: {
|
||||||
// css重构 打包编译后的css文件名称,添加时间戳
|
// css重构 打包编译后的css文件名称,添加时间戳
|
||||||
filename: `css/[name].${timestamp}.css`,
|
filename: `css/[name].${timestamp}.css`,
|
||||||
chunkFilename: `css/[name].${timestamp}.css`
|
chunkFilename: `css/[name].${timestamp}.css`,
|
||||||
},
|
},
|
||||||
preprocessorOptions: {
|
preprocessorOptions: {
|
||||||
scss: {
|
scss: {
|
||||||
additionalData: `@import "@/static/css/color.scss";`,
|
additionalData: `@import "@/static/css/color.scss";`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user