聊天
This commit is contained in:
@@ -9,9 +9,10 @@ const store = new Vuex.Store({
|
||||
|
||||
|
||||
import * as sdk from "@/common/imSdk/lim-sdk.js";
|
||||
|
||||
import lim from "@/common/imSdk/sdk-bridge.js";
|
||||
|
||||
const _im=lim.lim.im
|
||||
|
||||
// #ifdef VUE3
|
||||
import { createStore } from 'vuex'
|
||||
const store = createStore({
|
||||
@@ -52,6 +53,21 @@ import { createStore } from 'vuex'
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
onP2PMessage(context,data){
|
||||
console.log("========================store 收到信息")
|
||||
console.log("========================store 收到信息")
|
||||
console.log("========================store 收到信息")
|
||||
console.error(data)
|
||||
publicFc.getPush(data)
|
||||
|
||||
},
|
||||
sendMsg(context,data){
|
||||
console.log("========================")
|
||||
console.log("========================")
|
||||
console.log("========================")
|
||||
console.error(data)
|
||||
_im.sendP2PMessage(_im.createP2PTextMessage(data.userId,data.data.content))
|
||||
},
|
||||
updateChatDataState(context,data){
|
||||
context.state.chatDataState++
|
||||
context.state.chatDataUserId=data
|
||||
@@ -118,15 +134,19 @@ import { createStore } from 'vuex'
|
||||
context.commit('update_ChatList',data)
|
||||
},
|
||||
updateChatListInfoById(context,data) {//修改聊天记录
|
||||
console.log("修改聊天记录 2")
|
||||
var getKey=data.userId
|
||||
var retdata=publicFc.getKeyObjectStorage(context.state.userInfo.userId+'_'+'chatlistData')
|
||||
retdata[getKey]=data.data
|
||||
uni.setStorageSync(context.state.userInfo.userId+'_'+'chatlistData', JSON.stringify(retdata));
|
||||
},
|
||||
createChatObj(context,data){
|
||||
|
||||
console.log("修改聊天记录 3")
|
||||
console.log("context.state.userInfo.userId:",context.state.userInfo.userId)
|
||||
console.log("data.userId:",data.userId)
|
||||
var userId=data.userId
|
||||
var windowType=data.windowType
|
||||
debugger
|
||||
//初始化聊天记录
|
||||
var data2=publicFc.getKeyObjectStorage(context.state.userInfo.userId+'_'+'chatlistData')
|
||||
if(!data2[userId]){
|
||||
@@ -145,7 +165,7 @@ import { createStore } from 'vuex'
|
||||
// console.warn(res)
|
||||
// })
|
||||
|
||||
lim.lim.im.getSingleUserInfo(userId).then((res)=>{
|
||||
_im.getSingleUserInfo(userId).then((res)=>{
|
||||
console.log(res.data)
|
||||
console.log(res.data)
|
||||
console.log(res.data)
|
||||
@@ -155,7 +175,7 @@ import { createStore } from 'vuex'
|
||||
data1[userId]={
|
||||
fromInfo:{
|
||||
nickName: detail.nickName,
|
||||
portrait: detail.portrait,
|
||||
portrait: detail.photo,
|
||||
userId: detail.userId,
|
||||
userType:detail.userType
|
||||
},
|
||||
@@ -169,7 +189,7 @@ import { createStore } from 'vuex'
|
||||
userId: detail.userId,
|
||||
personId: context.state.userInfo.userId,
|
||||
nickName: detail.nickName,
|
||||
portrait: detail.portrait,
|
||||
portrait: detail.photo,
|
||||
content: '',
|
||||
time: publicFc.getNewDate('format',true),
|
||||
num: 0,
|
||||
|
||||
Reference in New Issue
Block a user