diff --git a/env.config.js b/env.config.js index 22057c1..c29c073 100644 --- a/env.config.js +++ b/env.config.js @@ -2,7 +2,7 @@ * @Author: ch * @Date: 2022-05-05 14:40:00 * @LastEditors: ch - * @LastEditTime: 2022-05-07 10:51:53 + * @LastEditTime: 2022-05-27 10:47:18 * @Description: 根据git分支生成对应环境的环境变量 * 开发时如果环境变量换了,可以不用重启服务,直接运行node env.config.js即可 */ @@ -12,16 +12,20 @@ const getRepoInfo = require('git-repo-info'); const envConfig = { dev : { - base_url: 'https://k8s-horse-gateway.mashibing.cn' + base_url: 'https://k8s-horse-gateway.mashibing.cn', + imUrl : 'wss://k8s-horse-gateway.mashibing.cn' }, test : { - base_url: 'https://k8s-horse-gateway.mashibing.cn' + base_url: 'https://k8s-horse-gateway.mashibing.cn', + imUrl : 'wss://k8s-horse-gateway.mashibing.cn' }, beta : { - base_url: 'https://you-gateway.mashibing.com' + base_url: 'https://you-gateway.mashibing.com', + imUrl : 'wss://you-gateway.mashibing.cn' }, prod : { - base_url: 'https://you-gateway.mashibing.com' + base_url: 'https://you-gateway.mashibing.com', + imUrl : 'wss://you-gateway.mashibing.cn' } } const branch = getRepoInfo().branch; // 调用获取git信息 diff --git a/pages/account/index/message.vue b/pages/account/index/message.vue index 32b6501..5eb144f 100644 --- a/pages/account/index/message.vue +++ b/pages/account/index/message.vue @@ -2,7 +2,7 @@ * @Author: ch * @Date: 2022-05-04 17:48:12 * @LastEditors: ch - * @LastEditTime: 2022-05-27 10:30:25 + * @LastEditTime: 2022-05-27 10:56:40 * @Description: file content --> @@ -13,7 +13,7 @@
{ + this.readMsg() + },2000) }, methods: { + + /** + * 把当前会话消息置为已读 + */ + async readMsg(){ + this.Socket.setRead({ + content: { + sessionId : this.msgData[0].sessionId + } + }); + }, /** * 点击详情跳转 diff --git a/plugins/im.js b/plugins/im.js index 8cfdc2d..bc4a387 100644 --- a/plugins/im.js +++ b/plugins/im.js @@ -1,5 +1,13 @@ +/* + * @Author: ch + * @Date: 2022-05-20 09:59:06 + * @LastEditors: ch + * @LastEditTime: 2022-05-27 10:51:44 + * @Description: file content + */ import Vue from "vue"; import { TOKEN_KEY } from "@/constants"; +import ENV from '@/plugins/config/env'; function guid() { return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) { @@ -10,10 +18,9 @@ function guid() { } Vue.prototype.$startWebSockets = function () { - console.log(); let token = this.$cookies.get(TOKEN_KEY); if (token && !Vue.prototype.Socket) { - let url = `wss://k8s-horse-gateway.mashibing.cn/ws?client=${token}&type=1`; + let url = `${ENV.imUrl}/ws?client=${token}&type=1`; Vue.prototype.Socket = new WebSocket(url); Vue.prototype.Socket.onopen = () => { let traceId = guid();