From d04791081c2ab3e0dcd913c7b73629beffde49e5 Mon Sep 17 00:00:00 2001 From: ch Date: Mon, 13 Jun 2022 10:53:34 +0800 Subject: [PATCH] =?UTF-8?q?fea:=20im=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/BsLogin.vue | 8 +- layouts/module/header/HeaderCart.vue | 4 +- layouts/module/header/HeaderInfoBar.vue | 18 +- nuxt.config.js | 9 +- pages/account/index/message.vue | 34 +- pages/index/index.vue | 3 +- plugins/api/im.js | 20 + plugins/axios.js | 6 +- plugins/axiosTk.js | 4 +- plugins/chat.js | 59 +++ plugins/msbIm.js | 464 ++++++++++++++++++++++++ plugins/potoReq.js | 1 + plugins/protoRsp.js | 1 + plugins/utils/other.js | 10 +- 14 files changed, 607 insertions(+), 34 deletions(-) create mode 100644 plugins/api/im.js create mode 100644 plugins/chat.js create mode 100644 plugins/msbIm.js create mode 100644 plugins/potoReq.js create mode 100644 plugins/protoRsp.js diff --git a/components/BsLogin.vue b/components/BsLogin.vue index 8bc8b16..ec836f0 100644 --- a/components/BsLogin.vue +++ b/components/BsLogin.vue @@ -64,6 +64,7 @@ import { mapState } from "vuex"; import { Message } from "element-ui"; import { ApiGetCode, ApiPostLogin } from "@/plugins/api/account"; import { IsPhone } from "/plugins/utils"; +import {Im, ImInit} from '@/plugins/chat' const COUNT_DOWN_TIME = 60; // 验证码倒计时 export default { @@ -167,7 +168,12 @@ export default { this.dialogVisible = false; this.$store.commit("setToken", result.token); this.$store.dispatch("getUserInfo"); - this.$startWebSockets() + // this.$startWebSockets() + // 初始化IM + ImInit().then(() => { + // 获取到会话列表 + Im.getSessionList(); + }); } } }); diff --git a/layouts/module/header/HeaderCart.vue b/layouts/module/header/HeaderCart.vue index b148608..d8f1004 100644 --- a/layouts/module/header/HeaderCart.vue +++ b/layouts/module/header/HeaderCart.vue @@ -42,7 +42,7 @@
{{ - item.productSku.name + item.productSku ? item.productSku.name : '--' }} {{ item.number }}
@@ -75,7 +75,7 @@
{{ - item.productSku.name + item.productSku ? item.productSku.name : '--' }} {{ item.number }}
diff --git a/layouts/module/header/HeaderInfoBar.vue b/layouts/module/header/HeaderInfoBar.vue index 55805b7..e79862e 100644 --- a/layouts/module/header/HeaderInfoBar.vue +++ b/layouts/module/header/HeaderInfoBar.vue @@ -96,6 +96,7 @@