qiushang 10 сар өмнө
parent
commit
8c577fad04

+ 1 - 0
package.json

@@ -40,6 +40,7 @@
     "fast-glob": "^3.3.2",
     "fs-extra": "10.1.0",
     "request": "^2.88.2",
+    "uuid": "^10.0.0",
     "vue": "^2.5.2",
     "vue-electron": "^1.0.6",
     "vue-router": "^3.0.1",

+ 7 - 7
src/renderer/components/home.vue

@@ -140,15 +140,16 @@
 </template>
 
 <script>
-import os from 'os'
-import fs from 'fs'
+import os from 'os';
+import fs from 'fs';
 import path from 'path';
-import electronApi from '@/utils/electronApi'; 
+import electronApi from '@/utils/electronApi';
 import softUpdate from './update.vue';
 import softHeader from './header.vue';
-import pjson from '/package.json'
-import fse from 'fs-extra'
+import pjson from '/package.json';
+import fse from 'fs-extra';
 const fg = require('fast-glob');
+import { v4 as uuidv4 } from 'uuid';
 
 let separator = '';
 if (os.platform == 'linux') {
@@ -417,7 +418,6 @@ export default {
 								if(this.handleData.type == '1'){ // 复制
 									//fse.copySync(item.path, newFilePath);
 									//item.status = '2';
-									
 									fse.copy(item.path, newFilePath, {overwrite: false, errorOnExist: true}).then(() => {
 										console.log('复制成功!')
 										item.status = '2';
@@ -426,7 +426,7 @@ export default {
 										console.error('复制失败', err.toString(), item.path)
 										if(str.indexOf('already exists') > -1 && str.indexOf(item.name) > -1){
 											console.log('重新复制')
-											// newFilePath = newPath + separator + item.title + '重复' + new Date().getTime() + i + item.suffix;
+											// newFilePath = newPath + separator + item.title + '重复' + uuidv4() + i.toString() + item.suffix;
 										}
 										item.status = '6';
 									})

+ 5 - 0
yarn.lock

@@ -9430,6 +9430,11 @@ utils-merge@1.0.1:
   resolved "https://registry.npmmirror.com/utils-merge/-/utils-merge-1.0.1.tgz"
   integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==
 
+uuid@^10.0.0:
+  version "10.0.0"
+  resolved "https://registry.npmmirror.com/uuid/-/uuid-10.0.0.tgz#5a95aa454e6e002725c79055fd42aaba30ca6294"
+  integrity sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==
+
 uuid@^3.3.2:
   version "3.4.0"
   resolved "https://registry.npmmirror.com/uuid/-/uuid-3.4.0.tgz"