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

修改@功能

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