feature/im-0602-ch
ch 3 years ago
parent e891706f3d
commit 0bdab1c4bf

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-05-18 14:54:47 * @Date: 2022-05-18 14:54:47
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-02 18:10:40 * @LastEditTime: 2022-06-07 19:28:14
* @Description: file content * @Description: file content
*/ */
import { CreateUUID, FormatDate, ToAsyncAwait } from "@/common/utils"; import { CreateUUID, FormatDate, ToAsyncAwait } from "@/common/utils";
@ -76,6 +76,7 @@ export default class MsbIm {
}); });
this.socket.onOpen(() => { this.socket.onOpen(() => {
this.socket.onMessage(async (res) => { this.socket.onMessage(async (res) => {
console.log(res.data,'apppppppp');
const result = fromatPotoRsp(res.data); const result = fromatPotoRsp(res.data);
// if (result.content?.payload) { // if (result.content?.payload) {

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-05-20 11:00:07 * @Date: 2022-05-20 11:00:07
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-02 17:18:33 * @LastEditTime: 2022-06-09 10:00:15
* @Description: file content * @Description: file content
*/ */
@ -17,24 +17,22 @@ const Im = new MsbIm({
reconnect: true, reconnect: true,
}); });
const ImInit = async () => { const ImInit = async () => {
const { error, result } = await ApiGetCurrentUser(); if (!$store.state.userInfo.id) {
ImInit();
return false;
}
const { error, result } = await ApiGetSoketTicket();
if (error) { if (error) {
return false; return false;
} }
// const { error: er, result: res } = await ApiGetSoketTicket();
// if (er) {
// return false;
// }
const par = FormatJsonSearch({ const par = FormatJsonSearch({
// client: res.client, client: result.client,
// ticket: res.ticket, ticket: result.ticket,
client: 'yan_xuan',
ticket: '6w/8bplSGxqhAbo3vTGaWQ==',
// 1普通用户 2客服链接 // 1普通用户 2客服链接
connect: 1, connect: 1,
user: result.id, user: $store.state.userInfo.id,
nickname: result.nickname, nickname: $store.state.userInfo.nickname,
avatar : result.avatar avatar : $store.state.userInfo.avatar
}) })
await ToAsyncAwait(Im.init({ await ToAsyncAwait(Im.init({
url: `${ENV.imUrl}/ws${par}` url: `${ENV.imUrl}/ws${par}`

Loading…
Cancel
Save