Commit c22c4cdf authored by 刘殿昕's avatar 刘殿昕

没想出来menu啥问题,暂时测试一周吧

parent 51d1b45b
<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 <div style="float:right;cursor: pointer;position:relative;" class="user_hover">
style="float:right;cursor: pointer;position:relative;" <span v-if="userInfo.user_name && userInfo.user_name != ''" class="user">{{ userInfo.user_name }}</span>
class="user_hover"
>
<span
v-if="userInfo.user_name && userInfo.user_name != ''"
class="user"
>{{ userInfo.user_name }}</span
>
<span v-else @click="gotopage('login')" class="user">请登录</span> <span v-else @click="gotopage('login')" class="user">请登录</span>
<img <img :class="userInfo.picture_path ? 'user_pic' : 'user_default'" :src="
:class="userInfo.picture_path ? 'user_pic' : 'user_default'"
:src="
userInfo.picture_path || require('../assets/imgs/home_ic_user.png') userInfo.picture_path || require('../assets/imgs/home_ic_user.png')
" " />
/> <div v-if="userInfo.user_name && userInfo.user_name != ''" class="user_menu">
<div <div v-for="(item, index) in user_arr" :key="index + 700" @click="gotopage(item.path)">
v-if="userInfo.user_name && userInfo.user_name != ''"
class="user_menu"
>
<div
v-for="(item, index) in user_arr"
:key="index + 700"
@click="gotopage(item.path)"
>
{{ item.name }} {{ item.name }}
</div> </div>
</div> </div>
<div <div v-if="userInfo.user_name && userInfo.user_name != ''" class="sj"></div>
v-if="userInfo.user_name && userInfo.user_name != ''"
class="sj"
></div>
</div> </div>
<div <div style="float:right;cursor: pointer;position:relative;" class="shop_hover" @click="gotopage('/shop/shopping_cart')">
style="float:right;cursor: pointer;position:relative;"
class="shop_hover"
@click="gotopage('/shop/shopping_cart')"
>
<div class="car"> <div class="car">
<el-badge <el-badge v-if="menuCartNum != 0" :value="menuCartNum" :max="99" class="number"></el-badge>
v-if="menuCartNum != 0"
:value="menuCartNum"
:max="99"
class="number"
></el-badge>
<img src="../assets/imgs/home_ic_shop.png" alt class="car_img" /> <img src="../assets/imgs/home_ic_shop.png" alt class="car_img" />
</div> </div>
<div <div v-if="userInfo.user_name && userInfo.user_name != ''" class="shop_menu">
v-if="userInfo.user_name && userInfo.user_name != ''"
class="shop_menu"
>
<div class="shop_list_title">最近加入的服务:</div> <div class="shop_list_title">最近加入的服务:</div>
<div <div v-for="(item, index) in shopping_list" :key="'shopping' + index" class="shop_list_cell shop_line">
v-for="(item, index) in shopping_list"
:key="'shopping' + index"
class="shop_list_cell shop_line"
>
<img :src="item.service.cover" class="shop_img" /> <img :src="item.service.cover" class="shop_img" />
<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.application.app_name : item.service.name }}
item.service_id == 0
? item.application.app_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.application.ywly : item.service.sectors_name }}
item.service_id == 0
? item.application.ywly
: 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.application.org : item.service.organization_name }}
item.service_id == 0
? item.application.org
: item.service.organization_name
}}
</p> </p>
</div> </div>
<div> <div>
<img <img @click.stop="deleteItem(item.id)" src="../assets/imgs/ic_delete.png" alt />
@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 @click="settlement" size="small" class="shop_settlement">去购物车申请结算</el-button>
>去购物车申请结算</el-button
>
</div> </div>
</div> </div>
<div <div v-if="userInfo.user_name && userInfo.user_name != ''" class="shop_sj"></div>
v-if="userInfo.user_name && userInfo.user_name != ''"
class="shop_sj"
></div>
</div> </div>
<div style="float:right"> <div style="float:right">
<div <div v-for="(item, index) in menu_arr" :key="index + 200" class="menu_box user_hover" @click="navAction(item.visit_url)" :style="{ color: now_menu == item.visit_url ? '#fff' : '' }">
v-for="(item, index) in menu_arr"
:key="index + 200"
class="menu_box user_hover"
@click="navAction(item.visit_url)"
:style="{ color: now_menu == item.visit_url ? '#fff' : '' }"
>
{{ item.menu_name }} {{ item.menu_name }}
<div <div class="user_menu" v-if="item.Child && item.Child.length" style="left: 30px;">
class="user_menu" <div v-for="(v, indexs) in item.Child" :key="indexs + 700" @click.stop="gotoChildPage(v, item.visit_url)">
v-if="item.Child && item.Child.length"
style="left: 30px;"
>
<div
v-for="(v, indexs) in item.Child"
:key="indexs + 700"
@click.stop="gotoChildPage(v, item.visit_url)"
>
{{ v.menu_name }} {{ v.menu_name }}
</div> </div>
</div> </div>
<div <div class="sj" v-if="item.Child && item.Child.length" style="left: 60px;"></div>
class="sj"
v-if="item.Child && item.Child.length"
style="left: 60px;"
></div>
<div class="bottom_show" v-if="now_menu == item.visit_url"></div> <div class="bottom_show" v-if="now_menu == item.visit_url"></div>
</div> </div>
</div> </div>
...@@ -146,10 +71,10 @@ export default { ...@@ -146,10 +71,10 @@ export default {
{ name: "消息通知", path: "/user/message" }, { name: "消息通知", path: "/user/message" },
{ name: "收银中心", path: "" }, { name: "收银中心", path: "" },
{ name: "关于BD-aPaaS", path: "" }, { name: "关于BD-aPaaS", path: "" },
{ name: "退出登录", path: "logout" }, { name: "退出登录", path: "logout" }
], ],
shopping_list: [], shopping_list: [],
menuCartNum: 0, menuCartNum: 0
}; };
}, },
mounted() { mounted() {
...@@ -162,15 +87,16 @@ export default { ...@@ -162,15 +87,16 @@ export default {
}, },
userInfo() { userInfo() {
return this.$store.state.userInfo || {}; return this.$store.state.userInfo || {};
}, }
}, },
watch: { watch: {
getMenuCartState(newVal) { getMenuCartState(newVal) {
this.getList(); this.getList();
}, }
}, },
methods: { methods: {
gotopage(n) { gotopage(n) {
console.log("function gotopage,menu test:" + n);
if (n == "logout") { if (n == "logout") {
window.location.href = "/iam/api/logout"; window.location.href = "/iam/api/logout";
} else if (n == "login") { } else if (n == "login") {
...@@ -185,7 +111,7 @@ export default { ...@@ -185,7 +111,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();
}); });
}, },
...@@ -195,26 +121,29 @@ export default { ...@@ -195,26 +121,29 @@ export default {
this.$router.push({ name: "shoppingCart" }); this.$router.push({ name: "shoppingCart" });
}, },
navAction(path) { navAction(path) {
this.$router.push(path); console.log("function navAction,menu test:" + path);
this.now_menu = path; this.now_menu = path;
window.sessionStorage.setItem("menuVisitUrl", path); window.sessionStorage.setItem("menuVisitUrl", path);
this.$router.push(path);
}, },
gotoChildPage(v, parent) { gotoChildPage(v, parent) {
console.log("function gotoChildPage,menu test:" + v + "|" + parent);
if (v.visit_url) { if (v.visit_url) {
if (v.visit_url == "/fwgl/" || v.visit_url == "/yygl/") { if (v.visit_url == "/fwgl/" || v.visit_url == "/yygl/") {
this.$router.push(v.visit_url + this.$store.getters.level); this.$router.push(v.visit_url + this.$store.getters.level);
} else if (parent == "/services_shop") { } else if (parent == "/services_shop") {
this.$router.push(v.visit_url);
this.$store.commit("serviceShopMenuAct", v.visit_url); this.$store.commit("serviceShopMenuAct", v.visit_url);
this.$router.push(v.visit_url);
} else { } else {
this.$router.push(v.visit_url); this.$router.push(v.visit_url);
} }
this.now_menu = parent; this.now_menu = parent;
window.sessionStorage.setItem("menuVisitUrl", parent); window.sessionStorage.setItem("menuVisitUrl", parent);
} }
}, },
getList() { getList() {
this.$api.serviceShop.getShoppingCart().then((response) => { this.$api.serviceShop.getShoppingCart().then(response => {
if (response.data.success == "1") { if (response.data.success == "1") {
this.menuCartNum = response.data.data.valid this.menuCartNum = response.data.data.valid
? response.data.data.valid.length ? response.data.data.valid.length
...@@ -233,15 +162,15 @@ export default { ...@@ -233,15 +162,15 @@ export default {
this.now_menu = visit_url ? visit_url : "/services_shop"; this.now_menu = visit_url ? visit_url : "/services_shop";
}, },
getNowMenu() { getNowMenu() {
this.$api.general.getNowMenu({ teamName: "APAAS3" }).then((response) => { this.$api.general.getNowMenu({ teamName: "APAAS3" }).then(response => {
if (response.data.success == 1) { if (response.data.success == 1) {
this.menu_arr = this.menu_arr =
(response.data.data[0] && response.data.data[0].Child) || []; (response.data.data[0] && response.data.data[0].Child) || [];
this.getMenuIndex(); this.getMenuIndex();
} }
}); });
}, }
}, }
}; };
</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