Commit 93156bb9 authored by 罗超's avatar 罗超

修改@功能

parent ff9c78b8
......@@ -88,7 +88,9 @@ const appXmlPath = process.execPath.substring(0, process.execPath.lastIndexOf('\
const forwardUrl = process.env.NODE_ENV === 'development' ? `http://localhost:9080/#/forwardMsg` : `file://${__dirname}/index.html#/forwardMsg`
const workWin = process.env.NODE_ENV === 'development' ? `http://localhost:9080/#/workWin` : `file://${__dirname}/index.html#/workWin`
process.on('uncaughtException', error => {
console.log(error)
});
if (process.env.NODE_ENV !== 'development') {
global.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\')
......@@ -545,7 +547,7 @@ ipc.on('get-face', function(event, keyword) {
})
req.end()
})
ipc.on('get-url-info', function (event, url, id) {
ipc.on('get-url-info', function(event, url, id) {
let html = "",
list = [],
buffer = null,
......@@ -559,7 +561,7 @@ ipc.on('get-url-info', function (event, url, id) {
html = buffer.toString()
let $ = cheerio.load(html)
let src = ""
if ($("img")) {
if ($("img")) {
for (var i = 1; i <= 1; i++) {
$("img").each((index, ele) => {
src = $(ele).attr("data-original-src") ? $(ele).attr("data-original-src") : $(ele).attr("src")
......@@ -760,32 +762,36 @@ ipc.on('send-file', function(event, obj) {
"Width": "210"
}
}
console.log(nim.sendFile)
if (!nim) {
console.log(global.LOGINUSER)
initNIM(global.LOGINUSER.ImAccount, global.LOGINUSER.ImToken)
}
nim.sendFile({
scene,
to,
type,
filePath,
custom: JSON.stringify(customMsg),
uploadprogress: function(data) {
file.progess = data.percentage
console.log(data)
event.sender.send('sending-process', file)
},
uploaderror: function() {
},
uploaddone: function(error, file) {
file.progess = 100
event.sender.send('sending-process', file)
},
beforesend: function(msg) {},
done: function(error, msg) {
//onSendMsgDone(error, msg)
}
})
} else {
nim.sendFile({
scene,
to,
type,
filePath,
custom: JSON.stringify(customMsg),
uploadprogress: function(data) {
file.progess = data.percentage
console.log(data)
event.sender.send('sending-process', file)
},
uploaderror: function() {
},
uploaddone: function(error, file) {
file.progess = 100
event.sender.send('sending-process', file)
},
beforesend: function(msg) {},
done: function(error, msg) {
//onSendMsgDone(error, msg)
}
})
}
})
ipc.on('read-clip', function(event) {
......
......@@ -125,6 +125,10 @@ export default {
//登录成功
var userData = jsonData.data;
localStorage.user = JSON.stringify(userData);
localStorage.imAccount = userData.ImAccount
if(!localStorage.currentAts){
localStorage.currentAts='{}'
}
if (this.usermodel.remeber) {
this.usermodel.userpic = userData.Icon;
this.usermodel.username = userData.emName;
......
......@@ -214,7 +214,6 @@ export default {
},
data() {
return {
sessionlistHis: [],
sessionKey: "",
currentSession: {
id: ""
......@@ -236,33 +235,32 @@ export default {
atIds:null,
forwardMsgInfo:{},
sessionlistArr: [],
initSessionList:[]
};
},
updated() {
// 提交sdk连接请求
this.$store.dispatch("connect");
this.$store.dispatch("updateRefreshState");
}, watch: {
// 监听消息接受
sessionlistHis(newVal, oldVal) {
if (JSON.stringify(newVal) !== JSON.stringify(oldVal)) {
this.getUnreadHis()
}
}
},
methods: {
// 获取会话列表有未读消息的会话的所有聊天记录
getUnreadHis: function (){
let list = this.sessionlistHis
for(let i = 0; i < list.length; i++){
getAts(){
if(this.initSessionList && this.initSessionList.length>0){
this.$store.dispatch("getHistoryMsgs", {
scene: list[i].scene,
to: list[i].to,
pageDatas: list[i].unread,
scene: this.initSessionList[0].scene,
to: this.initSessionList[0].to,
pageDatas: this.initSessionList[0].unread
});
console.log('go..........')
if(this.initSessionList.length==1){
this.initSessionList=[]
}else{
this.initSessionList.splice(0,1)
setTimeout(() => {
this.getAts()
}, 500);
}
}
// let msgs = this.$store.state.unreadListHis;
// console.log(msgs, "// 获取会话列表有未读消息的会话的所有聊天记录")
},
showNotice() {
this.$electron.ipcRenderer.send('load-notice')
......@@ -545,6 +543,21 @@ export default {
this.MsgBus.$on("create-session", function(obj) {
that.createSession(obj)
});
//
setTimeout(() => {
this.initSessionList=this.sessionlist.filter(x=>{
console.log(x.lastMsg)
if(x.scene=='team' && x.unread>0 && x.unread<100){
return x
}else{
return false
}
})
console.log(this.initSessionList)
if(this.initSessionList.length>0){
this.getAts()
}
}, 2000);
},
computed: {
sysMsgUnread() {
......@@ -565,7 +578,6 @@ export default {
},
sessionlist() {
let unreadList = [];
let sessionlistHis = []
let historicList = window.localStorage.historicList ? JSON.parse(window.localStorage.historicList) : [];
// console.log("this.$store.state.sessionlist", this.$store.state.sessionlist)
let sessionlist = this.$store.state.sessionlist.filter(item => {
......@@ -596,9 +608,6 @@ export default {
item.avatar = userInfo.avatar;
}
} else if (item.scene === "team") {
if (item.unread > 0) {
sessionlistHis.push(item)
}
let teamInfo = null;
teamInfo = this.$store.state.teamlist.find(team => {
return team.teamId === item.to;
......@@ -742,7 +751,6 @@ export default {
this.newMsgList = unreadList;
this.sessionlistHis = sessionlistHis;
return sessionlist;
}
// netState(){
......
......@@ -258,9 +258,14 @@ export default {
}
},
// 装入未读消息
unreadListHis(state, obj) {
state.unreadListHis[obj.to] = obj.msgs
console.log(state.unreadListHis, "装数据")
unreadListHis(state, obj) {
let currentAts = JSON.parse(localStorage.currentAts)
obj.msgs.forEach(x => {
if (x.apns && x.apns.accounts && x.apns.accounts.indexOf(localStorage.imAccount) != -1) {
currentAts[obj.to] = x.idServer
}
})
localStorage.currentAts = JSON.stringify(currentAts) || {}
},
// clearMsgs(state, obj) {
// state.msgs = []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment