qiushang hace 10 meses
padre
commit
aedcd536f1

+ 3 - 3
nsis/test.nsi

@@ -1,16 +1,16 @@
 # ====================== 自定义宏 产品信息==============================
 !define PRODUCT_MID        		    "Ds8JqlRmiiGR"
-!define PRODUCT_VERSION        		"2.0.4.1"
+!define PRODUCT_VERSION        		"2.0.4.2"
 !define PRODUCT_NAME           		"星优图片下载助手"
 !define INSTALL_OUTPUT_NAME    		"XYCapture_XY.exe" 
 !define EXE_NAME               		"XYCapture.exe"
 !define PRODUCT_PATHNAME           	"XYCapture"     #安装卸载项用到的KEY,注册表
 !define INSTALL_APPEND_PATH         "XYCapture"     #安装路径追加的名称 
-!define APP_DOWNLOAD_URL    		"https://xy.xingyousoft.com/soft/XYCapture/lastest2.0.4.1.7z"
+!define APP_DOWNLOAD_URL    		"https://xy.xingyousoft.com/soft/XYCapture/lastest2.0.4.2.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/XYCapture/uninstallWeb/?v=2.0.4.1"   # 接卸优惠网址
+!define UNINSTALL_url               "https://xy.xingyousoft.com/soft/XYCapture/uninstallWeb/?v=2.0.4.2"   # 接卸优惠网址
 
 # ====================== 自定义宏 安装信息==============================
 !define INSTALL_7Z_NAME 	   		"app.7z"

+ 1 - 1
package.json

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

+ 1 - 0
src/renderer/components/header.vue

