|
@@ -57,14 +57,18 @@
|
|
<el-main v-show="['1', '2', '3', '4', '10'].indexOf(menuIndex) > -1" ref="el-main" style="background-color: #fafafa;">
|
|
<el-main v-show="['1', '2', '3', '4', '10'].indexOf(menuIndex) > -1" ref="el-main" style="background-color: #fafafa;">
|
|
<template>
|
|
<template>
|
|
<div class="content-top">
|
|
<div class="content-top">
|
|
- <el-button-group>
|
|
|
|
- <el-button type="primary" size="mini" icon="el-icon-circle-plus-outline"
|
|
|
|
- @click="addVisible = true;">添加链接</el-button>
|
|
|
|
- <el-button type="primary" size="mini" icon="el-icon-upload"
|
|
|
|
- @click="pickFile()">导入链接</el-button>
|
|
|
|
- <el-button type="primary" size="mini" icon="el-icon-delete"
|
|
|
|
- @click="clearList()">清空链接</el-button>
|
|
|
|
- </el-button-group>
|
|
|
|
|
|
+ <div>
|
|
|
|
+ <el-button-group>
|
|
|
|
+ <el-button type="primary" size="mini" icon="el-icon-circle-plus-outline"
|
|
|
|
+ @click="addVisible = true;">添加链接</el-button>
|
|
|
|
+ <el-button type="primary" size="mini" icon="el-icon-upload"
|
|
|
|
+ @click="pickLink()">导入链接</el-button>
|
|
|
|
+ <el-button type="primary" size="mini" icon="el-icon-delete"
|
|
|
|
+ @click="clearList()">清空链接</el-button>
|
|
|
|
+ </el-button-group>
|
|
|
|
+
|
|
|
|
+ <el-link type="info" style="margin-left: 20px; vertical-align:baseline;" @click="downloadExample()">模板下载<i class="el-icon-download"></i></el-link>
|
|
|
|
+ </div>
|
|
|
|
|
|
<el-row type="flex" style="align-items: center;">
|
|
<el-row type="flex" style="align-items: center;">
|
|
<div class="set-item">
|
|
<div class="set-item">
|
|
@@ -79,7 +83,7 @@
|
|
</el-row>
|
|
</el-row>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
- <div style="padding: 20px 20px 0 20px; height: calc(100% - 160px);">
|
|
|
|
|
|
+ <div style="padding: 20px 20px 0 20px; height: calc(100% - 62px);">
|
|
<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>
|
|
@@ -439,7 +443,7 @@
|
|
}
|
|
}
|
|
});
|
|
});
|
|
},
|
|
},
|
|
- async pickFile() {
|
|
|
|
|
|
+ async pickLink() {
|
|
const spinLoad = this.$loading();
|
|
const spinLoad = this.$loading();
|
|
await electronApi.call('pickFile', ['xlsx,xls', true]).then(async (path) => {
|
|
await electronApi.call('pickFile', ['xlsx,xls', true]).then(async (path) => {
|
|
spinLoad.close();
|
|
spinLoad.close();
|
|
@@ -453,16 +457,44 @@
|
|
if(workSheetsFromBuffer && workSheetsFromBuffer.length > 0){
|
|
if(workSheetsFromBuffer && workSheetsFromBuffer.length > 0){
|
|
let errMsg = "";
|
|
let errMsg = "";
|
|
workSheetsFromBuffer[0].data.map((item, index) => {
|
|
workSheetsFromBuffer[0].data.map((item, index) => {
|
|
- if(item[0] == undefined){
|
|
|
|
- errMsg += "第" + (index+1) + "行格式有误</br>";
|
|
|
|
- item[0] = '';
|
|
|
|
|
|
+ if(item.length > 0){
|
|
|
|
+ if(item[1] == undefined){
|
|
|
|
+ errMsg += "第" + (index+1) + "行格式有误</br>";
|
|
|
|
+ item[1] = '';
|
|
|
|
+ }else if(!/^(http|https):\/\/.+$/.exec(item[1])){
|
|
|
|
+ errMsg += "第" + (index+1) + "行网址格式有误</br>";
|
|
|
|
+ }else{
|
|
|
|
+ let info = {
|
|
|
|
+ url: item[1],
|
|
|
|
+ title: item[0].trim(),
|
|
|
|
+ status: '1',
|
|
|
|
+ num: 0,
|
|
|
|
+ newPath: ''
|
|
|
|
+ }
|
|
|
|
+ switch(this.menuIndex){
|
|
|
|
+ case '1':
|
|
|
|
+ this.alibabaList.push(info);
|
|
|
|
+ break;
|
|
|
|
+ case '2':
|
|
|
|
+ this.jdList.push(info);
|
|
|
|
+ break;
|
|
|
|
+ case '3':
|
|
|
|
+ this.tmallList.push(info);
|
|
|
|
+ break;
|
|
|
|
+ case '4':
|
|
|
|
+ this.tbList.push(info);
|
|
|
|
+ break;
|
|
|
|
+ case '10':
|
|
|
|
+ this.commonList.push(info);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-
|
|
|
|
- console.log(item)
|
|
|
|
});
|
|
});
|
|
if(errMsg){
|
|
if(errMsg){
|
|
this.$notify({
|
|
this.$notify({
|
|
title: '请检查文件以下问题',
|
|
title: '请检查文件以下问题',
|
|
|
|
+ dangerouslyUseHTMLString: true,
|
|
message: errMsg,
|
|
message: errMsg,
|
|
type: 'warning'
|
|
type: 'warning'
|
|
});
|
|
});
|
|
@@ -1478,6 +1510,16 @@
|
|
await browser.close();
|
|
await browser.close();
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ //
|
|
|
|
+ downloadExample(){
|
|
|
|
+ let url = 'https://www.xingyousoft.com/soft/XYCapture/example.xlsx';
|
|
|
|
+ if (!fs.existsSync(this.downloadDir + separator + pjson.softInfo.softName)) {
|
|
|
|
+ fs.mkdirSync(this.downloadDir + separator + pjson.softInfo.softName);
|
|
|
|
+ }
|
|
|
|
+ let path = this.downloadDir + separator + pjson.softInfo.softName + '\\链接模板下载.xlsx';
|
|
|
|
+ this.downloadImage(url, path, 'example');
|
|
|
|
+ },
|
|
|
|
+
|
|
// 下载网址链接的图片
|
|
// 下载网址链接的图片
|
|
async downloadImage(imageUrl, outputPath, urlInfo) {
|
|
async downloadImage(imageUrl, outputPath, urlInfo) {
|
|
let _this = this;
|
|
let _this = this;
|
|
@@ -1514,7 +1556,21 @@
|
|
});
|
|
});
|
|
|
|
|
|
req.on('end', ()=> {
|
|
req.on('end', ()=> {
|
|
- urlInfo.num += 1;
|
|
|
|
|
|
+ if(urlInfo != 'example'){
|
|
|
|
+ urlInfo.num += 1;
|
|
|
|
+ }else{
|
|
|
|
+ this.$msgbox({
|
|
|
|
+ title: '消息',
|
|
|
|
+ message: '模板下载成功,保存位置:' + this.downloadDir + separator + pjson.softInfo.softName,
|
|
|
|
+ showCancelButton: true,
|
|
|
|
+ confirmButtonText: '去查看',
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
+ }).then(action => {
|
|
|
|
+ this.openFolder();
|
|
|
|
+ }).catch(action => {
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ }
|
|
//console.log('下载完成', outputPath)
|
|
//console.log('下载完成', outputPath)
|
|
resolve(true);
|
|
resolve(true);
|
|
});
|
|
});
|