Commit d206ffbb authored by 徐一鸣's avatar 徐一鸣

用户权限

parent 18199f81
<template> <template>
<div class="menu"> <div class="menu">
<img src="../assets/imgs/home_img_logo.png" alt class="logo" /> <img src="../assets/imgs/home_img_logo.png" alt class="logo" />
<div style="float:right;cursor: pointer;position:relative;" class="user_hover"> <div
<span class="user">用户</span> style="float:right;cursor: pointer;position:relative;"
<img src="../assets/imgs/home_ic_user.png" alt class="user_pic" /> class="user_hover"
>
<span class="user">{{ userInfo.user_name }}</span>
<img
class="user_pic"
:src="
userInfo.picture_path || require('../assets/imgs/home_ic_user.png')
"
/>
<div class="user_menu"> <div class="user_menu">
<div <div
v-for="(item, index) in user_arr" v-for="(item, index) in user_arr"
:key="index + 700" :key="index + 700"
@click="gotopage(item.path)" @click="gotopage(item.path)"
>{{ item.name }}</div> >
{{ item.name }}
</div>
</div> </div>
<div class="sj"></div> <div class="sj"></div>
</div> </div>
<div style="float:right;cursor: pointer;position:relative;" class="shop_hover"> <div
style="float:right;cursor: pointer;position:relative;"
class="shop_hover"
>
<div class="number">99+</div> <div class="number">99+</div>
<img src="../assets/imgs/home_ic_shop.png" alt class="car" /> <img src="../assets/imgs/home_ic_shop.png" alt class="car" />
<div class="shop_menu"> <div class="shop_menu">
...@@ -27,32 +40,38 @@ ...@@ -27,32 +40,38 @@
<div class="shop_cell_msgs"> <div class="shop_cell_msgs">
<p @click="getDetail(item.id)" class="shop_cell_name over_one"> <p @click="getDetail(item.id)" class="shop_cell_name over_one">
{{ {{
item.service_id == 0 item.service_id == 0
? item.application.app_name ? item.application.app_name
: item.service.name : item.service.name
}} }}
</p> </p>
<p class="shop_cell_msg bover_one"> <p class="shop_cell_msg bover_one">
{{ {{
item.service_id == 0 item.service_id == 0
? item.application.ywly ? item.application.ywly
: item.service.sectors_name : item.service.sectors_name
}} }}
</p> </p>
<p class="shop_cell_msg over_one"> <p class="shop_cell_msg over_one">
{{ {{
item.service_id == 0 item.service_id == 0
? item.application.org ? item.application.org
: item.service.organization_name : item.service.organization_name
}} }}
</p> </p>
</div> </div>
<div> <div>
<img @click.stop="deleteItem(item.id)" src="../assets/imgs/ic_delete.png" alt /> <img
@click.stop="deleteItem(item.id)"
src="../assets/imgs/ic_delete.png"
alt
/>
</div> </div>
</div> </div>
<div class="shop_footer"> <div class="shop_footer">
<el-button @click="settlement" size="small" class="shop_settlement">去购物车申请结算</el-button> <el-button @click="settlement" size="small" class="shop_settlement"
>去购物车申请结算</el-button
>
</div> </div>
</div> </div>
<div class="shop_sj"></div> <div class="shop_sj"></div>
...@@ -67,14 +86,24 @@ ...@@ -67,14 +86,24 @@
:style="{ color: now_menu == index ? '#fff' : '' }" :style="{ color: now_menu == index ? '#fff' : '' }"
> >
{{ item.name }} {{ item.name }}
<div class="user_menu" v-if="item.children && item.children.length" style="left: 30px;"> <div
class="user_menu"
v-if="item.children && item.children.length"
style="left: 30px;"
>
<div <div
v-for="(v, indexs) in item.children" v-for="(v, indexs) in item.children"
:key="indexs + 700" :key="indexs + 700"
@click.stop="gotoChildPage(v, index)" @click.stop="gotoChildPage(v, index)"
>{{ v.name }}</div> >
{{ v.name }}
</div>
</div> </div>
<div class="sj" v-if="item.children && item.children.length" style="left: 60px;"></div> <div
class="sj"
v-if="item.children && item.children.length"
style="left: 60px;"
></div>
<div class="bottom_show" v-if="now_menu == index"></div> <div class="bottom_show" v-if="now_menu == index"></div>
</div> </div>
</div> </div>
...@@ -92,21 +121,21 @@ export default { ...@@ -92,21 +121,21 @@ export default {
children: [ children: [
{ {
name: "服务注册", name: "服务注册",
path: "/fwzc/fwcs" path: "/fwzc/fwcs",
}, },
{ {
name: "服务管理", name: "服务管理",
path: "/fwgl/" path: "/fwgl/",
}, },
{ {
name: "应用管理", name: "应用管理",
path: "/yygl/" path: "/yygl/",
} },
] ],
}, },
{ {
name: "技术支持", name: "技术支持",
path: "/xxx" path: "/xxx",
}, },
{ {
name: "服务超市", name: "服务超市",
...@@ -114,59 +143,71 @@ export default { ...@@ -114,59 +143,71 @@ export default {
children: [ children: [
{ {
name: "数据服务", name: "数据服务",
path: "/shop/data_service_list/5" path: "/shop/data_service_list/5",
}, },
{ {
name: "时空服务", name: "时空服务",
path: "/shop/space_time_service_list/6" path: "/shop/space_time_service_list/6",
}, },
{ {
name: "视频服务", name: "视频服务",
path: "/shop/video_service_list/7" path: "/shop/video_service_list/7",
}, },
{ {
name: "感知服务", name: "感知服务",
path: "/shop/perception_service_list/10" path: "/shop/perception_service_list/10",
}, },
{ {
name: "综合应用", name: "综合应用",
path: "/shop/comprehensive_app_list/11" path: "/shop/comprehensive_app_list/11",
}, },
{ {
name: "云资源服务", name: "云资源服务",
path: "/shop/cloud" path: "/shop/cloud",
}, },
{ {
name: "应用商店", name: "应用商店",
path: "/shop/app_store_list/12" path: "/shop/app_store_list/12",
} },
] ],
} },
], ],
now_menu: 2, now_menu: 2,
user_arr: [ user_arr: [
{ name: "个人档案", path: "/user/user_info" }, { name: "个人档案", path: "/user/user_info" },
{ name: "消息通知", path: "/user/message" }, { name: "消息通知", path: "/user/message" },
{ name: "收银中心", path: "/authority" },
{ name: "关于BD-aPaaS", path: "/data_analysis" }, { name: "关于BD-aPaaS", path: "/data_analysis" },
{ name: "退出登录", path: "logout" } { name: "退出登录", path: "logout" },
], ],
shopping_list: [] shopping_list: [],
}; };
}, },
mounted() { mounted() {
if (this.$store.level == 2) {
this.user_arr = [
{ name: "个人档案", path: "/user/user_info" },
{ name: "消息通知", path: "/user/message" },
{ name: "收银中心", path: "/authority" },
{ name: "关于BD-aPaaS", path: "/data_analysis" },
{ name: "退出登录", path: "logout" },
];
}
this.getMenuIndex(); this.getMenuIndex();
this.getList(); this.getList();
}, },
computed: { computed: {
getMenuCartState() { getMenuCartState() {
return this.$store.state.menuCartState; return this.$store.state.menuCartState;
} },
userInfo() {
return this.$store.state.userInfo || {};
},
}, },
watch: { watch: {
getMenuCartState(newVal) { getMenuCartState(newVal) {
this.getList(); this.getList();
} },
}, },
methods: { methods: {
gotopage(n) { gotopage(n) {
...@@ -182,7 +223,7 @@ export default { ...@@ -182,7 +223,7 @@ export default {
}, },
deleteItem(id) { deleteItem(id) {
let query = [id]; let query = [id];
this.$api.serviceShop.delShoppingCart(query).then(response => { this.$api.serviceShop.delShoppingCart(query).then((response) => {
this.getList(); this.getList();
}); });
}, },
...@@ -211,7 +252,7 @@ export default { ...@@ -211,7 +252,7 @@ export default {
} }
}, },
getList() { getList() {
this.$api.serviceShop.getShoppingCart().then(response => { this.$api.serviceShop.getShoppingCart().then((response) => {
if (response.data.success == "1") { if (response.data.success == "1") {
console.log(response.data.data); console.log(response.data.data);
this.shopping_list = response.data.data.valid this.shopping_list = response.data.data.valid
...@@ -226,8 +267,8 @@ export default { ...@@ -226,8 +267,8 @@ export default {
let index = window.sessionStorage.getItem("menuIndex"); let index = window.sessionStorage.getItem("menuIndex");
console.log(index); console.log(index);
this.now_menu = index ? index : 2; this.now_menu = index ? index : 2;
} },
} },
}; };
</script> </script>
......
<template> <template>
<div class="fwgl_container"> <div class="fwgl_container">
<side-nav-bar title="权限管理" :title-icon="require('@/assets/imgs/tool_quanxian.png')" :nav-list="navList" :title-path="navList[0] && navList[0].path"></side-nav-bar> <side-nav-bar
title="权限管理"
:title-icon="require('@/assets/imgs/tool_quanxian.png')"
:nav-list="navList"
:title-path="navList[0] && navList[0].path"
></side-nav-bar>
<div class="main_container"> <div class="main_container">
<router-view :key="'type_' + $route.params.type"></router-view> <router-view :key="'type_' + $route.params.type"></router-view>
</div> </div>
...@@ -12,42 +17,60 @@ import sideNavBar from "@/components/side-nav-bar"; ...@@ -12,42 +17,60 @@ import sideNavBar from "@/components/side-nav-bar";
export default { export default {
components: { components: {
sideNavBar sideNavBar,
}, },
data: () => ({ data: () => ({
userNav: [ userNav: [
{ {
name: "组织管理", name: "组织管理",
path: `/authority/organization` path: `/authority/organization`,
}, },
{ {
name: "用户管理", name: "用户管理",
path: `/authority/users` path: `/authority/users`,
}, },
{ {
name: "菜单管理", name: "菜单管理",
path: `/authority/menu` path: `/authority/menu`,
}, },
{ {
name: "角色管理", name: "角色管理",
path: `/authority/roles` path: `/authority/roles`,
} },
], ],
navList: [] navList: [],
}), }),
watch: { watch: {
"$route.fullPath"(path) { "$route.fullPath"(path) {
this.initNavList(); this.initNavList();
} },
}, },
methods: { methods: {
initNavList() { initNavList() {
this.navList = this.userNav; this.navList = this.userNav;
} },
}, },
mounted() { mounted() {
this.initNavList(); this.$api.user.getNowUser().then(({ data }) => {
} if (data.success == 1) {
this.$store.commit("userInfofun", data.data);
const userLevel = this.$store.getters.level;
if (userLevel === 2) {
this.initNavList();
} else {
this.$message({
message: `您没有权限管理模块的权限.`,
type: "warning",
});
this.$router.push(`/index`);
}
} else {
console.log(data.errMsg);
}
});
},
}; };
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment