From 2ac28436a9f613a5dcd05e41c0b86882e51a8bb9 Mon Sep 17 00:00:00 2001 From: xuyiming Date: Wed, 5 Aug 2020 18:32:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5=E8=B0=83?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 21 ++++++++++-- src/components/menu.vue | 55 ++++++++++++++++++++++++++------ src/pages/user/notice/notice.vue | 8 +++-- 3 files changed, 69 insertions(+), 15 deletions(-) diff --git a/src/App.vue b/src/App.vue index fd0a605..0238e89 100644 --- a/src/App.vue +++ b/src/App.vue @@ -10,7 +10,7 @@ import bdMenu from "./components/menu"; export default { data: () => ({}), components: { - bdMenu + bdMenu, }, methods: { getCurrentUser() { @@ -24,11 +24,26 @@ export default { 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() { this.getCurrentUser(); - } + this.getMessage(); + }, }; diff --git a/src/components/menu.vue b/src/components/menu.vue index cce92cb..85536b5 100644 --- a/src/components/menu.vue +++ b/src/components/menu.vue @@ -12,10 +12,8 @@ class="user" >{{ userInfo.user_name }} 请登录 - + +
{{ item.menu_name }}
+ > + {{ item.menu_name }} + +
退出登录
@@ -89,7 +90,9 @@ @mouseleave.stop="change_now_hover(-1)" @mouseenter.stop="change_now_hover(indexs)" @click.stop="gotoChildPage(v, item.visit_url)" - >{{ v.menu_name }} + > + {{ v.menu_name }} +
@@ -127,7 +130,10 @@ export default { }, userInfo() { return this.$store.state.userInfo || {}; - } + }, + unreadMessageCount() { + return this.$store.state.unreadMessageCount; + }, }, watch: { getMenuCartState(newVal) { @@ -308,7 +314,7 @@ export default { left: calc(50% - 12px); } .user_menu { - width: 135px; + /* width: 135px; */ background-color: #ffffff; box-shadow: 0px 3px 6px 0px rgba(15, 19, 65, 0.05); border-radius: 8px; @@ -350,10 +356,11 @@ export default { display: block; } .user_menu div { - width: 135px; + /* width: 135px; */ height: 44px; line-height: 44px; - text-align: center; + padding: 0 30px; + text-align: left; color: #0d1847; } .user_menu div:hover { @@ -435,6 +442,34 @@ export default { text-overflow: ellipsis; 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; +}