diff --git a/package-lock.json b/package-lock.json index 0063519..b64edc0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -54,6 +54,7 @@ "eslint": "^6.7.2", "eslint-plugin-vue": "^6.2.2", "less-loader": "^7.3.0", + "mockjs": "^1.1.0", "node-sass": "^5.0.0", "vue-template-compiler": "^2.6.11" } @@ -10846,6 +10847,18 @@ "mkdirp": "bin/cmd.js" } }, + "node_modules/mockjs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mockjs/-/mockjs-1.1.0.tgz", + "integrity": "sha512-eQsKcWzIaZzEZ07NuEyO4Nw65g0hdWAyurVol1IPl1gahRwY+svqzfgfey8U8dahLwG44d6/RwEzuK52rSa/JQ==", + "dev": true, + "dependencies": { + "commander": "*" + }, + "bin": { + "random": "bin/random" + } + }, "node_modules/moment": { "version": "2.29.1", "resolved": "https://registry.npm.taobao.org/moment/download/moment-2.29.1.tgz?cache=0&sync_timestamp=1602337231601&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmoment%2Fdownload%2Fmoment-2.29.1.tgz", @@ -26922,6 +26935,15 @@ "minimist": "^1.2.5" } }, + "mockjs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mockjs/-/mockjs-1.1.0.tgz", + "integrity": "sha512-eQsKcWzIaZzEZ07NuEyO4Nw65g0hdWAyurVol1IPl1gahRwY+svqzfgfey8U8dahLwG44d6/RwEzuK52rSa/JQ==", + "dev": true, + "requires": { + "commander": "*" + } + }, "moment": { "version": "2.29.1", "resolved": "https://registry.npm.taobao.org/moment/download/moment-2.29.1.tgz?cache=0&sync_timestamp=1602337231601&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmoment%2Fdownload%2Fmoment-2.29.1.tgz", diff --git a/public/index.html b/public/index.html index 36c495d..cc97211 100644 --- a/public/index.html +++ b/public/index.html @@ -9,7 +9,7 @@ <%= htmlWebpackPlugin.options.title %> - + diff --git a/src/views/superFusionPlatform/main.js b/src/views/superFusionPlatform/main.js index 7c133e9..fd64f76 100644 --- a/src/views/superFusionPlatform/main.js +++ b/src/views/superFusionPlatform/main.js @@ -62,6 +62,49 @@ function getTotalUnreadCount() { } +mineReadfile().then(value => { + + RongIMClient = RongIMLib.init({ + appkey: value.key, + }); + RongIMClient.connect({ token: value.token }) + .then((user) => { + console.log("连接成功, 用户 id 为:", user.id); + localStorage.setItem("user_info", JSON.stringify({ id: user.id })); + // 获取消息数量 + getTotalUnreadCount() + + // 添加事件监听 + RongIMClient.watch({ + // 监听消息通知 + message(event) { + // 新接收到的消息内容 + const message = event.message; + console.log("event", event); + + getTotalUnreadCount() + if (event.message.type === 1) { + vueCom.$bus.emit("handelSendMessage", 1, event.message); + } + }, + // 监听 IM 连接状态变化 + status(event) { + // 链接监听失败回调 + console.log('connection status:', event.status); + } + }); + // 发送全局融云以便其他地方调取融云方法 + Vue.prototype.RongIMClient = RongIMClient + + }) + .catch((error) => { + + console.log("连接失败: ", error.code, error.msg); + }); + +}, reason => { + console.log(reason, 222) +}) @@ -116,49 +159,6 @@ function testPersonInfo(to, from, next) { } else { - mineReadfile().then(value => { - - RongIMClient = RongIMLib.init({ - appkey: value.key, - }); - RongIMClient.connect({ token: value.token }) - .then((user) => { - console.log("连接成功, 用户 id 为:", user.id); - localStorage.setItem("user_info", JSON.stringify({ id: user.id })); - // 获取消息数量 - getTotalUnreadCount() - - // 添加事件监听 - RongIMClient.watch({ - // 监听消息通知 - message(event) { - // 新接收到的消息内容 - const message = event.message; - console.log("event", event); - - getTotalUnreadCount() - if (event.message.type === 1) { - vueCom.$bus.emit("handelSendMessage", 1, event.message); - } - }, - // 监听 IM 连接状态变化 - status(event) { - // 链接监听失败回调 - console.log('connection status:', event.status); - } - }); - // 发送全局融云以便其他地方调取融云方法 - Vue.prototype.RongIMClient = RongIMClient - - }) - .catch((error) => { - - console.log("连接失败: ", error.code, error.msg); - }); - - }, reason => { - console.log(reason, 222) - }) gotoPage(to, from, next); diff --git a/src/views/superFusionPlatform/messageProcessing/message/Conversation/ConversationItem.vue b/src/views/superFusionPlatform/messageProcessing/message/Conversation/ConversationItem.vue index dc72ed6..fe8c5ab 100644 --- a/src/views/superFusionPlatform/messageProcessing/message/Conversation/ConversationItem.vue +++ b/src/views/superFusionPlatform/messageProcessing/message/Conversation/ConversationItem.vue @@ -104,6 +104,17 @@ export default { targetId: this.value.targetId, type: this.value.type, }); + // 存入本地存储 + const conversation_info = { + person_name: this.name, + avatar: this.avatar, + targetId: this.value.targetId, + type: this.value.type, + }; + localStorage.setItem( + "conversation_info", + JSON.stringify(conversation_info) + ); } //是否扩展信息里面有名称、头像数据 diff --git a/vue.config.js b/vue.config.js index b22e839..56b9160 100644 --- a/vue.config.js +++ b/vue.config.js @@ -21,10 +21,10 @@ function getEntry() { let filepath = items[i] let fileList = filepath.split('/'); let fileName = fileList[fileList.length - 2]; - // TODO 只打包正在编码的项目 - if (fileName != "physicalHealth") { - continue; - } + // // TODO 只打包正在编码的项目 + // if (fileName != "physicalHealth") { + // continue; + // } entries[fileName] = { entry: `src/views/${fileName}/main.js`, // 在 dist/index.html 的输出