diff --git a/im-ui/.env.production b/im-ui/.env.production index acca7e2..f372106 100644 --- a/im-ui/.env.production +++ b/im-ui/.env.production @@ -1,6 +1,8 @@ ENV = 'production' +# app名称 +VUE_APP_NAME = "盒子IM" # 接口地址 VUE_APP_BASE_API = 'https://8.134.92.70:443/api' - +# ws地址 VUE_APP_WS_URL = 'wss://8.134.92.70:81/im' \ No newline at end of file diff --git a/im-ui/public/index.html b/im-ui/public/index.html index d2c9d76..5ae1079 100644 --- a/im-ui/public/index.html +++ b/im-ui/public/index.html @@ -5,13 +5,9 @@ - <%= htmlWebpackPlugin.options.title %> + 盒子IM -
- diff --git a/im-ui/src/api/element.js b/im-ui/src/api/element.js index 8a83926..a92fde5 100644 --- a/im-ui/src/api/element.js +++ b/im-ui/src/api/element.js @@ -14,7 +14,17 @@ let fixLeft = (e) => { return offset } +let setTitleTip = (tip) => { + let title = process.env.VUE_APP_NAME; + if(tip){ + title = `(${tip})${title}`; + } + document.title =title; + +} + export default{ fixTop, - fixLeft + fixLeft, + setTitleTip } diff --git a/im-ui/src/view/Home.vue b/im-ui/src/view/Home.vue index 85f6d84..186eebf 100644 --- a/im-ui/src/view/Home.vue +++ b/im-ui/src/view/Home.vue @@ -1,15 +1,16 @@ @@ -51,7 +46,7 @@ import Setting from '../components/setting/Setting.vue'; import UserInfo from '../components/common/UserInfo.vue'; import FullImage from '../components/common/FullImage.vue'; - + export default { components: { HeadImage, @@ -173,9 +168,26 @@ this.showSettingDialog = false; } }, - computed:{ - uiStore(){ + computed: { + uiStore() { return this.$store.state.uiStore; + }, + unreadCount() { + let unreadCount = 0; + let chats = this.$store.state.chatStore.chats; + chats.forEach((chat) => { + unreadCount += chat.unreadCount + }); + return unreadCount; + } + }, + watch: { + unreadCount: { + handler(newCount, oldCount) { + let tip = newCount > 0 ? `${newCount}条未读` : ""; + this.$elm.setTitleTip(tip); + }, + immediate: true } }, mounted() { @@ -209,12 +221,14 @@ flex: 1; .el-menu-item { - margin-top: 20px; + margin: 25px 0; .router-link-exact-active span { color: white !important; } + + span { font-size: 24px !important; color: #aaaaaa; @@ -223,6 +237,21 @@ color: white !important; } } + + .unread-text { + position: absolute; + line-height: 20px; + background-color: #f56c6c; + left: 36px; + top: 7px; + color: white; + border-radius: 30px; + padding: 0 5px; + font-size: 10px; + text-align: center; + white-space: nowrap; + border: 1px solid #f1e5e5; + } } }