Commit d50e7b74 authored by 罗超's avatar 罗超

no message

parent 52471885
......@@ -58,6 +58,7 @@ let messageEvent = null
let messageProtocol = null
let CAP_IMG=''
let nim=null
let SCREENCOUNT=0
global.defaultdownloaddir=require('os').userInfo().homedir+'\\Downloads\\'
global.DEFAULT_SCREENSHOT_PATH=require('os').userInfo().homedir+'\\Pictures\\demo.png'
......@@ -163,19 +164,14 @@ function createWindow () {
mainWindow.webContents.session.on('will-download', (event, item, webContents) => {
const totalBytes = item.getTotalBytes()
let pathAll = folderpath + `\\` + downloadname
console.log(pathAll)
item.setSavePath(pathAll)
item.on('updated', (event, state) => {
if (state === 'interrupted') {
console.log('Download is interrupted but can be resumed')
} else if (state === 'progressing') {
if (item.isPaused()) {
console.log('Download is paused')
} else {
console.log(`Received bytes: ${item.getReceivedBytes()}`)
}
mainWindow.setProgressBar(item.getReceivedBytes() / totalBytes)
console.log(downloadObj)
downloadObj.sender.send('downloading', (parseFloat(item.getReceivedBytes()) / parseFloat(totalBytes))*100)
}
})
......@@ -183,8 +179,6 @@ function createWindow () {
if (!mainWindow.isDestroyed()) {
mainWindow.setProgressBar(-1)
mainWindow.flashFrame(true)
// console.log(BrowserWindow.getFocusedWindow())
}
if (state === 'completed') {
try {
......@@ -193,7 +187,7 @@ function createWindow () {
}
} else {
console.log(`Download failed: ${state}`)
}
})
})
......@@ -331,7 +325,6 @@ ipc.on('loginSuccess', function (event, userInfo) {
const contextMenu = Menu.buildFromTemplate([{
label: '打开主界面',
click: function () {
console.log(loginWindow.isDestroyed())
if (isLogin) {
if (!mainWindow.isDestroyed()) {
mainWindow.show()
......@@ -394,7 +387,7 @@ ipc.on('loginSuccess', function (event, userInfo) {
const RUN_LOCATION = '\\Software\\Microsoft\\Windows\\CurrentVersion\\Run'
let key = new WinReg({hive: WinReg.HKCU, key: RUN_LOCATION})
key.set('WYOFFICE', WinReg.REG_SZ, process.execPath, (err) => {
console.log('设置自动启动' + err)
//console.log('设置自动启动' + err)
})
app.setAsDefaultProtocolClient('Woyou')
......@@ -511,7 +504,6 @@ ipc.on('download', (evt, pdownloadpath, pfolderpath, dfileName, pmsgId) => {
msgId = pmsgId
// evt.sender.send('tips',downloadpath);
mainWindow.webContents.downloadURL(downloadpath)
console.log(downloadpath)
} catch (error) {
}
......@@ -624,6 +616,7 @@ ipc.on('openPreviwerVideo', function (event,url) {
})
ipc.on('addClipboard', function (event,content) {
let img = nativeImage.createFromDataURL(content)
mainEvent.sender.send('new-screen-hot',content)
clipboard.writeImage(img)
})
ipc.on('screens-session', function (event) {
......@@ -660,12 +653,11 @@ ipc.on('send-file', function (event,obj) {
filePath,
custom: JSON.stringify(customMsg),
uploadprogress: function(data){
console.log(data)
file.progess=data.percentage
event.sender.send('sending-process',file)
},
uploaderror: function () {
console && console.log('上传失败')
},
uploaddone: function (error, file) {
file.progess=100
......@@ -680,7 +672,6 @@ ipc.on('send-file', function (event,obj) {
ipc.on('read-clip', function (event) {
const rawFilePath = clipboard.readBuffer('FileNameW').toString('ucs2');
let filePath = rawFilePath.replace(new RegExp(String.fromCharCode(0), 'g'), '');
console.log(filePath)
if(filePath && filePath.length>0){
fs.stat(filePath,function(error,stats){
if(!error){
......@@ -898,7 +889,15 @@ let screenHotBegin=function(){
screenshot({format: 'png',filename:p}).then((img) => {
if(scrollerhotWindows && !scrollerhotWindows.isDestroyed()){
screenEvent.sender.send('new-hot')
if(SCREENCOUNT==0){
scrollerhotWindows.reload()
scrollerhotWindows.once('ready-to-show', () => {
scrollerhotWindows.show()
})
}else{
scrollerhotWindows.show()
}
SCREENCOUNT++
}else{
getScrollerhotWindows()
}
......@@ -933,7 +932,6 @@ let formatDate=function(date,format){
return format;
};
let initNIM=function(uid,token){
console.log(uid,token)
nim = SDK.getInstance({
debug: false,
appKey: 'b612b31e837c79c68f141aeb719d2b20',
......@@ -947,18 +945,15 @@ let initNIM=function(uid,token){
})
function onConnect() {
console.log('连接成功');
}
function onWillReconnect(obj) {
// 此时说明 SDK 已经断开连接, 请开发者在界面上提示用户连接已断开, 而且正在重新建立连接
console.log('即将重连');
console.log(obj.retryCount);
console.log(obj.duration);
}
function onDisconnect(error) {
// 此时说明 SDK 处于断开状态, 开发者此时应该根据错误码提示相应的错误信息, 并且跳转到登录页面
console.log('丢失连接');
console.log(error);
if (error) {
switch (error.code) {
// 账号或者密码错误, 请跳转到登录页面并提示错误
......
......@@ -3,10 +3,11 @@ import MsgBus from './msgBus'
export default {
install (Vue, options) {
Vue.prototype.MsgBus = MsgBus;
Vue.prototype.GLOBALSENDING = [],
Vue.prototype.GLOBALSENDING = [];
Vue.prototype.TOPSESSION = [];
Vue.prototype.isOnline = function() {
return process.env.NODE_ENV !== 'development';
},
}
Vue.prototype.domainManager = function() {
var domainUrl = "http://reborn.oytour.com";//主域名
if (this.isOnline()) {
......@@ -355,7 +356,6 @@ export default {
return "dir-small"
let css = ""
icons.forEach(x => {
//console.log(x.filesIcon.hasOwnProperty(suffix))
if (x.filesIcon.hasOwnProperty(suffix)) {
css = x.filesIcon[suffix][size]
return false
......
<style>
@import url("./assets/css/font.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>
......
......@@ -86,6 +86,9 @@ export default {
this.$electron.ipcRenderer.on('ignore-all-unRead', (event,session) => {
this.MsgBus.$emit("ignore-all-unRead")
})
this.$electron.ipcRenderer.on('new-screen-hot', (event,dataurl) => {
this.MsgBus.$emit("new-screen-hot",dataurl)
})
},
methods: {
changeMenu(i, n) {
......
This diff is collapsed.
......@@ -141,7 +141,6 @@ export default {
inputObj: {
handler(val, oldVal) {
this.msgToSent = val.txt;
console.log(val.file);
},
deep: true
}
......@@ -179,7 +178,6 @@ export default {
},
methods: {
openScreenhot() {
console.log("截图");
this.$electron.ipcRenderer.send("open-screenhot");
},
dataURLtoBlob(dataurl) {
......@@ -230,14 +228,6 @@ export default {
(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
// });
fileInfo.dataurl = dataurl;
fileInfo.md5 = md5;
crt.sendingBang(fileInfo);
......@@ -476,7 +466,9 @@ export default {
x.progess = 0;
x.avatar = this.avatar;
this.GLOBALSENDING.push(x)
x.path=x.dataurl?x.dataurl:x.path
this.MsgBus.$emit("update-sending");
if(!x.dataurl){
this.$electron.ipcRenderer.send("send-file", {
scene: this.scene,
to: this.to,
......@@ -487,6 +479,9 @@ export default {
type,
file:x
});
}else{
this.sendFileDataUrl(x)
}
});
}
},
......@@ -530,9 +525,8 @@ export default {
this.isEmojiShown = false;
},
addEmoji(emojiName) {
console.log("emojiName");
this.msgToSent += emojiName;
//this.hideEmoji()
this.$refs.editor.addContent(emojiName)
},
chooseRobot(robot) {
if (robot && robot.account) {
......@@ -564,7 +558,6 @@ export default {
} else if (/\.(wav|mp3|wma)$/i.test(file.name)) {
type = "file";
}
let that = this;
let exts = file.name.split(".");
file.ext = exts[exts.length - 1].toLowerCase();
file.type = type;
......@@ -576,6 +569,10 @@ export default {
file.avatar = this.avatar;
this.GLOBALSENDING.push(file);
this.MsgBus.$emit("update-sending");
this.sendFileDataUrl(file)
},
sendFileDataUrl(file){
let that=this
this.$store.dispatch("sendDataUrlMsgCall", {
scene: this.scene,
to: this.to,
......@@ -583,9 +580,8 @@ export default {
name: file.name,
size: file.size,
md5: file.md5,
type,
type:file.type,
onUploadprogress: function(data) {
console.log("上传文件中....", data.percentage);
that.GLOBALSENDING.forEach(x => {
if (x.msgId == file.msgId) {
x.progess = data.percentage;
......
......@@ -84,18 +84,21 @@ export default {
this.$emit('add-emoji', emoji.key)
} else if (this.currType === 'pinup') {
if (this.type === 'session') {
this.$store.dispatch('sendMsg', {
type: 'custom',
scene: this.scene,
to: this.to,
pushContent: '[贴图表情]',
content: {
let custommsg= {
type: 3,
msgtype:'custom_chartlet',
data: {
catalog: this.currAlbum,
chartlet: emoji.key
}
}
this.$store.dispatch('sendMsg', {
type: 'custom',
scene: this.scene,
to: this.to,
pushContent: '[贴图表情]',
content: custommsg,
custom:JSON.stringify(custommsg)
})
} else if (this.type === 'chatroom') {
this.$store.dispatch('sendChatroomMsg', {
......@@ -103,11 +106,13 @@ export default {
pushContent: '[贴图表情]',
content: {
type: 3,
msgtype:101,
data: {
catalog: this.currAlbum,
chartlet: emoji.key
}
}
},
custom:JSON.stringify(custommsg)
})
}
this.$emit('hide-emoji')
......
......@@ -26,9 +26,11 @@
:type="msg.type"
:class="{'in':msg.flow==='in','out':msg.flow==='out'}"
>
<!-- v-touch:hold="revocateMsg" -->
<a class="msg-head" v-if="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>
<p class="msg-user" v-else-if="msg.type!=='notification'">
<em>{{msg.showTime}}</em>
......@@ -85,7 +87,7 @@
<div
class="state"
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="item_btn" @click="openLocaltion(msg.locationPath)">打开</div>
<div class="item_btn" @click="openLocaltionFoled(msg.locationPath)">打开文件夹</div>
......@@ -947,6 +949,7 @@ export default {
padding-right: 30%;
display: flex;
flex-direction: row;
align-items: flex-start;
}
.item-me .out {
padding-left: 30%;
......@@ -956,9 +959,6 @@ export default {
}
.item-you .in .msg-head,
.item-me .out .msg-head {
width: 38px;
height: 38px;
border-radius: 100%;
display: inline-block;
overflow: hidden;
}
......@@ -979,8 +979,15 @@ export default {
}
.item-you .in .msg-head img,
.item-me .out .msg-head img {
width: 100%;
height: 100%;
width: 38px;
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-me .out span {
......
<template>
<div class="msgbox">
<audio id="msgaudio" >
<audio id="msgaudio">
<source src="../../static/audio/msg.mp3" type="audio/mpeg">
</audio>
<audio id="shakeaudio">
......@@ -37,13 +37,54 @@
</div>
</div>
</li>
<template v-for="(session, index) in sessionlist">
<li
:class="{'active':currentSession.id==session.id}"
v-for="(session, index) in sessionlist"
v-if="session.top"
:key="index"
@click="enterChat(session)"
>
<el-badge :value="session.unread" :max="99" class="item">
<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>
</li>
</template>
<template v-for="(session, index) in sessionlist">
<li
: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}"
......@@ -59,14 +100,18 @@
<div class="name">{{session.name}}</div>
<div class="time">{{session.updateTimeShow}}</div>
</div>
<div class="msgbase">{{session.lastMsgShow}}</div>
<div class="msgbase">
<span v-if="session.isMute && session.unread>0">[{{session.unread}}]</span>
{{session.lastMsgShow}}
</div>
</div>
</li>
</template>
</ul>
</div>
<div class="messagebox">
<div v-if="currentSession.id!=''">
<chat :id="currentSession.id"></chat>
<chat :id="currentSession.id" @update-session='updateSession'></chat>
</div>
<div v-else class="nosession">
<img src="../../assets/img/backgroundlogo.png">
......@@ -108,16 +153,27 @@ export default {
this.$store.dispatch("updateRefreshState");
},
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) {
this.$electron.ipcRenderer.send("clearPrevImgs");
let index=-1
this.newMsgList.forEach((x,i)=>{
if(x.id==session.id){
index=i
let index = -1;
this.newMsgList.forEach((x, i) => {
if (x.id == session.id) {
index = i;
}
})
if(index!=-1)
this.newMsgList.splice(index,1)
});
if (index != -1) this.newMsgList.splice(index, 1);
this.currentSession = session;
},
dou() {
......@@ -155,8 +211,7 @@ export default {
},
calcUnRead(oldarr, newarr) {
let isplay = false;
if(newarr.length>oldarr.length)
return true
if (newarr.length > oldarr.length) return true;
newarr.forEach(x => {
let isExsit = false;
oldarr.forEach(y => {
......@@ -173,10 +228,13 @@ export default {
return false;
}
});
return isplay
return isplay;
}
},
mounted() {
if (window.localStorage.top) {
this.TOPSESSION=JSON.parse(window.localStorage.top)
}
this.$store.dispatch("connect");
let that = this;
this.MsgBus.$on("doudong", function() {
......@@ -186,16 +244,16 @@ export default {
that.enterChat(data);
});
this.MsgBus.$on("dispose-session", function() {
that.$store.dispatch('resetCurrSession')
that.currentSession={
that.$store.dispatch("resetCurrSession");
that.currentSession = {
id: ""
}
};
});
this.MsgBus.$on("ignore-all-unRead", function() {
that.newMsgList.forEach(x=>{
that.$store.dispatch('setCurrSession', x.id)
that.$store.dispatch('sendMsgReceipt')
})
that.newMsgList.forEach(x => {
that.$store.dispatch("setCurrSession", x.id);
that.$store.dispatch("sendMsgReceipt");
});
});
},
computed: {
......@@ -210,6 +268,7 @@ export default {
return this.$store.state.userInfos;
},
myInfo() {
return this.$store.state.myInfo;
},
myPhoneId() {
......@@ -241,17 +300,22 @@ export default {
teamInfo = this.$store.state.teamlist.find(team => {
return team.teamId === item.to;
});
item.groupType = teamInfo.type == "normal" ? 0 : 1;
if (teamInfo) {
if(!teamInfo.validToCurrentUser || !teamInfo.valid) return;
item.groupType = teamInfo.type == "normal" ? 0 : 1;
item.name = teamInfo.name;
item.avatar =
teamInfo.avatar ||
(teamInfo.type === "normal"
? this.myGroupIcon
: this.myAdvancedIcon);
item.isMute=teamInfo.usermute?teamInfo.usermute:false
} else {
return;
item.groupType = 'normal'
item.name = `群${item.to}`;
item.avatar = item.avatar || this.myGroupIcon;
item.isMute=false
}
}
let lastMsg = item.lastMsg || {};
......@@ -276,7 +340,24 @@ export default {
this.noticeObj = item;
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) {
this.dou();
this.enterChat(item);
......@@ -286,19 +367,19 @@ export default {
return item;
});
if (!this.$electron.remote.getCurrentWindow().isVisible()) {
if(this.calcUnRead(this.newMsgList,unreadList)){
if (this.calcUnRead(this.newMsgList, unreadList)) {
document.querySelector("#msgaudio").play();
}
this.$electron.ipcRenderer.send("newMessage", this.newMsgList);
} else {
this.$electron.ipcRenderer.send("newMessage", []);
}
if(!this.$electron.remote.getCurrentWindow().isFocused()){
if(this.calcUnRead(this.newMsgList,unreadList)){
this.$electron.remote.getCurrentWindow().flashFrame(true)
if (!this.$electron.remote.getCurrentWindow().isFocused()) {
if (this.calcUnRead(this.newMsgList, unreadList)) {
this.$electron.remote.getCurrentWindow().flashFrame(true);
}
}
this.newMsgList=unreadList
this.newMsgList = unreadList;
return sessionlist;
}
}
......
<template>
</template>
<script>
export default {
}
</script>
<style>
</style>
......@@ -42,6 +42,9 @@ export default {
this.initClip();
let that = this;
let pDom = document.querySelector("#msgEditorBox");
this.MsgBus.$on("new-screen-hot", function(dataurl) {
that.createImage(dataurl)
});
pDom.addEventListener("drop", e => {
return false;
});
......@@ -69,7 +72,8 @@ export default {
}
});
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) {
let dom = null;
pDom.querySelectorAll(".file-send-box").forEach((x, i) => {
......@@ -92,10 +96,10 @@ export default {
}, 100);
}
} else if (e.ctrlKey && 13 == ec) {
var div = document.createElement('div');
var newContent = document.createElement('br')
div.appendChild(newContent)
pDom.appendChild(div)
var div = document.createElement("div");
var newContent = document.createElement("br");
div.appendChild(newContent);
pDom.appendChild(div);
var o = pDom.lastChild;
var sel = window.getSelection();
var range = document.createRange();
......@@ -105,13 +109,13 @@ export default {
range.setStartAfter(o);
sel.removeAllRanges();
sel.addRange(range);
} else if (ec == 13){
that.sendMsg()
} else if (ec == 13) {
that.sendMsg();
e.preventDefault();
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 => {
return x.path == path;
});
......@@ -138,7 +142,6 @@ export default {
this.child.txt = this.$el.innerText;
},
updateClipboard() {
console.log("update....");
this.$electron.ipcRenderer.send("auto-update-clip");
},
readBlobAsDataURL(blob, callback) {
......@@ -149,7 +152,7 @@ export default {
a.readAsDataURL(blob);
},
initClip() {
let _this = this;
let that = this;
document
.querySelector("#msgEditorBox")
.addEventListener("paste", function(event) {
......@@ -158,7 +161,7 @@ export default {
if (clipboardData) {
items = clipboardData.items;
if (!items || items.length == 0) {
_this.$electron.ipcRenderer.send("read-clip")
that.$electron.ipcRenderer.send("read-clip");
return false;
} else {
// 保存在剪贴板中的数据类型
......@@ -174,46 +177,41 @@ export default {
item.kind === "file" &&
item.type.match(/^image\//i)
) {
console.log(item);
// 读取该图片
// var file = item.getAsFile(),
// reader = new FileReader(),
// name = "";
// if (item.type.match(/^image\//i))
// name = `截图_${Date.parse(new Date())}.png`;
// reader.onload = function(e) {
// const bmf = new BMF();
// bmf.md5(
// crtItem,
// (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);
var file = item.getAsFile(),
reader = new FileReader(),
name = "";
if (item.type.match(/^image\//i))
name = `截图_${Date.parse(new Date())}.png`;
reader.onload = function(e) {
that.createImage(e.target.result)
};
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) {
let html = `<div title='${
f.name
......@@ -230,14 +228,15 @@ export default {
clearContent() {
this.child.file = [];
this.child.txt = "";
let dom=document.querySelector("#msgEditorBox")
let dom = document.querySelector("#msgEditorBox");
dom.innerHTML = "";
while(dom.hasChildNodes())
{
while (dom.hasChildNodes()) {
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 {
this.$electron.remote.getCurrentWindow().close();
},
handleClose(done) {
console.log('in........')
this.close()
}
}
......
......@@ -18,7 +18,6 @@ export default {
},
mounted() {
this.url = this.$electron.remote.getGlobal("PREVIWERURL");
console.log(this.url);
},
methods: {
closeWin() {
......
......@@ -24,7 +24,6 @@ export default {
mounted() {
this.url=this.$electron.remote.getGlobal('PREVIWERVIDEOURL')
setTimeout(() => {
console.log(this.$electron.remote.getCurrentWindow().height)
this.$electron.remote.getCurrentWindow().setSize(420,document.querySelector("#videos").clientHeight+20)
this.bg='rgba(0, 0, 0, 1)'
}, 1000);
......
......@@ -15,11 +15,10 @@ export default {
created() {
//
let that = this;
this.imgPath = this.$electron.remote.getGlobal("DEFAULT_SCREENSHOT_PATH");
this.$electron.ipcRenderer.send("screens-session");
this.$electron.ipcRenderer.on("new-hot", event => {
that.imgPath = null;
console.log(that.$electron.remote.getGlobal("DEFAULT_SCREENSHOT_PATH"))
that.imgPath = that.$electron.remote.getGlobal("DEFAULT_SCREENSHOT_PATH")
that.screenhot()
});
......@@ -31,6 +30,8 @@ export default {
},
mounted() {
let that = this;
this.imgPath = this.$electron.remote.getGlobal("DEFAULT_SCREENSHOT_PATH");
console.log(this.imgPath,'imgPath')
document.onkeydown = function(event) {
var e = event || window.event || arguments.callee.caller.arguments[0];
if (e && e.keyCode == 27) {
......
......@@ -43,6 +43,11 @@ export default new Router({
path: '/dialog',
name: 'dialog',
component: require('@/components/tools/dialog')
},
{
path: '/addnewuser',
name: 'addnewuser',
component: require('@/components/team/addNewUser')
}
]
})
......@@ -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
if (account && (typeof isBlack === 'boolean')) {
nim.markInBlacklist({
account,
// `true`表示加入黑名单, `false`表示从黑名单移除
isAdd: isBlack,
done: function (error, obj) {
if (error) {
alert(error)
return
}
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'
import {updateFriend, addFriend, deleteFriend} from './friends'
import {resetSearchResult, searchUsers, searchTeam} from './search'
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 {sendChatroomMsg, sendChatroomRobotMsg, sendChatroomFileMsg, getChatroomHistoryMsgs} from './chatroomMsgs'
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) {
let {force} = Object.assign({}, obj)
......@@ -117,6 +117,7 @@ export default {
sendFileMsg,
sendDataUrlMsg,
sendDataUrlMsgCall,
markInMutelist,
sendRobotMsg,
// 发送消息已读回执
sendMsgReceipt,
......@@ -151,6 +152,7 @@ export default {
delegateTeamFunction,
// 处理群消息回调
onTeamNotificationMsg,
getNotifyForNewTeamMsg,
// 进入群信息设置页
enterSettingPage,
// 获取群成员
......
......@@ -11,7 +11,7 @@ import {onRobots} from './robots'
import {onBlacklist, onMarkInBlacklist} from './blacks'
import {onMyInfo, onUserInfo} from './userInfo'
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 { 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) {
// 用户关系及好友关系
onblacklist: onBlacklist,
onsyncmarkinblacklist: onMarkInBlacklist,
// onmutelist: onMutelist,
// onsyncmarkinmutelist: onMarkInMutelist,
onmutelist: onMutelist,
onsyncmarkinmutelist: onMarkInMutelist,
onfriends: onFriends,
onsyncfriendaction: onSyncFriendAction,
// 机器人
......
......@@ -39,14 +39,50 @@ export function onOfflineMsgs (obj) {
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) {
const nim = store.state.nim
let isLocal='isLocal' in obj ? obj.isLocal : false
nim.sendTipMsg({
scene: obj.scene,
to: obj.to,
tip: obj.tip,
isLocal,
done: function sendTipMsgDone (error, msg) {
onSendMsgDone(error, msg)
console.log(msg)
onMsg(msg)
}
})
}
......
......@@ -6,7 +6,9 @@ export function onTeams(teams) {
teams = [teams]
}
teams = teams.filter(item => !!item)
let teamIds = []
teams.forEach(team=>{
teamIds.push(team.teamId)
if (team.validToCurrentUser === undefined) {
team.validToCurrentUser = true
}
......@@ -14,6 +16,8 @@ export function onTeams(teams) {
team.avatar = team.avatar + '?imageView&thumbnail=300y300'
}
})
getNotifyForNewTeamMsg(store,teamIds)
store.commit('updateTeamList', teams)
}
......@@ -119,9 +123,9 @@ export function onTeamMsgReceipt(obj) {
// 进入可配置的群信息设置页,进入前改变state中的配置信息,进入页面后读取配置信息更新视图
export function enterSettingPage({commit}, obj) {
commit('updateTeamSettingConfig', obj)
setTimeout(() => {
location.href = `#/teamsetting`
}, 20)
// setTimeout(() => {
// location.href = `#/teamsetting`
// }, 20)
}
......@@ -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) {
var result = /team-(\d+)/.exec(state.currSessionId)
if (!result) {
......
......@@ -124,6 +124,19 @@ export default {
const nim = state.nim
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) {
const nim = state.nim
......@@ -170,6 +183,9 @@ 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 (tempMsgs.length === 0 || msg.time >= tempMsgs[lastMsgIndex].time) {
tempMsgs.push(msg)
} else {
......@@ -208,7 +224,6 @@ export default {
let lastMsgIndex = tempMsgs.length - 1
for (let i = lastMsgIndex; i >= 0; i--) {
let currMsg = tempMsgs[i]
console.log(idClient, currMsg.idClient, currMsg.text)
if (idClient === currMsg.idClient) {
state.msgs[sessionId].splice(i, 1, msg)
break
......@@ -481,6 +496,13 @@ export default {
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'
}
})
},
updateTeamMembers (state, obj) {
const nim = state.nim
var teamId = obj.teamId
......
......@@ -33,7 +33,7 @@ export default {
// 黑名单列表
blacklist: [],
// 禁言列表
// mutelist: [],
mutelist: [],
teamlist: [],
// 群自身的属性,数据结构如:{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