提交 c2edcf09 编写于 作者: 张平's avatar 张平

Merge branch 'dev-nav-20200319' into 'release'

Dev nav 20200319 导航权限设置代码合并

codereviewer:ping.zhang

See merge request !1
......@@ -6,10 +6,10 @@ export const envConfig = {
// baseUrl: 'https://dev-sc.yunqueyi.com/',
// // baseUrl: 'http://10.177.15.180:10202/',
// // baseUrl: 'http://192.168.140.14:10201/',
// baseUrl: 'https://test1-sc.yunqueyi.com/',
// baseUrl: 'https://test1-sc.yunqueyi.com/',
//baseUrl: 'https://uat-sc.yunqueyi.com/',
baseUrl: 'https://dev-sc.yunqueyi.com/',
baseUrl: 'https://uat-sc.yunqueyi.com/',
qiniuFileUrl: "https://dev-sc.yunqueyi.com/contents/admin/qiniu/token1",
qiniuResourceUrl: "https://test1-videos.yunqueyi.com",
qiniuImgUrl: "https://test1-file.yunqueyi.com",
......@@ -48,7 +48,7 @@ export const envConfig = {
yuequeyiIndexUrl: 'https://uat.yunqueyi.com/pica_index.html',
excelUrl: 'https://uat-sc.yunqueyi.com/raytheon/excel/template/1',
},
pro: {
pro: {
baseUrl: 'https://sc.yunqueyi.com/',
qiniuFileUrl: "https://sc.yunqueyi.com/contents/admin/qiniu/token1",
qiniuResourceUrl: "https://video.yunqueyi.com",
......
......@@ -69,14 +69,7 @@ export default {
},
handleCommand(command) {
if (command === 'logout') {
// let req = {token: localStorage.getItem("storageToken")};
// let logOutPromise = vm.removeToken(req);
// logOutPromise.then(function (res) {
// logout();
// }).catch(function (error) {
// console.log('登出失败:'+error);
// logout();
// });
sessionStorage.removeItem('PROT_CENTER_NAVS')
localStorage.removeItem('storageToken')
if(vm.idType == 1) { // 内部
window.location.href = getInnerLoginUrl()
......
......@@ -8,7 +8,7 @@
router
>
<template v-for="(item,_index) in items">
<template v-if="item.subs">
<template v-if="item.subs && item.subs.length">
<el-submenu :index=" 'index_' + _index" :key="item.index">
<template slot="title">
<i :class="item.icon"></i>
......@@ -47,38 +47,8 @@ export default {
},
data() {
return {
items: [
// {
// title: "黑名单",
// icon: "el-icon-blacklist",
// index: "blacklist"
// },
// {
// title: "疲劳度控制",
// icon: "el-icon-set-up",
// index: "fatigue-control"
// },
{
title: "协议管理",
icon: "el-icon-history-push",
index: "protocol-list"
},
// {
// title: "创建协议",
// icon: "el-icon-document-add",
// index: "create-protocol"
// },
// {
// title: "查看协议",
// icon: "el-icon-chat-line-square",
// index: "protocol-detail"
// },
// {
// title: "历史版本",
// icon: "el-icon-chat-line-square",
// index: "protocol-history"
// }
]
items: []
// items: [{ title: '协议管理', icon: 'el-icon-history-push', index: 'protocol-list' }]
};
},
computed: {
......@@ -88,24 +58,46 @@ export default {
},
created() {
vm = this;
const navs = sessionStorage.getItem('PROT_CENTER_NAVS');
vm.getNav();
},
watch: {
// authList(newVal, oldVal) {
// if (!newVal.P001) {
// // 项目管理
// vm.items[1].subs[1].index = "blank";
// }
// if (!newVal.P002) {
// // 组件管理
// vm.items[1].subs[0].index = "blank";
// }
// if (!newVal.P003) {
// // 角色管理
// vm.items[2].subs[0].index = "blank";
// }
// }
},
methods: {}
watch: {},
methods: {
getNav() {
this.POST('basic-data/menu/list', { systemType: 29 }).then(res => {
if (res.code == '000000') {
const { vueMenuDtos } = res.data;
this.items = vueMenuDtos;
sessionStorage.setItem('PROT_CENTER_NAVS', JSON.stringify(vueMenuDtos));
// 做当前路由无权限时处理
this.checkAuth(this.$route.path.split('/')[1], vueMenuDtos);
}
});
},
checkAuth(path, navs) {
let navList = getNavs(navs);
function getNavs(arr) {
let nvs = [];
for (let i = 0; i < arr.length; i++) {
const nav = arr[i];
const subs = nav.subs;
if (subs.length) {
nvs = nvs.concat(getNavs(subs));
} else {
nvs.push(nav.index);
}
}
return nvs;
}
if (navList.indexOf(path) == -1) {
this.$router.push(`/${navList[0]}`);
}
}
}
};
</script>
<style lang="scss">
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册