qiushang 9 月之前
父节点
当前提交
0589b9c46d
共有 2 个文件被更改,包括 68 次插入60 次删除
  1. 1 1
      package.json
  2. 67 59
      src/renderer/components/home.vue

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
 	"name": "XYCapture",
-	"version": "2.0.5.1",
+	"version": "2.0.5.2",
 	"author": "苏州星优办公软件有限公司",
 	"description": "An electron-vue project",
 	"license": "capture",

+ 67 - 59
src/renderer/components/home.vue

@@ -1300,30 +1300,34 @@
 								
 								return outObj;
 							}, authority, this.execNum);
-							// 主图下载
-							for(let j = 0; j < imgInfo.mainImg.length; j++){
-								let fileName = imgInfo.mainImg[j].split('/').pop();
-								if(fileName){
-									let queryIndex = fileName.indexOf('?');
-									if (queryIndex !== -1) {
-										fileName = fileName.substr(0, queryIndex);  
-									}
-									
-									let num = Number(j) + 1;
-									let suffix = '';
-									if(fileName.lastIndexOf('.') > -1){
-										suffix = fileName.substr(fileName.lastIndexOf('.'));
-									}
-									
-									if (!fs.existsSync(urlInfo.newPath + '\\主图')) {
-										fs.mkdirSync(urlInfo.newPath + '\\主图');
+							
+							if(this.settingArr.indexOf('mainImg') > -1){
+								// 主图下载
+								for(let j = 0; j < imgInfo.mainImg.length; j++){
+									let fileName = imgInfo.mainImg[j].split('/').pop();
+									if(fileName){
+										let queryIndex = fileName.indexOf('?');
+										if (queryIndex !== -1) {
+											fileName = fileName.substr(0, queryIndex);  
+										}
+										
+										let num = Number(j) + 1;
+										let suffix = '';
+										if(fileName.lastIndexOf('.') > -1){
+											suffix = fileName.substr(fileName.lastIndexOf('.'));
+										}
+										
+										if (!fs.existsSync(urlInfo.newPath + '\\主图')) {
+											fs.mkdirSync(urlInfo.newPath + '\\主图');
+										}
+										
+										let outputPath = urlInfo.newPath + '\\主图\\主图' + num + suffix;
+										await this.downloadImage(imgInfo.mainImg[j], outputPath, urlInfo);
 									}
-									
-									let outputPath = urlInfo.newPath + '\\主图\\主图' + num + suffix;
-									await this.downloadImage(imgInfo.mainImg[j], outputPath, urlInfo);
 								}
 							}
 							
+							
 							// sku图片下载
 							if(this.settingArr.indexOf('skuImg') > -1){
 								for(let j = 0; j < imgInfo.skuImg.length; j++){
@@ -1586,27 +1590,29 @@
 										imgInfo.video = responseVideo;
 									}
 									
-									// 主图下载
-									for(let j = 0; j < imgInfo.mainImg.length; j++){
-										let fileName = imgInfo.mainImg[j].split('/').pop();
-										if(fileName){
-											let queryIndex = fileName.indexOf('?');
-											if (queryIndex !== -1) {
-												fileName = fileName.substr(0, queryIndex);  
-											}
-											
-											let num = Number(j) + 1;
-											let suffix = '';
-											if(fileName.lastIndexOf('.') > -1){
-												suffix = fileName.substr(fileName.lastIndexOf('.'));
-											}
-											
-											if (!fs.existsSync(urlInfo.newPath + '\\主图')) {
-												fs.mkdirSync(urlInfo.newPath + '\\主图');
+									if(this.settingArr.indexOf('mainImg') > -1){
+										// 主图下载
+										for(let j = 0; j < imgInfo.mainImg.length; j++){
+											let fileName = imgInfo.mainImg[j].split('/').pop();
+											if(fileName){
+												let queryIndex = fileName.indexOf('?');
+												if (queryIndex !== -1) {
+													fileName = fileName.substr(0, queryIndex);  
+												}
+												
+												let num = Number(j) + 1;
+												let suffix = '';
+												if(fileName.lastIndexOf('.') > -1){
+													suffix = fileName.substr(fileName.lastIndexOf('.'));
+												}
+												
+												if (!fs.existsSync(urlInfo.newPath + '\\主图')) {
+													fs.mkdirSync(urlInfo.newPath + '\\主图');
+												}
+												
+												let outputPath = urlInfo.newPath + '\\主图\\主图' + num + suffix;
+												await this.downloadImage(imgInfo.mainImg[j], outputPath, urlInfo);
 											}
-											
-											let outputPath = urlInfo.newPath + '\\主图\\主图' + num + suffix;
-											await this.downloadImage(imgInfo.mainImg[j], outputPath, urlInfo);
 										}
 									}
 									
@@ -1794,26 +1800,28 @@
 				}, authority, this.execNum);
 				
 				// 主图下载
-				for(let j = 0; j < imgInfo.mainImg.length; j++){
-					let fileName = imgInfo.mainImg[j].split('/').pop();
-					if(fileName){
-						let queryIndex = fileName.indexOf('?');
-						if (queryIndex !== -1) {
-							fileName = fileName.substr(0, queryIndex);  
-						}
-						
-						let num = Number(j) + 1;
-						let suffix = '';
-						if(fileName.lastIndexOf('.') > -1){
-							suffix = fileName.substr(fileName.lastIndexOf('.'));
-						}
-						
-						if (!fs.existsSync(urlInfo.newPath + '\\主图')) {
-							fs.mkdirSync(urlInfo.newPath + '\\主图');
+				if(this.settingArr.indexOf('mainImg') > -1){
+					for(let j = 0; j < imgInfo.mainImg.length; j++){
+						let fileName = imgInfo.mainImg[j].split('/').pop();
+						if(fileName){
+							let queryIndex = fileName.indexOf('?');
+							if (queryIndex !== -1) {
+								fileName = fileName.substr(0, queryIndex);  
+							}
+							
+							let num = Number(j) + 1;
+							let suffix = '';
+							if(fileName.lastIndexOf('.') > -1){
+								suffix = fileName.substr(fileName.lastIndexOf('.'));
+							}
+							
+							if (!fs.existsSync(urlInfo.newPath + '\\主图')) {
+								fs.mkdirSync(urlInfo.newPath + '\\主图');
+							}
+							
+							let outputPath = urlInfo.newPath + '\\主图\\主图' + num + suffix;
+							await this.downloadImage(imgInfo.mainImg[j], outputPath, urlInfo);
 						}
-						
-						let outputPath = urlInfo.newPath + '\\主图\\主图' + num + suffix;
-						await this.downloadImage(imgInfo.mainImg[j], outputPath, urlInfo);
 					}
 				}