From 4dc180a26f2922b75d8f7613716558efbc90aeb1 Mon Sep 17 00:00:00 2001 From: zhuhao <979263092@qq.com> Date: Tue, 23 Jul 2024 14:31:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8C=E6=9C=9F=EF=BC=9A=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=8A=9F=E8=83=BD=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/file.js | 5 +++-- src/renderer/src/views/prepare/index.vue | 8 ++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/file.js b/src/main/file.js index 5d516f9..5637a23 100644 --- a/src/main/file.js +++ b/src/main/file.js @@ -127,9 +127,10 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) { } else { const stats = fs.statSync(filePath) //如果线上时间大于线下时间,就需要从线上下载,否则则需要上传 - if (lastModifyTime > stats.mtime.getTime()) { + let time = new Date(lastModifyTime) + if (time > stats.mtime.getTime()) { e.reply('is-async-local-file-reply' + fileNewName, { isAsync: true, type: 'down' }) - } else if (lastModifyTime < stats.mtime.getTime()) { + } else if (time < stats.mtime.getTime()) { e.reply('is-async-local-file-reply' + fileNewName, { isAsync: true, type: 'upload' }) } } diff --git a/src/renderer/src/views/prepare/index.vue b/src/renderer/src/views/prepare/index.vue index 9a8721f..62d3300 100644 --- a/src/renderer/src/views/prepare/index.vue +++ b/src/renderer/src/views/prepare/index.vue @@ -163,6 +163,7 @@ export default { //判断是否需要从线上拿新的文件 isAsyncLocalFile(item.fileNewName, item.lastModifyTime, item.fileMd5).then( ({ isAsync, type }) => { + console.log(isAsync, type) item.async = !isAsync if (isAsync === true) { item.async = 'on' @@ -177,9 +178,12 @@ export default { }) } if (type === 'upload') { + let cookie = localStorage.getItem('Admin-Token') ipcRenderer.send('upload-file-change', { - url: item.fileFullPath, - fileName: item.fileNewName + id: item.id, + fileNewName: item.fileNewName, + cookie, + fileType: item.fileType }) ipcRenderer.once( 'upload-file-change-success' + item.fileNewName,