From 2988ea46da5f747df80174ed069c181b1bf28fc7 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Mon, 18 Nov 2024 10:48:18 +0800 Subject: [PATCH] fix --- src/components/upload/config.js | 11 ++++++++++- src/pages/theoryExam/index.vue | 2 ++ src/plugins/requests/index.js | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/components/upload/config.js b/src/components/upload/config.js index 1216d71..3af242e 100644 --- a/src/components/upload/config.js +++ b/src/components/upload/config.js @@ -2,10 +2,19 @@ * 阿里云oss配置 * */ +import Util from '@/libs/util' +import store from '@/store' export default async function () { try { let RE = localStorage.getItem('osc') - if (RE) RE = JSON.parse(RE) + if (RE) { + RE = JSON.parse(RE) + } else { + Util.errorMsg('登录过期,请重新登录!') + setTimeout(() => { + store.dispatch('user/logout') + }, 1500) + } return RE ? { // oss账号信息 config: { diff --git a/src/pages/theoryExam/index.vue b/src/pages/theoryExam/index.vue index 79c6a92..4b99c48 100644 --- a/src/pages/theoryExam/index.vue +++ b/src/pages/theoryExam/index.vue @@ -637,6 +637,7 @@ export default { }] ques.attachmentName = file.name ques.attachmentUrl = url + ques.answered = 1 this.submit(0) } catch (e) { } }, @@ -661,6 +662,7 @@ export default { ques.fileList = [] ques.attachmentName = '' ques.attachmentUrl = '' + ques.answered = 0 this.submit(0) }, diff --git a/src/plugins/requests/index.js b/src/plugins/requests/index.js index f4bdeb0..7c7ec6d 100644 --- a/src/plugins/requests/index.js +++ b/src/plugins/requests/index.js @@ -14,7 +14,7 @@ service.defaults.headers.post["Content-Type"] = "application/json;charset=UTF-8" // 请求拦截器 service.interceptors.request.use(config => { let token = Util.local.get(Setting.tokenKey); - if (token) config.headers.token = token; + if (token) config.headers.token = token return config; }, err => { Util.errorMsg({