From 3137da82c3d75f3dfd1eb94e843a12627264751a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=BE=81?= Date: Tue, 17 May 2022 15:27:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E8=AE=A2=E5=8D=95bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/BsAddress.vue | 29 +++++++++++++++---- components/UiGoodsItem.vue | 4 +++ layouts/module/header/HeaderInfoBar.vue | 12 ++++---- pages/account/index/message.vue | 12 ++++---- .../index/order/detail/module/GoodsInfo.vue | 2 +- pages/index/module/TabbarFixed.vue | 1 - plugins/im.js | 9 +++--- 7 files changed, 45 insertions(+), 24 deletions(-) diff --git a/components/BsAddress.vue b/components/BsAddress.vue index ad84d7b..9bd95ba 100644 --- a/components/BsAddress.vue +++ b/components/BsAddress.vue @@ -93,11 +93,14 @@ :class="!isAccount ? 'flex-column' : ''" > 设为默认地址 -
+
取消 item.id == vm.curAddressListItem.id); - console.log(vm.selectData) + let curItem = vm.addressList.find( + (item) => item.id == vm.curAddressListItem.id + ); + console.log(vm.selectData); if (!vm.selectData?.area?.code) { vm.$message.error("请选择所在区域~"); return; @@ -274,7 +291,7 @@ export default { vm.$message.error("请输入收货人~"); return; } - if (!IsPhone(vm.addressPhone)&&vm.addressPhone!=curItem.phone) { + if (!IsPhone(vm.addressPhone) && vm.addressPhone != curItem.phone) { vm.$message.error("请输入收货人手机号码~"); return; } @@ -413,7 +430,7 @@ export default { margin-right: 38px; } } - .clearmargin{ + .clearmargin { margin: 0 0 0 20px; } } diff --git a/components/UiGoodsItem.vue b/components/UiGoodsItem.vue index a9d94b9..4b716c8 100644 --- a/components/UiGoodsItem.vue +++ b/components/UiGoodsItem.vue @@ -55,6 +55,10 @@ export default { cursor: pointer; background: #ffffff; + &:hover{ + box-shadow: 0px 0px 10px 1px rgba(0, 0, 0, 0.10000000149011612); + } + &__img { width: 232px; height: 232px; diff --git a/layouts/module/header/HeaderInfoBar.vue b/layouts/module/header/HeaderInfoBar.vue index fc35920..848a5a6 100644 --- a/layouts/module/header/HeaderInfoBar.vue +++ b/layouts/module/header/HeaderInfoBar.vue @@ -62,11 +62,11 @@ /> 消息
- {{ messageCount }} + {{ unreadCount }}
@@ -149,17 +149,19 @@ export default { value: MENU_VALUE.LOGON_OUT, }, ], - messageCount: 0, // 消息未读数 }; }, computed: { - ...mapState(["userInfo", "token"]), + ...mapState(["userInfo", "token","unreadCount"]), menuIcon() { return this.menuVisible ? require("~/assets/img/layout/icon-up-light.png") : require("~/assets/img/layout/icon-up.png"); }, }, + mounted() { + this.$startWebSockets() + }, methods: { onLoginClick() { this.$isLoginValidate(); diff --git a/pages/account/index/message.vue b/pages/account/index/message.vue index 58b3a7a..3275547 100644 --- a/pages/account/index/message.vue +++ b/pages/account/index/message.vue @@ -11,7 +11,7 @@

消息通知

- +
@@ -46,7 +46,7 @@ export default { ...mapState(["token","socketMsgData"]), }, mounted(){ - console.log(`socketMsgData`,this.$store) + console.log(`socketMsgData`,this.$store.state) }, methods: {}, }; diff --git a/pages/account/index/order/detail/module/GoodsInfo.vue b/pages/account/index/order/detail/module/GoodsInfo.vue index 279ee23..e739186 100644 --- a/pages/account/index/order/detail/module/GoodsInfo.vue +++ b/pages/account/index/order/detail/module/GoodsInfo.vue @@ -52,7 +52,7 @@

-

+

diff --git a/pages/index/module/TabbarFixed.vue b/pages/index/module/TabbarFixed.vue index e4a9c15..418aac8 100644 --- a/pages/index/module/TabbarFixed.vue +++ b/pages/index/module/TabbarFixed.vue @@ -72,7 +72,6 @@ export default { }, mounted() { this.getTabBarVisible(); - this.$startWebSockets() }, methods: { getTabBarVisible() { diff --git a/plugins/im.js b/plugins/im.js index b6d0484..0798b55 100644 --- a/plugins/im.js +++ b/plugins/im.js @@ -12,7 +12,7 @@ function guid() { Vue.prototype.$startWebSockets = function () { console.log(); let token = this.$cookies.get(TOKEN_KEY); - if (token) { + if (token&&!Vue.prototype.Socket) { let url = `wss://k8s-horse-gateway.mashibing.cn/ws?client=${token}&type=1`; Vue.prototype.Socket = new WebSocket(url); Vue.prototype.Socket.onopen = () => { @@ -48,6 +48,9 @@ Vue.prototype.$startWebSockets = function () { // 获取消息列表 if (msg.traceType == 2) { this.$store.commit("setSocketMsgData", msg.content); + setTimeout(()=>{ + console.log(this.$store.state) + },500) } // 接收消息 @@ -57,10 +60,6 @@ Vue.prototype.$startWebSockets = function () { `{"traceId":"${traceId}",traceType:1,"content":{"size": 100}}` ); } - - setTimeout(()=>{ - console.log(this.$store.state) - },500) }; } };