|
@@ -61,7 +61,7 @@
|
|
</el-row>
|
|
</el-row>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
- <div style="padding: 15px 20px 0 20px; height: calc(100% - 160px);">
|
|
|
|
|
|
+ <div style="padding: 20px 20px 0 20px; height: calc(100% - 160px);">
|
|
<el-row type="flex" justify="space-between">
|
|
<el-row type="flex" justify="space-between">
|
|
<h3>
|
|
<h3>
|
|
<span v-if="menuIndex == '1'">阿里巴巴 - </span>
|
|
<span v-if="menuIndex == '1'">阿里巴巴 - </span>
|
|
@@ -76,15 +76,17 @@
|
|
<div style="padding: 15px 0 20px;">
|
|
<div style="padding: 15px 0 20px;">
|
|
<el-row type="flex" justify="space-between">
|
|
<el-row type="flex" justify="space-between">
|
|
<div v-if="menuIndex == '10'" style="padding-top: 10px;">
|
|
<div v-if="menuIndex == '10'" style="padding-top: 10px;">
|
|
- <el-checkbox :value="true" style="opacity: 0.6; cursor: not-allowed;">下载图片</el-checkbox>
|
|
|
|
|
|
+ <label>下载类型:</label>
|
|
|
|
+ <el-checkbox :value="true" style="opacity: 0.6; cursor: not-allowed;">图片</el-checkbox>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div v-if="menuIndex < 10" style="padding-top: 10px;">
|
|
<div v-if="menuIndex < 10" style="padding-top: 10px;">
|
|
- <el-checkbox :value="true" style="opacity: 0.6; cursor: not-allowed;">下载主图</el-checkbox>
|
|
|
|
- <el-checkbox v-model="settingData.detailImg" >下载详情图</el-checkbox>
|
|
|
|
- <el-checkbox v-model="settingData.skuImg" >下载SKU图</el-checkbox>
|
|
|
|
- <el-checkbox v-model="settingData.commentImg" v-if="menuIndex == '3' || menuIndex == '4'">下载评论图</el-checkbox>
|
|
|
|
- <el-checkbox v-model="settingData.video" >下载视频</el-checkbox>
|
|
|
|
|
|
+ <label>下载类型:</label>
|
|
|
|
+ <el-checkbox :value="true" style="opacity: 0.6; cursor: not-allowed;">主图</el-checkbox>
|
|
|
|
+ <el-checkbox v-model="settingData.detailImg" >详情图</el-checkbox>
|
|
|
|
+ <el-checkbox v-model="settingData.skuImg" >SKU图</el-checkbox>
|
|
|
|
+ <el-checkbox v-model="settingData.commentImg" v-if="menuIndex == '3' || menuIndex == '4'">评论图</el-checkbox>
|
|
|
|
+ <el-checkbox v-model="settingData.video" >视频</el-checkbox>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<!-- 天猫/淘宝 -->
|
|
<!-- 天猫/淘宝 -->
|
|
@@ -252,6 +254,7 @@
|
|
checkLoading: false, //点击检测登录状态
|
|
checkLoading: false, //点击检测登录状态
|
|
tbStatus: 1, // 1、未检测 2、已经登录 3、未登录
|
|
tbStatus: 1, // 1、未检测 2、已经登录 3、未登录
|
|
execLimit: 2,
|
|
execLimit: 2,
|
|
|
|
+ execNum: 5, // 限制5张
|
|
|
|
|
|
};
|
|
};
|
|
},
|
|
},
|
|
@@ -312,7 +315,7 @@
|
|
this.menuIndex = index;
|
|
this.menuIndex = index;
|
|
if(index.indexOf('2-') > -1){
|
|
if(index.indexOf('2-') > -1){
|
|
let num = Number(index.split('-')[1]);
|
|
let num = Number(index.split('-')[1]);
|
|
- this.$refs.imgRef.menuIndex = num;
|
|
|
|
|
|
+ this.$refs.imgRef.setMenuIndex(num);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 选择目录
|
|
// 选择目录
|
|
@@ -569,9 +572,11 @@
|
|
|
|
|
|
// 10-普通网址下载
|
|
// 10-普通网址下载
|
|
async normalDownload(urlInfo){
|
|
async normalDownload(urlInfo){
|
|
|
|
+ let authority = this.$refs.headerRef.authority.isAuthority;
|
|
let task = await new Promise((resolve,reject) =>{
|
|
let task = await new Promise((resolve,reject) =>{
|
|
(async () => {
|
|
(async () => {
|
|
try{
|
|
try{
|
|
|
|
+ let number = 0;
|
|
urlInfo.status = '2';
|
|
urlInfo.status = '2';
|
|
urlInfo.num = 0;
|
|
urlInfo.num = 0;
|
|
const browser = await puppeteer.launch({
|
|
const browser = await puppeteer.launch({
|
|
@@ -625,12 +630,23 @@
|
|
let outputPath = urlInfo.newPath + '\\' + this.randomString(35) + '.' + imgInfo.imgType;
|
|
let outputPath = urlInfo.newPath + '\\' + this.randomString(35) + '.' + imgInfo.imgType;
|
|
|
|
|
|
urlInfo.status = '3';
|
|
urlInfo.status = '3';
|
|
|
|
+ number++;
|
|
|
|
+ if(!authority && number <= this.execNum){
|
|
|
|
+ if(imgInfo.isBase){ //base64位图片下载
|
|
|
|
+ this.downloadBaseImage(imgInfo.url, outputPath, urlInfo)
|
|
|
|
+ }else{
|
|
|
|
+ this.downloadImage(imgInfo.url, outputPath, urlInfo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- if(imgInfo.isBase){ //base64位图片下载
|
|
|
|
- this.downloadBaseImage(imgInfo.url, outputPath, urlInfo)
|
|
|
|
- }else{
|
|
|
|
- this.downloadImage(imgInfo.url, outputPath, urlInfo);
|
|
|
|
|
|
+ if(authority){
|
|
|
|
+ if(imgInfo.isBase){ //base64位图片下载
|
|
|
|
+ this.downloadBaseImage(imgInfo.url, outputPath, urlInfo)
|
|
|
|
+ }else{
|
|
|
|
+ this.downloadImage(imgInfo.url, outputPath, urlInfo);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
@@ -743,6 +759,7 @@
|
|
|
|
|
|
// 京东下载
|
|
// 京东下载
|
|
async jdDownload(urlInfo){
|
|
async jdDownload(urlInfo){
|
|
|
|
+ let authority = this.$refs.headerRef.authority.isAuthority;
|
|
let task = await new Promise((resolve,reject) =>{
|
|
let task = await new Promise((resolve,reject) =>{
|
|
(async () => {
|
|
(async () => {
|
|
try{
|
|
try{
|
|
@@ -821,7 +838,12 @@
|
|
}
|
|
}
|
|
|
|
|
|
let outputPath = urlInfo.newPath + '\\详情图\\' + fileName;
|
|
let outputPath = urlInfo.newPath + '\\详情图\\' + fileName;
|
|
- await this.downloadImage(imgUrl, outputPath, urlInfo);
|
|
|
|
|
|
+ if(!authority && i < this.execNum){
|
|
|
|
+ await this.downloadImage(imgUrl, outputPath, urlInfo);
|
|
|
|
+ }
|
|
|
|
+ if(authority){
|
|
|
|
+ await this.downloadImage(imgUrl, outputPath, urlInfo);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -863,6 +885,7 @@
|
|
let regex = /^https:\/\/img[0-9]+.360buyimg.com\/n/;
|
|
let regex = /^https:\/\/img[0-9]+.360buyimg.com\/n/;
|
|
if(regex.exec(response.url())){ // 匹配符合规则的图片路径
|
|
if(regex.exec(response.url())){ // 匹配符合规则的图片路径
|
|
if(response.url().indexOf('/s40x40_jfs/') > -1 && this.settingData.skuImg){ // sku图片
|
|
if(response.url().indexOf('/s40x40_jfs/') > -1 && this.settingData.skuImg){ // sku图片
|
|
|
|
+ let skuNum = 0;
|
|
let skuImgUrl = response.url().replace('/s40x40_jfs/', '/jfs/').replace(/\/n[0-9]+\/jfs\//, '/n1/jfs/').replace('.avif', '');
|
|
let skuImgUrl = response.url().replace('/s40x40_jfs/', '/jfs/').replace(/\/n[0-9]+\/jfs\//, '/n1/jfs/').replace('.avif', '');
|
|
jdImgInfo.skuImg.push(skuImgUrl);
|
|
jdImgInfo.skuImg.push(skuImgUrl);
|
|
|
|
|
|
@@ -876,12 +899,19 @@
|
|
fs.mkdirSync(urlInfo.newPath + '\\sku图');
|
|
fs.mkdirSync(urlInfo.newPath + '\\sku图');
|
|
}
|
|
}
|
|
let outputPath = urlInfo.newPath + '\\sku图\\' + fileName;
|
|
let outputPath = urlInfo.newPath + '\\sku图\\' + fileName;
|
|
- await this.downloadImage(skuImgUrl, outputPath, urlInfo);
|
|
|
|
|
|
+ skuNum ++;
|
|
|
|
+ if(!authority && skuNum <= this.execNum){
|
|
|
|
+ await this.downloadImage(skuImgUrl, outputPath, urlInfo);
|
|
|
|
+ }
|
|
|
|
+ if(authority){
|
|
|
|
+ await this.downloadImage(skuImgUrl, outputPath, urlInfo);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
let reg = /\/n[0-9]+\/jfs\//;
|
|
let reg = /\/n[0-9]+\/jfs\//;
|
|
let reg2 = /\/n[0-9]+\/s54x54_jfs\//;
|
|
let reg2 = /\/n[0-9]+\/s54x54_jfs\//;
|
|
if(response.url().match(reg) || response.url().match(reg2)){ // 主图
|
|
if(response.url().match(reg) || response.url().match(reg2)){ // 主图
|
|
|
|
+ let mainNum = 0;
|
|
let mainImgUrl = response.url().replace(reg, '/n1/jfs/').replace(reg2, '/n1/jfs/').replace('.avif', '');
|
|
let mainImgUrl = response.url().replace(reg, '/n1/jfs/').replace(reg2, '/n1/jfs/').replace('.avif', '');
|
|
jdImgInfo.mainImg.push(mainImgUrl);
|
|
jdImgInfo.mainImg.push(mainImgUrl);
|
|
|
|
|
|
@@ -895,7 +925,14 @@
|
|
fs.mkdirSync(urlInfo.newPath + '\\主图');
|
|
fs.mkdirSync(urlInfo.newPath + '\\主图');
|
|
}
|
|
}
|
|
let outputPath = urlInfo.newPath + '\\主图\\' + fileName;
|
|
let outputPath = urlInfo.newPath + '\\主图\\' + fileName;
|
|
- await this.downloadImage(mainImgUrl, outputPath, urlInfo);
|
|
|
|
|
|
+ mainNum ++;
|
|
|
|
+ if(!authority && mainNum <= this.execNum){
|
|
|
|
+ await this.downloadImage(mainImgUrl, outputPath, urlInfo);
|
|
|
|
+ }
|
|
|
|
+ if(authority){
|
|
|
|
+ await this.downloadImage(mainImgUrl, outputPath, urlInfo);
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
@@ -994,6 +1031,7 @@
|
|
|
|
|
|
// 淘宝天猫扫描下载图片
|
|
// 淘宝天猫扫描下载图片
|
|
async tbScanImg(urlInfo){
|
|
async tbScanImg(urlInfo){
|
|
|
|
+ let authority = this.$refs.headerRef.authority.isAuthority;
|
|
let task = await new Promise((resolve,reject) =>{
|
|
let task = await new Promise((resolve,reject) =>{
|
|
(async () => {
|
|
(async () => {
|
|
try{
|
|
try{
|
|
@@ -1064,7 +1102,12 @@
|
|
if(result){
|
|
if(result){
|
|
mainImgUrl = mainImgUrl.replace(result[0], '.'+result[1]);
|
|
mainImgUrl = mainImgUrl.replace(result[0], '.'+result[1]);
|
|
}
|
|
}
|
|
- outObj.mainImg.push(mainImgUrl);
|
|
|
|
|
|
+ if(!authority && i < this.execNum){
|
|
|
|
+ outObj.mainImg.push(mainImgUrl);
|
|
|
|
+ }
|
|
|
|
+ if(authority){
|
|
|
|
+ outObj.mainImg.push(mainImgUrl);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
//sku图片
|
|
//sku图片
|
|
let arr2 = document.querySelectorAll('img[class^=SkuContent--valueItemImg--]');
|
|
let arr2 = document.querySelectorAll('img[class^=SkuContent--valueItemImg--]');
|
|
@@ -1077,7 +1120,12 @@
|
|
if(result){
|
|
if(result){
|
|
skuImgUrl = skuImgUrl.replace(result[0], '.'+result[1]);
|
|
skuImgUrl = skuImgUrl.replace(result[0], '.'+result[1]);
|
|
}
|
|
}
|
|
- outObj.skuImg.push(skuImgUrl);
|
|
|
|
|
|
+ if(!authority && i < this.execNum){
|
|
|
|
+ outObj.skuImg.push(skuImgUrl);
|
|
|
|
+ }
|
|
|
|
+ if(authority){
|
|
|
|
+ outObj.skuImg.push(skuImgUrl);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
//详情图片
|
|
//详情图片
|
|
let arr3 = document.querySelectorAll('#content img')
|
|
let arr3 = document.querySelectorAll('#content img')
|
|
@@ -1087,7 +1135,12 @@
|
|
if(result){
|
|
if(result){
|
|
detailImgUrl = detailImgUrl.replace(result[0], '.'+result[1]);
|
|
detailImgUrl = detailImgUrl.replace(result[0], '.'+result[1]);
|
|
}
|
|
}
|
|
- outObj.detailImg.push(detailImgUrl);
|
|
|
|
|
|
+ if(!authority && i < this.execNum){
|
|
|
|
+ outObj.detailImg.push(detailImgUrl);
|
|
|
|
+ }
|
|
|
|
+ if(authority){
|
|
|
|
+ outObj.detailImg.push(detailImgUrl);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
//评论图片
|
|
//评论图片
|
|
let arr4 = document.querySelectorAll('div[class^=Comments--comments--] img');
|
|
let arr4 = document.querySelectorAll('div[class^=Comments--comments--] img');
|
|
@@ -1096,14 +1149,24 @@
|
|
}
|
|
}
|
|
for(let i=0; i< arr4.length; i++){
|
|
for(let i=0; i< arr4.length; i++){
|
|
if(arr4[i].src.indexOf('/avatar/sns/user/flag/sns_logo') == -1){ //过滤淘宝用户头像
|
|
if(arr4[i].src.indexOf('/avatar/sns/user/flag/sns_logo') == -1){ //过滤淘宝用户头像
|
|
- outObj.commentImg.push(arr4[i].src);
|
|
|
|
|
|
+ if(!authority && i < this.execNum){
|
|
|
|
+ outObj.commentImg.push(arr4[i].src);
|
|
|
|
+ }
|
|
|
|
+ if(authority){
|
|
|
|
+ outObj.commentImg.push(arr4[i].src);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 视频
|
|
// 视频
|
|
let arr5 = document.querySelectorAll('video.lib-video');
|
|
let arr5 = document.querySelectorAll('video.lib-video');
|
|
for(let i=0; i< arr5.length; i++){
|
|
for(let i=0; i< arr5.length; i++){
|
|
if(outObj.video.indexOf(arr5[i].src) == -1){
|
|
if(outObj.video.indexOf(arr5[i].src) == -1){
|
|
- outObj.video.push(arr5[i].src);
|
|
|
|
|
|
+ if(!authority && i < this.execNum){
|
|
|
|
+ outObj.video.push(arr5[i].src);
|
|
|
|
+ }
|
|
|
|
+ if(authority){
|
|
|
|
+ outObj.video.push(arr5[i].src);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return outObj;
|
|
return outObj;
|
|
@@ -1223,6 +1286,7 @@
|
|
|
|
|
|
// 阿里巴巴 - 扫描并下载图片
|
|
// 阿里巴巴 - 扫描并下载图片
|
|
async alibabaScanImg(browser, page, urlInfo){
|
|
async alibabaScanImg(browser, page, urlInfo){
|
|
|
|
+ let authority = this.$refs.headerRef.authority.isAuthority;
|
|
//detailImg:详情图;skuImg:sku图片;commentImg: 评论图;video: 视频
|
|
//detailImg:详情图;skuImg:sku图片;commentImg: 评论图;video: 视频
|
|
const imgInfo = await page.evaluate(() => {
|
|
const imgInfo = await page.evaluate(() => {
|
|
let outObj = {
|
|
let outObj = {
|
|
@@ -1236,29 +1300,54 @@
|
|
//主图
|
|
//主图
|
|
let arr1 = document.querySelectorAll('img.detail-gallery-img');
|
|
let arr1 = document.querySelectorAll('img.detail-gallery-img');
|
|
for(let i=0; i< arr1.length; i++){
|
|
for(let i=0; i< arr1.length; i++){
|
|
- outObj.mainImg.push(arr1[i].src);
|
|
|
|
|
|
+ if(!authority && i < this.execNum){
|
|
|
|
+ outObj.mainImg.push(arr1[i].src);
|
|
|
|
+ }
|
|
|
|
+ if(authority){
|
|
|
|
+ outObj.mainImg.push(arr1[i].src);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
//sku图片
|
|
//sku图片
|
|
let arr2 = document.querySelectorAll('.prop-img');
|
|
let arr2 = document.querySelectorAll('.prop-img');
|
|
for(let i=0; i< arr2.length; i++){
|
|
for(let i=0; i< arr2.length; i++){
|
|
let src = window.getComputedStyle(arr2[i]).backgroundImage.replace(/url\(["']?(.+?)["']?\)/i, '$1');
|
|
let src = window.getComputedStyle(arr2[i]).backgroundImage.replace(/url\(["']?(.+?)["']?\)/i, '$1');
|
|
- outObj.skuImg.push(src);
|
|
|
|
|
|
+ if(!authority && i < this.execNum){
|
|
|
|
+ outObj.skuImg.push(src);
|
|
|
|
+ }
|
|
|
|
+ if(authority){
|
|
|
|
+ outObj.skuImg.push(src);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
//详情图片
|
|
//详情图片
|
|
let arr3 = document.querySelectorAll('img.desc-img-loaded');
|
|
let arr3 = document.querySelectorAll('img.desc-img-loaded');
|
|
for(let i=0; i< arr3.length; i++){
|
|
for(let i=0; i< arr3.length; i++){
|
|
- outObj.detailImg.push(arr3[i].src);
|
|
|
|
|
|
+ if(!authority && i < this.execNum){
|
|
|
|
+ outObj.detailImg.push(arr3[i].src);
|
|
|
|
+ }
|
|
|
|
+ if(authority){
|
|
|
|
+ outObj.detailImg.push(arr3[i].src);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
//评论图片 -- 需要点击切换
|
|
//评论图片 -- 需要点击切换
|
|
// let arr4 = document.querySelectorAll('img.image-box');
|
|
// let arr4 = document.querySelectorAll('img.image-box');
|
|
// for(let i=0; i< arr4.length; i++){
|
|
// for(let i=0; i< arr4.length; i++){
|
|
- // outObj.commentImg.push(arr4[i].src);
|
|
|
|
|
|
+ // if(!authority && i < this.execNum){
|
|
|
|
+ // outObj.commentImg.push(arr4[i].src);
|
|
|
|
+ // }
|
|
|
|
+ // if(authority){
|
|
|
|
+ // outObj.commentImg.push(arr4[i].src);
|
|
|
|
+ // }
|
|
// }
|
|
// }
|
|
// 视频
|
|
// 视频
|
|
let arr5 = document.querySelectorAll('video.lib-video');
|
|
let arr5 = document.querySelectorAll('video.lib-video');
|
|
for(let i=0; i< arr5.length; i++){
|
|
for(let i=0; i< arr5.length; i++){
|
|
if(outObj.video.indexOf(arr5[i].src) == -1){
|
|
if(outObj.video.indexOf(arr5[i].src) == -1){
|
|
- outObj.video.push(arr5[i].src);
|
|
|
|
|
|
+ if(!authority && i < this.execNum){
|
|
|
|
+ outObj.video.push(arr5[i].src);
|
|
|
|
+ }
|
|
|
|
+ if(authority){
|
|
|
|
+ outObj.video.push(arr5[i].src);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return outObj;
|
|
return outObj;
|
|
@@ -1541,14 +1630,6 @@
|
|
font-size: 12px;
|
|
font-size: 12px;
|
|
}
|
|
}
|
|
|
|
|
|
- .soft-content {
|
|
|
|
- height: calc(100% - 118px);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- .handle-label {
|
|
|
|
- vertical-align: top;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
.handle-desc {
|
|
.handle-desc {
|
|
display: inline-block;
|
|
display: inline-block;
|
|
width: calc(100% - 100px);
|
|
width: calc(100% - 100px);
|