diff --git a/src/api/api.js b/src/api/api.js index c40cf35..5dff220 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -261,6 +261,9 @@ const queryStandardCompliance = (params) => getAction('/process/projectStandard/ // 在线编辑-通过在线编辑的文件id获取文件信息 const queryFileInfoByEditId = (params) => getAction('/onlyOffice/queryById', params) +// 获取taskName +const queryTaskNameByTaskId = (params) => getAction('/workCenter/getByTaskId', params) + export { queryPermissionsByUser, getFormDictTreeList, @@ -385,5 +388,7 @@ export { rejectStandardCompliance, queryStandardCompliance, - queryFileInfoByEditId + queryFileInfoByEditId, + + queryTaskNameByTaskId } diff --git a/src/permission.js b/src/permission.js index bba467d..39c6031 100644 --- a/src/permission.js +++ b/src/permission.js @@ -3,7 +3,7 @@ import router from './router' import store from './store' import { ACCESS_TOKEN, UI_CACHE_DB_DICT_DATA, USER_INFO, USER_NAME } from '@/store/mutation-types' import { welcome } from '@/utils/util' -import { getSSOUserInfo } from './api/api' +import { getSSOUserInfo, queryTaskNameByTaskId } from './api/api' const whiteList = ['/user/login'] // no redirect whitelist @@ -26,10 +26,20 @@ router.beforeEach(async (to, from, next) => { if (to.path === '/user/login') { next('/') } else { - if (to.query.taskName) { + if (to.query.taskId) { + queryTaskNameByTaskId({ taskId: to.query.taskId }).then(res => { + if (res.success) { + to.meta.title = res.result.taskName + } + }).finally(() => { + next() + }) + } else if (to.query.taskName) { to.meta.title = to.query.taskName + next() + } else { + next() } - next() } } else { if (whiteList.indexOf(to.path) !== -1) {