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

no message

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