Commit 2ac28436 authored by 徐一鸣's avatar 徐一鸣

消息通知调试

parent 85877838
...@@ -10,7 +10,7 @@ import bdMenu from "./components/menu"; ...@@ -10,7 +10,7 @@ import bdMenu from "./components/menu";
export default { export default {
data: () => ({}), data: () => ({}),
components: { components: {
bdMenu bdMenu,
}, },
methods: { methods: {
getCurrentUser() { getCurrentUser() {
...@@ -24,11 +24,26 @@ export default { ...@@ -24,11 +24,26 @@ export default {
console.log(data.errMsg); console.log(data.errMsg);
} }
}); });
},
getMessage() {
this.$http
.get("/apaas/service/v3/mymsg/unread", {
params: {
size: 10,
page: 1,
},
})
.then(({ data }) => {
if (data.success === 1) {
this.setUnreadMessageCount(data.data.total || 0);
} }
});
},
}, },
created() { created() {
this.getCurrentUser(); this.getCurrentUser();
} this.getMessage();
},
}; };
</script> </script>
......
...@@ -12,10 +12,8 @@ ...@@ -12,10 +12,8 @@
class="user" class="user"
>{{ userInfo.user_name }}</span> >{{ 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 && false ? 'user_pic' : 'user_default'" src="../assets/imgs/home_ic_user.png" />
:class="userInfo.picture_path&&false ? 'user_pic' : 'user_default'" <span class="has_msg" v-if="unreadMessageCount > 0"></span>
src="../assets/imgs/home_ic_user.png"
/>
<!-- 菜单图片不需要动态渲染,只用ui给的图标 --> <!-- 菜单图片不需要动态渲染,只用ui给的图标 -->
<div v-if="userInfo.user_name && userInfo.user_name != ''" class="user_menu"> <div v-if="userInfo.user_name && userInfo.user_name != ''" class="user_menu">
<div <div
...@@ -24,7 +22,10 @@ ...@@ -24,7 +22,10 @@
@mouseleave.stop="change_now_hover(-1)" @mouseleave.stop="change_now_hover(-1)"
@mouseenter.stop="change_now_hover(index)" @mouseenter.stop="change_now_hover(index)"
@click="gotopage(item.visit_url)" @click="gotopage(item.visit_url)"
>{{ item.menu_name }}</div> >
{{ item.menu_name }}
<span v-if="unreadMessageCount > 0 && item.visit_url === '/user/notice'" class="width_num" v-text="unreadMessageCount"></span>
</div>
<div @click="gotopage('logout')">退出登录</div> <div @click="gotopage('logout')">退出登录</div>
</div> </div>
<div v-if="userInfo.user_name && userInfo.user_name != ''" class="sj" :style="now_hover==0?{backgroundColor:'#e56600'}:{}"></div> <div v-if="userInfo.user_name && userInfo.user_name != ''" class="sj" :style="now_hover==0?{backgroundColor:'#e56600'}:{}"></div>
...@@ -89,7 +90,9 @@ ...@@ -89,7 +90,9 @@
@mouseleave.stop="change_now_hover(-1)" @mouseleave.stop="change_now_hover(-1)"
@mouseenter.stop="change_now_hover(indexs)" @mouseenter.stop="change_now_hover(indexs)"
@click.stop="gotoChildPage(v, item.visit_url)" @click.stop="gotoChildPage(v, item.visit_url)"
>{{ v.menu_name }}</div> >
{{ v.menu_name }}
</div>
</div> </div>
<div class="sj" v-if="item.Child && item.Child.length" :style="now_hover==0?{backgroundColor:'#e56600',left: '60px'}:{left: '60px'}"></div> <div class="sj" v-if="item.Child && item.Child.length" :style="now_hover==0?{backgroundColor:'#e56600',left: '60px'}:{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>
...@@ -127,7 +130,10 @@ export default { ...@@ -127,7 +130,10 @@ export default {
}, },
userInfo() { userInfo() {
return this.$store.state.userInfo || {}; return this.$store.state.userInfo || {};
} },
unreadMessageCount() {
return this.$store.state.unreadMessageCount;
},
}, },
watch: { watch: {
getMenuCartState(newVal) { getMenuCartState(newVal) {
...@@ -308,7 +314,7 @@ export default { ...@@ -308,7 +314,7 @@ export default {
left: calc(50% - 12px); left: calc(50% - 12px);
} }
.user_menu { .user_menu {
width: 135px; /* width: 135px; */
background-color: #ffffff; background-color: #ffffff;
box-shadow: 0px 3px 6px 0px rgba(15, 19, 65, 0.05); box-shadow: 0px 3px 6px 0px rgba(15, 19, 65, 0.05);
border-radius: 8px; border-radius: 8px;
...@@ -350,10 +356,11 @@ export default { ...@@ -350,10 +356,11 @@ export default {
display: block; display: block;
} }
.user_menu div { .user_menu div {
width: 135px; /* width: 135px; */
height: 44px; height: 44px;
line-height: 44px; line-height: 44px;
text-align: center; padding: 0 30px;
text-align: left;
color: #0d1847; color: #0d1847;
} }
.user_menu div:hover { .user_menu div:hover {
...@@ -435,6 +442,34 @@ export default { ...@@ -435,6 +442,34 @@ export default {
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.width_num {
display: inline-block;
vertical-align: middle;
min-width: 30px;
background-color: #e56600;
font-size: 10px;
line-height: 16px;
color: #fff;
padding: 0 8px;
margin-left: 5px;
box-sizing: border-box;
border-radius: 8px;
text-align: center;
overflow: hidden;
}
.user_menu div:hover .width_num {
background-color: #fcefd6;
color: #e56600;
}
.has_msg {
width: 8px;
height: 8px;
border-radius: 50%;
background-color: #e56600;
position: absolute;
top: 23px;
left: 15px;
}
</style> </style>
<style> <style>
.number .el-badge__content { .number .el-badge__content {
......
...@@ -13,7 +13,11 @@ ...@@ -13,7 +13,11 @@
<div class="notcie_filter"> <div class="notcie_filter">
<a :class="{ current: unread }" @click.prevent="filterAction(true)"> <a :class="{ current: unread }" @click.prevent="filterAction(true)">
<span class="btn_text">未读消息</span> <span class="btn_text">未读消息</span>
<span class="width_num" v-text="unreadMessageCount"></span> <span
class="width_num"
v-if="unreadMessageCount > 0"
v-text="unreadMessageCount"
></span>
</a> </a>
<a :class="{ current: !unread }" @click.prevent="filterAction(false)"> <a :class="{ current: !unread }" @click.prevent="filterAction(false)">
<span class="btn_text">全部消息</span> <span class="btn_text">全部消息</span>
...@@ -316,7 +320,7 @@ export default { ...@@ -316,7 +320,7 @@ export default {
display: none; display: none;
} }
.notcie_filter a .width_num { .notcie_filter a .width_num {
min-width: 40px; min-width: 30px;
background-color: #8890a7; background-color: #8890a7;
font-size: 10px; font-size: 10px;
line-height: 16px; line-height: 16px;
......
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