Commit 27d1f42c authored by 罗超's avatar 罗超

部分调整

parent 4b4dd98a
...@@ -713,7 +713,7 @@ ipc.on('delete-file', function(event, p) { ...@@ -713,7 +713,7 @@ ipc.on('delete-file', function(event, p) {
fs.unlink(p, function(err) {}) fs.unlink(p, function(err) {})
}) })
ipc.on('send-file', function(event, obj) { ipc.on('send-file', function(event, obj) {
let { scene, to, filePath, name, size, md5, type, file } = obj let { scene, to, filePath, name, size, md5, type, fileInfo } = obj
let customMsg = { let customMsg = {
"msgtype": "custom_file", "msgtype": "custom_file",
"data": { "data": {
...@@ -730,6 +730,9 @@ ipc.on('send-file', function(event, obj) { ...@@ -730,6 +730,9 @@ ipc.on('send-file', function(event, obj) {
"Width": "210" "Width": "210"
} }
} }
if (!nim) {
initNIM(global.LOGINUSER.ImAccount, global.LOGINUSER.ImToken)
}
nim.sendFile({ nim.sendFile({
scene, scene,
to, to,
...@@ -738,7 +741,7 @@ ipc.on('send-file', function(event, obj) { ...@@ -738,7 +741,7 @@ ipc.on('send-file', function(event, obj) {
custom: JSON.stringify(customMsg), custom: JSON.stringify(customMsg),
uploadprogress: function(data) { uploadprogress: function(data) {
file.progess = data.percentage file.progess = data.percentage
console.log(file) console.log(data)
event.sender.send('sending-process', file) event.sender.send('sending-process', file)
}, },
uploaderror: function() { uploaderror: function() {
...@@ -753,6 +756,7 @@ ipc.on('send-file', function(event, obj) { ...@@ -753,6 +756,7 @@ ipc.on('send-file', function(event, obj) {
//onSendMsgDone(error, msg) //onSendMsgDone(error, msg)
} }
}) })
}) })
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');
...@@ -1149,7 +1153,7 @@ let formatDate = function(date, format) { ...@@ -1149,7 +1153,7 @@ let formatDate = function(date, format) {
}; };
let initNIM = function(uid, token) { let initNIM = function(uid, token) {
try { try {
nim = SDK.getInstance({ nim = SDK.NIM.getInstance({
debug: false, debug: false,
appKey: 'b612b31e837c79c68f141aeb719d2b20', appKey: 'b612b31e837c79c68f141aeb719d2b20',
account: uid, account: uid,
...@@ -1192,9 +1196,9 @@ let initNIM = function(uid, token) { ...@@ -1192,9 +1196,9 @@ let initNIM = function(uid, token) {
function onError(error) { function onError(error) {
// console.log(error); // console.log(error);
console.log('error........') console.log('error........', error)
} }
} catch (error) { } catch (error) {
console.log('error2........', error)
} }
} }
\ No newline at end of file
...@@ -88,7 +88,6 @@ export default { ...@@ -88,7 +88,6 @@ export default {
}); });
this.$electron.ipcRenderer.on("sending-process", (event, file) => { this.$electron.ipcRenderer.on("sending-process", (event, file) => {
console.log(file)
this.GLOBALSENDING.forEach(x => { this.GLOBALSENDING.forEach(x => {
if ((x.msgId = file.msgId)) { if ((x.msgId = file.msgId)) {
x = file; x = file;
......
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