diff --git a/service/core/router/index.cjs b/service/core/router/index.cjs index fe35734..df2197d 100644 --- a/service/core/router/index.cjs +++ b/service/core/router/index.cjs @@ -96,7 +96,10 @@ const matchFile = async (request, response) => { fs.readFile(targetPath, (err, file) => { if (!err) { const mimetype = getMimeType(cleanPath) - const responseHeaders = { 'Content-Type': mimetype } + const responseHeaders = { + 'Content-Type': mimetype, + 'Access-Control-Allow-Origin': '*' + } if (cleanPath.endsWith("-sw.js")) { responseHeaders["Service-Worker-Allowed"] = '/' } @@ -115,7 +118,13 @@ const endIndex = async (request, response) => { console.log(dist + '/index.html') fs.readFile(dist + '/index.html', (err, html) => { if (!err) { - response.writeHead(httpOk, { 'Content-type': 'text/html;charset=utf-8' }) + response.writeHead(httpOk, { + 'Content-type': 'text/html;charset=utf-8', + 'Cache-Control': 'no-cache, no-store, must-revalidate', + 'Pragma': 'no-cache', + 'Expires': '0', + 'Access-Control-Allow-Origin': '*' + }) response.end(html) logger.info(`${request.method} ${httpOk} ${request.url}`) } diff --git a/src/components/simulator/StatusBar.vue b/src/components/simulator/StatusBar.vue index 1abecc9..33feda2 100644 --- a/src/components/simulator/StatusBar.vue +++ b/src/components/simulator/StatusBar.vue @@ -2,9 +2,9 @@
{{ time }} - - +
@@ -12,10 +12,10 @@
{{ battery }} - +
- +
diff --git a/src/router/index.js b/src/router/index.js index 5baa6a0..3ae1ffa 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -38,7 +38,6 @@ router.beforeEach(async (to, from, next) => { // 不需要认证的页面,直接放行 if (!to.meta.requiresAuth) return next() - // 需要认证的页面:如果没有 token 或者 token 已失效,跳回首页并唤起登录框 if (!token || !userStore.tokenValid) { return next({ path: '/', query: { showLogin: 1 } }) } @@ -46,4 +45,11 @@ router.beforeEach(async (to, from, next) => { next() }) +router.onError((error) => { + const pattern = /Failed to fetch dynamically imported module|Importing a module script failed/i + if (pattern.test(error?.message || '')) { + window.location.reload() + } +}) + export default router diff --git a/src/views/Profile.vue b/src/views/Profile.vue index 94c7bcc..07decb6 100644 --- a/src/views/Profile.vue +++ b/src/views/Profile.vue @@ -25,8 +25,8 @@
- - + + 我的作品
@@ -67,7 +67,7 @@
- +
diff --git a/src/views/wxPage/ChatEdit.vue b/src/views/wxPage/ChatEdit.vue index f943405..656026b 100644 --- a/src/views/wxPage/ChatEdit.vue +++ b/src/views/wxPage/ChatEdit.vue @@ -468,7 +468,7 @@ const systemMsgTemplates = ref([ { label: '+ 添加成功提示', command: '以上是打招呼的消息' }, { label: '+ 账号安全', command: '对方账号不在常用环境使用,请仔细核实真实身份,涉及汇款、转账等务必电话确认,请保护自身财产和隐私安全。' }, { label: '+ 我要投诉', command: "对方账号安全性未知,如涉及金钱交易务必电话确认,保护个人财产和隐私安全。我要投诉" }, - { label: '+ 红包领取', command: "xxx领取了xxx的红包" } + { label: '+ 红包领取', command: "xxx领取了xxx的红包" } ]) let msgIdCounter = 1 @@ -630,9 +630,9 @@ function onRedpacketStatusChange(status) { let content = "" const theirName = settings.theirName || '对方' if (selectedMsg.value.sender === 'me') { - content = `${theirName}领取了你的红包` + content = `${theirName}领取了你的红包` } else { - content = `你领取了${theirName}的红包` + content = `你领取了${theirName}的红包` } messages.value.push({