qiushang 7 сар өмнө
parent
commit
39282abf9a

+ 3 - 3
nsis/test.nsi

@@ -1,16 +1,16 @@
 # ====================== 自定义宏 产品信息==============================
 !define PRODUCT_MID        		    "4qgNl8jfYlLV"
-!define PRODUCT_VERSION        		"2.1.2.0"
+!define PRODUCT_VERSION        		"2.1.2.1"
 !define PRODUCT_NAME           		"星优文件名管理器"
 !define INSTALL_OUTPUT_NAME    		"XYRename_XY.exe" 
 !define EXE_NAME               		"XYRename.exe"
 !define PRODUCT_PATHNAME           	"XYRename"     #安装卸载项用到的KEY,注册表
 !define INSTALL_APPEND_PATH         "XYRename"     #安装路径追加的名称 
-!define APP_DOWNLOAD_URL    		"https://xy.xingyousoft.com/soft/XYRename/lastest2.1.2.0.7z"
+!define APP_DOWNLOAD_URL    		"https://xy.xingyousoft.com/soft/XYRename/lastest2.1.2.1.7z"
 !define PRODUCT_PUBLISHER      	    "苏州星优办公软件有限公司"
 !define PRODUCT_LEGAL          	    "苏州星优办公软件有限公司"
 !define STATISTICS_url              "https://www.xingyousoft.com/api/index/user_log"   # 统计网址
-!define UNINSTALL_url               "https://xy.xingyousoft.com/soft/XYRename/uninstallWeb/?v=2.1.2.0"   # 接卸优惠网址
+!define UNINSTALL_url               "https://xy.xingyousoft.com/soft/XYRename/uninstallWeb/?v=2.1.2.1"   # 接卸优惠网址
 
 # ====================== 自定义宏 安装信息==============================
 !define INSTALL_7Z_NAME 	   		"app.7z"

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "XYRename",
-  "version": "2.1.2.0",
+  "version": "2.1.2.1",
   "author": "苏州星优办公软件有限公司",
   "description": "An electron-vue project",
   "license": "rename",

+ 77 - 18
src/renderer/components/home.vue

@@ -376,7 +376,7 @@
 										</template>
 									</vxe-column>
 									<vxe-column field="path" title="文件位置" width="200"></vxe-column>
-									<vxe-column field="status" title="状态" width="180">
+									<vxe-column field="status" title="状态" width="260">
 										<template #default="{ row }">
 											<template v-if="row.status == '1'">
 												<i class="el-icon-info" style="font-size: 16px; color: #999;"></i>
@@ -399,14 +399,25 @@
 												<span>文件已存在</span>
 											</template>
 											<template v-if="row.status == '6'">
-												<template v-if="row.searchList && row.searchList.length > row.total">
-													<i class="el-icon-loading" style="font-size: 16px; color: #999;"></i>
-													<span>提取中<span v-if="row.searchList">,共{{row.searchList.length}}个,{{row.total}}</span></span>
-												</template>
-												<template v-else>
+												<template v-if="mergeData.extractType == '1'">
 													<i class="el-icon-success" style="font-size: 16px; color: #19be6b;"></i>
-													<span>提取成功<span v-if="row.searchList">,共{{row.searchList.length}}个,{{row.total}}</span></span>
+													<span>提取成功,成功{{row.total}}个</span>
+												</template>
+												
+												<template v-if="mergeData.extractType != '1'">
+													<template v-if="row.searchList.length > row.total + row.error">
+														<i class="el-icon-loading" style="font-size: 16px; color: #999;"></i>
+														<span v-if="row.searchList.length > 0">提取中,共{{row.searchList.length}}个,成功{{row.total}}个</span>
+														<span v-else>提取中,成功{{row.total}}个</span>
+													</template>
+													<template v-else>
+														<i class="el-icon-success" style="font-size: 16px; color: #19be6b;"></i>
+														<span v-if="row.searchList.length > 0">提取成功,共{{row.searchList.length}}个,成功{{row.total}}个</span>
+														<span v-else>提取成功,成功{{row.total}}个</span>
+													</template>
 												</template>
+												
+												
 											</template>
 										</template>
 									</vxe-column>
@@ -453,11 +464,21 @@
 										<div class="handle-item">
 											<label class="handle-label">文件类型:</label>
 											<el-select v-model="mergeData.fileType" style="width:150px;" size="small" >
-												<el-option value="1" label="图片"></el-option>
-												<el-option value="2" label="视频"></el-option>
-												<el-option value="3" label="文本"></el-option>
+												<el-option value="1" label="图片格式"></el-option>
+												<el-option value="2" label="视频格式"></el-option>
+												<el-option value="3" label="文本文档"></el-option>
 											</el-select>
 										</div>
