Commit 9ec8efa5 authored by 罗超's avatar 罗超

Merge branch 'master' of http://gitlab.oytour.com/viitto/madara

# Conflicts:
#	src/renderer/components/msssage/index.vue
parents 93156bb9 0bc25050
This diff is collapsed.
......@@ -129,6 +129,7 @@ export default {
if(!localStorage.currentAts){
localStorage.currentAts='{}'
}
localStorage.selfNam=userData.emName
if (this.usermodel.remeber) {
this.usermodel.userpic = userData.Icon;
this.usermodel.username = userData.emName;
......
......@@ -406,28 +406,26 @@ export default {
let accids=[]
ats.forEach(x=>{
if(x=='@全体成员(all)'){
accids.push({
account:'-1',
alias:'@全体成员(all)'
})
accids.push('-1')
} else {
this.members.forEach(y=>{
if(x==`@${y.alias}`){
accids.push({
account:y.account,
alias:'@'+y.alias
})
accids.push(`${y.account}`)
}
})
}
})
let apns={
accounts:accids,
content:`${localStorage.selfNam}在群里@了你`,
forcePush:true
}
this.$store.dispatch("sendMsg", {
type: "at",
scene: this.scene,
to: this.to,
text: this.msgToSent,
content: accids,
callbackTeam:this.callBackTeam
apns
});
}else{
console.log('in start...........',new Date())
......
......@@ -512,14 +512,15 @@ export default {
// 文本消息
item.showText = util.escape(item.text);
let ats = item.showText.replace(/ /ig, " ").match(/@[^\s@$]+/g)
if(ats && item.scene=='team' && item.custom){
let atUser=JSON.parse(item.custom)
if(ats && item.scene=='team' && item.apns && item.apns.accounts && item.apns.accounts.length>0){
//let atUser=item.apns
console.log(item)
ats.forEach(at=>{
let isExsit=atUser.find(x=>{
return x.alias==at
})
if(isExsit)
item.showText=item.showText.replace(at,`<p class='at-user'>${at}</p>`)
// let isExsit=atUser.find(x=>{
// return x.alias==at
// })
// if(isExsit)
item.showText=item.showText.replace(at,`<p class='at-user'>${at}</p>`)
})
}
if (/\[[^\]]+\]/.test(item.showText)) {
......
......@@ -78,58 +78,13 @@
</div>
</li>
</template>
<template v-for="(session, index) in sessionlist">
<li
:class="{'active':currentSession.id==session.id}"
style="background:rgb(238,238,238)"
v-if="session.top && (sessionKey=='' || session.name.indexOf(sessionKey)!=-1)"
:key="index"
@contextmenu.prevent='showMenu(session,$event)'
@click="enterChat(session)"
>
<el-badge
:value="session.unread"
:max="99"
class="item"
:hidden="session.unread==0"
:is-dot="session.isMute && session.unread>0"
>
<div
class="headinfo"
:class="{'notice':!session.avatar,'blue':session.groupType==0,'green':session.groupType==1,'user':session.groupType==-1}"
>
<img :src="session.avatar" v-if="session.avatar">
<i class="iconfont icontaolun" v-else-if="session.groupType == 0"></i>
<i class="iconfont iconqunzu" v-else-if="session.groupType == 1"></i>
<i class="iconfont iconyonghutouxiang" v-else></i>
</div>
</el-badge>
<div class="baseinfo">
<div class="userbase">
<div class="name">{{session.name}}</div>
<div class="time">{{session.updateTimeShow}}</div>
</div>
<div class="msgbase">
<div class="last">
<span class="at-me" v-if="session.atId">[有人@我]</span>
<template v-if="session.isMute && session.unread>0 && !session.historiMsg">
<span>[{{session.unread}}]</span>
</template>
<span v-if="!session.historiMsg">{{session.lastMsgShow}}</span>
<span v-if="session.historiMsg && currentSession.id !== session.id" style="color: red">[草稿]</span>{{session.historiMsg}}
</div>
<div class="no-tip" v-if="session.isMute">
<i class="iconfont iconmiandarao-kai"></i>
</div>
</div>
</div>
</li>
</template>
<template v-for="(session, index) in sessionlist">
<!-- && session.lastMsgShow!== '[未知消息类型]' -->
<li
:class="{'active':currentSession.id==session.id}"
v-if="!session.top && (sessionKey=='' || session.name.indexOf(sessionKey)!=-1) && session.name!== ''"
v-if="(sessionKey=='' || session.name.indexOf(sessionKey)!=-1) && session.name!== ''"
:style="{background: session.top ? 'rgb(238,238,238)' : ''}"
:key="index"
@contextmenu.prevent='showMenu(session,$event)'
@click="enterChat(session)"
......@@ -158,7 +113,7 @@
</div>
<div class="msgbase">
<div class="last">
<span class="at-me" v-if="session.atId">[有人@我]</span>
<span class="at-me" v-if="session.atId && session.unread>0">[有人@我]</span>
<template v-if="session.isMute && session.unread>0 && !session.historiMsg">
<span>[{{session.unread}}]</span>
</template>
......@@ -235,7 +190,8 @@ export default {
atIds:null,
forwardMsgInfo:{},
sessionlistArr: [],
initSessionList:[]
initSessionList:[],
localAts:{}
};
},
updated() {
......@@ -383,33 +339,38 @@ export default {
}
},
clearAtMe(){
let teamInfo = null;
if (this.currentSession.scene === "team") {
teamInfo = this.$store.state.teamlist.find(team => {
return team.teamId === this.currentSession.to;
this.$store.state.teamlist.forEach(team => {
if(team.teamId === this.currentSession.to){
delete team.atId
}
});
this.localAts=JSON.parse(localStorage.currentAts)
if(this.localAts[this.currentSession.to])
delete this.localAts[this.currentSession.to]
localStorage.currentAts=JSON.stringify(this.localAts)
}
if(teamInfo && teamInfo.custom){
let custom=JSON.parse(teamInfo.custom)
if(custom.ats){
custom.ats=custom.ats.filter(x=>{
if(x.account==this.$store.state.userUID)
return
return x
})
// if(teamInfo && teamInfo.custom){
// let custom=JSON.parse(teamInfo.custom)
// if(custom.ats){
// custom.ats=custom.ats.filter(x=>{
// if(x.account==this.$store.state.userUID)
// return
// return x
// })
this.$store.dispatch("delegateTeamFunction", {
functionName: 'updateTeam',
options: {
teamId: teamInfo.teamId,
custom: JSON.stringify(custom),
done: (error, team) => {
// console.log('serverCustom Error:',error)
}
}
})
}
}
// this.$store.dispatch("delegateTeamFunction", {
// functionName: 'updateTeam',
// options: {
// teamId: teamInfo.teamId,
// custom: JSON.stringify(custom),
// done: (error, team) => {
// // console.log('serverCustom Error:',error)
// }
// }
// })
// }
// }
},
openNotice(){
this.$store.dispatch("resetCurrSession")
......@@ -496,6 +457,7 @@ export default {
},
mounted() {
this.audio_base=this.$electron.remote.getGlobal("AUDIO_PATH")+'audio/'
this.localAts=JSON.parse(localStorage.currentAts)
if (window.localStorage.top) {
this.TOPSESSION = JSON.parse(window.localStorage.top);
}
......@@ -543,17 +505,18 @@ export default {
this.MsgBus.$on("create-session", function(obj) {
that.createSession(obj)
});
this.MsgBus.$on('reload-ats',function(){
this.localAts=JSON.parse(localStorage.currentAts)
})
//
setTimeout(() => {
this.initSessionList=this.sessionlist.filter(x=>{
console.log(x.lastMsg)
if(x.scene=='team' && x.unread>0 && x.unread<100){
if(x.scene=='team' && x.unread>0 && x.unread<100 && !this.localAts[x.to]){
return x
}else{
return false
}
})
console.log(this.initSessionList)
if(this.initSessionList.length>0){
this.getAts()
}
......@@ -622,23 +585,35 @@ export default {
? this.myGroupIcon
: this.myAdvancedIcon);
item.isMute = teamInfo.usermute ? teamInfo.usermute : false;
try {
if(teamInfo.custom){
let custom=JSON.parse(teamInfo.custom)
if(custom.ats){
let atme =custom.ats.find(x=>{
return x.account==this.$store.state.userUID
})
if(atme && this.currentSession.id!=item.id){
item.atId=atme.id
}else if(atme && this.currentSession.id==item.id){
setTimeout(() => {
this.clearAtMe()
}, 1000);
}
// try {
// if(teamInfo.custom){
// let custom=JSON.parse(teamInfo.custom)
// if(custom.ats){
// let atme =custom.ats.find(x=>{
// return x.account==this.$store.state.userUID
// })
// if(atme && this.currentSession.id!=item.id){
// item.atId=atme.id
// }else if(atme && this.currentSession.id==item.id){
// setTimeout(() => {
// this.clearAtMe()
// }, 1000);
// }
// }
// }
// } catch (error) {}
if(item.lastMsg.apns && item.lastMsg.apns.accounts && (item.lastMsg.apns.accounts.indexOf(localStorage.imAccount) != -1 || item.lastMsg.apns.accounts[0] == -1)){
item.atId=item.lastMsg.idServer
}else{
if(teamInfo.atId){
item.atId=teamInfo.atId
}else{
item.atId=null
if(this.localAts[item.to]){
item.atId=this.localAts[item.to]
}
}
} catch (error) {}
}
} else {
return;
item.groupType = "normal";
......@@ -751,6 +726,7 @@ export default {
this.newMsgList = unreadList;
sessionlist.sort((a, b) => b.top - a.top)
return sessionlist;
}
// netState(){
......
......@@ -233,7 +233,6 @@ export function sendMsg({ state, commit }, obj) {
done: onSendMsgDone,
needMsgReceipt: obj.needMsgReceipt || false
})
console.log('start sdk.........')
util.getDate()
break
case 'at':
......@@ -241,13 +240,11 @@ export function sendMsg({ state, commit }, obj) {
scene: obj.scene,
to: obj.to,
text: obj.text,
done: function(err, msg) {
obj.callbackTeam(obj.content, msg.idServer)
onMsg(msg)
},
needMsgReceipt: obj.needMsgReceipt || false,
custom: JSON.stringify(obj.content)
apns: obj.apns,
done: onSendMsgDone,
needMsgReceipt: obj.needMsgReceipt || false
})
util.getDate()
break
case 'custom':
nim.sendCustomMsg({
......@@ -482,7 +479,7 @@ export function getHistoryMsgs({ state, commit }, obj) {
msgs: msgs,
to: to
})
} else {
} else {
commit('updateCurrSessionMsgs', {
type: 'concat',
msgs: msgs
......
This diff is collapsed.
......@@ -260,12 +260,25 @@ export default {
// 装入未读消息
unreadListHis(state, obj) {
let currentAts = JSON.parse(localStorage.currentAts)
let tempteamlist = store.state.teamlist
let teamObj = []
obj.msgs.forEach(x => {
if (x.apns && x.apns.accounts && x.apns.accounts.indexOf(localStorage.imAccount) != -1) {
if (x.apns && x.apns.accounts && (x.apns.accounts.indexOf(localStorage.imAccount) != -1 || x.apns.accounts[0] == -1)) {
console.log(x.apns)
currentAts[obj.to] = x.idServer
localStorage.setItem("currentAts", JSON.stringify(currentAts) || {});
tempteamlist.forEach(t => {
if (t.teamId == obj.to) {
t.atId = x.idServer
}
teamObj.push(t)
})
}
})
localStorage.currentAts = JSON.stringify(currentAts) || {}
if (teamObj.length > 0) {
store.commit('updateTeamList', teamObj)
}
},
// clearMsgs(state, obj) {
// state.msgs = []
......
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