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