大屏权限控制
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 { selectPermission } from "@/http/rule/index"
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
const routes: Array<RouteRecordRaw> = [
|
||||
{
|
||||
path: "/child",
|
||||
@ -60,13 +61,11 @@ const routes: Array<RouteRecordRaw> = [
|
||||
{
|
||||
path: "/energyConsume",
|
||||
name: "energyConsume",
|
||||
component: () => import("../views/energyConsume/index.vue"),
|
||||
children: [
|
||||
{
|
||||
path: "/energyConsume/",
|
||||
component: () => import("../views/energyConsume/index.vue"),
|
||||
},
|
||||
{
|
||||
path: "/energyConsume/historyData",
|
||||
name: 'historyData',
|
||||
component: () =>
|
||||
import("../views/energyConsume/content/child/historyData.vue"),
|
||||
},
|
||||
@ -83,12 +82,12 @@ const routes: Array<RouteRecordRaw> = [
|
||||
children: [
|
||||
{
|
||||
path: "/Offsite/",
|
||||
name:"offSiteIndex",
|
||||
name: "offSiteIndex",
|
||||
component: () => import("../views/Offsite/index.vue"),
|
||||
},
|
||||
{
|
||||
path: "/Offsite/devList/:city",
|
||||
name:"offSiteDevList",
|
||||
name: "offSiteDevList",
|
||||
component: () => import("../views/Offsite/child/index.vue"),
|
||||
},
|
||||
],
|
||||
@ -139,14 +138,11 @@ const routes: Array<RouteRecordRaw> = [
|
||||
{
|
||||
path: "/energyConsumejixie",
|
||||
name: "energyConsumejixie",
|
||||
component: () => import("../views/energyConsumeJixiefenchang/index.vue"),
|
||||
children: [
|
||||
{
|
||||
path: "/energyConsumejixie/",
|
||||
component: () =>
|
||||
import("../views/energyConsumeJixiefenchang/index.vue"),
|
||||
},
|
||||
{
|
||||
path: "/energyConsumejixie/historyData",
|
||||
name: "jixieHistoryData",
|
||||
component: () =>
|
||||
import(
|
||||
"../views/energyConsumeJixiefenchang/content/child/historyData.vue"
|
||||
@ -330,11 +326,36 @@ const router = createRouter({
|
||||
routes,
|
||||
});
|
||||
|
||||
router.beforeEach((to, from,next) => {
|
||||
router.beforeEach(async (to: any, from, next) => {
|
||||
// ...
|
||||
let address = to.name
|
||||
let hash = to.query.hash
|
||||
let arr = [
|
||||
'legionProducts', 'devItem', 'tufting', 'Winding', 'Large_Format',
|
||||
'GetonAgain', 'OffsiteDevList', 'Mechanicschild', 'Mechanicsson', 'jixieHistoryData'
|
||||
]
|
||||
|
||||
// 返回 false 以取消导航
|
||||
//console.log(to,from);
|
||||
|
||||
next()
|
||||
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()
|
||||
} else {
|
||||
ElMessageBox.alert('没有该页面权限', '通知', {
|
||||
// if you want to disable its autofocus
|
||||
// autofocus: false,
|
||||
confirmButtonText: '确认'
|
||||
})
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
export default router;
|
||||
|
@ -53,7 +53,9 @@ import { ref, onMounted, onUnmounted } from "vue";
|
||||
import list from "@/components/assembly/indexList.vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { getStoredLanguage, saveStoredLanguage } from "@/utils/languageStorage";
|
||||
import { useRoute } from 'vue-router'
|
||||
let langicon=require("@/assets/svg/language.svg")
|
||||
let route = useRoute()
|
||||
window.document.title = "大屏物联管理系统";
|
||||
let { t } = useI18n();
|
||||
let routerList = [
|
||||
@ -305,7 +307,10 @@ function changelang(val){
|
||||
saveStoredLanguage(val)
|
||||
location.reload()
|
||||
}
|
||||
onMounted(() => {});
|
||||
onMounted(() => {
|
||||
console.log(route.query);
|
||||
|
||||
});
|
||||
onUnmounted(() => {});
|
||||
</script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user