From 37ef0f9d0414e1c27ee396f86cd553107f24a1a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=BE=81?= Date: Tue, 17 May 2022 16:55:17 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E4=BA=8C=E6=AC=A1?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/BsAddress.vue | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/components/BsAddress.vue b/components/BsAddress.vue index b74d846..82d8c27 100644 --- a/components/BsAddress.vue +++ b/components/BsAddress.vue @@ -212,13 +212,7 @@ export default { onCanceloperation() { let vm = this; vm.isOperation = false; - vm.$set(vm.selectData.area, "value", ""); - vm.$set(vm.selectData.city, "value", ""); - vm.$set(vm.selectData.province, "value", ""); - vm.$set(vm, "detailAddress", ""); - vm.$set(vm, "defaultAddress", ""); - vm.$set(vm, "addressUser", ""); - vm.$set(vm, "addressPhone", ""); + vm.clearForm(); vm.$emit("onSaveSuccess"); }, onEdit() { @@ -274,8 +268,8 @@ export default { }, async onAddAddress() { let vm = this; - let curItem = vm.addressList[vm.editIndex] - console.log(`vm.addressPhone != curItem.phone`,vm.addressPhone , curItem); + let curItem = vm.addressList[vm.editIndex]; + console.log(`vm.addressPhone != curItem.phone`, vm.addressPhone, curItem); if (!vm.selectData?.area?.code) { vm.$message.error("请选择所在区域~"); return; @@ -313,13 +307,7 @@ export default { } if (!res.error) { vm.$message.success("添加成功!"); - vm.$set(vm.selectData.area, "value", ""); - vm.$set(vm.selectData.city, "value", ""); - vm.$set(vm.selectData.province, "value", ""); - vm.$set(vm, "detailAddress", ""); - vm.$set(vm, "defaultAddress", ""); - vm.$set(vm, "addressUser", ""); - vm.$set(vm, "addressPhone", ""); + vm.clearForm(); vm.$emit("onSaveSuccess"); vm.isEdit = false; vm.getAddressData(); @@ -332,6 +320,19 @@ export default { vm.$emit("emitAddress", item); vm.dialogVisible = false; }, + clearForm() { + let vm = this; + vm.$set(vm.selectData.area, "value", ""); + vm.$set(vm.selectData.city, "value", ""); + vm.$set(vm.selectData.province, "value", ""); + vm.$set(vm.selectData.area, "code", ""); + vm.$set(vm.selectData.city, "code", ""); + vm.$set(vm.selectData.province, "code", ""); + vm.$set(vm, "detailAddress", ""); + vm.$set(vm, "defaultAddress", ""); + vm.$set(vm, "addressUser", ""); + vm.$set(vm, "addressPhone", ""); + }, }, }; From c097a9251cc13e6e796400db24a27b61d78a74af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=BE=81?= Date: Tue, 17 May 2022 17:47:32 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=E4=BF=AE=E6=94=B9im?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/BsAddress.vue | 3 ++- plugins/im.js | 16 +++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/components/BsAddress.vue b/components/BsAddress.vue index 82d8c27..a6cb15e 100644 --- a/components/BsAddress.vue +++ b/components/BsAddress.vue @@ -78,12 +78,13 @@
收货人 - + 手机号码
diff --git a/plugins/im.js b/plugins/im.js index 0798b55..8cfdc2d 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&&!Vue.prototype.Socket) { + 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 = () => { @@ -40,17 +40,19 @@ Vue.prototype.$startWebSockets = function () { if (msg.traceType == 1) { let traceId = guid(); let sys = msg.content.sessionVOS.find((item) => item.type != 3); - let str = `{"traceId":"${traceId}",traceType:2,"content":{"sessionId":${sys.id}}}`; - Vue.prototype.Socket.send(str); - this.$store.commit("setUnreadCount", msg.content.totalUnreadCount); + if (sys) { + let str = `{"traceId":"${traceId}",traceType:2,"content":{"sessionId":${sys.id}}}`; + Vue.prototype.Socket.send(str); + this.$store.commit("setUnreadCount", msg.content.totalUnreadCount); + } } // 获取消息列表 if (msg.traceType == 2) { this.$store.commit("setSocketMsgData", msg.content); - setTimeout(()=>{ - console.log(this.$store.state) - },500) + setTimeout(() => { + console.log(this.$store.state); + }, 500); } // 接收消息