改正Manuscript
This commit is contained in:
49
src/main.js
49
src/main.js
@@ -63,7 +63,7 @@ async function loadJournalType() {
|
||||
await api
|
||||
.post('api/Articletype/getArticleType', {})
|
||||
.then((res) => {
|
||||
|
||||
|
||||
if (res.status == 1) {
|
||||
localStorage.setItem('journalTypeData', JSON.stringify(res.data.base)); // 将数据存储到 localStorage
|
||||
localStorage.setItem('journalTypeDataAll', JSON.stringify([...res.data.base, ...res.data.supplement])); // 将数据存储到 localStorage
|
||||
@@ -73,49 +73,44 @@ async function loadJournalType() {
|
||||
await api
|
||||
.post('api/Articletype/getMedicalType', {})
|
||||
.then((res) => {
|
||||
|
||||
|
||||
if (res.status == 1) {
|
||||
localStorage.setItem('opMedicalListData', JSON.stringify(res.data)); // 将数据存储到 localStorage
|
||||
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
} catch (error) {
|
||||
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
async function loadJournalList() {
|
||||
try {
|
||||
const localData = store.state.journalList;
|
||||
console.log('localData at line 93:', localData);
|
||||
|
||||
|
||||
const localData = store.state.journalList;
|
||||
if (localData && Array.isArray(localData) && localData.length > 0) {
|
||||
return localData;
|
||||
return localData;
|
||||
}
|
||||
|
||||
|
||||
const res = await api.post('api/Article/getJournal', {});
|
||||
|
||||
|
||||
|
||||
if (res ) {
|
||||
const journalList = res;
|
||||
store.commit('setJournalList', journalList);
|
||||
return journalList;
|
||||
|
||||
|
||||
|
||||
if (res) {
|
||||
const journalList = res;
|
||||
store.commit('setJournalList', journalList);
|
||||
return journalList;
|
||||
} else {
|
||||
return [];
|
||||
|
||||
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,7 +207,7 @@ const i18n = new VueI18n({
|
||||
messages
|
||||
});
|
||||
//使用钩子函数对路由进行权限跳转
|
||||
router.beforeEach(async(to, from, next) => {
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
try {
|
||||
// 尝试请求接口(即使失败也继续后续逻辑)
|
||||
await Promise.all([
|
||||
@@ -221,14 +216,14 @@ router.beforeEach(async(to, from, next) => {
|
||||
]);
|
||||
} catch (err) {
|
||||
// 仅打印错误,不阻断路由
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 无论接口成功/失败,都执行原有跳转逻辑
|
||||
document.title = `${to.meta.title} | Traditional Medicine Research`;
|
||||
const role = localStorage.getItem('U_name');
|
||||
const userrole = localStorage.getItem('U_status');
|
||||
|
||||
|
||||
if (!role && to.path != '/register' && to.path !== '/submission' && to.path !== '/verification' && to.path !== '/orcidLink' && to.path !== '/img' && to.path !== '/reviewer' && to.path !== '/thanks' && to.path !== '/login' && to.path !== '/refuse' && to.path !== '/managing' && to.path.search(/retrieve/i) < 0) {
|
||||
next('/login');
|
||||
} else {
|
||||
@@ -240,7 +235,7 @@ router.beforeEach(async(to, from, next) => {
|
||||
next();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
new Vue({
|
||||
@@ -248,7 +243,7 @@ new Vue({
|
||||
i18n,
|
||||
store,
|
||||
render: h => h(App),
|
||||
|
||||
|
||||
mounted() {
|
||||
this.$renderMath(); // 页面加载后自动渲染
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user