修改融云链接错误

init
xialiang 4 years ago
parent 48f524fa9e
commit 8c50fa0e1b

22
package-lock.json generated

@ -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",

@ -9,7 +9,7 @@
<title>
<%= htmlWebpackPlugin.options.title %>
</title>
<!--<script src="https://cdn.ronghub.com/RongIMLib-4.4.7.prod.js"></script>-->
<script src="https://cdn.ronghub.com/RongIMLib-4.4.7.prod.js"></script>
</head>

@ -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);

@ -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)
);
}
//

@ -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 的输出

Loading…
Cancel
Save