Commit 536bdf24 authored by 罗超's avatar 罗超

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

parents 4669e85c 37c990b0
......@@ -715,7 +715,7 @@ 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');
let filePath = rawFilePath.replace(new RegExp(String.fromCharCode(0), 'g'), '');
if (filePath && filePath.length > 0) {
......
......@@ -101,6 +101,7 @@ export default {
};
},
mounted() {
// var devInnerHeight = 658.0;
// var devDevicePixelRatio = 1.5;
// var devScaleFactor = 1.5;
......@@ -160,6 +161,7 @@ export default {
this.MsgBus.$emit("ignore-all-unRead")
})
this.$electron.ipcRenderer.on('new-screen-hot', (event,dataurl) => {
this.$electron.remote.getCurrentWindow().show();
this.MsgBus.$emit("new-screen-hot",dataurl)
})
//
......
......@@ -35,7 +35,7 @@
<div draggable="true" id="text-box" ref="box">
<!-- <textarea v-model="msgToSent" class="input" @keyup.13="sendTextMsg"></textarea>
<div class='input' @keyup.13="sendTextMsg"></div>-->
<content-editor :members='members' @force-update='forceUpdateChild' :child="inputObj" ref="editor" @send="sendTextMsg"></content-editor>
<content-editor :sessionId='sessionId' :members='members' @force-update='forceUpdateChild' :child="inputObj" ref="editor" @send="sendTextMsg"></content-editor>
</div>
<div class="bottom-op-box">
<span class="errorTip">{{errorTip}}</span>
......@@ -222,6 +222,9 @@ export default {
this.msgToSent=obj
},
openScreenhot() {
if (this.hideThisWinActive == '1') {
this.$electron.remote.getCurrentWindow().hide();
}
this.$electron.ipcRenderer.send("open-screenhot");
},
dataURLtoBlob(dataurl) {
......
......@@ -226,7 +226,8 @@ export default {
isNetError:true,
audio_base:'',
atIds:null,
forwardMsgInfo:{}
forwardMsgInfo:{},
sessionlistArr: [],
};
},
updated() {
......@@ -325,8 +326,12 @@ export default {
});
if (index != -1) this.newMsgList.splice(index, 1);
this.$electron.ipcRenderer.send("close-team-box");
this.$store.dispatch('resetNoMoreHistoryMsgs')
this.currentSession = session;
this.$store.dispatch('resetNoMoreHistoryMsgs');
this.currentSession.id = '';
let _this = this;
// setTimeout(()=>{
_this.currentSession = session;
// }, 20)
if(session.atId){
this.clearAtMe()
this.atIds=session.atId
......@@ -516,9 +521,9 @@ export default {
},
sessionlist() {
let unreadList = [];
let historicList = window.localStorage.historicList ? JSON.parse(window.localStorage.historicList) : [];
let sessionlist = this.$store.state.sessionlist.filter(item => {
if (item.to === "684cb79fe92f46877777"){
return; //过滤推送消息
}
this.createSessions=this.createSessions.filter(x=>{
......@@ -655,6 +660,14 @@ export default {
}
unreadList.push(item);
}
if (historicList && historicList.length > 0){
let sessionlist = this.sessionlistArr
historicList.map(y=>{
if (item.id == y.id) {
item.historiMsg = y.innerHTML
}
})
}
return item;
});
if (!this.$electron.remote.getCurrentWindow().isVisible()) {
......@@ -670,6 +683,8 @@ export default {
this.$electron.remote.getCurrentWindow().flashFrame(true);
}
}
this.newMsgList = unreadList;
return sessionlist;
}
......
......@@ -36,7 +36,8 @@ export default {
members:{
type: Array,
default:[]
}
},
sessionId: String,
},
components: {
At
......@@ -50,6 +51,7 @@ export default {
toolTop: 0,
toolLeft: 0,
toolShow: false,
chatId: '',
};
},
watch: {
......@@ -79,14 +81,27 @@ export default {
}
},
deep: true
},
sessionId: {
handler(newValue, oldValue) {
if (newValue) {
this.chatId = newValue
document.querySelector('#msgEditorBox').innerHTML = ''
this.gethistoricList(newValue)
}
}
}
},
beforeDestroy() {
// 重复图片问题解决方案
// 事件处理中心msgBus,vue页面销毁后,原先的监听事件并没有销毁,导致组件再次载入的时候会重复相同的事件监听,所以当组件销毁时同时需要在 beforeDestroy 钩子中销毁对应的事件监听!!!
this.offMsgBusListener()
},computed:{
},
mounted() {
this.chatId = this.sessionId
this.gethistoricList(this.sessionId)
let that = this;
this.MsgBus.$on("send-at-name", function(name) {
document.querySelector('#msgEditorBox').innerText = document.querySelector('#msgEditorBox').innerText + `@${name} `
......@@ -212,6 +227,20 @@ export default {
let myInterval = window.setInterval(this.updateClipboard, 500);
},
methods: {
gethistoricList(id){
//获取历史输入记录
let historicList = window.localStorage.historicList ? JSON.parse(window.localStorage.historicList) : [];
//如果有输入历史
if(historicList && historicList.length > 0) {
// 循环输入历史
for(let i = 0; i < historicList.length; i++) {
if (id === historicList[i].id) {
//如果有相同 赋值
document.querySelector('#msgEditorBox').innerText = historicList[i].innerHTML
}
}
}
},
offMsgBusListener(){
this.MsgBus.$off("send-at-name");
this.MsgBus.$off("new-screen-hot");
......@@ -229,6 +258,32 @@ export default {
},
changeTxt: function(e) {
this.child.txt = document.querySelector('#msgEditorBox').innerText;
let sessionText = document.querySelector('#msgEditorBox').innerText;
//获取历史输入记录
let historicList = window.localStorage.historicList ? JSON.parse(window.localStorage.historicList) : [];
let rp = false
if(historicList && historicList.length > 0) {
// 循环输入历史
for(let i = 0; i < historicList.length; i++) {
if (this.chatId === historicList[i].id) {
rp = true
if (sessionText.replace(/\s+/g,"") == '') {
historicList.splice(i, 1);
break;
}
historicList[i].innerHTML = sessionText
break;
}
}
}
if (!rp) {
historicList.push({
id: this.chatId,
innerHTML: sessionText
})
}
this.MsgBus.$emit('change-historic')
window.localStorage.historicList = JSON.stringify(historicList)
},
updateClipboard() {
this.$electron.ipcRenderer.send("auto-update-clip");
......@@ -300,6 +355,7 @@ export default {
img.style.maxHeight = "150px";
img.className='file-send-box'
document.querySelector("#msgEditorBox").appendChild(img);
this.changeTxt()
},
formatHTML(f) {
let html = `<div title='${
......
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