+										
+										<el-popover placement="left" popper-class="popper-open" trigger="hover" content="内容">
+											<div>
+												<p>图片格式包含:jpg,jpeg,png,gif,bmp,ico,webp,heic,jfif,tif,tiff,svg,psd,ai,cdr,wmf</p>
+												<p>视频格式包含:mp4,avi,mov,wmv,flv,mkv,webm,m4v,3gp,mpeg,mpg,rmvb,ts,vob,rm,ram,swf</p>
+												<p>文本文档包含:txt,doc,docx,ppt,pptx,xls,xlsx,pdf</p>
+											</div>
+											
+											<div slot="reference" class="i-tips">点击查看提取的文件类型</div>
+										</el-popover>
 									</template>
 									<template v-if="mergeData.extractType == '3'">
 										<el-divider content-position="left">提取包含以下名称的文件</el-divider>
@@ -1220,7 +1241,8 @@ export default {
 					path: dirs[i].slice(0, lastIndex+1),
 					status: "1",
 					searchList: [],
-					total: 0
+					total: 0,
+					error: 0
 				};
 				
 				if(this.dirList.length == 0){
@@ -1945,7 +1967,27 @@ export default {
 							this.traverseDirectoryIteratively(i, this.mergeData.newPath, 'folder').catch(console.error);
 							break;
 						case "2": // 按类型提取
-							
+							(async () => {
+								let ruleStr = [];
+								let searchDir = item.path.replace(/\\/g, '/') + item.name;
+								let suffixStr = '';
+								switch(this.mergeData.fileType){
+									case '1':
+										suffixStr = '{jpg,jpeg,png,gif,bmp,ico,webp,heic,jfif,tif,tiff,svg,psd,ai,cdr,wmf}';
+										break;
+									case '2':
+										suffixStr = '{mp4,avi,mov,wmv,flv,mkv,webm,m4v,3gp,mpeg,mpg,rmvb,ts,vob,rm,ram,swf}';
+										break;
+									case '3':
+										suffixStr = '{txt,doc,docx,ppt,pptx,xls,xlsx,pdf}';
+										break;
+								}
+								ruleStr.push(searchDir + '/**/' + '*.' + suffixStr);
+								const files = await fg(ruleStr, { dot: true, caseSensitiveMatch: false});
+								this.dirList[i].searchList = files;
+								
+								this.traverseDirectoryIteratively(i, this.mergeData.newPath, 'files').catch(console.error);
+							})();
 							break;
 						case "3": // 按名称提取
 							(async () => {
@@ -1974,6 +2016,8 @@ export default {
 								ruleStr.push(searchDir + '/**/' + '*.' + this.mergeData.suffixName);
 								const files = await fg(ruleStr, { dot: true });
 								this.dirList[i].searchList = files;
+								
+								this.traverseDirectoryIteratively(i, this.mergeData.newPath, 'files').catch(console.error);
 							})();
 							break;
 					}
@@ -1983,6 +2027,12 @@ export default {
 		},
 		// 按文件夹提取文件
 		async traverseDirectoryIteratively(index, newPath, type) {
+			let authority = this.$refs.headerRef.authority;
+			let size = 999999999;
+			if(!authority.isAuthority){
+				size = 5;
+			}
+			
 			const fs = require('fs').promises;
 			if(!this.dirList[index].total){
 				this.dirList[index].total = 0;
@@ -2007,14 +2057,17 @@ export default {
 				                if (entry.isDirectory()) {
 									queue.push(fullPath); // 将子目录添加到队列中以便后续遍历
 				                } else if (entry.isFile()) {
-				                    // 处理文件
-									console.log(`Found file: ${fullPath}`);
+									// 处理文件 console.log(`Found file: ${fullPath}`);
 									let targetPath = newPath + separator + entry.name;
-									await fs.copyFile(fullPath, targetPath);
-									this.dirList[index].total += 1;
+									if(this.dirList[index].total < size){
+										await fs.copyFile(fullPath, targetPath);
+										this.dirList[index].total += 1;
+									}
+									
 				                }
 				            }
 				        } catch (err) {
+							this.dirList[index].error += 1;
 				            console.error(`Unable to scan directory: ${currentPath}, Error: ${err}`);
 				        }
 				    }
@@ -2024,8 +2077,14 @@ export default {
 					for (const entry of this.dirList[index].searchList) {
 						let filename = entry.substr(entry.lastIndexOf('/')+1);
 						let targetPath = newPath + separator + filename;
-						await fs.copyFile(entry, targetPath);
-						this.dirList[index].total += 1;
+						if(this.dirList[index].total < size){
+							await fs.copyFile(entry, targetPath);
+							this.dirList[index].total += 1;
+							if(this.dirList[index].total > this.dirList[index].searchList.length){
+								this.dirList[index].total = this.dirList[index].searchList.length;
+							}
+						}
+						
 					}
 				} catch (err) {
 					console.error(`Unable to scan directory: Error: ${err}`);