大屏权限控制
This commit is contained in:
parent
95abe79821
commit
a3e736b460
15
src/http/rule/index.ts
Normal file
15
src/http/rule/index.ts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* @FilePath: \wwwd:\code\screenFront\src\http\realtimeSecurity\index.ts
|
||||||
|
* @Author: 王路平
|
||||||
|
* @文件版本: V1.0.0
|
||||||
|
* @Date: 2023-02-14 08:45:45
|
||||||
|
* @Description:
|
||||||
|
*
|
||||||
|
* 版权信息 : 2023 by ${再登软件}, All Rights Reserved.
|
||||||
|
*/
|
||||||
|
import {get,post} from "@/utils/http"
|
||||||
|
|
||||||
|
//气压
|
||||||
|
export function selectPermission({address,hash}){
|
||||||
|
return get('/manage/selectPermission',{address,hash})
|
||||||
|
}
|
@ -9,7 +9,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";
|
import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";
|
||||||
|
import { selectPermission } from "@/http/rule/index"
|
||||||
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
const routes: Array<RouteRecordRaw> = [
|
const routes: Array<RouteRecordRaw> = [
|
||||||
{
|
{
|
||||||
path: "/child",
|
path: "/child",
|
||||||
@ -60,13 +61,11 @@ const routes: Array<RouteRecordRaw> = [
|
|||||||
{
|
{
|
||||||
path: "/energyConsume",
|
path: "/energyConsume",
|
||||||
name: "energyConsume",
|
name: "energyConsume",
|
||||||
|
component: () => import("../views/energyConsume/index.vue"),
|
||||||
children: [
|
children: [
|
||||||
{
|
|
||||||
path: "/energyConsume/",
|
|
||||||
component: () => import("../views/energyConsume/index.vue"),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: "/energyConsume/historyData",
|
path: "/energyConsume/historyData",
|
||||||
|
name: 'historyData',
|
||||||
component: () =>
|
component: () =>
|
||||||
import("../views/energyConsume/content/child/historyData.vue"),
|
import("../views/energyConsume/content/child/historyData.vue"),
|
||||||
},
|
},
|
||||||
@ -83,12 +82,12 @@ const routes: Array<RouteRecordRaw> = [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "/Offsite/",
|
path: "/Offsite/",
|
||||||
name:"offSiteIndex",
|
name: "offSiteIndex",
|
||||||
component: () => import("../views/Offsite/index.vue"),
|
component: () => import("../views/Offsite/index.vue"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/Offsite/devList/:city",
|
path: "/Offsite/devList/:city",
|
||||||
name:"offSiteDevList",
|
name: "offSiteDevList",
|
||||||
component: () => import("../views/Offsite/child/index.vue"),
|
component: () => import("../views/Offsite/child/index.vue"),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -139,14 +138,11 @@ const routes: Array<RouteRecordRaw> = [
|
|||||||
{
|
{
|
||||||
path: "/energyConsumejixie",
|
path: "/energyConsumejixie",
|
||||||
name: "energyConsumejixie",
|
name: "energyConsumejixie",
|
||||||
|
component: () => import("../views/energyConsumeJixiefenchang/index.vue"),
|
||||||
children: [
|
children: [
|
||||||
{
|
|
||||||
path: "/energyConsumejixie/",
|
|
||||||
component: () =>
|
|
||||||
import("../views/energyConsumeJixiefenchang/index.vue"),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: "/energyConsumejixie/historyData",
|
path: "/energyConsumejixie/historyData",
|
||||||
|
name: "jixieHistoryData",
|
||||||
component: () =>
|
component: () =>
|
||||||
import(
|
import(
|
||||||
"../views/energyConsumeJixiefenchang/content/child/historyData.vue"
|
"../views/energyConsumeJixiefenchang/content/child/historyData.vue"
|
||||||
@ -330,11 +326,36 @@ const router = createRouter({
|
|||||||
routes,
|
routes,
|
||||||
});
|
});
|
||||||
|
|
||||||
router.beforeEach((to, from,next) => {
|
router.beforeEach(async (to: any, from, next) => {
|
||||||
// ...
|
// ...
|
||||||
// 返回 false 以取消导航
|
let address = to.name
|
||||||
//console.log(to,from);
|
let hash = to.query.hash
|
||||||
|
let arr = [
|
||||||
|
'legionProducts', 'devItem', 'tufting', 'Winding', 'Large_Format',
|
||||||
|
'GetonAgain', 'OffsiteDevList', 'Mechanicschild', 'Mechanicsson', 'jixieHistoryData'
|
||||||
|
]
|
||||||
|
|
||||||
|
// 返回 false 以取消导航
|
||||||
|
if (to.path == "/") {
|
||||||
|
sessionStorage.setItem("screen_user_id", to.query.id);
|
||||||
|
|
||||||
|
next();
|
||||||
|
} else if (arr.includes(address)) {
|
||||||
|
next();
|
||||||
|
} else {
|
||||||
|
let res: any = await selectPermission({ address, hash })
|
||||||
|
if (res.data == true) {
|
||||||
next()
|
next()
|
||||||
|
} else {
|
||||||
|
ElMessageBox.alert('没有该页面权限', '通知', {
|
||||||
|
// if you want to disable its autofocus
|
||||||
|
// autofocus: false,
|
||||||
|
confirmButtonText: '确认'
|
||||||
|
})
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
export default router;
|
export default router;
|
||||||
|
@ -53,7 +53,9 @@ import { ref, onMounted, onUnmounted } from "vue";
|
|||||||
import list from "@/components/assembly/indexList.vue";
|
import list from "@/components/assembly/indexList.vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { getStoredLanguage, saveStoredLanguage } from "@/utils/languageStorage";
|
import { getStoredLanguage, saveStoredLanguage } from "@/utils/languageStorage";
|
||||||
|
import { useRoute } from 'vue-router'
|
||||||
let langicon=require("@/assets/svg/language.svg")
|
let langicon=require("@/assets/svg/language.svg")
|
||||||
|
let route = useRoute()
|
||||||
window.document.title = "大屏物联管理系统";
|
window.document.title = "大屏物联管理系统";
|
||||||
let { t } = useI18n();
|
let { t } = useI18n();
|
||||||
let routerList = [
|
let routerList = [
|
||||||
@ -305,7 +307,10 @@ function changelang(val){
|
|||||||
saveStoredLanguage(val)
|
saveStoredLanguage(val)
|
||||||
location.reload()
|
location.reload()
|
||||||
}
|
}
|
||||||
onMounted(() => {});
|
onMounted(() => {
|
||||||
|
console.log(route.query);
|
||||||
|
|
||||||
|
});
|
||||||
onUnmounted(() => {});
|
onUnmounted(() => {});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user