diff --git a/package.json b/package.json index 4e0ed40..07ca6e7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.0.0", + "version": "1.0.1", "description": "An Electron application with Vue", "main": "./out/main/index.js", "author": "lichong", diff --git a/src/main/index.js b/src/main/index.js index 5d51b3b..86ca81c 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -63,6 +63,7 @@ app.whenReady().then(() => { for (let index = 0; index < pathList.length; index++) { let element = pathList[index]; let folderPath = path.join("D:\\test\\", element); + folderPath = Buffer.from(folderPath, 'utf8').toString('utf8'); try { fs.mkdirSync(`${folderPath}\\`, { recursive: true }); successList.push(element) @@ -80,6 +81,8 @@ app.whenReady().then(() => { let errorList = [] let oldfolderPath = path.join("D:\\test\\", pathObj.oldPath); let newfolderPath = path.join("D:\\test\\", pathObj.newPath); + oldfolderPath = Buffer.from(oldfolderPath, 'utf8').toString('utf8'); + newfolderPath = Buffer.from(newfolderPath, 'utf8').toString('utf8'); try { fs.rename(`${oldfolderPath}\\`, `${newfolderPath}\\`, error => { if (error) { @@ -118,6 +121,8 @@ app.whenReady().then(() => { let element = pathList[index]; let destinationFilePath = path.join("D:\\test\\", element.path); let sourceFilePath = element.prePath; + destinationFilePath = Buffer.from(destinationFilePath, 'utf8').toString('utf8'); + sourceFilePath = Buffer.from(sourceFilePath, 'utf8').toString('utf8'); try { fs.copyFileSync(sourceFilePath, destinationFilePath); successList.push(element) @@ -144,9 +149,9 @@ app.whenReady().then(() => { }) // 下载文件 ipcMain.on('downloadFile', (e, pathStr) => { - let filePath = path.join("D:\\test\\", pathStr); + let filePath = path.join("D:\\test\\", pathStr.replace("D:\\test\\", "")); // 读取文件后传给前端 - fs.readFile(filePath, function (err, data) { + fs.readFile(filePath, 'utf8', function (err, data) { if (err) { console.error('读取文件时出错:', err); mainWindow.webContents.send(`downloadFileResult`, { success: false, error: err.message }); @@ -164,6 +169,7 @@ app.whenReady().then(() => { for (let index = 0; index < pathList.length; index++) { let element = pathList[index]; let folderPath = path.join("D:\\test\\", element); + folderPath = Buffer.from(folderPath, 'utf8').toString('utf8'); try { fs.mkdirSync(`${folderPath}\\`, { recursive: true }); successFolderList.push(element) @@ -178,6 +184,8 @@ app.whenReady().then(() => { let element = tableList[index]; let destinationFilePath = path.join("D:\\test\\", element.path.replace("D:\\test\\", "")); let sourceFilePath = element.prePath; + destinationFilePath = Buffer.from(destinationFilePath, 'utf8').toString('utf8'); + sourceFilePath = Buffer.from(sourceFilePath, 'utf8').toString('utf8'); // 读取文件大小 let fileSize = fs.statSync(sourceFilePath).size; element.size = fileSize diff --git a/src/renderer/src/App.vue b/src/renderer/src/App.vue index e33a37d..a7ec76a 100644 --- a/src/renderer/src/App.vue +++ b/src/renderer/src/App.vue @@ -27,7 +27,7 @@ export default { computed: {}, methods: {}, async mounted() { - let fiveDay = dayjs('2024-12-05T00:00:00').valueOf() + let fiveDay = dayjs('2024-12-14T00:00:00').valueOf() if (!this.isVip) { if (dayjs().valueOf() > fiveDay) { this.isVip = false diff --git a/src/renderer/src/components/treecomponent.vue b/src/renderer/src/components/treecomponent.vue index c39f8cd..ae3b5fb 100644 --- a/src/renderer/src/components/treecomponent.vue +++ b/src/renderer/src/components/treecomponent.vue @@ -3,13 +3,14 @@