@@ -301,6 +301,7 @@
 					this.deleteFolder(path2, false);
 					setTimeout(() => {
 						this.$message({message: '缓存清除成功!', type: 'success'});
+						this.$emit('clear-cache', true);
 						this.cacheLoading = false;
 					}, 3000)
 				}).catch(() => {

+ 68 - 54
src/renderer/components/home.vue

@@ -49,7 +49,7 @@
 				
 				<el-container>
 					<el-header height="45px" style="background-color: #fafafa; padding: 0 10px;">
-						<soft-header ref="headerRef" @update-soft="updateSoft()" @export-file="exportFile" @login-url="loginUrl"></soft-header>
+						<soft-header ref="headerRef" @update-soft="updateSoft()" @export-file="exportFile" @login-url="loginUrl" @clear-cache="clearCache"></soft-header>
 					</el-header>
 					
 					<soft-img ref="imgRef" v-show="['2-1', '2-2', '2-3', '2-5'].indexOf(menuIndex) > -1" @open-vip="openVip" @check-authority="checkAuthority"></soft-img>
@@ -101,8 +101,9 @@
 											(需登录京东账号后才能下载)
 										</el-link>
 									</div>
-									
-									<el-link v-if="tbStatus == 3 || jdStatus == 3" :underline="false" type="danger" style="text-align: center; font-size: 12px;">登录完成后请关闭浏览器</el-link>
+									<template v-if="menuIndex == '2' || menuIndex == '3' || menuIndex == '4'">
+										<el-link v-if="tbStatus == 3 || jdStatus == 3" :underline="false" type="danger" style="text-align: center; font-size: 12px;">登录完成后请关闭浏览器</el-link>
+									</template>
 								</el-row>
 								
 								<div style="padding: 15px 0 20px;">
@@ -236,6 +237,7 @@
 	import os from 'os'
 	import fs from 'fs'
 	import request from 'request'
+	import path from 'path';
 	import xlsx from 'node-xlsx';
 	import softUpdate from './update.vue';
 	import softHeader from './header.vue';
@@ -355,6 +357,11 @@
 			if (!fs.existsSync(os.tmpdir() + separator + 'chrome-data-capture-jd')) {
 				fs.mkdirSync(os.tmpdir() + separator + 'chrome-data-capture-jd');
 			}
+			
+			let path = os.tmpdir() + separator + 'chrome-data-capture';
+			let path2 = os.tmpdir() + separator + 'chrome-data-capture-jd';
+			this.deleteAll(path, false);
+			this.deleteAll(path2, false);
 
 			// 打开浏览器
 			const {
@@ -371,6 +378,22 @@
 			
 		},
 		methods: {
+			// 删除文件夹内容
+			deleteAll(folderPath, flag) {
+				if (fs.existsSync(folderPath)) {
+					fs.readdirSync(folderPath).forEach((file, index) => {
+						var curPath = path.join(folderPath, file);
+						if (fs.lstatSync(curPath).isDirectory()) {
+							this.deleteAll(curPath, true);
+						} else {
+							fs.unlinkSync(curPath);
+						}
+					});
+					if(flag){
+						fs.rmdirSync(folderPath);
+					}
+				}
+			},
 			checkAuthority(){
 				let authority = this.$refs.headerRef.authority;
 				this.$refs.imgRef.authority = authority;
@@ -576,6 +599,12 @@
 				});
 			},
 			
+			// 清除缓存
+			clearCache(){
+				this.jdStatus = 3;
+				this.tbStatus = 3;
+			},
+			
 			// 去登录
 			loginUrl(url){
 				(async () => {
@@ -656,6 +685,40 @@
 						fs.mkdirSync(os.tmpdir() + separator + 'chrome-data-capture');
 					}
 					
+					if(this.menuIndex == '2'){ // 京东
+						if(this.jdStatus == 1 || this.jdStatus == 3){  // 未检测登录状态/或提示未登录状态,开始检测
+							await this.checkJdLogin().then((data) => {
+								if(data != 2){  // 未登录
+									this.jdStatus = 3;
+									this.loginVisible = true;
+								}
+							}).catch(err => {
+								this.jdStatus = 3;
+							});
+							if(this.jdStatus == 3){
+								this.loading = false;
+								return false;
+							}
+						}
+					}
+					
+					if(this.menuIndex == '3' || this.menuIndex == '4'){ // 天猫/淘宝
+						if(this.tbStatus == 1 || this.tbStatus == 3){  // 未检测登录状态/或提示未登录状态,开始检测
+							await this.checkLogin().then((data) => {
+								if(data != 2){ // 未登录
+									this.tbStatus = 3;
+									this.loginVisible = true;
+								}
+							}).catch(err => {
+								this.tbStatus = 3;
+							});
+						}
+						if(this.tbStatus == 3){
+							this.loading = false;
+							return false;
+						}
+					}
+					
 					let taskArr = [];
 					let task = "";
 					for(let i = 0; i < fileList.length; i++){
@@ -666,11 +729,11 @@
 								task = this.alibabaDownload(item);
 								break;
 							case '2': // 京东
-								task = this.jdDownload(item);
+								task = this.jdScanImg(item);
 								break;
 							case '3': // 天猫
 							case '4': // 淘宝
-								task = this.tbDownload(item);
+								task = this.tbScanImg(item);
 								break;
 							case '10': // 普通网址
 								task = this.normalDownload(item);
@@ -953,29 +1016,6 @@
 				});
 			},
 			
-			//京东下载
-			async jdDownload(urlInfo){
-				let task = null;
-				if(this.jdStatus == 1 || this.jdStatus == 3){  // 未检测登录状态/或提示未登录状态,开始检测
-					await this.checkJdLogin().then((data) => {
-						if(data == 2){ // 已经登录,处理下载
-							task = this.jdScanImg(urlInfo);
-						}else{ // 未登录
-							task = 'notLogin';
-							this.jdStatus = 3;
-							this.loginVisible = true;
-						}
-					}).catch(err => {
-						task = 'notLogin';
-						this.jdStatus = 3;
-					});
-				}else if(this.jdStatus == 2){ // 已经登录
-					task = this.jdScanImg(urlInfo);
-				}
-				
-				return task;
-			},
-			
 			// 京东下载
 			async jdScanImg(urlInfo){
 				let task = await new Promise((resolve,reject) =>{
@@ -1247,32 +1287,6 @@
 				});
 				
 			},
-	
-			//淘宝\天猫下载
-			async tbDownload(urlInfo){
-				let task = null;
-				if(this.tbStatus == 1 || this.tbStatus == 3){  // 未检测登录状态/或提示未登录状态,开始检测
-					await this.checkLogin().then((data) => {
-						if(data == 2){ // 已经登录,处理下载
-							task = this.tbScanImg(urlInfo);
-						}else{ // 未登录
-							task = 'notLogin';
-							this.tbStatus = 3;
-							this.loginVisible = true;
-							// this.$notify.error({
-							// 	title: '淘宝/天猫账号未登录,下载失败! - error'
-							// });
-						}
-					}).catch(err => {
-						task = 'notLogin';
-						this.tbStatus = 3;
-					});
-				}else if(this.tbStatus == 2){ // 已经登录
-					task = this.tbScanImg(urlInfo);
-				}
-				
-				return task;
-			},
 			
 			// 淘宝天猫扫描下载图片
 			async tbScanImg(urlInfo){

+ 3 - 0
src/renderer/components/update.vue

@@ -95,6 +95,9 @@
 				<el-collapse-item title="报错:权限受限,请以管理员权限运行软件" name="8">
 					<div>软件权限受系统限制无法运行,需要退出软件,鼠标右击软件图标以管理员权限运行一下。</div>
 				</el-collapse-item>
+				<el-collapse-item title="为什么每次打开软件,需要重新登录平台账号" name="9">
+					<div>为了考虑安全性,软件在退出后会清空所有的缓存和账号信息,因此每次重新打开软件需要要求用户重新登录各个平台账号。</div>
+				</el-collapse-item>
 			</el-collapse>
 			<div slot="footer" class="dialog-footer-center">
 				<el-button @click="questionVisible = false;">关闭</el-button>