Commit d50e7b74 authored by 罗超's avatar 罗超

no message

parent 52471885
...@@ -58,6 +58,7 @@ let messageEvent = null ...@@ -58,6 +58,7 @@ let messageEvent = null
let messageProtocol = null let messageProtocol = null
let CAP_IMG='' let CAP_IMG=''
let nim=null let nim=null
let SCREENCOUNT=0
global.defaultdownloaddir=require('os').userInfo().homedir+'\\Downloads\\' global.defaultdownloaddir=require('os').userInfo().homedir+'\\Downloads\\'
global.DEFAULT_SCREENSHOT_PATH=require('os').userInfo().homedir+'\\Pictures\\demo.png' global.DEFAULT_SCREENSHOT_PATH=require('os').userInfo().homedir+'\\Pictures\\demo.png'
...@@ -163,19 +164,14 @@ function createWindow () { ...@@ -163,19 +164,14 @@ function createWindow () {
mainWindow.webContents.session.on('will-download', (event, item, webContents) => { mainWindow.webContents.session.on('will-download', (event, item, webContents) => {
const totalBytes = item.getTotalBytes() const totalBytes = item.getTotalBytes()
let pathAll = folderpath + `\\` + downloadname let pathAll = folderpath + `\\` + downloadname
console.log(pathAll)
item.setSavePath(pathAll) item.setSavePath(pathAll)
item.on('updated', (event, state) => { item.on('updated', (event, state) => {
if (state === 'interrupted') { if (state === 'interrupted') {
console.log('Download is interrupted but can be resumed')
} else if (state === 'progressing') { } else if (state === 'progressing') {
if (item.isPaused()) { if (item.isPaused()) {
console.log('Download is paused')
} else { } else {
console.log(`Received bytes: ${item.getReceivedBytes()}`)
} }
mainWindow.setProgressBar(item.getReceivedBytes() / totalBytes) mainWindow.setProgressBar(item.getReceivedBytes() / totalBytes)
console.log(downloadObj)
downloadObj.sender.send('downloading', (parseFloat(item.getReceivedBytes()) / parseFloat(totalBytes))*100) downloadObj.sender.send('downloading', (parseFloat(item.getReceivedBytes()) / parseFloat(totalBytes))*100)
} }
}) })
...@@ -183,8 +179,6 @@ function createWindow () { ...@@ -183,8 +179,6 @@ function createWindow () {
if (!mainWindow.isDestroyed()) { if (!mainWindow.isDestroyed()) {
mainWindow.setProgressBar(-1) mainWindow.setProgressBar(-1)
mainWindow.flashFrame(true) mainWindow.flashFrame(true)
// console.log(BrowserWindow.getFocusedWindow())
} }
if (state === 'completed') { if (state === 'completed') {
try { try {
...@@ -193,7 +187,7 @@ function createWindow () { ...@@ -193,7 +187,7 @@ function createWindow () {
} }
} else { } else {
console.log(`Download failed: ${state}`)
} }
}) })
}) })
...@@ -331,7 +325,6 @@ ipc.on('loginSuccess', function (event, userInfo) { ...@@ -331,7 +325,6 @@ ipc.on('loginSuccess', function (event, userInfo) {
const contextMenu = Menu.buildFromTemplate([{ const contextMenu = Menu.buildFromTemplate([{
label: '打开主界面', label: '打开主界面',
click: function () { click: function () {
console.log(loginWindow.isDestroyed())
if (isLogin) { if (isLogin) {
if (!mainWindow.isDestroyed()) { if (!mainWindow.isDestroyed()) {
mainWindow.show() mainWindow.show()
...@@ -394,7 +387,7 @@ ipc.on('loginSuccess', function (event, userInfo) { ...@@ -394,7 +387,7 @@ ipc.on('loginSuccess', function (event, userInfo) {
const RUN_LOCATION = '\\Software\\Microsoft\\Windows\\CurrentVersion\\Run' const RUN_LOCATION = '\\Software\\Microsoft\\Windows\\CurrentVersion\\Run'
let key = new WinReg({hive: WinReg.HKCU, key: RUN_LOCATION}) let key = new WinReg({hive: WinReg.HKCU, key: RUN_LOCATION})
key.set('WYOFFICE', WinReg.REG_SZ, process.execPath, (err) => { key.set('WYOFFICE', WinReg.REG_SZ, process.execPath, (err) => {
console.log('设置自动启动' + err) //console.log('设置自动启动' + err)
}) })
app.setAsDefaultProtocolClient('Woyou') app.setAsDefaultProtocolClient('Woyou')
...@@ -511,7 +504,6 @@ ipc.on('download', (evt, pdownloadpath, pfolderpath, dfileName, pmsgId) => { ...@@ -511,7 +504,6 @@ ipc.on('download', (evt, pdownloadpath, pfolderpath, dfileName, pmsgId) => {
msgId = pmsgId msgId = pmsgId
// evt.sender.send('tips',downloadpath); // evt.sender.send('tips',downloadpath);
mainWindow.webContents.downloadURL(downloadpath) mainWindow.webContents.downloadURL(downloadpath)
console.log(downloadpath)
} catch (error) { } catch (error) {
} }
...@@ -624,6 +616,7 @@ ipc.on('openPreviwerVideo', function (event,url) { ...@@ -624,6 +616,7 @@ ipc.on('openPreviwerVideo', function (event,url) {
}) })
ipc.on('addClipboard', function (event,content) { ipc.on('addClipboard', function (event,content) {
let img = nativeImage.createFromDataURL(content) let img = nativeImage.createFromDataURL(content)
mainEvent.sender.send('new-screen-hot',content)
clipboard.writeImage(img) clipboard.writeImage(img)
}) })
ipc.on('screens-session', function (event) { ipc.on('screens-session', function (event) {
...@@ -660,12 +653,11 @@ ipc.on('send-file', function (event,obj) { ...@@ -660,12 +653,11 @@ ipc.on('send-file', function (event,obj) {
filePath, filePath,
custom: JSON.stringify(customMsg), custom: JSON.stringify(customMsg),
uploadprogress: function(data){ uploadprogress: function(data){
console.log(data)
file.progess=data.percentage file.progess=data.percentage
event.sender.send('sending-process',file) event.sender.send('sending-process',file)
}, },
uploaderror: function () { uploaderror: function () {
console && console.log('上传失败')
}, },
uploaddone: function (error, file) { uploaddone: function (error, file) {
file.progess=100 file.progess=100
...@@ -680,7 +672,6 @@ ipc.on('send-file', function (event,obj) { ...@@ -680,7 +672,6 @@ ipc.on('send-file', function (event,obj) {
ipc.on('read-clip', function (event) { ipc.on('read-clip', function (event) {
const rawFilePath = clipboard.readBuffer('FileNameW').toString('ucs2'); const rawFilePath = clipboard.readBuffer('FileNameW').toString('ucs2');
let filePath = rawFilePath.replace(new RegExp(String.fromCharCode(0), 'g'), ''); let filePath = rawFilePath.replace(new RegExp(String.fromCharCode(0), 'g'), '');
console.log(filePath)
if(filePath && filePath.length>0){ if(filePath && filePath.length>0){
fs.stat(filePath,function(error,stats){ fs.stat(filePath,function(error,stats){
if(!error){ if(!error){
...@@ -898,7 +889,15 @@ let screenHotBegin=function(){ ...@@ -898,7 +889,15 @@ let screenHotBegin=function(){
screenshot({format: 'png',filename:p}).then((img) => { screenshot({format: 'png',filename:p}).then((img) => {
if(scrollerhotWindows && !scrollerhotWindows.isDestroyed()){ if(scrollerhotWindows && !scrollerhotWindows.isDestroyed()){
screenEvent.sender.send('new-hot') screenEvent.sender.send('new-hot')
scrollerhotWindows.show() if(SCREENCOUNT==0){
scrollerhotWindows.reload()
scrollerhotWindows.once('ready-to-show', () => {
scrollerhotWindows.show()
})
}else{
scrollerhotWindows.show()
}
SCREENCOUNT++
}else{ }else{
getScrollerhotWindows() getScrollerhotWindows()
} }
...@@ -933,7 +932,6 @@ let formatDate=function(date,format){ ...@@ -933,7 +932,6 @@ let formatDate=function(date,format){
return format; return format;
}; };
let initNIM=function(uid,token){ let initNIM=function(uid,token){
console.log(uid,token)
nim = SDK.getInstance({ nim = SDK.getInstance({
debug: false, debug: false,
appKey: 'b612b31e837c79c68f141aeb719d2b20', appKey: 'b612b31e837c79c68f141aeb719d2b20',
...@@ -947,18 +945,15 @@ let initNIM=function(uid,token){ ...@@ -947,18 +945,15 @@ let initNIM=function(uid,token){
}) })
function onConnect() { function onConnect() {
console.log('连接成功');
} }
function onWillReconnect(obj) { function onWillReconnect(obj) {
// 此时说明 SDK 已经断开连接, 请开发者在界面上提示用户连接已断开, 而且正在重新建立连接 // 此时说明 SDK 已经断开连接, 请开发者在界面上提示用户连接已断开, 而且正在重新建立连接
console.log('即将重连');
console.log(obj.retryCount);
console.log(obj.duration);
} }
function onDisconnect(error) { function onDisconnect(error) {
// 此时说明 SDK 处于断开状态, 开发者此时应该根据错误码提示相应的错误信息, 并且跳转到登录页面 // 此时说明 SDK 处于断开状态, 开发者此时应该根据错误码提示相应的错误信息, 并且跳转到登录页面
console.log('丢失连接');
console.log(error);
if (error) { if (error) {
switch (error.code) { switch (error.code) {
// 账号或者密码错误, 请跳转到登录页面并提示错误 // 账号或者密码错误, 请跳转到登录页面并提示错误
......
...@@ -3,10 +3,11 @@ import MsgBus from './msgBus' ...@@ -3,10 +3,11 @@ import MsgBus from './msgBus'
export default { export default {
install (Vue, options) { install (Vue, options) {
Vue.prototype.MsgBus = MsgBus; Vue.prototype.MsgBus = MsgBus;
Vue.prototype.GLOBALSENDING = [], Vue.prototype.GLOBALSENDING = [];
Vue.prototype.TOPSESSION = [];
Vue.prototype.isOnline = function() { Vue.prototype.isOnline = function() {
return process.env.NODE_ENV !== 'development'; return process.env.NODE_ENV !== 'development';
}, }
Vue.prototype.domainManager = function() { Vue.prototype.domainManager = function() {
var domainUrl = "http://reborn.oytour.com";//主域名 var domainUrl = "http://reborn.oytour.com";//主域名
if (this.isOnline()) { if (this.isOnline()) {
...@@ -355,7 +356,6 @@ export default { ...@@ -355,7 +356,6 @@ export default {
return "dir-small" return "dir-small"
let css = "" let css = ""
icons.forEach(x => { icons.forEach(x => {
//console.log(x.filesIcon.hasOwnProperty(suffix))
if (x.filesIcon.hasOwnProperty(suffix)) { if (x.filesIcon.hasOwnProperty(suffix)) {
css = x.filesIcon[suffix][size] css = x.filesIcon[suffix][size]
return false return false
......
<style> <style>
@import url("./assets/css/font.css"); @import url("./assets/css/font.css");
@import url("./assets/css/global.css"); @import url("./assets/css/global.css");
@import url("//at.alicdn.com/t/font_1062339_lofkb8xnbrf.css"); @import url("//at.alicdn.com/t/font_1062339_2wir0xyzmh3.css");
</style> </style>
......
...@@ -86,6 +86,9 @@ export default { ...@@ -86,6 +86,9 @@ export default {
this.$electron.ipcRenderer.on('ignore-all-unRead', (event,session) => { this.$electron.ipcRenderer.on('ignore-all-unRead', (event,session) => {
this.MsgBus.$emit("ignore-all-unRead") this.MsgBus.$emit("ignore-all-unRead")
}) })
this.$electron.ipcRenderer.on('new-screen-hot', (event,dataurl) => {
this.MsgBus.$emit("new-screen-hot",dataurl)
})
}, },
methods: { methods: {
changeMenu(i, n) { changeMenu(i, n) {
......
...@@ -2,10 +2,122 @@ ...@@ -2,10 +2,122 @@
<div> <div>
<div class="messagehead"> <div class="messagehead">
<span class="objname">{{sessionName}}</span> <span class="objname">{{sessionName}}</span>
<div class="rightOperabox"> <div class="opera-p2p-box" v-if="p2pShow">
<el-tooltip class="item" effect="dark" content="将TA加入黑名单" placement="bottom">
<i class="iconfont iconheimingdan1" :class="{'active':isBlack}" @click="markInBacklist"></i>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="会话置顶" placement="bottom">
<i class="iconfont iconzhiding" :class="{'active':isTop}" @click="markSessionTop"></i>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="屏蔽消息提醒" placement="bottom">
<i
class="iconfont"
:class="{'iconmiandarao':!ismute,'iconmiandarao-kai active':ismute}"
@click="markInMutelist"
></i>
</el-tooltip>
</div>
<div class="rightOperabox" @click="getMore">
<i class="iconfont icongengduo"></i> <i class="iconfont icongengduo"></i>
</div> </div>
</div> </div>
<div class="opera-team-box" v-if="teamShow">
<div class="search__session__box">
<div class="seach_ctr">
<span class="seach__item__icon">
<i class="iconfont iconsearch"></i>
</span>
<input type="text" class="seach__item__input" v-model="searchMember" placeholder="搜索">
</div>
</div>
<ul class="user-box" :style="{'max-height':(showAllMember?'unset':'395px')}">
<li>
<span class="opera">
<i class="el-icon-plus"></i>
</span>
<div class="nick-name">添加</div>
</li>
<li>
<span class="opera">
<i class="el-icon-minus"></i>
</span>
<div class="nick-name">删除</div>
</li>
<li v-for="(item, index) in membersInDisplay" :key="index">
<img :src="item.avatar" v-if="item.avatar">
<span class="default__head" v-else>
<i class="iconfont iconyonghutouxiang"></i>
</span>
<div class="nick-name">{{item.alias}}</div>
</li>
</ul>
<div class="more-box" v-if='(this.teamInfo.memberNum+1+(this.isOwner?1:0))>20' @click="changeShowAll">
{{showAllMember?'收起群成员':'查看更多群成员'}}
<i :class="{'el-icon-arrow-down':!showAllMember,'el-icon-arrow-up':showAllMember}"></i>
</div>
<div class="split"></div>
<div class="manager-item">
<span class="t">群名</span>
<span class="c">
<span class="txt" v-show="!editorStatus.nameStatus" @click="editorData('nameStatus')">
{{teamInfo.backName}}
<i class="el-icon-edit" v-if="isOwner"></i>
</span>
<input type="text" @blur.prevent='updateName' @keyup.enter="$event.target.blur" class="input" ref='nameStatus' v-model="teamInfo.backName" v-show="editorStatus.nameStatus"/>
</span>
</div>
<!-- <div class="manager-item">
<span class="t">群公告</span>
<span class="c">
<span v-if="editorStatus.announcementStatus">
{{!teamInfo.announcement || teamInfo.announcement==''?'本群暂无公告':teamInfo.announcement}}
</span>
</span>
</div> -->
<div class="manager-item">
<span class="t">群介绍</span>
<span class="d">
<span class="txt" v-show="!editorStatus.introStatus" @click="editorData('introStatus')">
{{!teamInfo.intro || teamInfo.intro==''?'本群暂无介绍':teamInfo.intro}}
<i class="el-icon-edit" v-if="isOwner"></i>
</span>
<el-input
type="textarea"
autosize
placeholder="请输入本群介绍"
@blur.prevent='updateIntro'
@keyup.enter="$event.target.blur"
class="input"
ref='introStatus'
v-show="editorStatus.introStatus"
v-model="teamInfo.intro">
</el-input>
</span>
</div>
<div class="manager-item">
<span class="t">消息免打扰</span>
<span class="c">
<el-switch
v-model="muteTeam"
:width='42'
@change="markTeamInMutelist">
</el-switch>
</span>
</div>
<div class="manager-item">
<span class="t">消息置顶</span>
<span class="c">
<el-switch
v-model="isTop"
:width='42'
@change='markSessionTop'>
</el-switch>
</span>
</div>
<div class="split"></div>
<span class="bottom" @click="dismissTeam" v-if="isOwner">解散并退出群聊</span>
<span class="bottom" @click="leaveTeam" v-if="!isOwner">退出群聊</span>
</div>
<div class="messagecontent" :style="{'bottom':(consoleinfo.currenth+1)+'px'}"> <div class="messagecontent" :style="{'bottom':(consoleinfo.currenth+1)+'px'}">
<div class="invalidHint" v-if="scene==='team' && teamInvalid"> <div class="invalidHint" v-if="scene==='team' && teamInvalid">
<span>{{`您已退出该${teamInfo && teamInfo.type==='normal' ? '讨论组':'群'}`}}</span> <span>{{`您已退出该${teamInfo && teamInfo.type==='normal' ? '讨论组':'群'}`}}</span>
...@@ -16,7 +128,7 @@ ...@@ -16,7 +128,7 @@
:userInfos="userInfos" :userInfos="userInfos"
:myInfo="myInfo" :myInfo="myInfo"
:isRobot="isRobot" :isRobot="isRobot"
:sessionId='id' :sessionId="id"
@msgs-loaded="msgsLoaded" @msgs-loaded="msgsLoaded"
></chat-list> ></chat-list>
</div> </div>
...@@ -33,7 +145,7 @@ ...@@ -33,7 +145,7 @@
> >
<chateditor <chateditor
type="session" type="session"
:sessionId='id' :sessionId="id"
:scene="scene" :scene="scene"
:to="to" :to="to"
:isRobot="isRobot" :isRobot="isRobot"
...@@ -70,7 +182,21 @@ export default { ...@@ -70,7 +182,21 @@ export default {
minh: 130, minh: 130,
maxh: 350, maxh: 350,
currenth: 130 currenth: 130
} },
isTop: false,
p2pShow: false,
isOwner: false,
hasManagePermission: false,
showAllMode:true,
searchMember:'',
teamShow:false,
editorStatus:{
nameStatus:false,
announcementStatus:false,
introStatus:false
},
muteTeam:false,
showAllMember:false
}; };
}, },
updated() { updated() {
...@@ -79,22 +205,39 @@ export default { ...@@ -79,22 +205,39 @@ export default {
destroyed() { destroyed() {
this.$store.dispatch("resetCurrSession"); this.$store.dispatch("resetCurrSession");
}, },
watch: {
id(val) {
this.initTop();
this.p2pShow = false;
this.teamShow=false;
this.editorStatus={
nameStatus:false,
announcementStatus:false,
introStatus:false
}
this.showAllMember=false;
}
},
mounted() { mounted() {
//获取记录的操作区域高度 //获取记录的操作区域高度
if (localStorage.consoleh && localStorage.consoleh != "") { if (localStorage.consoleh && localStorage.consoleh != "") {
this.consoleinfo.currenth = parseInt(localStorage.consoleh); this.consoleinfo.currenth = parseInt(localStorage.consoleh);
} }
this.initTop();
setTimeout(() => { setTimeout(() => {
this.$store.dispatch("hideLoading"); this.$store.dispatch("hideLoading");
}, 1000); }, 1000);
}, },
computed: { computed: {
sessionId() { sessionId() {
let sessionId = this.id; let sessionId = this.id;
this.$store.dispatch("showLoading"); this.$store.dispatch("showLoading");
// 此时设置当前会话 // 此时设置当前会话
let user;
this.$store.dispatch("setCurrSession", sessionId); this.$store.dispatch("setCurrSession", sessionId);
pageUtil.scrollChatListDown(); //pageUtil.scrollChatListDown();
return sessionId; return sessionId;
}, },
sessionName() { sessionName() {
...@@ -112,21 +255,23 @@ export default { ...@@ -112,21 +255,23 @@ export default {
} }
} else if (/^team-/.test(sessionId)) { } else if (/^team-/.test(sessionId)) {
var teamMembers = this.$store.state.teamMembers[this.to]; var teamMembers = this.$store.state.teamMembers[this.to];
if ( if(this.teamInfo){
teamMembers === undefined || if (
teamMembers.length < this.teamInfo.memberNum teamMembers === undefined ||
) { teamMembers.length < this.teamInfo.memberNum
this.$store.dispatch("getTeamMembers", this.to); ) {
} this.$store.dispatch("getTeamMembers", this.to);
if (this.teamInfo) { }
// teamInfo中的人数为初始获取的值,在人员增减后不会及时更新,而teamMembers在人员增减后同步维护的人员信息 if (this.teamInfo) {
var members = // teamInfo中的人数为初始获取的值,在人员增减后不会及时更新,而teamMembers在人员增减后同步维护的人员信息
this.$store.state.teamMembers && var members =
this.$store.state.teamMembers[this.teamInfo.teamId]; this.$store.state.teamMembers &&
var memberCount = members && members.length; this.$store.state.teamMembers[this.teamInfo.teamId];
return this.teamInfo.name + (memberCount ? `(${memberCount})` : ""); var memberCount = members && members.length;
} else { return this.teamInfo.name + (memberCount ? `(${memberCount})` : "");
return "群"; } else {
return "群";
}
} }
} }
}, },
...@@ -164,13 +309,61 @@ export default { ...@@ -164,13 +309,61 @@ export default {
teamInfo() { teamInfo() {
if (this.scene === "team") { if (this.scene === "team") {
var teamId = this.sessionId.replace("team-", ""); var teamId = this.sessionId.replace("team-", "");
this.teamShow=true
return this.$store.state.teamlist.find(team => { return this.$store.state.teamlist.find(team => {
return team.teamId === teamId; return team.teamId === teamId;
}); });
} }
return undefined; return undefined;
}, },
members() {
if (this.scene === "team") {
this.teamInfo.backName=this.teamInfo.name
var members = this.$store.state.teamMembers[this.teamInfo.teamId];
var userInfos = this.userInfos;
var needSearchAccounts = [];
if (members) {
members = members.map(item => {
var member = Object.assign({}, item); //重新创建一个对象,用于存储展示数据,避免对vuex数据源的修改
member.valid = true; //被管理员移除后,标记为false
if (member.account === this.$store.state.userUID) {
member.alias = "我";
member.avatar = this.$store.state.myInfo.avatar;
this.isOwner = member.type === "owner";
this.hasManagePermission = member.type !== "normal";
this.muteTeam=member.muteTeam
} else if (userInfos[member.account] === undefined) {
needSearchAccounts.push(member.account);
member.avatar = member.avatar || this.avatar;
member.alias = member.nickInTeam || member.account;
} else {
member.avatar = userInfos[member.account].avatar;
member.alias =
member.nickInTeam || userInfos[member.account].nick;
}
return member;
});
if (needSearchAccounts.length > 0) {
while (needSearchAccounts.length > 0) {
this.searchUsers(needSearchAccounts.splice(0, 150));
}
}
return members;
}
}
return [];
},
membersInDisplay() {
if (this.showAllMode) {
return this.members;
} else {
return this.members.slice(0, this.hasInvitePermission ? 3 : 4);
}
},
hasInvitePermission() {
return (this.hasManagePermission || (this.teamInfo && this.teamInfo.inviteMode === "all"));
},
muteInTeam() { muteInTeam() {
if (this.scene !== "team") return false; if (this.scene !== "team") return false;
var teamMembers = this.$store.state.teamMembers; var teamMembers = this.$store.state.teamMembers;
...@@ -197,9 +390,191 @@ export default { ...@@ -197,9 +390,191 @@ export default {
return "您已被禁言"; return "您已被禁言";
} }
return "无权限发送消息"; return "无权限发送消息";
},
ismute() {
let have = false;
this.$store.state.mutelist.forEach(x => {
if (x.account == this.to) {
have = true;
return false;
}
});
return have;
}, //blacklist
isBlack() {
let have = false;
this.$store.state.blacklist.forEach(x => {
if (x.account == this.to) {
have = true;
return false;
}
});
return have;
} }
}, },
methods: { methods: {
changeShowAll(){
this.showAllMember=!this.showAllMember
},
editorData(refName){
if(!this.isOwner) return
this.editorStatus[refName]=true
setTimeout(() => {
this.$refs[refName].focus()
}, 500);
},
getMore() {
if (this.id.indexOf("p2p") != -1) {
this.p2pShow = !this.p2pShow;
}
},
updateIntro(){
this.editorStatus.introStatus=false
if (this.teamInfo.intro===undefined || this.teamInfo.intro.length < 1) {
return
}
var action = 'updateTeam'
this.$store.dispatch('delegateTeamFunction',{
functionName: action,
options: {
teamId: this.teamInfo.teamId,
intro: this.teamInfo.intro,
done: (error, team)=>{}
}
})
},
updateName(){
this.editorStatus.nameStatus=false
if ((this.teamInfo.backName===undefined && this.teamInfo.backName.length < 1) || this.teamInfo.backName== this.teamInfo.name) {
this.teamInfo.backName=this.teamInfo.name
return
}
var action = 'updateTeam'
this.$store.dispatch('delegateTeamFunction',{
functionName: action,
options: {
teamId: this.teamInfo.teamId,
name: this.teamInfo.backName,
done: (error, team)=>{}
}
})
},
initTop() {
let TOPSESSION = [];
if (window.localStorage.top) {
TOPSESSION = JSON.parse(window.localStorage.top);
}
let have = false;
TOPSESSION.forEach(x => {
if (x == this.id) {
have = true;
return false;
}
});
this.isTop = have;
},
markInMutelist() {
this.$store.dispatch("markInMutelist", {
scene: this.scene,
to: this.to,
isAdd: !this.ismute,
account: this.to,
name: this.sessionName
});
},
markTeamInMutelist() {
var action = 'updateInfoInTeam'
console.log(this.muteTeam)
this.$store.dispatch('delegateTeamFunction',{
functionName: action,
options: {
teamId: this.teamInfo.teamId,
muteTeam: this.muteTeam,
muteNotiType: this.muteTeam?1:0,
done: (error, team)=>{
}
}
})
},
markInBacklist() {
this.$store.dispatch("updateBlack", {
scene: this.scene,
to: this.to,
isBlack: !this.isBlack,
account: this.to,
name: this.sessionName
});
},
markSessionTop() {
let TOPSESSION = [];
if (window.localStorage.top) {
let isExsit = -1;
TOPSESSION = JSON.parse(window.localStorage.top);
if (TOPSESSION.length > 0) {
TOPSESSION.forEach((x, i) => {
if (x == this.sessionId) {
isExsit = i;
}
});
}
if (isExsit == -1) {
TOPSESSION.push(this.sessionId);
this.isTop=true
} else {
TOPSESSION.splice(isExsit, 1);
this.isTop=false
}
}else{
TOPSESSION.push(this.sessionId);
this.isTop=true
}
window.localStorage.top = JSON.stringify(TOPSESSION);
this.$emit("update-session", TOPSESSION);
},
searchUsers(Accounts) {
this.$store.dispatch('searchUsers',
{
accounts: Accounts,
done: (users) => {
this.updateTeamMember(users)
}
})
},
updateTeamMember(users) {
users.forEach(user =>{
var member = this.members.find(member=>{
return member.account === user.account
})
if(member) {
member.avatar = user.avatar
member.alias = member.nickInTeam || user.nick
}
})
},
dismissTeam(){
this.MsgBus.$emit('dispose-session')
this.$store.dispatch('delegateTeamFunction',{
functionName: 'dismissTeam',
options: {
teamId: this.teamInfo.teamId,
done: (error, team)=>{
}
}
})
},
leaveTeam(){
this.MsgBus.$emit('dispose-session')
this.$store.dispatch('delegateTeamFunction',{
functionName: 'leaveTeam',
options: {
teamId: this.teamInfo.teamId,
done: (error, team)=>{
}
}
})
},
onResizing(x, y, w, h) { onResizing(x, y, w, h) {
localStorage.consoleh = h; localStorage.consoleh = h;
this.consoleinfo.currenth = h; this.consoleinfo.currenth = h;
...@@ -254,6 +629,242 @@ export default { ...@@ -254,6 +629,242 @@ export default {
font-size: 24px; font-size: 24px;
color: #333; color: #333;
} }
.msgbox .messagebox .opera-team-box {
top: 47px;
right: 0;
bottom: 0;
width: 260px;
box-shadow: -1px 0px 6px 0px rgba(0, 0, 0, 0.08);
overflow: hidden;
position: absolute;
background: #fff;
z-index: 10;
border-left: 1px solid #ddd;
padding: 20px;
box-sizing: border-box;
overflow-y: auto;
}
.msgbox .messagebox .opera-team-box .search__session__box {
display: flex;
margin-bottom: 20px;
}
.msgbox .messagebox .opera-team-box .search__session__box .seach_ctr {
flex: 1;
position: relative;
}
.msgbox .messagebox .opera-team-box .search__session__box .seach_ctr .seach__item__input {
width: 100%;
text-indent: 23px;
height: 23px;
line-height: 23px;
border: none;
border: 1px solid rgb(225,225,225);
outline: none;
font-size: 12px;
color: #000;
background: transparent;
box-sizing: border-box;
background: rgb(225,225,225);
border-radius: 2px;
}
.msgbox .messagebox .opera-team-box .search__session__box .seach_ctr .seach__item__input:focus {
background:#FFF;
}
.msgbox .messagebox .opera-team-box .search__session__box .seach_ctr .seach__item__icon {
font-size: 14px;
color: #999;
position: absolute;
top: 2px;
left: 0;
padding-left: 7px;
}
.msgbox .messagebox .opera-team-box .split{
height:1px;
background:rgba(238,238,238,1);
margin:10px 0 20px 0;
}
.msgbox .messagebox .opera-team-box .search__session__box .seach_ctr .seach__item__icon i{
font-size: 12px;
}
.msgbox .messagebox .opera-team-box .user-box {
display: flex;
flex-wrap: wrap;
margin: 0;
padding: 0;
overflow: hidden;
}
.msgbox .messagebox .opera-team-box .user-box li {
width: 25%;
min-width: 25%;
max-width: 25%;
list-style: none;
padding: none;
text-align: center;
margin: 10px 0;
}
.msgbox .messagebox .opera-team-box .user-box li img,
.msgbox .messagebox .opera-team-box .user-box li .default__head {
width: 36px;
height: 36px;
border-radius: 100%;
}
.msgbox .messagebox .opera-team-box .user-box li .default__head{
display: inline-block;
text-align: center;
vertical-align: middle;
font-size: 24px;
background: #bbb;
color: #666;
margin-bottom: 4px;
}
.msgbox .messagebox .opera-team-box .user-box li .opera {
width: 36px;
height: 36px;
border-radius: 100%;
}
.msgbox .messagebox .opera-team-box .user-box li .opera {
display: inline-block;
text-align: center;
vertical-align: middle;
font-size: 20px;
border:1px solid #bbb;
box-sizing: border-box;
color: #666;
margin-bottom: 4px;
}
.msgbox .messagebox .opera-team-box .user-box li .opera i{
font-size: 14px;
color: #bbb;
}
.msgbox .messagebox .opera-team-box .user-box li .opera:hover{
border-color: #999;
}
.msgbox .messagebox .opera-team-box .user-box li .opera:hover i{
color: #999;
}
.msgbox .messagebox .opera-team-box .user-box li .nick-name {
font-size: 12px;
color: #000;
text-align: center;
overflow: hidden;
margin-top: 3px;
font-family: '微软雅黑' !important;
text-overflow: ellipsis;
}
.msgbox .messagebox .opera-team-box .manager-item{
margin-bottom: 20px
}
.msgbox .messagebox .opera-team-box .more-box{
margin-top: 20px;
text-align: center;
font-size: 12px;
font-family: 微软雅黑 !important;
/* background-color: white; */
color: #aaa;
margin-bottom: 20px;
cursor: pointer;
}
.msgbox .messagebox .opera-team-box .more-box i{
font-size: 12px;
color: #aaa;
margin-left: 5px;
}
.msgbox .messagebox .opera-team-box .manager-item .t{
margin-bottom: 10px;
font-size: 12px;
color: #666;
display: block;
}
.msgbox .messagebox .opera-team-box .manager-item .c{
font-size: 16px;
color: #111;
display: block;
font-family: '微软雅黑' !important;
}
.msgbox .messagebox .opera-team-box .manager-item .txt{
cursor: pointer;
font-family: '微软雅黑' !important;
display: inline-block;
max-width: calc(100% - 20px);
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.msgbox .messagebox .opera-team-box .manager-item .el-textarea__inner{
font-size: 12px;
font-family: '微软雅黑' !important;
border: none;
background: transparent;
outline: none;
}
.msgbox .messagebox .opera-team-box .manager-item .txt i{
visibility: hidden;
font-size: 10px;
margin-left: 4px;
color:#666;
}
.msgbox .messagebox .opera-team-box .manager-item .txt:hover i{
visibility:visible;
}
.msgbox .messagebox .opera-team-box .manager-item .input{
font-family: 微软雅黑 !important;
font-size: 16px;
color: #111;
border: none;
margin: 0;
padding: 0px;
outline: none;
border: none;
width: 100%;
}
.msgbox .messagebox .opera-team-box .manager-item .d{
font-size: 12px;
color: #333;
font-family: '微软雅黑' !important;
padding: 4px;
border-radius: 2px;
background: rgb(225,225,225);
display: block;
}
.msgbox .messagebox .opera-team-box .bottom{
display: inline-block;
font-size: 16px;
color: #FF3A3A;
cursor: pointer;
}
.el-switch--wide .el-switch__label.el-switch__label--right span,
.el-switch--wide .el-switch__label.el-switch__label--left span{
display: none !important;
color: transparent;
}
.el-switch.is-checked .el-switch__core{
border-color: #0acd68 !important;
background-color: #0acd68 !important;
}
.el-switch .el-switch__core{
border-color: #ccc !important;
background-color: #ccc !important;
}
.msgbox .messagebox .messagehead .opera-p2p-box {
height: 46px;
line-height: 46px;
text-align: right;
position: absolute;
right: 46px;
top: 0;
}
.msgbox .messagebox .messagehead .opera-p2p-box i {
font-size: 20px;
margin-right: 12px;
color: #aaa;
cursor: pointer;
}
.msgbox .messagebox .messagehead .opera-p2p-box i:hover {
color: #555;
}
.msgbox .messagebox .messagehead .opera-p2p-box i.active {
color: #3a68ff;
}
.msgbox .messagebox .messagehead .rightOperabox { .msgbox .messagebox .messagehead .rightOperabox {
height: 46px; height: 46px;
line-height: 46px; line-height: 46px;
...@@ -268,6 +879,9 @@ export default { ...@@ -268,6 +879,9 @@ export default {
font-size: 4px; font-size: 4px;
color: #aaa; color: #aaa;
} }
.msgbox .messagebox .messagehead .rightOperabox i:hover {
color: #555;
}
.msgbox .messagebox .sendconsole { .msgbox .messagebox .sendconsole {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
......
...@@ -141,7 +141,6 @@ export default { ...@@ -141,7 +141,6 @@ export default {
inputObj: { inputObj: {
handler(val, oldVal) { handler(val, oldVal) {
this.msgToSent = val.txt; this.msgToSent = val.txt;
console.log(val.file);
}, },
deep: true deep: true
} }
...@@ -179,7 +178,6 @@ export default { ...@@ -179,7 +178,6 @@ export default {
}, },
methods: { methods: {
openScreenhot() { openScreenhot() {
console.log("截图");
this.$electron.ipcRenderer.send("open-screenhot"); this.$electron.ipcRenderer.send("open-screenhot");
}, },
dataURLtoBlob(dataurl) { dataURLtoBlob(dataurl) {
...@@ -230,14 +228,6 @@ export default { ...@@ -230,14 +228,6 @@ export default {
(err, md5) => { (err, md5) => {
crt.setLocationPath(md5, crtItem.path); crt.setLocationPath(md5, crtItem.path);
crt.readBlobAsDataURL(crtItem, function(dataurl) { crt.readBlobAsDataURL(crtItem, function(dataurl) {
// crt.$store.dispatch("sendDataUrlMsg", {
// scene: crt.scene,
// to: crt.to,
// dataURL: dataurl,
// name: crtItem.name,
// size: crt.bytesToSize(crtItem.size),
// md5
// });
fileInfo.dataurl = dataurl; fileInfo.dataurl = dataurl;
fileInfo.md5 = md5; fileInfo.md5 = md5;
crt.sendingBang(fileInfo); crt.sendingBang(fileInfo);
...@@ -476,17 +466,22 @@ export default { ...@@ -476,17 +466,22 @@ export default {
x.progess = 0; x.progess = 0;
x.avatar = this.avatar; x.avatar = this.avatar;
this.GLOBALSENDING.push(x) this.GLOBALSENDING.push(x)
x.path=x.dataurl?x.dataurl:x.path
this.MsgBus.$emit("update-sending"); this.MsgBus.$emit("update-sending");
this.$electron.ipcRenderer.send("send-file", { if(!x.dataurl){
scene: this.scene, this.$electron.ipcRenderer.send("send-file", {
to: this.to, scene: this.scene,
filePath: x.path, to: this.to,
name: x.name, filePath: x.path,
size: x.size, name: x.name,
md5: md5, size: x.size,
type, md5: md5,
file:x type,
}); file:x
});
}else{
this.sendFileDataUrl(x)
}
}); });
} }
}, },
...@@ -530,9 +525,8 @@ export default { ...@@ -530,9 +525,8 @@ export default {
this.isEmojiShown = false; this.isEmojiShown = false;
}, },
addEmoji(emojiName) { addEmoji(emojiName) {
console.log("emojiName");
this.msgToSent += emojiName; this.msgToSent += emojiName;
//this.hideEmoji() this.$refs.editor.addContent(emojiName)
}, },
chooseRobot(robot) { chooseRobot(robot) {
if (robot && robot.account) { if (robot && robot.account) {
...@@ -564,7 +558,6 @@ export default { ...@@ -564,7 +558,6 @@ export default {
} else if (/\.(wav|mp3|wma)$/i.test(file.name)) { } else if (/\.(wav|mp3|wma)$/i.test(file.name)) {
type = "file"; type = "file";
} }
let that = this;
let exts = file.name.split("."); let exts = file.name.split(".");
file.ext = exts[exts.length - 1].toLowerCase(); file.ext = exts[exts.length - 1].toLowerCase();
file.type = type; file.type = type;
...@@ -576,6 +569,10 @@ export default { ...@@ -576,6 +569,10 @@ export default {
file.avatar = this.avatar; file.avatar = this.avatar;
this.GLOBALSENDING.push(file); this.GLOBALSENDING.push(file);
this.MsgBus.$emit("update-sending"); this.MsgBus.$emit("update-sending");
this.sendFileDataUrl(file)
},
sendFileDataUrl(file){
let that=this
this.$store.dispatch("sendDataUrlMsgCall", { this.$store.dispatch("sendDataUrlMsgCall", {
scene: this.scene, scene: this.scene,
to: this.to, to: this.to,
...@@ -583,9 +580,8 @@ export default { ...@@ -583,9 +580,8 @@ export default {
name: file.name, name: file.name,
size: file.size, size: file.size,
md5: file.md5, md5: file.md5,
type, type:file.type,
onUploadprogress: function(data) { onUploadprogress: function(data) {
console.log("上传文件中....", data.percentage);
that.GLOBALSENDING.forEach(x => { that.GLOBALSENDING.forEach(x => {
if (x.msgId == file.msgId) { if (x.msgId == file.msgId) {
x.progess = data.percentage; x.progess = data.percentage;
......
...@@ -84,18 +84,21 @@ export default { ...@@ -84,18 +84,21 @@ export default {
this.$emit('add-emoji', emoji.key) this.$emit('add-emoji', emoji.key)
} else if (this.currType === 'pinup') { } else if (this.currType === 'pinup') {
if (this.type === 'session') { if (this.type === 'session') {
let custommsg= {
type: 3,
msgtype:'custom_chartlet',
data: {
catalog: this.currAlbum,
chartlet: emoji.key
}
}
this.$store.dispatch('sendMsg', { this.$store.dispatch('sendMsg', {
type: 'custom', type: 'custom',
scene: this.scene, scene: this.scene,
to: this.to, to: this.to,
pushContent: '[贴图表情]', pushContent: '[贴图表情]',
content: { content: custommsg,
type: 3, custom:JSON.stringify(custommsg)
data: {
catalog: this.currAlbum,
chartlet: emoji.key
}
}
}) })
} else if (this.type === 'chatroom') { } else if (this.type === 'chatroom') {
this.$store.dispatch('sendChatroomMsg', { this.$store.dispatch('sendChatroomMsg', {
...@@ -103,11 +106,13 @@ export default { ...@@ -103,11 +106,13 @@ export default {
pushContent: '[贴图表情]', pushContent: '[贴图表情]',
content: { content: {
type: 3, type: 3,
msgtype:101,
data: { data: {
catalog: this.currAlbum, catalog: this.currAlbum,
chartlet: emoji.key chartlet: emoji.key
} }
} },
custom:JSON.stringify(custommsg)
}) })
} }
this.$emit('hide-emoji') this.$emit('hide-emoji')
......
...@@ -26,9 +26,11 @@ ...@@ -26,9 +26,11 @@
:type="msg.type" :type="msg.type"
:class="{'in':msg.flow==='in','out':msg.flow==='out'}" :class="{'in':msg.flow==='in','out':msg.flow==='out'}"
> >
<!-- v-touch:hold="revocateMsg" --> <!-- v-touch:hold="revocateMsg" -->
<a class="msg-head" v-if="msg.avatar"> <a class="msg-head" v-if="msg.avatar">
<img class="icon u-circle" :src="msg.avatar"> <img class="icon u-circle" :src="msg.avatar">
<div class="userName" v-if="msg.flow=='in' && msg.scene==='team'">{{msg.fromNick}}</div>
</a> </a>
<p class="msg-user" v-else-if="msg.type!=='notification'"> <p class="msg-user" v-else-if="msg.type!=='notification'">
<em>{{msg.showTime}}</em> <em>{{msg.showTime}}</em>
...@@ -85,7 +87,7 @@ ...@@ -85,7 +87,7 @@
<div <div
class="state" class="state"
v-else v-else
>{{msg.locationPath!=='-1' && msg.flow=='out'?'未下载临时文件':'本地文件已被移除'}}</div> >{{msg.locationPath!=='-1'?'未下载临时文件':'本地文件已被移除'}}</div>
<div class="btn" v-if="msg.locationPath!=='' && msg.locationPath!=='-1'"> <div class="btn" v-if="msg.locationPath!=='' && msg.locationPath!=='-1'">
<div class="item_btn" @click="openLocaltion(msg.locationPath)">打开</div> <div class="item_btn" @click="openLocaltion(msg.locationPath)">打开</div>
<div class="item_btn" @click="openLocaltionFoled(msg.locationPath)">打开文件夹</div> <div class="item_btn" @click="openLocaltionFoled(msg.locationPath)">打开文件夹</div>
...@@ -947,6 +949,7 @@ export default { ...@@ -947,6 +949,7 @@ export default {
padding-right: 30%; padding-right: 30%;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: flex-start;
} }
.item-me .out { .item-me .out {
padding-left: 30%; padding-left: 30%;
...@@ -956,9 +959,6 @@ export default { ...@@ -956,9 +959,6 @@ export default {
} }
.item-you .in .msg-head, .item-you .in .msg-head,
.item-me .out .msg-head { .item-me .out .msg-head {
width: 38px;
height: 38px;
border-radius: 100%;
display: inline-block; display: inline-block;
overflow: hidden; overflow: hidden;
} }
...@@ -979,8 +979,15 @@ export default { ...@@ -979,8 +979,15 @@ export default {
} }
.item-you .in .msg-head img, .item-you .in .msg-head img,
.item-me .out .msg-head img { .item-me .out .msg-head img {
width: 100%; width: 38px;
height: 100%; height: 38px;
border-radius: 100%;
}
.item-you .in .msg-head .userName{
width: 38px;
font-size: 12px;
text-align: center;
color: #333;
} }
.item-you .in span, .item-you .in span,
.item-me .out span { .item-me .out span {
......
<template> <template>
<div class="msgbox"> <div class="msgbox">
<audio id="msgaudio" > <audio id="msgaudio">
<source src="../../static/audio/msg.mp3" type="audio/mpeg"> <source src="../../static/audio/msg.mp3" type="audio/mpeg">
</audio> </audio>
<audio id="shakeaudio"> <audio id="shakeaudio">
<source src="../../static/audio/shake.wav" type="audio/wav"> <source src="../../static/audio/shake.wav" type="audio/wav">
</audio> </audio>
<div class="sessionbox"> <div class="sessionbox">
<div class="search__session__box"> <div class="search__session__box">
<div class="seach_ctr"> <div class="seach_ctr">
...@@ -37,36 +37,81 @@ ...@@ -37,36 +37,81 @@
</div> </div>
</div> </div>
</li> </li>
<li <template v-for="(session, index) in sessionlist">
:class="{'active':currentSession.id==session.id}" <li
v-for="(session, index) in sessionlist" :class="{'active':currentSession.id==session.id}"
:key="index" v-if="session.top"
@click="enterChat(session)" :key="index"
> @click="enterChat(session)"
<el-badge :value="session.unread" :max="99" class="item"> >
<div <el-badge
class="headinfo" :value="session.unread"
:class="{'notice':!session.avatar,'blue':session.groupType==0,'green':session.groupType==1,'user':session.groupType==-1}" :max="99"
class="item"
:is-dot="session.isMute && session.unread>0"
> >
<img :src="session.avatar" v-if="session.avatar"> <div
<i class="iconfont icontaolun" v-else-if="session.groupType == 0"></i> class="headinfo"
<i class="iconfont iconqunzu" v-else-if="session.groupType == 1"></i> :class="{'notice':!session.avatar,'blue':session.groupType==0,'green':session.groupType==1,'user':session.groupType==-1}"
<i class="iconfont iconyonghutouxiang" v-else></i> >
<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">
<span v-if="session.isMute && session.unread>0">[{{session.unread}}]</span>
{{session.lastMsgShow}}
</div>
</div> </div>
</el-badge> </li>
<div class="baseinfo"> </template>
<div class="userbase"> <template v-for="(session, index) in sessionlist">
<div class="name">{{session.name}}</div> <li
<div class="time">{{session.updateTimeShow}}</div> :class="{'active':currentSession.id==session.id}"
v-if="!session.top"
:key="index"
@click="enterChat(session)"
>
<el-badge
:value="session.unread"
:max="99"
class="item"
: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">
<span v-if="session.isMute && session.unread>0">[{{session.unread}}]</span>
{{session.lastMsgShow}}
</div>
</div> </div>
<div class="msgbase">{{session.lastMsgShow}}</div> </li>
</div> </template>
</li>
</ul> </ul>
</div> </div>
<div class="messagebox"> <div class="messagebox">
<div v-if="currentSession.id!=''"> <div v-if="currentSession.id!=''">
<chat :id="currentSession.id"></chat> <chat :id="currentSession.id" @update-session='updateSession'></chat>
</div> </div>
<div v-else class="nosession"> <div v-else class="nosession">
<img src="../../assets/img/backgroundlogo.png"> <img src="../../assets/img/backgroundlogo.png">
...@@ -108,16 +153,27 @@ export default { ...@@ -108,16 +153,27 @@ export default {
this.$store.dispatch("updateRefreshState"); this.$store.dispatch("updateRefreshState");
}, },
methods: { methods: {
updateSession(topSession){
this.sessionlist.forEach(item=>{
item.top = false
topSession.forEach(x => {
if (item.id == x) {
item.top = true;
return false;
}
});
})
this.TOPSESSION=topSession
},
enterChat(session) { enterChat(session) {
this.$electron.ipcRenderer.send("clearPrevImgs"); this.$electron.ipcRenderer.send("clearPrevImgs");
let index=-1 let index = -1;
this.newMsgList.forEach((x,i)=>{ this.newMsgList.forEach((x, i) => {
if(x.id==session.id){ if (x.id == session.id) {
index=i index = i;
} }
}) });
if(index!=-1) if (index != -1) this.newMsgList.splice(index, 1);
this.newMsgList.splice(index,1)
this.currentSession = session; this.currentSession = session;
}, },
dou() { dou() {
...@@ -155,8 +211,7 @@ export default { ...@@ -155,8 +211,7 @@ export default {
}, },
calcUnRead(oldarr, newarr) { calcUnRead(oldarr, newarr) {
let isplay = false; let isplay = false;
if(newarr.length>oldarr.length) if (newarr.length > oldarr.length) return true;
return true
newarr.forEach(x => { newarr.forEach(x => {
let isExsit = false; let isExsit = false;
oldarr.forEach(y => { oldarr.forEach(y => {
...@@ -173,10 +228,13 @@ export default { ...@@ -173,10 +228,13 @@ export default {
return false; return false;
} }
}); });
return isplay return isplay;
} }
}, },
mounted() { mounted() {
if (window.localStorage.top) {
this.TOPSESSION=JSON.parse(window.localStorage.top)
}
this.$store.dispatch("connect"); this.$store.dispatch("connect");
let that = this; let that = this;
this.MsgBus.$on("doudong", function() { this.MsgBus.$on("doudong", function() {
...@@ -186,16 +244,16 @@ export default { ...@@ -186,16 +244,16 @@ export default {
that.enterChat(data); that.enterChat(data);
}); });
this.MsgBus.$on("dispose-session", function() { this.MsgBus.$on("dispose-session", function() {
that.$store.dispatch('resetCurrSession') that.$store.dispatch("resetCurrSession");
that.currentSession={ that.currentSession = {
id: "" id: ""
} };
}); });
this.MsgBus.$on("ignore-all-unRead", function() { this.MsgBus.$on("ignore-all-unRead", function() {
that.newMsgList.forEach(x=>{ that.newMsgList.forEach(x => {
that.$store.dispatch('setCurrSession', x.id) that.$store.dispatch("setCurrSession", x.id);
that.$store.dispatch('sendMsgReceipt') that.$store.dispatch("sendMsgReceipt");
}) });
}); });
}, },
computed: { computed: {
...@@ -210,6 +268,7 @@ export default { ...@@ -210,6 +268,7 @@ export default {
return this.$store.state.userInfos; return this.$store.state.userInfos;
}, },
myInfo() { myInfo() {
return this.$store.state.myInfo; return this.$store.state.myInfo;
}, },
myPhoneId() { myPhoneId() {
...@@ -240,18 +299,23 @@ export default { ...@@ -240,18 +299,23 @@ export default {
let teamInfo = null; let teamInfo = null;
teamInfo = this.$store.state.teamlist.find(team => { teamInfo = this.$store.state.teamlist.find(team => {
return team.teamId === item.to; return team.teamId === item.to;
}); });
item.groupType = teamInfo.type == "normal" ? 0 : 1;
if (teamInfo) { if (teamInfo) {
if(!teamInfo.validToCurrentUser || !teamInfo.valid) return;
item.groupType = teamInfo.type == "normal" ? 0 : 1;
item.name = teamInfo.name; item.name = teamInfo.name;
item.avatar = item.avatar =
teamInfo.avatar || teamInfo.avatar ||
(teamInfo.type === "normal" (teamInfo.type === "normal"
? this.myGroupIcon ? this.myGroupIcon
: this.myAdvancedIcon); : this.myAdvancedIcon);
item.isMute=teamInfo.usermute?teamInfo.usermute:false
} else { } else {
return;
item.groupType = 'normal'
item.name = `群${item.to}`; item.name = `群${item.to}`;
item.avatar = item.avatar || this.myGroupIcon; item.avatar = item.avatar || this.myGroupIcon;
item.isMute=false
} }
} }
let lastMsg = item.lastMsg || {}; let lastMsg = item.lastMsg || {};
...@@ -276,7 +340,24 @@ export default { ...@@ -276,7 +340,24 @@ export default {
this.noticeObj = item; this.noticeObj = item;
return; return;
} }
if (item.unread > 0) { if(item.scene !== "team"){
item.isMute = false;
this.$store.state.mutelist.forEach(x => {
if (x.account == item.to) {
item.isMute = true;
return false;
}
});
}
item.top = false;
this.TOPSESSION.forEach(x => {
if (item.id == x) {
item.top = true;
return false;
}
});
if (item.unread > 0 && !item.isMute) {
if (item.lastMsg.tip && item.lastMsg.tip.indexOf("抖了一下") != -1) { if (item.lastMsg.tip && item.lastMsg.tip.indexOf("抖了一下") != -1) {
this.dou(); this.dou();
this.enterChat(item); this.enterChat(item);
...@@ -286,19 +367,19 @@ export default { ...@@ -286,19 +367,19 @@ export default {
return item; return item;
}); });
if (!this.$electron.remote.getCurrentWindow().isVisible()) { if (!this.$electron.remote.getCurrentWindow().isVisible()) {
if(this.calcUnRead(this.newMsgList,unreadList)){ if (this.calcUnRead(this.newMsgList, unreadList)) {
document.querySelector("#msgaudio").play(); document.querySelector("#msgaudio").play();
} }
this.$electron.ipcRenderer.send("newMessage", this.newMsgList); this.$electron.ipcRenderer.send("newMessage", this.newMsgList);
} else { } else {
this.$electron.ipcRenderer.send("newMessage", []); this.$electron.ipcRenderer.send("newMessage", []);
} }
if(!this.$electron.remote.getCurrentWindow().isFocused()){ if (!this.$electron.remote.getCurrentWindow().isFocused()) {
if(this.calcUnRead(this.newMsgList,unreadList)){ if (this.calcUnRead(this.newMsgList, unreadList)) {
this.$electron.remote.getCurrentWindow().flashFrame(true) this.$electron.remote.getCurrentWindow().flashFrame(true);
} }
} }
this.newMsgList=unreadList this.newMsgList = unreadList;
return sessionlist; return sessionlist;
} }
} }
......
<template>
</template>
<script>
export default {
}
</script>
<style>
</style>
...@@ -42,6 +42,9 @@ export default { ...@@ -42,6 +42,9 @@ export default {
this.initClip(); this.initClip();
let that = this; let that = this;
let pDom = document.querySelector("#msgEditorBox"); let pDom = document.querySelector("#msgEditorBox");
this.MsgBus.$on("new-screen-hot", function(dataurl) {
that.createImage(dataurl)
});
pDom.addEventListener("drop", e => { pDom.addEventListener("drop", e => {
return false; return false;
}); });
...@@ -69,7 +72,8 @@ export default { ...@@ -69,7 +72,8 @@ export default {
} }
}); });
pDom.addEventListener("keydown", e => { pDom.addEventListener("keydown", e => {
var e = e || window.event, ec = e.keyCode || e.which; var e = e || window.event,
ec = e.keyCode || e.which;
if (ec == 8 || ec == 46) { if (ec == 8 || ec == 46) {
let dom = null; let dom = null;
pDom.querySelectorAll(".file-send-box").forEach((x, i) => { pDom.querySelectorAll(".file-send-box").forEach((x, i) => {
...@@ -92,10 +96,10 @@ export default { ...@@ -92,10 +96,10 @@ export default {
}, 100); }, 100);
} }
} else if (e.ctrlKey && 13 == ec) { } else if (e.ctrlKey && 13 == ec) {
var div = document.createElement('div'); var div = document.createElement("div");
var newContent = document.createElement('br') var newContent = document.createElement("br");
div.appendChild(newContent) div.appendChild(newContent);
pDom.appendChild(div) pDom.appendChild(div);
var o = pDom.lastChild; var o = pDom.lastChild;
var sel = window.getSelection(); var sel = window.getSelection();
var range = document.createRange(); var range = document.createRange();
...@@ -105,13 +109,13 @@ export default { ...@@ -105,13 +109,13 @@ export default {
range.setStartAfter(o); range.setStartAfter(o);
sel.removeAllRanges(); sel.removeAllRanges();
sel.addRange(range); sel.addRange(range);
} else if (ec == 13){ } else if (ec == 13) {
that.sendMsg() that.sendMsg();
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
} }
}); });
this.$electron.ipcRenderer.on("new-send-file", (event, path,size) => { this.$electron.ipcRenderer.on("new-send-file", (event, path, size) => {
let h = that.child.file.find(x => { let h = that.child.file.find(x => {
return x.path == path; return x.path == path;
}); });
...@@ -138,7 +142,6 @@ export default { ...@@ -138,7 +142,6 @@ export default {
this.child.txt = this.$el.innerText; this.child.txt = this.$el.innerText;
}, },
updateClipboard() { updateClipboard() {
console.log("update....");
this.$electron.ipcRenderer.send("auto-update-clip"); this.$electron.ipcRenderer.send("auto-update-clip");
}, },
readBlobAsDataURL(blob, callback) { readBlobAsDataURL(blob, callback) {
...@@ -149,7 +152,7 @@ export default { ...@@ -149,7 +152,7 @@ export default {
a.readAsDataURL(blob); a.readAsDataURL(blob);
}, },
initClip() { initClip() {
let _this = this; let that = this;
document document
.querySelector("#msgEditorBox") .querySelector("#msgEditorBox")
.addEventListener("paste", function(event) { .addEventListener("paste", function(event) {
...@@ -158,7 +161,7 @@ export default { ...@@ -158,7 +161,7 @@ export default {
if (clipboardData) { if (clipboardData) {
items = clipboardData.items; items = clipboardData.items;
if (!items || items.length == 0) { if (!items || items.length == 0) {
_this.$electron.ipcRenderer.send("read-clip") that.$electron.ipcRenderer.send("read-clip");
return false; return false;
} else { } else {
// 保存在剪贴板中的数据类型 // 保存在剪贴板中的数据类型
...@@ -174,46 +177,41 @@ export default { ...@@ -174,46 +177,41 @@ export default {
item.kind === "file" && item.kind === "file" &&
item.type.match(/^image\//i) item.type.match(/^image\//i)
) { ) {
console.log(item);
// 读取该图片 // 读取该图片
// var file = item.getAsFile(), var file = item.getAsFile(),
// reader = new FileReader(), reader = new FileReader(),
// name = ""; name = "";
// if (item.type.match(/^image\//i)) if (item.type.match(/^image\//i))
// name = `截图_${Date.parse(new Date())}.png`; name = `截图_${Date.parse(new Date())}.png`;
// reader.onload = function(e) { reader.onload = function(e) {
// const bmf = new BMF(); that.createImage(e.target.result)
// bmf.md5( };
// crtItem, reader.readAsDataURL(file);
// (err, md5) => {
// crt.setLocationPath(md5, crtItem.path);
// crt.readBlobAsDataURL(crtItem, function(dataurl) {
// crt.$store.dispatch("sendDataUrlMsg", {
// scene: crt.scene,
// to: crt.to,
// dataURL: dataurl,
// name: crtItem.name,
// size: crt.bytesToSize(crtItem.size),
// md5
// });
// });
// },
// progress => {}
// )
// _this.$store.dispatch("sendDataUrlMsg", {
// scene: util.parseSession(window.localStorage.sessionId).scene,
// to: util.parseSession(window.localStorage.sessionId).to,
// dataURL: e.target.result,
// name
// });
// pageUtil.scrollChatListDown();
//};
//reader.readAsDataURL(file);
} }
} }
} }
}); });
}, },
createImage(dataurl){
var strLen = dataurl.length;
var size = strLen-(strLen/8)*2;
let f = {
path:'',
size,
icon: '',
ext: 'png',
name: `截图_${Date.parse(new Date())}.png`,
dataurl
};
this.child.file.push(f);
let img = document.createElement("img");
img.src = dataurl;
img.style.maxWidth = "150px";
img.style.maxHeight = "150px";
img.className='file-send-box'
document.querySelector("#msgEditorBox").appendChild(img);
},
formatHTML(f) { formatHTML(f) {
let html = `<div title='${ let html = `<div title='${
f.name f.name
...@@ -230,14 +228,15 @@ export default { ...@@ -230,14 +228,15 @@ export default {
clearContent() { clearContent() {
this.child.file = []; this.child.file = [];
this.child.txt = ""; this.child.txt = "";
let dom=document.querySelector("#msgEditorBox") let dom = document.querySelector("#msgEditorBox");
dom.innerHTML = ""; dom.innerHTML = "";
while(dom.hasChildNodes()) while (dom.hasChildNodes()) {
{
dom.removeChild(dom.firstChild); dom.removeChild(dom.firstChild);
} }
console.log(dom.hasChildNodes()) },
addContent(txt) {
var txtElement = document.createTextNode(txt);
document.querySelector("#msgEditorBox").appendChild(txtElement);
} }
} }
}; };
......
...@@ -24,7 +24,6 @@ export default { ...@@ -24,7 +24,6 @@ export default {
this.$electron.remote.getCurrentWindow().close(); this.$electron.remote.getCurrentWindow().close();
}, },
handleClose(done) { handleClose(done) {
console.log('in........')
this.close() this.close()
} }
} }
......
...@@ -18,7 +18,6 @@ export default { ...@@ -18,7 +18,6 @@ export default {
}, },
mounted() { mounted() {
this.url = this.$electron.remote.getGlobal("PREVIWERURL"); this.url = this.$electron.remote.getGlobal("PREVIWERURL");
console.log(this.url);
}, },
methods: { methods: {
closeWin() { closeWin() {
......
...@@ -24,7 +24,6 @@ export default { ...@@ -24,7 +24,6 @@ export default {
mounted() { mounted() {
this.url=this.$electron.remote.getGlobal('PREVIWERVIDEOURL') this.url=this.$electron.remote.getGlobal('PREVIWERVIDEOURL')
setTimeout(() => { setTimeout(() => {
console.log(this.$electron.remote.getCurrentWindow().height)
this.$electron.remote.getCurrentWindow().setSize(420,document.querySelector("#videos").clientHeight+20) this.$electron.remote.getCurrentWindow().setSize(420,document.querySelector("#videos").clientHeight+20)
this.bg='rgba(0, 0, 0, 1)' this.bg='rgba(0, 0, 0, 1)'
}, 1000); }, 1000);
......
...@@ -15,11 +15,10 @@ export default { ...@@ -15,11 +15,10 @@ export default {
created() { created() {
// //
let that = this; let that = this;
this.imgPath = this.$electron.remote.getGlobal("DEFAULT_SCREENSHOT_PATH");
this.$electron.ipcRenderer.send("screens-session"); this.$electron.ipcRenderer.send("screens-session");
this.$electron.ipcRenderer.on("new-hot", event => { this.$electron.ipcRenderer.on("new-hot", event => {
that.imgPath = null; that.imgPath = null;
console.log(that.$electron.remote.getGlobal("DEFAULT_SCREENSHOT_PATH"))
that.imgPath = that.$electron.remote.getGlobal("DEFAULT_SCREENSHOT_PATH") that.imgPath = that.$electron.remote.getGlobal("DEFAULT_SCREENSHOT_PATH")
that.screenhot() that.screenhot()
}); });
...@@ -31,6 +30,8 @@ export default { ...@@ -31,6 +30,8 @@ export default {
}, },
mounted() { mounted() {
let that = this; let that = this;
this.imgPath = this.$electron.remote.getGlobal("DEFAULT_SCREENSHOT_PATH");
console.log(this.imgPath,'imgPath')
document.onkeydown = function(event) { document.onkeydown = function(event) {
var e = event || window.event || arguments.callee.caller.arguments[0]; var e = event || window.event || arguments.callee.caller.arguments[0];
if (e && e.keyCode == 27) { if (e && e.keyCode == 27) {
......
...@@ -43,6 +43,11 @@ export default new Router({ ...@@ -43,6 +43,11 @@ export default new Router({
path: '/dialog', path: '/dialog',
name: 'dialog', name: 'dialog',
component: require('@/components/tools/dialog') component: require('@/components/tools/dialog')
},
{
path: '/addnewuser',
name: 'addnewuser',
component: require('@/components/team/addNewUser')
} }
] ]
}) })
...@@ -37,20 +37,50 @@ export function onMarkInBlacklist (obj) { ...@@ -37,20 +37,50 @@ export function onMarkInBlacklist (obj) {
} }
} }
export function updateBlack ({state}, {account, isBlack}) { export function updateBlack ({state}, obj) {
let {account, isBlack, scene, to, name} = obj
const nim = state.nim const nim = state.nim
if (account && (typeof isBlack === 'boolean')) { if (account && (typeof isBlack === 'boolean')) {
nim.markInBlacklist({ nim.markInBlacklist({
account, account,
// `true`表示加入黑名单, `false`表示从黑名单移除
isAdd: isBlack, isAdd: isBlack,
done: function (error, obj) { done: function (error, obj) {
if (error) {
alert(error)
return
}
onMarkInBlacklist(obj) onMarkInBlacklist(obj)
} }
}) })
} }
}
export function onMsg (msg) {
msg = formatMsg(msg)
store.commit('putMsg', msg)
if (msg.sessionId === store.state.currSessionId) {
store.commit('updateCurrSessionMsgs', {
type: 'put',
msg
})
}
}
export function formatMsg (msg) {
const nim = store.state.nim
if (msg.type === 'robot') {
if (msg.content && msg.content.flag === 'bot') {
if (msg.content.message) {
msg.content.message = msg.content.message.map(item => {
switch (item.type) {
case 'template':
item.content = nim.parseRobotTemplate(item.content)
break
case 'text':
case 'image':
case 'answer':
break
}
return item
})
}
}
}
return msg
} }
\ No newline at end of file
...@@ -11,11 +11,11 @@ import {updateBlack} from './blacks' ...@@ -11,11 +11,11 @@ import {updateBlack} from './blacks'
import {updateFriend, addFriend, deleteFriend} from './friends' import {updateFriend, addFriend, deleteFriend} from './friends'
import {resetSearchResult, searchUsers, searchTeam} from './search' import {resetSearchResult, searchUsers, searchTeam} from './search'
import {deleteSession, setCurrSession, resetCurrSession} from './session' import {deleteSession, setCurrSession, resetCurrSession} from './session'
import {sendMsg, sendTip, sendFileMsg,sendDataUrlMsg,sendDataUrlMsgCall, sendMsgReceipt, sendRobotMsg, revocateMsg, updateLocalMsg, getHistoryMsgs, resetNoMoreHistoryMsgs, continueRobotMsg} from './msgs' import {sendMsg, sendTip,markInMutelist, sendFileMsg,sendDataUrlMsg,sendDataUrlMsgCall, sendMsgReceipt, sendRobotMsg, revocateMsg, updateLocalMsg, getHistoryMsgs, resetNoMoreHistoryMsgs, continueRobotMsg} from './msgs'
import {markSysMsgRead, resetSysMsgs, deleteSysMsgs, markCustomSysMsgRead} from './sysMsgs' import {markSysMsgRead, resetSysMsgs, deleteSysMsgs, markCustomSysMsgRead} from './sysMsgs'
import {sendChatroomMsg, sendChatroomRobotMsg, sendChatroomFileMsg, getChatroomHistoryMsgs} from './chatroomMsgs' import {sendChatroomMsg, sendChatroomRobotMsg, sendChatroomFileMsg, getChatroomHistoryMsgs} from './chatroomMsgs'
import {initChatroomInfos, getChatroomInfo, getChatroomMembers, clearChatroomMembers} from './chatroomInfos' import {initChatroomInfos, getChatroomInfo, getChatroomMembers, clearChatroomMembers} from './chatroomInfos'
import { delegateTeamFunction, onTeamNotificationMsg, enterSettingPage, getTeamMembers, checkTeamMsgReceipt, getTeamMsgReads} from './team' import { delegateTeamFunction, getNotifyForNewTeamMsg,onTeamNotificationMsg, enterSettingPage, getTeamMembers, checkTeamMsgReceipt, getTeamMsgReads} from './team'
function connectNim ({state, commit, dispatch}, obj) { function connectNim ({state, commit, dispatch}, obj) {
let {force} = Object.assign({}, obj) let {force} = Object.assign({}, obj)
...@@ -117,6 +117,7 @@ export default { ...@@ -117,6 +117,7 @@ export default {
sendFileMsg, sendFileMsg,
sendDataUrlMsg, sendDataUrlMsg,
sendDataUrlMsgCall, sendDataUrlMsgCall,
markInMutelist,
sendRobotMsg, sendRobotMsg,
// 发送消息已读回执 // 发送消息已读回执
sendMsgReceipt, sendMsgReceipt,
...@@ -151,6 +152,7 @@ export default { ...@@ -151,6 +152,7 @@ export default {
delegateTeamFunction, delegateTeamFunction,
// 处理群消息回调 // 处理群消息回调
onTeamNotificationMsg, onTeamNotificationMsg,
getNotifyForNewTeamMsg,
// 进入群信息设置页 // 进入群信息设置页
enterSettingPage, enterSettingPage,
// 获取群成员 // 获取群成员
......
...@@ -11,7 +11,7 @@ import {onRobots} from './robots' ...@@ -11,7 +11,7 @@ import {onRobots} from './robots'
import {onBlacklist, onMarkInBlacklist} from './blacks' import {onBlacklist, onMarkInBlacklist} from './blacks'
import {onMyInfo, onUserInfo} from './userInfo' import {onMyInfo, onUserInfo} from './userInfo'
import {onSessions, onUpdateSession} from './session' import {onSessions, onUpdateSession} from './session'
import {onRoamingMsgs, onOfflineMsgs, onMsg} from './msgs' import {onRoamingMsgs, onOfflineMsgs, onMsg, onMutelist, onMarkInMutelist} from './msgs'
import {onSysMsgs, onSysMsg, onSysMsgUnread, onCustomSysMsgs} from './sysMsgs' import {onSysMsgs, onSysMsg, onSysMsgUnread, onCustomSysMsgs} from './sysMsgs'
import { onTeams, onSynCreateTeam, onCreateTeam, onUpdateTeam, onTeamMembers, onUpdateTeamMember, onAddTeamMembers, onRemoveTeamMembers, onUpdateTeamManagers, onDismissTeam, onUpdateTeamMembersMute, onTeamMsgReceipt} from './team' import { onTeams, onSynCreateTeam, onCreateTeam, onUpdateTeam, onTeamMembers, onUpdateTeamMember, onAddTeamMembers, onRemoveTeamMembers, onUpdateTeamManagers, onDismissTeam, onUpdateTeamMembersMute, onTeamMsgReceipt} from './team'
...@@ -80,8 +80,8 @@ export function initNimSDK ({ state, commit, dispatch }, loginInfo) { ...@@ -80,8 +80,8 @@ export function initNimSDK ({ state, commit, dispatch }, loginInfo) {
// 用户关系及好友关系 // 用户关系及好友关系
onblacklist: onBlacklist, onblacklist: onBlacklist,
onsyncmarkinblacklist: onMarkInBlacklist, onsyncmarkinblacklist: onMarkInBlacklist,
// onmutelist: onMutelist, onmutelist: onMutelist,
// onsyncmarkinmutelist: onMarkInMutelist, onsyncmarkinmutelist: onMarkInMutelist,
onfriends: onFriends, onfriends: onFriends,
onsyncfriendaction: onSyncFriendAction, onsyncfriendaction: onSyncFriendAction,
// 机器人 // 机器人
......
...@@ -39,14 +39,50 @@ export function onOfflineMsgs (obj) { ...@@ -39,14 +39,50 @@ export function onOfflineMsgs (obj) {
store.commit('updateMsgs', msgs) store.commit('updateMsgs', msgs)
} }
export function onMutelist (mutelist){
store.commit('updateMutelist', mutelist)
}
export function onMarkInMutelist (obj){
console.log(obj.account + '被你' + (obj.isAdd ? '加入' : '移除') + '静音列表');
if (obj.isAdd) {
addToMutelist(obj);
} else {
removeFromMutelist(obj);
}
}
export function addToMutelist(obj) {
store.commit('addToMutelist', obj)
}
export function removeFromMutelist(obj) {
store.commit('removeFromMutelist', obj)
}
export function markInMutelist({state,commit}, obj){
const nim = store.state.nim
let {account,isAdd,scene,to,name} = obj
nim.markInMutelist({
account,
isAdd,
done: function markInMutelistDone(error, obj) {
console.log(error)
onMarkInMutelist(obj)
}
});
}
export function sendTip ({state, commit}, obj) { export function sendTip ({state, commit}, obj) {
const nim = store.state.nim const nim = store.state.nim
let isLocal='isLocal' in obj ? obj.isLocal : false
nim.sendTipMsg({ nim.sendTipMsg({
scene: obj.scene, scene: obj.scene,
to: obj.to, to: obj.to,
tip: obj.tip, tip: obj.tip,
isLocal,
done: function sendTipMsgDone (error, msg) { done: function sendTipMsgDone (error, msg) {
onSendMsgDone(error, msg) console.log(msg)
onMsg(msg)
} }
}) })
} }
......
...@@ -6,7 +6,9 @@ export function onTeams(teams) { ...@@ -6,7 +6,9 @@ export function onTeams(teams) {
teams = [teams] teams = [teams]
} }
teams = teams.filter(item => !!item) teams = teams.filter(item => !!item)
let teamIds = []
teams.forEach(team=>{ teams.forEach(team=>{
teamIds.push(team.teamId)
if (team.validToCurrentUser === undefined) { if (team.validToCurrentUser === undefined) {
team.validToCurrentUser = true team.validToCurrentUser = true
} }
...@@ -14,6 +16,8 @@ export function onTeams(teams) { ...@@ -14,6 +16,8 @@ export function onTeams(teams) {
team.avatar = team.avatar + '?imageView&thumbnail=300y300' team.avatar = team.avatar + '?imageView&thumbnail=300y300'
} }
}) })
getNotifyForNewTeamMsg(store,teamIds)
store.commit('updateTeamList', teams) store.commit('updateTeamList', teams)
} }
...@@ -119,9 +123,9 @@ export function onTeamMsgReceipt(obj) { ...@@ -119,9 +123,9 @@ export function onTeamMsgReceipt(obj) {
// 进入可配置的群信息设置页,进入前改变state中的配置信息,进入页面后读取配置信息更新视图 // 进入可配置的群信息设置页,进入前改变state中的配置信息,进入页面后读取配置信息更新视图
export function enterSettingPage({commit}, obj) { export function enterSettingPage({commit}, obj) {
commit('updateTeamSettingConfig', obj) commit('updateTeamSettingConfig', obj)
setTimeout(() => { // setTimeout(() => {
location.href = `#/teamsetting` // location.href = `#/teamsetting`
}, 20) // }, 20)
} }
...@@ -165,6 +169,17 @@ export function getTeamMembers({ state }, teamId) { ...@@ -165,6 +169,17 @@ export function getTeamMembers({ state }, teamId) {
}) })
} }
export function getNotifyForNewTeamMsg({state,commit},teamIds) {
const nim = state.nim
nim.notifyForNewTeamMsg({
teamIds: teamIds,
done: (err, obj) => {
commit('updateTeamUserMute',obj)
}
})
}
export function checkTeamMsgReceipt({state}, msgs) { export function checkTeamMsgReceipt({state}, msgs) {
var result = /team-(\d+)/.exec(state.currSessionId) var result = /team-(\d+)/.exec(state.currSessionId)
if (!result) { if (!result) {
......
...@@ -124,6 +124,19 @@ export default { ...@@ -124,6 +124,19 @@ export default {
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){
const nim = state.nim
state.mutelist = nim.mergeRelations(state.mutelist, obj.record);
},
removeFromMutelist(state,obj){
const nim = state.nim
state.mutelist = nim.cutRelations(state.mutelist, obj.record);
},
updateMutelist (state, mutelist) {
const nim = state.nim
state.mutelist=nim.mergeRelations(state.mutelist,mutelist)
state.mutelist = nim.cutRelations(state.mutelist, mutelist.invalid)
},
// 初始化,收到离线漫游消息时调用 // 初始化,收到离线漫游消息时调用
updateMsgs (state, msgs) { updateMsgs (state, msgs) {
const nim = state.nim const nim = state.nim
...@@ -170,6 +183,9 @@ export default { ...@@ -170,6 +183,9 @@ 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){
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)
} else { } else {
...@@ -208,7 +224,6 @@ export default { ...@@ -208,7 +224,6 @@ export default {
let lastMsgIndex = tempMsgs.length - 1 let lastMsgIndex = tempMsgs.length - 1
for (let i = lastMsgIndex; i >= 0; i--) { for (let i = lastMsgIndex; i >= 0; i--) {
let currMsg = tempMsgs[i] let currMsg = tempMsgs[i]
console.log(idClient, currMsg.idClient, currMsg.text)
if (idClient === currMsg.idClient) { if (idClient === currMsg.idClient) {
state.msgs[sessionId].splice(i, 1, msg) state.msgs[sessionId].splice(i, 1, msg)
break break
...@@ -481,6 +496,13 @@ export default { ...@@ -481,6 +496,13 @@ export default {
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) {
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 const nim = state.nim
var teamId = obj.teamId var teamId = obj.teamId
......
...@@ -33,7 +33,7 @@ export default { ...@@ -33,7 +33,7 @@ export default {
// 黑名单列表 // 黑名单列表
blacklist: [], blacklist: [],
// 禁言列表 // 禁言列表
// mutelist: [], mutelist: [],
teamlist: [], teamlist: [],
// 群自身的属性,数据结构如:{tid: {attr: ...}, ...} // 群自身的属性,数据结构如:{tid: {attr: ...}, ...}
......
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