|
@@ -256,7 +256,11 @@
|
|
|
|
|
|
<el-dialog title="提示" :visible.sync="loginVisible" width="400px" :close-on-click-modal="false" :close-on-press-escape="false">
|
|
|
<div style="text-align: center; color: #999; font-size: 14px;">
|
|
|
- <template v-if="menuIndex == '2'">
|
|
|
+ <template v-if="menuIndex == '1'">
|
|
|
+ <p>阿里巴巴渠道需要登录后才能下载</p>
|
|
|
+ <p class="visible-tips-style">目前检测还未登录阿里巴巴账号,需立即登录</p>
|
|
|
+ </template>
|
|
|
+ <template v-else-if="menuIndex == '2'">
|
|
|
<p>京东渠道需要登录后才能下载</p>
|
|
|
<p class="visible-tips-style">目前检测还未登录京东账号,需立即登录</p>
|
|
|
</template>
|
|
@@ -272,6 +276,7 @@
|
|
|
</div>
|
|
|
<div slot="footer" class="dialog-footer-center">
|
|
|
<el-button v-if="menuIndex == '2'" @click="loginVisible = false; loginUrl('https://passport.jd.com/new/login.aspx')">点击登录京东账号</el-button>
|
|
|
+ <el-button v-else-if="menuIndex == '1'" @click="loginVisible = false; loginUrl('https://www.1688.com')">点击登录阿里巴巴账号</el-button>
|
|
|
<el-button v-else-if="menuIndex == '5'" @click="loginVisible = false; loginUrl('https://www.xiaohongshu.com')">点击登录小红书账号</el-button>
|
|
|
<el-button v-else @click="loginVisible = false; loginUrl('https://login.taobao.com')">点击登录天猫/淘宝账号</el-button>
|
|
|
</div>
|
|
@@ -839,6 +844,23 @@
|
|
|
fs.mkdirSync(os.tmpdir() + separator + 'chrome-data-capture');
|
|
|
}
|
|
|
|
|
|
+ if(this.menuIndex == '1'){ // 阿里巴巴
|
|
|
+ if(this.alibabaStatus == 1 || this.alibabaStatus == 3){ // 未检测登录状态/或提示未登录状态,开始检测
|
|
|
+ await this.checkAlibabaLogin().then((data) => {
|
|
|
+ if(data != 2){ // 未登录
|
|
|
+ this.alibabaStatus = 3;
|
|
|
+ this.loginVisible = true;
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ this.alibabaStatus = 3;
|
|
|
+ });
|
|
|
+ if(this.alibabaStatus == 3){
|
|
|
+ this.loading = false;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if(this.menuIndex == '2'){ // 京东
|
|
|
if(this.jdStatus == 1 || this.jdStatus == 3){ // 未检测登录状态/或提示未登录状态,开始检测
|
|
|
await this.checkJdLogin().then((data) => {
|
|
@@ -1118,7 +1140,7 @@
|
|
|
|
|
|
},
|
|
|
|
|
|
- // 检查天猫淘宝登录状态
|
|
|
+ // 检查阿里巴巴登录状态
|
|
|
checkAlibabaLogin(){
|
|
|
this.checkLoading = true;
|
|
|
this.alibabaStatus = 1;
|
|
@@ -1138,27 +1160,17 @@
|
|
|
await page.setViewport({ width: 1280, height: 800 });
|
|
|
let testUrl = 'https://www.1688.com';
|
|
|
await page.goto(testUrl, {waitUntil : 'networkidle2'});
|
|
|
+
|
|
|
+ let userDiv = await page.$('div[class^=userSimpleInfo-]');
|
|
|
+ let loginDiv = await page.$('div[class^=userNotLogin-]');
|
|
|
|
|
|
- let loginInfo = await page.evaluate(() => {
|
|
|
- let navTags = document.querySelector('.site-nav-sign a');
|
|
|
- let userTags = document.querySelector('.site-nav-user a');
|
|
|
-
|
|
|
- if(navTags && navTags.innerHTML.indexOf('登录') > -1){
|
|
|
- return false;
|
|
|
- }else if(userTags){
|
|
|
- return true;
|
|
|
- }else{
|
|
|
- return false;
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- if(loginInfo){
|
|
|
- this.tbStatus = 2;
|
|
|
+ if(loginDiv){
|
|
|
+ this.alibabaStatus = 3; //未登录
|
|
|
}else{
|
|
|
- this.tbStatus = 3;
|
|
|
+ this.alibabaStatus = 2;
|
|
|
}
|
|
|
|
|
|
- resolve(this.tbStatus);
|
|
|
+ resolve(this.alibabaStatus);
|
|
|
this.checkLoading = false;
|
|
|
await this.loginBrowser.close();
|
|
|
this.loginBrowser = null;
|
|
@@ -1234,7 +1246,7 @@
|
|
|
urlInfo.status = '4';
|
|
|
resolve(true);
|
|
|
}
|
|
|
- }, 300);
|
|
|
+ }, 500);
|
|
|
|
|
|
}catch(e){
|
|
|
urlInfo.status = '5';
|
|
@@ -1991,7 +2003,7 @@
|
|
|
resolve(true);
|
|
|
this.loading = false;
|
|
|
}
|
|
|
- }, 300);
|
|
|
+ }, 500);
|
|
|
}catch(e){
|
|
|
reject(e);
|
|
|
this.showError(e);
|