diff --git a/src/router/index.js b/src/router/index.js index cb01cf5..94a2513 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -60,7 +60,7 @@ const routes = [ } }, { - path: '/tunnel/:siteId(\\d+)/:type/:userId(\\d+)', + path: '/tunnel/:siteId/:type/:userId', name: 'tunnel', component: () => import('@/views/tunnel-manage/index.vue'), meta: { @@ -85,6 +85,7 @@ const router = createRouter({ }); router.beforeEach((to, form, next) => { NProgress.start() + console.log('token-----',getToken()) if (!getToken()) { if (to.path === '/login') { next() @@ -94,12 +95,12 @@ router.beforeEach((to, form, next) => { } } else { console.log('有token') - if (to.path === '/login') { - next('/') - NProgress.done() - } else { + // if (to.path === '/login') { + // next('/') + // NProgress.done() + // } else { next() - } + // } } }) router.afterEach(() => { diff --git a/src/utils/request.js b/src/utils/request.js index 10627aa..5befe96 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -68,13 +68,13 @@ serveice.interceptors.response.use(response=>{ window.location = '/login' }) return Promise.reject('会话已过期,请重新登录') - case 402: - break; - case 403: - ElMessage.warning('禁止访问') - removeToken() - window.location = '/forbidden' - break; + // case 402: + // break; + // case 403: + // ElMessage.warning('禁止访问') + // removeToken() + // window.location = '/forbidden' + // break; case 404: ElMessage.warning('不存在的地址') break; diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 9416666..aeb283f 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -46,7 +46,7 @@ const router = useRouter(); const authStore = useAuthStore(); const loginForm = reactive({ // username: "admin", - password: "12345", + password: "", username: "", // password: "", code: "", diff --git a/src/views/tunnel/index.vue b/src/views/tunnel/index.vue index 0b62367..ad25dd5 100644 --- a/src/views/tunnel/index.vue +++ b/src/views/tunnel/index.vue @@ -80,7 +80,7 @@ import {dateFormat} from "@/utils/date.js"; import {getToken} from "@/utils/auth"; import {useAuthStore} from "@/store/userstore.js"; import {getLargeScreen, getLargeScreenInfo, getTunnelBySiteId} from "@/api/largeScreen"; -import {ElMessageBox} from "element-plus"; +import {ElMessage,ElMessageBox} from "element-plus"; import {getUserInfo} from "@/api/login"; import {initSceneData} from "@/api/tunnelScene"; import {getSiteDetail} from "../../api/site"; @@ -146,23 +146,27 @@ const getOtherInfo = () => { }); }; const getScreenInfo = (id) => { - tunnelId.value=id - getLargeScreen(id).then((res) => { - if (res?.code === 1000) { - largeScreenData.value = res.data; - } - }); - initSceneData(id).then((res) => { - tunnelLength.value=res.data.tunnelLength - constructionLength.value=res.data.constructionLength - }) + if(id){ + tunnelId.value=id + getLargeScreen(id).then((res) => { + if (res?.code === 1000) { + largeScreenData.value = res.data; + }else { + ElMessage.warning(res.msg) + } + }); + initSceneData(id).then((res) => { + tunnelLength.value=res.data.tunnelLength + constructionLength.value=res.data.constructionLength + }) + } }; //根据站点id获取隧道信息 const getTunnel = (id) => { getTunnelBySiteId(id).then((res) => { if (res?.code === 1000) { tunnelList.value = res.data - getScreenInfo(res.data[0].value) + getScreenInfo(res.data[0]?.value) } }); } @@ -180,15 +184,16 @@ const changeTunnel = (e) => { } const manageSelect = (index) => { console.log("首页点击-", index); - if (index === '站点管理') { + if (index == '站点管理') { if(currentUserId.value){ router.push("/site"+'/'+currentUserId.value); } - } else if (index === '隧道管理') { - if(currentSiteId.value&¤tUserId.value){ - router.push("/tunnel/" + currentSiteId.value+'/i'+'/'+currentUserId.value); - } - } else if (index === '用户管理') { + } else if (index == '隧道管理') { + console.log('无查看权限??',currentSiteId.value,currentUserId.value) + // if(currentSiteId.value&¤tUserId.value){ + router.push("/tunnel/" + currentSiteId.value+'/i'+'/'+currentUserId.value); + // } + } else if (index == '用户管理') { if(currentSiteId.value){ router.push("/user/" + currentSiteId.value); }