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