diff --git a/service/core/router/index.cjs b/service/core/router/index.cjs index df2197d..b59ac01 100644 --- a/service/core/router/index.cjs +++ b/service/core/router/index.cjs @@ -100,8 +100,11 @@ const matchFile = async (request, response) => { 'Content-Type': mimetype, 'Access-Control-Allow-Origin': '*' } - if (cleanPath.endsWith("-sw.js")) { + if (cleanPath.endsWith("-sw.js") || cleanPath.includes("dat-module-map.json")) { responseHeaders["Service-Worker-Allowed"] = '/' + responseHeaders["Cache-Control"] = 'no-cache, no-store, must-revalidate' + responseHeaders["Pragma"] = 'no-cache' + responseHeaders["Expires"] = '0' } response.writeHead(httpOk, responseHeaders) response.end(file) diff --git a/src/router/index.js b/src/router/index.js index 9a5a03d..153aafb 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,16 +1,26 @@ import { createRouter, createWebHistory } from 'vue-router' import { useUserStore } from '@/stores/user' +import IndexView from '@/views/index/index.vue' +import ChatEdit from '@/views/wxPage/ChatEdit.vue' +import BalanceEdit from '@/views/wxPage/BalanceEdit.vue' +import WorksView from '@/views/work/works.vue' +import AboutView from '@/views/About.vue' +import ProfileView from '@/views/Profile.vue' +import ArticleList from '@/views/article/list.vue' +import ArticleDetail from '@/views/article/detail.vue' +import GongZiDan from '@/views/other/gongzidan.vue' + const routes = [ - { path: '/', name: 'index', component: () => import('@/views/index/index.vue') }, - { path: '/chat', name: 'Chat', component: () => import('@/views/wxPage/ChatEdit.vue'), meta: { requiresAuth: false } }, - { path: '/balance', name: 'Balance', component: () => import('@/views/wxPage/BalanceEdit.vue'), meta: { requiresAuth: false } }, - { path: '/works', name: 'Works', component: () => import('@/views/work/works.vue'), meta: { requiresAuth: true } }, - { path: '/about', name: 'About', component: () => import('@/views/About.vue') }, - { path: '/profile', name: 'Profile', component: () => import('@/views/Profile.vue'), meta: { requiresAuth: true } }, - { path: '/article', name: 'Article', component: () => import('@/views/article/list.vue') }, - { path: '/article-detail', name: 'ArticleDetail', component: () => import('@/views/article/detail.vue') }, - { path: '/gongzidan', name: 'GongZiDan', component: () => import('@/views/other/gongzidan.vue') }, + { path: '/', name: 'index', component: IndexView }, + { path: '/chat', name: 'Chat', component: ChatEdit, meta: { requiresAuth: false } }, + { path: '/balance', name: 'Balance', component: BalanceEdit, meta: { requiresAuth: false } }, + { path: '/works', name: 'Works', component: WorksView, meta: { requiresAuth: true } }, + { path: '/about', name: 'About', component: AboutView }, + { path: '/profile', name: 'Profile', component: ProfileView, meta: { requiresAuth: true } }, + { path: '/article', name: 'Article', component: ArticleList }, + { path: '/article-detail', name: 'ArticleDetail', component: ArticleDetail }, + { path: '/gongzidan', name: 'GongZiDan', component: GongZiDan }, ] const router = createRouter({