From 4a659fdde4ac6aba686e5582f6929981897bbbce Mon Sep 17 00:00:00 2001 From: wangxiaoshuang <825034831@qq.com> Date: Tue, 16 Jul 2024 11:17:25 +0800 Subject: [PATCH] =?UTF-8?q?bug=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 23 +++++++++++++++++++++++ src/permission.js | 7 ------- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/App.vue b/src/App.vue index 50e0010b..b4b11701 100644 --- a/src/App.vue +++ b/src/App.vue @@ -89,6 +89,7 @@ import { batchAddOrUpdateFrontInternationalization, getFrontInternationalizationList, } from "@/api/dictionary/dictionary"; +import { getTrialExtralConfig } from "@/api/trials"; import Vue from "vue"; import i18n from "./lang"; export default { @@ -105,6 +106,28 @@ export default { mounted() { this.show = process.env.VUE_APP_OSS_PATH === "/test/dist"; }, + watch: { + "$route.query": { + async handler() { + if ( + this.$route.query.trialId && + this.$route.query.trialId !== this.$store.state.trials.config.trialId + ) { + let res = await getTrialExtralConfig({ + TrialId: this.$route.query.trialId, + }); + if (res.IsSuccess) { + this.$store.dispatch("trials/setConfig", { + trialId: this.$route.query.trialId, + ...res.Result, + }); + } + } + }, + immediate: true, + deep: true, + }, + }, methods: { changeValue(target, attr, e) { this.$set(target, attr, e); diff --git a/src/permission.js b/src/permission.js index 41d0dd65..5ed14a2f 100644 --- a/src/permission.js +++ b/src/permission.js @@ -6,7 +6,6 @@ import 'nprogress/nprogress.css' import { getToken } from '@/utils/auth' import Vue from 'vue' import { OSSclient } from './utils/oss' -import { getTrialExtralConfig } from "@/api/trials" // import getPageTitle from '@/utils/get-page-title' NProgress.configure({ showSpinner: false }) @@ -23,12 +22,6 @@ router.beforeEach(async (to, from, next) => { Vue.prototype.toPath = to.path Vue.prototype.$path = [] if (hasToken) { - if (to.query.trialId && to.query.trialId !== store.state.trials.config.trialId) { - let res = await getTrialExtralConfig({ TrialId: to.query.trialId }); - if (res.IsSuccess) { - store.dispatch('trials/setConfig', { trialId: to.query.trialId, ...res.Result }); - } - } if (to.path === '/login' || to.path === '/recompose' || to.path === '/email-recompose' || to.path === '/error' || to.path === '/ReviewersResearchForm' || to.path === '/ReviewersResearch') { if (to.path === '/ReviewersResearch') { await this.$store.dispatch('user/logout')