Commit 4669e85c authored by 罗超's avatar 罗超

no message

parent 93929c38
...@@ -79,6 +79,8 @@ const addnewuserUrl = process.env.NODE_ENV === 'development' ? `http://localhost ...@@ -79,6 +79,8 @@ const addnewuserUrl = process.env.NODE_ENV === 'development' ? `http://localhost
const appXmlPath = process.execPath.substring(0, process.execPath.lastIndexOf('\\') + 1) + 'app.json' const appXmlPath = process.execPath.substring(0, process.execPath.lastIndexOf('\\') + 1) + 'app.json'
const forwardUrl = process.env.NODE_ENV === 'development' ? `http://localhost:9080/#/forwardMsg` : `file://${__dirname}/index.html#/forwardMsg` const forwardUrl = process.env.NODE_ENV === 'development' ? `http://localhost:9080/#/forwardMsg` : `file://${__dirname}/index.html#/forwardMsg`
if (process.env.NODE_ENV !== 'development') { if (process.env.NODE_ENV !== 'development') {
global.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\') global.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\')
...@@ -290,8 +292,8 @@ app.on('activate', () => { ...@@ -290,8 +292,8 @@ app.on('activate', () => {
createWindow() createWindow()
} }
}) })
ipc.on('reconnect',function(event){ ipc.on('reconnect', function(event) {
nim=null nim = null
initNIM(global.LOGINUSER.ImAccount, global.LOGINUSER.ImToken) initNIM(global.LOGINUSER.ImAccount, global.LOGINUSER.ImToken)
}) })
ipc.on('loginSuccess', function(event, userInfo) { ipc.on('loginSuccess', function(event, userInfo) {
...@@ -697,6 +699,7 @@ ipc.on('send-file', function(event, obj) { ...@@ -697,6 +699,7 @@ ipc.on('send-file', function(event, obj) {
custom: JSON.stringify(customMsg), custom: JSON.stringify(customMsg),
uploadprogress: function(data) { uploadprogress: function(data) {
file.progess = data.percentage file.progess = data.percentage
console.log(file)
event.sender.send('sending-process', file) event.sender.send('sending-process', file)
}, },
uploaderror: function() { uploaderror: function() {
...@@ -936,7 +939,8 @@ let getNoticeWindows = function() { ...@@ -936,7 +939,8 @@ let getNoticeWindows = function() {
width: 300, width: 300,
height: 115, height: 115,
skipTaskbar: true, skipTaskbar: true,
alwaysOnTop: true alwaysOnTop: false,
focusable: false
}) })
noticeWindows.setBounds({ noticeWindows.setBounds({
y: electron.screen.getPrimaryDisplay().workAreaSize.height - 115, y: electron.screen.getPrimaryDisplay().workAreaSize.height - 115,
...@@ -1099,7 +1103,6 @@ let initNIM = function(uid, token) { ...@@ -1099,7 +1103,6 @@ let initNIM = function(uid, token) {
function onDisconnect(error) { function onDisconnect(error) {
// 此时说明 SDK 处于断开状态, 开发者此时应该根据错误码提示相应的错误信息, 并且跳转到登录页面 // 此时说明 SDK 处于断开状态, 开发者此时应该根据错误码提示相应的错误信息, 并且跳转到登录页面
if (error) { if (error) {
switch (error.code) { switch (error.code) {
// 账号或者密码错误, 请跳转到登录页面并提示错误 // 账号或者密码错误, 请跳转到登录页面并提示错误
...@@ -1115,6 +1118,7 @@ let initNIM = function(uid, token) { ...@@ -1115,6 +1118,7 @@ let initNIM = function(uid, token) {
break; break;
} }
} }
console.log('异常了');
} }
function onError(error) { function onError(error) {
......
...@@ -9,6 +9,9 @@ ...@@ -9,6 +9,9 @@
export default { export default {
name: "MageOffice", name: "MageOffice",
mounted() { mounted() {
window.alert = function() {
return false;
}
document.querySelector('#app').addEventListener( document.querySelector('#app').addEventListener(
"dragover", "dragover",
function(e) { function(e) {
......
...@@ -195,7 +195,6 @@ export default { ...@@ -195,7 +195,6 @@ export default {
}, 8*1000); }, 8*1000);
}, },
atMsg(){ atMsg(){
console.log(11111111111111)
this.MsgBus.$emit('send-at-name', this.atInfo.atName) this.MsgBus.$emit('send-at-name', this.atInfo.atName)
}, },
showCard(e){ showCard(e){
......
...@@ -85,6 +85,7 @@ export default { ...@@ -85,6 +85,7 @@ export default {
}); });
this.$electron.ipcRenderer.on("sending-process", (event, file) => { this.$electron.ipcRenderer.on("sending-process", (event, file) => {
console.log(file)
this.GLOBALSENDING.forEach(x => { this.GLOBALSENDING.forEach(x => {
if ((x.msgId = file.msgId)) { if ((x.msgId = file.msgId)) {
x = file; x = file;
......
...@@ -590,7 +590,9 @@ export default { ...@@ -590,7 +590,9 @@ export default {
lastMsg.type === "notification" && lastMsg.type === "notification" &&
lastMsg.attach && lastMsg.attach &&
lastMsg.attach.team && lastMsg.attach.team &&
lastMsg.attach.team.custom lastMsg.attach.team.custom &&
this.$store.state.msgs[item.id] &&
this.$store.state.msgs[item.id].length>0
) { ) {
for (let i = this.$store.state.msgs[item.id].length-1; i >= 0; i--) { for (let i = this.$store.state.msgs[item.id].length-1; i >= 0; i--) {
lastMsg=this.$store.state.msgs[item.id][i] lastMsg=this.$store.state.msgs[item.id][i]
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
import store from '../' import store from '../'
// 如果会话对象不是好友,需要更新好友名片 // 如果会话对象不是好友,需要更新好友名片
function updateSessionAccount (sessions) { function updateSessionAccount(sessions) {
let accountsNeedSearch = [] let accountsNeedSearch = []
sessions.forEach(item => { sessions.forEach(item => {
if (item.scene === 'p2p') { if (item.scene === 'p2p') {
...@@ -23,18 +23,18 @@ function updateSessionAccount (sessions) { ...@@ -23,18 +23,18 @@ function updateSessionAccount (sessions) {
} }
// onSessions只在初始化完成后回调 // onSessions只在初始化完成后回调
export function onSessions (sessions) { export function onSessions(sessions) {
updateSessionAccount(sessions) updateSessionAccount(sessions)
store.commit('updateSessions', sessions) store.commit('updateSessions', sessions)
} }
export function onUpdateSession (session) { export function onUpdateSession(session) {
let sessions = [session] let sessions = [session]
updateSessionAccount(sessions) updateSessionAccount(sessions)
store.commit('updateSessions', sessions) store.commit('updateSessions', sessions)
} }
export function deleteSession ({state, commit}, sessionId) { export function deleteSession({ state, commit }, sessionId) {
const nim = state.nim const nim = state.nim
sessionId = sessionId || '' sessionId = sessionId || ''
let scene = null let scene = null
...@@ -50,7 +50,7 @@ export function deleteSession ({state, commit}, sessionId) { ...@@ -50,7 +50,7 @@ export function deleteSession ({state, commit}, sessionId) {
nim.deleteSession({ nim.deleteSession({
scene, scene,
to: account, to: account,
done: function deleteServerSessionDone (error, obj) { done: function deleteServerSessionDone(error, obj) {
if (error) { if (error) {
//alert(error) //alert(error)
...@@ -58,7 +58,7 @@ export function deleteSession ({state, commit}, sessionId) { ...@@ -58,7 +58,7 @@ export function deleteSession ({state, commit}, sessionId) {
} }
nim.deleteLocalSession({ nim.deleteLocalSession({
id: sessionId, id: sessionId,
done: function deleteLocalSessionDone (error, obj) { done: function deleteLocalSessionDone(error, obj) {
if (error) { if (error) {
//alert(error) //alert(error)
return return
...@@ -71,7 +71,7 @@ export function deleteSession ({state, commit}, sessionId) { ...@@ -71,7 +71,7 @@ export function deleteSession ({state, commit}, sessionId) {
} }
} }
export function setCurrSession ({state, commit, dispatch}, sessionId) { export function setCurrSession({ state, commit, dispatch }, sessionId) {
const nim = state.nim const nim = state.nim
if (sessionId) { if (sessionId) {
commit('updateCurrSessionId', { commit('updateCurrSessionId', {
...@@ -91,7 +91,7 @@ export function setCurrSession ({state, commit, dispatch}, sessionId) { ...@@ -91,7 +91,7 @@ export function setCurrSession ({state, commit, dispatch}, sessionId) {
} }
} }
export function resetCurrSession ({state, commit}) { export function resetCurrSession({ state, commit }) {
const nim = state.nim const nim = state.nim
nim.resetCurrSession() nim.resetCurrSession()
commit('updateCurrSessionMsgs', { commit('updateCurrSessionMsgs', {
......
...@@ -8,16 +8,16 @@ import config from '../../configs' ...@@ -8,16 +8,16 @@ import config from '../../configs'
import Vue from 'Vue' import Vue from 'Vue'
export default { export default {
updateRefreshState (state) { updateRefreshState(state) {
state.isRefresh = false state.isRefresh = false
}, },
updateLoading (state, status) { updateLoading(state, status) {
clearTimeout(state.loadingTimer) clearTimeout(state.loadingTimer)
state.loadingTimer = setTimeout(() => { state.loadingTimer = setTimeout(() => {
state.isLoading = status state.isLoading = status
}, 20) }, 20)
}, },
updateFullscreenImage (state, obj) { updateFullscreenImage(state, obj) {
obj = obj || {} obj = obj || {}
if (obj.src && obj.type === 'show') { if (obj.src && obj.type === 'show') {
state.fullscreenImgSrc = obj.src state.fullscreenImgSrc = obj.src
...@@ -27,16 +27,16 @@ export default { ...@@ -27,16 +27,16 @@ export default {
state.isFullscreenImgShow = false state.isFullscreenImgShow = false
} }
}, },
updateUserUID (state, loginInfo) { updateUserUID(state, loginInfo) {
state.userUID = loginInfo.uid state.userUID = loginInfo.uid
state.sdktoken = loginInfo.sdktoken state.sdktoken = loginInfo.sdktoken
cookie.setCookie('uid', loginInfo.uid) cookie.setCookie('uid', loginInfo.uid)
cookie.setCookie('sdktoken', loginInfo.sdktoken) cookie.setCookie('sdktoken', loginInfo.sdktoken)
}, },
updateMyInfo (state, myInfo) { updateMyInfo(state, myInfo) {
state.myInfo = util.mergeObject(state.myInfo, myInfo) state.myInfo = util.mergeObject(state.myInfo, myInfo)
}, },
updateUserInfo (state, users) { updateUserInfo(state, users) {
let userInfos = state.userInfos let userInfos = state.userInfos
users.forEach(user => { users.forEach(user => {
let account = user.account let account = user.account
...@@ -46,13 +46,13 @@ export default { ...@@ -46,13 +46,13 @@ export default {
}) })
state.userInfos = util.mergeObject(state.userInfos, userInfos) state.userInfos = util.mergeObject(state.userInfos, userInfos)
}, },
updateFriends (state, friends, cutFriends = []) { updateFriends(state, friends, cutFriends = []) {
const nim = state.nim const nim = state.nim
state.friendslist = nim.mergeFriends(state.friendslist, friends) state.friendslist = nim.mergeFriends(state.friendslist, friends)
// state.friendslist = nim.cutFriends(state.friendslist, cutFriends) // state.friendslist = nim.cutFriends(state.friendslist, cutFriends)
state.friendslist = nim.cutFriends(state.friendslist, friends.invalid) state.friendslist = nim.cutFriends(state.friendslist, friends.invalid)
}, },
updateRobots (state, robots) { updateRobots(state, robots) {
const nim = state.nim const nim = state.nim
robots = robots.map(item => { robots = robots.map(item => {
if (item.avatar) { if (item.avatar) {
...@@ -77,7 +77,7 @@ export default { ...@@ -77,7 +77,7 @@ export default {
state.robotInfosByNick[robot.nick] = robot state.robotInfosByNick[robot.nick] = robot
}) })
}, },
updateBlacklist (state, blacks) { updateBlacklist(state, blacks) {
const nim = state.nim const nim = state.nim
state.blacklist = nim.cutFriends(state.blacklist, blacks.invalid) state.blacklist = nim.cutFriends(state.blacklist, blacks.invalid)
let addBlacks = blacks.filter(item => { let addBlacks = blacks.filter(item => {
...@@ -91,7 +91,7 @@ export default { ...@@ -91,7 +91,7 @@ export default {
// 解除黑名单 // 解除黑名单
state.blacklist = nim.cutFriends(state.blacklist, remBlacks) state.blacklist = nim.cutFriends(state.blacklist, remBlacks)
}, },
updateSearchlist (state, obj) { updateSearchlist(state, obj) {
const type = obj.type const type = obj.type
switch (type) { switch (type) {
case 'user': case 'user':
...@@ -110,7 +110,7 @@ export default { ...@@ -110,7 +110,7 @@ export default {
break break
} }
}, },
updateSessions (state, sessions) { updateSessions(state, sessions) {
const nim = state.nim const nim = state.nim
state.sessionlist = nim.mergeSessions(state.sessionlist, sessions) state.sessionlist = nim.mergeSessions(state.sessionlist, sessions)
state.sessionlist.sort((a, b) => { state.sessionlist.sort((a, b) => {
...@@ -120,28 +120,28 @@ export default { ...@@ -120,28 +120,28 @@ export default {
state.sessionMap[item.id] = item state.sessionMap[item.id] = item
}) })
}, },
deleteSessions (state, sessionIds) { deleteSessions(state, sessionIds) {
const nim = state.nim const nim = state.nim
state.sessionlist = nim.cutSessionsByIds(state.sessionlist, sessionIds) state.sessionlist = nim.cutSessionsByIds(state.sessionlist, sessionIds)
}, },
addToMutelist(state,obj){ addToMutelist(state, obj) {
const nim = state.nim const nim = state.nim
state.mutelist = nim.mergeRelations(state.mutelist, obj.record); state.mutelist = nim.mergeRelations(state.mutelist, obj.record);
}, },
removeFromMutelist(state,obj){ removeFromMutelist(state, obj) {
const nim = state.nim const nim = state.nim
state.mutelist = nim.cutRelations(state.mutelist, obj.record); state.mutelist = nim.cutRelations(state.mutelist, obj.record);
}, },
updateMutelist (state, mutelist) { updateMutelist(state, mutelist) {
const nim = state.nim const nim = state.nim
state.mutelist=nim.mergeRelations(state.mutelist,mutelist) state.mutelist = nim.mergeRelations(state.mutelist, mutelist)
state.mutelist = nim.cutRelations(state.mutelist, mutelist.invalid) state.mutelist = nim.cutRelations(state.mutelist, mutelist.invalid)
}, },
updateNetError(state, status) { updateNetError(state, status) {
state.isNetError=status state.isNetError = status
}, },
// 初始化,收到离线漫游消息时调用 // 初始化,收到离线漫游消息时调用
updateMsgs (state, msgs) { updateMsgs(state, msgs) {
const nim = state.nim const nim = state.nim
let tempSessionMap = {} let tempSessionMap = {}
msgs.forEach(msg => { msgs.forEach(msg => {
...@@ -178,7 +178,7 @@ export default { ...@@ -178,7 +178,7 @@ export default {
} }
}, },
// 更新追加消息,追加一条消息 // 更新追加消息,追加一条消息
putMsg (state, msg) { putMsg(state, msg) {
let sessionId = msg.sessionId let sessionId = msg.sessionId
if (!state.msgs[sessionId]) { if (!state.msgs[sessionId]) {
state.msgs[sessionId] = [] state.msgs[sessionId] = []
...@@ -186,8 +186,8 @@ export default { ...@@ -186,8 +186,8 @@ export default {
store.commit('updateMsgByIdClient', msg) store.commit('updateMsgByIdClient', msg)
let tempMsgs = state.msgs[sessionId] let tempMsgs = state.msgs[sessionId]
let lastMsgIndex = tempMsgs.length - 1 let lastMsgIndex = tempMsgs.length - 1
if(msg.isLocal && lastMsgIndex>=0){ if (msg.isLocal && lastMsgIndex >= 0) {
msg.time = tempMsgs[lastMsgIndex].time+1 msg.time = tempMsgs[lastMsgIndex].time + 1
} }
if (tempMsgs.length === 0 || msg.time >= tempMsgs[lastMsgIndex].time) { if (tempMsgs.length === 0 || msg.time >= tempMsgs[lastMsgIndex].time) {
tempMsgs.push(msg) tempMsgs.push(msg)
...@@ -202,7 +202,7 @@ export default { ...@@ -202,7 +202,7 @@ export default {
} }
}, },
// 删除消息列表消息 // 删除消息列表消息
deleteMsg (state, msg) { deleteMsg(state, msg) {
let sessionId = msg.sessionId let sessionId = msg.sessionId
let tempMsgs = state.msgs[sessionId] let tempMsgs = state.msgs[sessionId]
if (!tempMsgs || tempMsgs.length === 0) { if (!tempMsgs || tempMsgs.length === 0) {
...@@ -218,8 +218,8 @@ export default { ...@@ -218,8 +218,8 @@ export default {
} }
}, },
// 替换消息列表消息,如消息撤回 // 替换消息列表消息,如消息撤回
replaceMsg (state, obj) { replaceMsg(state, obj) {
let {sessionId, idClient, msg} = obj let { sessionId, idClient, msg } = obj
let tempMsgs = state.msgs[sessionId] let tempMsgs = state.msgs[sessionId]
if (!tempMsgs || tempMsgs.length === 0) { if (!tempMsgs || tempMsgs.length === 0) {
return return
...@@ -234,7 +234,7 @@ export default { ...@@ -234,7 +234,7 @@ export default {
} }
}, },
// 用idClient 更新消息,目前用于消息撤回 // 用idClient 更新消息,目前用于消息撤回
updateMsgByIdClient (state, msgs) { updateMsgByIdClient(state, msgs) {
if (!Array.isArray(msgs)) { if (!Array.isArray(msgs)) {
msgs = [msgs] msgs = [msgs]
} }
...@@ -247,7 +247,7 @@ export default { ...@@ -247,7 +247,7 @@ export default {
}) })
}, },
// 更新当前会话id,用于唯一判定是否在current session状态 // 更新当前会话id,用于唯一判定是否在current session状态
updateCurrSessionId (state, obj) { updateCurrSessionId(state, obj) {
let type = obj.type || '' let type = obj.type || ''
if (type === 'destroy') { if (type === 'destroy') {
state.currSessionId = null state.currSessionId = null
...@@ -257,9 +257,12 @@ export default { ...@@ -257,9 +257,12 @@ export default {
} }
} }
}, },
// clearMsgs(state, obj) {
// state.msgs = []
// },
// 更新当前会话列表的聊天记录,包括历史消息、单聊消息等,不包括聊天室消息 // 更新当前会话列表的聊天记录,包括历史消息、单聊消息等,不包括聊天室消息
// replace: 替换idClient的消息 // replace: 替换idClient的消息
updateCurrSessionMsgs (state, obj) { updateCurrSessionMsgs(state, obj) {
let type = obj.type || '' let type = obj.type || ''
if (type === 'destroy') { // 清空会话消息 if (type === 'destroy') { // 清空会话消息
state.currSessionMsgs = [] state.currSessionMsgs = []
...@@ -349,7 +352,7 @@ export default { ...@@ -349,7 +352,7 @@ export default {
} }
} }
}, },
updateSysMsgs (state, sysMsgs) { updateSysMsgs(state, sysMsgs) {
const nim = state.nim const nim = state.nim
if (!Array.isArray(sysMsgs)) { if (!Array.isArray(sysMsgs)) {
sysMsgs = [sysMsgs] sysMsgs = [sysMsgs]
...@@ -363,7 +366,7 @@ export default { ...@@ -363,7 +366,7 @@ export default {
Vue.set(state, sysMsgs, state.sysMsgs) Vue.set(state, sysMsgs, state.sysMsgs)
}, },
// 更新消息的状态,如管理员批准或拒绝入群后,会收到新消息,更新入群申请的状态 // 更新消息的状态,如管理员批准或拒绝入群后,会收到新消息,更新入群申请的状态
updateSysMsgState (state, sysMsg) { updateSysMsgState(state, sysMsg) {
let exitMsg = state.sysMsgs.find(msg => { let exitMsg = state.sysMsgs.find(msg => {
return msg.idServer === sysMsg.idServer return msg.idServer === sysMsg.idServer
}) })
...@@ -371,10 +374,10 @@ export default { ...@@ -371,10 +374,10 @@ export default {
exitMsg.state = sysMsg.state exitMsg.state = sysMsg.state
} }
}, },
updateSysMsgUnread (state, obj) { updateSysMsgUnread(state, obj) {
state.sysMsgUnread = Object.assign({}, obj) state.sysMsgUnread = Object.assign({}, obj)
}, },
updateCustomSysMsgs (state, sysMsgs) { updateCustomSysMsgs(state, sysMsgs) {
const nim = state.nim const nim = state.nim
if (!Array.isArray(sysMsgs)) { if (!Array.isArray(sysMsgs)) {
sysMsgs = [sysMsgs] sysMsgs = [sysMsgs]
...@@ -391,8 +394,8 @@ export default { ...@@ -391,8 +394,8 @@ export default {
unread: sysMsgs.length unread: sysMsgs.length
}) })
}, },
updateCustomSysMsgUnread (state, obj) { updateCustomSysMsgUnread(state, obj) {
let {type, unread} = obj let { type, unread } = obj
switch (type) { switch (type) {
case 'reset': case 'reset':
state.customSysMsgUnread = unread || 0 state.customSysMsgUnread = unread || 0
...@@ -402,7 +405,7 @@ export default { ...@@ -402,7 +405,7 @@ export default {
break break
} }
}, },
resetSysMsgs (state, obj) { resetSysMsgs(state, obj) {
let type = obj.type let type = obj.type
switch (type) { switch (type) {
case 0: case 0:
...@@ -416,37 +419,37 @@ export default { ...@@ -416,37 +419,37 @@ export default {
break break
} }
}, },
deleteSysMsgs (state, obj) { deleteSysMsgs(state, obj) {
let type = obj.type let type = obj.type
let idServer = obj.idServer let idServer = obj.idServer
let arr = type===0 ? state.sysMsgs : state.customSysMsgs let arr = type === 0 ? state.sysMsgs : state.customSysMsgs
arr = arr.filter(msg=>{ arr = arr.filter(msg => {
return msg.idServer !== idServer return msg.idServer !== idServer
}) })
Vue.set(state, 'sysMsgs', arr) Vue.set(state, 'sysMsgs', arr)
}, },
setNoMoreHistoryMsgs (state) { setNoMoreHistoryMsgs(state) {
state.noMoreHistoryMsgs = true state.noMoreHistoryMsgs = true
}, },
resetNoMoreHistoryMsgs (state) { resetNoMoreHistoryMsgs(state) {
state.noMoreHistoryMsgs = false state.noMoreHistoryMsgs = false
}, },
// 继续与机器人会话交互 // 继续与机器人会话交互
continueRobotMsg (state, robotAccid) { continueRobotMsg(state, robotAccid) {
state.continueRobotAccid = robotAccid state.continueRobotAccid = robotAccid
}, },
initChatroomInfos (state, obj) { initChatroomInfos(state, obj) {
state.chatroomInfos = obj state.chatroomInfos = obj
}, },
setCurrChatroom (state, chatroomId) { setCurrChatroom(state, chatroomId) {
state.currChatroomId = chatroomId state.currChatroomId = chatroomId
state.currChatroom = state.chatroomInsts[chatroomId] state.currChatroom = state.chatroomInsts[chatroomId]
state.currChatroomMsgs = [] state.currChatroomMsgs = []
state.currChatroomInfo = {} state.currChatroomInfo = {}
state.currChatroomMembers = [] state.currChatroomMembers = []
}, },
resetCurrChatroom (state) { resetCurrChatroom(state) {
state.currChatroomId = null state.currChatroomId = null
state.currChatroom = null state.currChatroom = null
state.currChatroomMsgs = [] state.currChatroomMsgs = []
...@@ -454,11 +457,11 @@ export default { ...@@ -454,11 +457,11 @@ export default {
state.currChatroomMembers = [] state.currChatroomMembers = []
}, },
// 聊天室相关逻辑 // 聊天室相关逻辑
updateChatroomInfo (state, obj) { updateChatroomInfo(state, obj) {
state.currChatroomInfo = Object.assign(state.currChatroomInfo, obj) state.currChatroomInfo = Object.assign(state.currChatroomInfo, obj)
}, },
updateCurrChatroomMsgs (state, obj) { updateCurrChatroomMsgs(state, obj) {
let {type, msgs} = Object.assign({}, obj) let { type, msgs } = Object.assign({}, obj)
if (type === 'put') { if (type === 'put') {
msgs.forEach(msg => { msgs.forEach(msg => {
let chatroomId = msg.chatroomId let chatroomId = msg.chatroomId
...@@ -480,11 +483,11 @@ export default { ...@@ -480,11 +483,11 @@ export default {
} }
} }
}, },
getChatroomInfo (state, obj) { getChatroomInfo(state, obj) {
state.currChatroomInfo = obj state.currChatroomInfo = obj
}, },
updateChatroomMembers (state, obj) { updateChatroomMembers(state, obj) {
let {type, members} = obj let { type, members } = obj
if (type === 'destroy') { if (type === 'destroy') {
state.currChatroomMembers = [] state.currChatroomMembers = []
} else if (type === 'put') { } else if (type === 'put') {
...@@ -495,19 +498,19 @@ export default { ...@@ -495,19 +498,19 @@ export default {
}) })
} }
}, },
updateTeamList (state, teams) { updateTeamList(state, teams) {
const nim = state.nim const nim = state.nim
store.state.teamlist = nim.mergeTeams(store.state.teamlist, teams) store.state.teamlist = nim.mergeTeams(store.state.teamlist, teams)
store.state.teamlist = nim.cutTeams(store.state.teamlist, teams.invalid) store.state.teamlist = nim.cutTeams(store.state.teamlist, teams.invalid)
}, },
updateTeamUserMute (state, map) { updateTeamUserMute(state, map) {
store.state.teamlist.forEach(x=>{ store.state.teamlist.forEach(x => {
if(map[x.teamId]!=undefined && map[x.teamId]!=null){ if (map[x.teamId] != undefined && map[x.teamId] != null) {
x.usermute=map[x.teamId]=='1' x.usermute = map[x.teamId] == '1'
} }
}) })
}, },
updateTeamMembers (state, obj) { updateTeamMembers(state, obj) {
const nim = state.nim const nim = state.nim
var teamId = obj.teamId var teamId = obj.teamId
var members = obj.members var members = obj.members
...@@ -530,8 +533,8 @@ export default { ...@@ -530,8 +533,8 @@ export default {
var teamId = obj.teamId var teamId = obj.teamId
var invalidAccounts = obj.accounts var invalidAccounts = obj.accounts
if (state.teamMembers[teamId] === undefined) return if (state.teamMembers[teamId] === undefined) return
state.teamMembers[teamId] = state.teamMembers[teamId].filter((member, index)=>{ state.teamMembers[teamId] = state.teamMembers[teamId].filter((member, index) => {
return invalidAccounts.indexOf(member.account)===-1 return invalidAccounts.indexOf(member.account) === -1
}) })
state.teamMembers = Object.assign({}, state.teamMembers) state.teamMembers = Object.assign({}, state.teamMembers)
}, },
...@@ -548,7 +551,7 @@ export default { ...@@ -548,7 +551,7 @@ export default {
state.teamSettingConfig = obj state.teamSettingConfig = obj
}, },
updateSentReceipedMap(state, obj) { updateSentReceipedMap(state, obj) {
if (!obj || obj.length<1) { if (!obj || obj.length < 1) {
return return
} }
var teamId = obj[0].teamId var teamId = obj[0].teamId
...@@ -573,7 +576,7 @@ export default { ...@@ -573,7 +576,7 @@ export default {
idServer: msg.idServer idServer: msg.idServer
} }
}) })
if (needQuery.length>0) { if (needQuery.length > 0) {
state.receiptQueryList.push(...needQuery) state.receiptQueryList.push(...needQuery)
} }
if (needQuery.length > 0) { if (needQuery.length > 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment