Merge pull request '邓洁 : 修复bug' (#201) from dengjie into dev

Reviewed-on: http://git.feashow.cn/clay/tunnel-cloud-web/pulls/201
This commit is contained in:
odjbin
2023-12-29 08:59:01 +00:00
4 changed files with 38 additions and 32 deletions

View File

@@ -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(() => {

View File

@@ -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;

View File

@@ -46,7 +46,7 @@ const router = useRouter();
const authStore = useAuthStore();
const loginForm = reactive({
// username: "admin",
password: "12345",
password: "",
username: "",
// password: "",
code: "",

View File

@@ -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&&currentUserId.value){
router.push("/tunnel/" + currentSiteId.value+'/i'+'/'+currentUserId.value);
}
} else if (index === '用户管理') {
} else if (index == '隧道管理') {
console.log('无查看权限??',currentSiteId.value,currentUserId.value)
// if(currentSiteId.value&&currentUserId.value){
router.push("/tunnel/" + currentSiteId.value+'/i'+'/'+currentUserId.value);
// }
} else if (index == '用户管理') {
if(currentSiteId.value){
router.push("/user/" + currentSiteId.value);
}