diff --git a/components/BsChosen.vue b/components/BsChosen.vue index 097ff1b..308f9c6 100644 --- a/components/BsChosen.vue +++ b/components/BsChosen.vue @@ -39,7 +39,8 @@ export default { categoryId: "", order: "", }); - vm.recommendedData = res.result; + console.log(res.result) + vm.recommendedData = res.result.records; }, }, }; diff --git a/pages/account/index/message.vue b/pages/account/index/message.vue index 5064ecd..58b3a7a 100644 --- a/pages/account/index/message.vue +++ b/pages/account/index/message.vue @@ -43,10 +43,10 @@ export default { return {}; }, computed: { - ...mapState(["token"], ["socketMsgData"]), + ...mapState(["token","socketMsgData"]), }, mounted(){ - console.log(`socketMsgData`,this.socketMsgData) + console.log(`socketMsgData`,this.$store) }, methods: {}, }; diff --git a/plugins/im.js b/plugins/im.js index e88ae1a..b6d0484 100644 --- a/plugins/im.js +++ b/plugins/im.js @@ -18,7 +18,7 @@ Vue.prototype.$startWebSockets = function () { Vue.prototype.Socket.onopen = () => { let traceId = guid(); Vue.prototype.Socket.send( - `{"traceId":${traceId},traceType:1,"content":{"size": 100}}` + `{"traceId":"${traceId}",traceType:1,"content":{"size": 100}}` ); }; Vue.prototype.Socket.onclose = () => { @@ -40,7 +40,7 @@ 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}}}`; + let str = `{"traceId":"${traceId}",traceType:2,"content":{"sessionId":${sys.id}}}`; Vue.prototype.Socket.send(str); this.$store.commit("setUnreadCount", msg.content.totalUnreadCount); } @@ -54,9 +54,13 @@ Vue.prototype.$startWebSockets = function () { if (msg.traceType == 3) { let traceId = guid(); Vue.prototype.Socket.send( - `{"traceId":${traceId},traceType:1,"content":{"size": 100}}` + `{"traceId":"${traceId}",traceType:1,"content":{"size": 100}}` ); } + + setTimeout(()=>{ + console.log(this.$store.state) + },500) }; } }; diff --git a/store/index.js b/store/index.js index f7315b5..a655789 100644 --- a/store/index.js +++ b/store/index.js @@ -54,6 +54,7 @@ const mutations = { }, setSocketMsgData(state, val){ state.socketMsgData = val; + console.log(state.socketMsgData) } }; const actions = {