新增清除缓存时同时清理聊天记录缓存;新增打包编译文件用时间戳维护
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 pageAnimation from '@/components/page-animation/index.vue'
|
||||
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()
|
||||
dayjs.locale('zh-cn')
|
||||
@ -92,6 +93,9 @@ export function createApp() {
|
||||
|
||||
//处理OA、墨册强制刷新时,聊天同步强制刷新
|
||||
window.doLocationRefresh = () => {
|
||||
//同时先清除聊天记录缓存
|
||||
useDialogueListStore().dialogueList.value = []
|
||||
uniStorage.removeItem('dialogueList')
|
||||
location.reload(true)
|
||||
}
|
||||
|
||||
|
@ -15,10 +15,14 @@ export default defineConfig({
|
||||
resolve: {
|
||||
alias: [
|
||||
{
|
||||
find: "@",
|
||||
replacement: resolve(process.cwd(), 'src')
|
||||
}
|
||||
]
|
||||
find: '@',
|
||||
replacement: resolve(process.cwd(), 'src'),
|
||||
},
|
||||
{
|
||||
find: '@/static',
|
||||
replacement: resolve(__dirname, 'src/static'),
|
||||
},
|
||||
],
|
||||
},
|
||||
server: {
|
||||
host: '0.0.0.0', // 监听所有网络接口
|
||||
@ -28,9 +32,9 @@ export default defineConfig({
|
||||
'/pag': {
|
||||
target: 'https://cdn.tmui.design',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, '/api')
|
||||
rewrite: (path) => path.replace(/^\/api/, '/api'),
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
Uni(),
|
||||
@ -44,39 +48,69 @@ export default defineConfig({
|
||||
'useDialog',
|
||||
'useMessage',
|
||||
'useNotification',
|
||||
'useLoadingBar'
|
||||
]
|
||||
}
|
||||
]
|
||||
'useLoadingBar',
|
||||
],
|
||||
},
|
||||
],
|
||||
}),
|
||||
Components({
|
||||
resolvers: [NaiveUiResolver()]
|
||||
})
|
||||
resolvers: [NaiveUiResolver()],
|
||||
}),
|
||||
],
|
||||
build: {
|
||||
rollupOptions: {
|
||||
output: {
|
||||
// 输出重构 打包编译后的js文件名称,添加时间戳
|
||||
entryFileNames: `js/[name].${timestamp}.js`,
|
||||
chunkFileNames: `js/[name].${timestamp}.js`,
|
||||
assetFileNames: `[ext]/[name].${timestamp}.[ext]`,
|
||||
// 确保 Vue 文件编译后的 JS 文件也添加时间戳
|
||||
manualChunks: {
|
||||
'vue': ['vue']
|
||||
entryFileNames(chunkInfo) {
|
||||
return `static/js/${chunkInfo.name}.${timestamp}.js`
|
||||
},
|
||||
//需要注释掉 @dcloudio/uni-h5-vite/dist/plugin/config.js 中的同名方法,不然不会生效
|
||||
chunkFileNames: (chunkInfo) => {
|
||||
const facadeModuleId = chunkInfo.facadeModuleId
|
||||
? 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: {
|
||||
extract: {
|
||||
// css重构 打包编译后的css文件名称,添加时间戳
|
||||
filename: `css/[name].${timestamp}.css`,
|
||||
chunkFilename: `css/[name].${timestamp}.css`
|
||||
chunkFilename: `css/[name].${timestamp}.css`,
|
||||
},
|
||||
preprocessorOptions: {
|
||||
scss: {
|
||||
additionalData: `@import "@/static/css/color.scss";`,
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user