diff --git a/package.json b/package.json
index 1b5eca3..3dc437a 100644
--- a/package.json
+++ b/package.json
@@ -10,15 +10,16 @@
"@antv/g2plot": "^2.4.25",
"axios": "^1.4.0",
"core-js": "^3.8.3",
+ "crypto-js": "^4.0.0",
"dayjs": "^1.11.9",
"element-ui": "^2.15.13",
+ "spark-md5": "^3.0.2",
"v-viewer": "^1.6.4",
"vue": "^2.6.14",
"vue-cropper": "^0.6.4",
"vue-json-excel": "^0.3.0",
"vue-qr": "^4.0.9",
"vue-router": "^3.2.0",
- "crypto-js": "^4.0.0",
"vuex": "^3.4.0",
"vuex-persistedstate": "^4.1.0"
},
diff --git a/public/js/download.js b/public/js/download.js
index f530f3a..0453bee 100644
--- a/public/js/download.js
+++ b/public/js/download.js
@@ -1,5 +1,5 @@
function init() {
- if (window.location.href.startsWith('https://www.aliexpress.us/item/')) {
+ if (window.location.href.startsWith('https://www.aliexpress.com/item/')) {
const popup = document.createElement("div")
popup.innerText = "下载图片"
const styles = {
diff --git a/public/rules_3.json b/public/rules_3.json
new file mode 100644
index 0000000..cd069df
--- /dev/null
+++ b/public/rules_3.json
@@ -0,0 +1,24 @@
+[
+ {
+ "id": 12,
+ "priority": 1,
+ "action": {
+ "type": "modifyHeaders",
+ "requestHeaders": [
+ {
+ "header": "Origin",
+ "operation": "set",
+ "value": "https://www.aliexpress.com"
+ },
+ {
+ "header": "Referer",
+ "operation": "set",
+ "value": "https://www.aliexpress.com"
+ }
+ ]
+ },
+ "condition": {
+ "urlFilter": "||aeproductsourcesite.alicdn.com"
+ }
+ }
+]
\ No newline at end of file
diff --git a/public/rules_4.json b/public/rules_4.json
new file mode 100644
index 0000000..4b48258
--- /dev/null
+++ b/public/rules_4.json
@@ -0,0 +1,24 @@
+[
+ {
+ "id": 12,
+ "priority": 1,
+ "action": {
+ "type": "modifyHeaders",
+ "requestHeaders": [
+ {
+ "header": "Origin",
+ "operation": "set",
+ "value": "https://kuajing.pinduoduo.com"
+ },
+ {
+ "header": "Referer",
+ "operation": "set",
+ "value": "https://kuajing.pinduoduo.com"
+ }
+ ]
+ },
+ "condition": {
+ "urlFilter": "||kuajing-file.pinduoduo.com"
+ }
+ }
+]
\ No newline at end of file
diff --git a/src/api/chromeApi.js b/src/api/chromeApi.js
index 94c526e..7ac06d3 100644
--- a/src/api/chromeApi.js
+++ b/src/api/chromeApi.js
@@ -7,7 +7,9 @@ import {genAnti} from "@/api/genAnti";
*/
export async function sendChromeAPIMessage(message) {
message.type = 'api'
- message.url = "https://kuajing.pinduoduo.com/" + message.url;
+ if (!message.url.startsWith('http')) {
+ message.url = "https://kuajing.pinduoduo.com/" + message.url;
+ }
message.anti = message.anti || false
if (message.needMallId) {
// 如果参数中没有携带MallId,则从state中获取
@@ -53,6 +55,19 @@ export async function sendChromeWebReqMessage(message) {
})
}
+/**
+ * 向Chrome发送消息
+ * @param message 消息
+ */
+export async function sendSheinAPIMessage(message) {
+ message.type = 'sheinApi'
+ message.url = "https://www.shein.com/" + message.url;
+ return new Promise((resolve) => {
+ // @ts-ignore
+ chrome.runtime.sendMessage(message, resolve)
+ })
+}
+
/**
* 向Chrome发送消息
* @param message 消息
@@ -63,4 +78,4 @@ export function sendChromeNotification(message) {
// @ts-ignore
chrome.runtime.sendMessage(message, resolve)
})
-}
+}
\ No newline at end of file
diff --git a/src/components/AiCopyFromAliExpress.vue b/src/components/AiCopyFromAliExpress.vue
new file mode 100644
index 0000000..60618b6
--- /dev/null
+++ b/src/components/AiCopyFromAliExpress.vue
@@ -0,0 +1,375 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 取 消
+ 确定
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/AiCopyFromTemu.vue b/src/components/AiCopyFromTemu.vue
index 4c9a69d..76b92a0 100644
--- a/src/components/AiCopyFromTemu.vue
+++ b/src/components/AiCopyFromTemu.vue
@@ -6,12 +6,6 @@
:closable="false">
-
-
- TEMU
-
-
-
diff --git a/src/components/AiProductDetail.vue b/src/components/AiProductDetail.vue
index 3047ade..6b384ff 100644
--- a/src/components/AiProductDetail.vue
+++ b/src/components/AiProductDetail.vue
@@ -9,7 +9,7 @@
-
+
diff --git a/src/components/AiProductDropDown.vue b/src/components/AiProductDropDown.vue
index 91e390d..ff348c3 100644
--- a/src/components/AiProductDropDown.vue
+++ b/src/components/AiProductDropDown.vue
@@ -9,14 +9,14 @@
加入收藏
取消收藏
加入分组
- 商品采集
+ 商品采集
访问商品
访问店铺
{
if (request.type == 'api') {
new Promise((resolve) => {
let headers = {};
+ let data = null;
if (request.needMallId) {
headers.Mallid = request.mallId;
}
if (request.anti) {
headers["Anti-Content"] = request.anti
}
- headers['Content-Type'] = 'application/json';
+ if (!request.isFormData) {
+ headers['Content-Type'] = 'application/json';
+ data = JSON.stringify(request.data)
+ } else {
+ console.log(request.data)
+ const formData = new FormData();
+ Object.keys(request.data).forEach(key => {
+ const value = request.data[key]
+ if (Array.isArray(value)) {
+ value.forEach((subValue, i) => {
+ formData.append(key + `[${i}]`, subValue)
+ })
+ } else {
+ if (key == 'image') {
+ let blob = new Blob([request.data[key]], {type: 'application/png'})
+ // formData.append(key, new Blob([request.data[key]], {type: 'application/png'}))
+ formData.append(key, blob)
+ } else {
+ formData.append(key, request.data[key])
+ }
+ }
+ })
+ data = formData
+ }
headers.cookie = getCookie();
Promise.resolve().then(() => fetch(request.url, {
'headers': headers,
'method': 'POST',
'referrerPolicy': 'no-referrer',
'credentials': 'include',
- 'body': JSON.stringify(request.data),
+ 'body': data,
'mode': 'cors'
})).then((res) => {
resolve(res.json());
@@ -111,6 +135,24 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
});
});
}).then(sendResponse);
+ } else if (request.type == 'sheinApi') {
+ new Promise((resolve) => {
+ let headers = {};
+ headers['Content-Type'] = 'application/json';
+ headers.cookie = getSheinCookie()
+ request.params = formatParams(request.params)
+ let _url = request.url + (request.params ? ('?' + request.params) : '')
+ Promise.resolve().then(() => fetch(_url, {
+ 'headers': headers,
+ 'method': request.method,
+ 'referrerPolicy': 'no-referrer',
+ 'credentials': 'include',
+ 'body': JSON.stringify(request.data),
+ 'mode': 'cors'
+ })).then((res) => {
+ resolve(res.json());
+ });
+ }).then(sendResponse);
} else if (request.type == 'notify') {
chrome.notifications.create(
"" + Math.random(), {
@@ -183,8 +225,8 @@ function getTemuCookie() {
return cStr;
}
-function getAliexpressCookie() {
- const url = new URL("https://www.aliexpress.us/");
+function getSheinCookie() {
+ const url = new URL("https://www.shein.com/");
let cStr = '';
chrome.cookies.getAll({domain: url.host}, (cookie) => {
cookie.map((c) => {
@@ -192,4 +234,24 @@ function getAliexpressCookie() {
});
});
return cStr;
+}
+
+
+function getAliexpressCookie() {
+ const url = new URL("https://www.aliexpress.com/");
+ let cStr = '';
+ chrome.cookies.getAll({domain: url.host}, (cookie) => {
+ cookie.map((c) => {
+ cStr += c.name + '=' + c.value + ';';
+ });
+ });
+ return cStr;
+}
+
+function formatParams(data) {
+ const arr = []
+ for (let name in data) {
+ arr.push(encodeURIComponent(name) + "=" + encodeURIComponent(data[name]))
+ }
+ return arr.join("&")
}
\ No newline at end of file
diff --git a/src/manifest.development.json b/src/manifest.development.json
index 2a94a45..91b1a22 100644
--- a/src/manifest.development.json
+++ b/src/manifest.development.json
@@ -14,10 +14,13 @@
"action": {
},
"host_permissions": [
+ "*://*.jjcp52.com/",
"*://*.pinduoduo.com/",
"*://*.temu.com/",
- "*://*.aliexpress.us/",
- "*://*.amazon.com/"
+ "*://*.aliexpress.com/",
+ "*://*.alicdn.com/",
+ "*://*.amazon.com/",
+ "*://*.shein.com/"
],
"permissions": [
"cookies",
@@ -35,12 +38,16 @@
"id": "1",
"enabled": true,
"path": "rules_1.json"
+ },{
+ "id": "3",
+ "enabled": true,
+ "path": "rules_3.json"
}]
},
"content_scripts": [
{
"matches": [
- "*://*.aliexpress.us/item/*",
+ "*://*.aliexpress.com/item/*",
"*://*.amazon.com/*"
],
"js": [
@@ -51,7 +58,7 @@
"web_accessible_resources": [
{
"resources": [ "js/download.js","js/jszip.min.js","js/FileSaver.js" ],
- "matches": [ "*://*.aliexpress.us/*", "*://*.amazon.com/*" ]
+ "matches": [ "*://*.aliexpress.com/*", "*://*.amazon.com/*" ]
}
]
}
diff --git a/src/manifest.production.json b/src/manifest.production.json
index 706d874..7af667d 100644
--- a/src/manifest.production.json
+++ b/src/manifest.production.json
@@ -14,10 +14,13 @@
"action": {
},
"host_permissions": [
+ "*://*.jjcp52.com/",
"*://*.pinduoduo.com/",
"*://*.temu.com/",
- "*://*.aliexpress.us/",
- "*://*.amazon.com/"
+ "*://*.aliexpress.com/",
+ "*://*.alicdn.com/",
+ "*://*.amazon.com/",
+ "*://*.shein.com/"
],
"permissions": [
"cookies",
@@ -35,12 +38,20 @@
"id": "1",
"enabled": true,
"path": "rules_1.json"
+ },{
+ "id": "3",
+ "enabled": true,
+ "path": "rules_3.json"
+ },{
+ "id": "4",
+ "enabled": true,
+ "path": "rules_4.json"
}]
},
"content_scripts": [
{
"matches": [
- "*://*.aliexpress.us/item/*",
+ "*://*.aliexpress.com/item/*",
"*://*.amazon.com/*"
],
"js": [
@@ -51,7 +62,7 @@
"web_accessible_resources": [
{
"resources": [ "js/download.js","js/jszip.min.js","js/FileSaver.js" ],
- "matches": [ "*://*.aliexpress.us/*", "*://*.amazon.com/*" ]
+ "matches": [ "*://*.aliexpress.com/*", "*://*.amazon.com/*" ]
}
]
}
diff --git a/src/router/index.js b/src/router/index.js
index 9856132..ac87f30 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -72,6 +72,11 @@ const router = new VueRouter({
name: 'niubiCopy',
component: () => import('../view/selection/NiubiCopy.vue')
},
+ {
+ path: 'aliExpressCopy',
+ name: 'aliExpressCopy',
+ component: () => import('../view/selection/AliExpressCopy.vue')
+ },
{
path: 'storeTrack',
name: 'storeTrack',
diff --git a/src/utils/image.js b/src/utils/image.js
new file mode 100644
index 0000000..6733c4b
--- /dev/null
+++ b/src/utils/image.js
@@ -0,0 +1,49 @@
+import SparkMd5 from 'spark-md5'
+
+export function getImageMd5(imageUrl) {
+ /*return new Promise((resolve, reject) => {
+ fetch(imageUrl).then((response) => response.blob()) // 将响应转换为Blob对象
+ .then((blobData) => {
+ const reader = new FileReader();
+
+ // 读取Blob对象的内容
+ reader.onloadend = function() {
+ let spark = new SparkMd5()
+ spark.appendBinary(this.result);
+ let md5 = spark.end()
+ console.log(md5)
+ console.log(this.result)
+
+ //resolve({md5, imageData: new File([blobData], 'test.jpeg', {type: blobData.type})});
+ resolve({md5, imageData: this.result});
+ };
+
+ reader.readAsBinaryString(blobData); // 将Blob对象作为参数传递给FileReader的readAsArrayBuffer()方法
+
+
+ })
+
+ });*/
+
+ return new Promise((resolve, reject) => {
+ fetch(imageUrl).then((response) => response.blob()) // 将响应转换为Blob对象
+ .then((blobData) => {
+ const reader = new FileReader();
+
+ // 读取Blob对象的内容
+ reader.onloadend = function() {
+ let spark = new SparkMd5.ArrayBuffer()
+ spark.append(this.result);
+ let md5 = spark.end()
+
+ //resolve({md5, imageData: new File([blobData], 'test.jpeg', {type: blobData.type})});
+ resolve({md5, imageData: this.result});
+ };
+
+ reader.readAsArrayBuffer(blobData); // 将Blob对象作为参数传递给FileReader的readAsArrayBuffer()方法
+
+
+ })
+
+ });
+}
\ No newline at end of file
diff --git a/src/view/Home.vue b/src/view/Home.vue
index a1d80d1..48d2d08 100644
--- a/src/view/Home.vue
+++ b/src/view/Home.vue
@@ -81,6 +81,7 @@
选品采集
商品采集
+ 速卖通采集
选品跟踪
diff --git a/src/view/selection/AliExpressCopy.vue b/src/view/selection/AliExpressCopy.vue
new file mode 100644
index 0000000..93ae6db
--- /dev/null
+++ b/src/view/selection/AliExpressCopy.vue
@@ -0,0 +1,168 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+
+
+
+
+ 开始采集
+
+
+
+
+
+
+
+
+
+
+
+ 速卖通
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/view/selection/NiubiCopy.vue b/src/view/selection/NiubiCopy.vue
index ee03835..992de44 100644
--- a/src/view/selection/NiubiCopy.vue
+++ b/src/view/selection/NiubiCopy.vue
@@ -3,7 +3,7 @@
@@ -11,10 +11,6 @@
this.$dict.getLabel('copy_from', v), },
+ { slot: 'type', label: '来源', width: '100px', align: 'left'},
{ prop: 'mallName', label: '店铺名称', width: '200px', align: 'left'},
{ prop: 'createTime', label: '复制时间', width: '180px'}
],
@@ -94,7 +95,6 @@ import AiCopyFromTemu from "@/components/AiCopyFromTemu.vue";
},
created () {
- this.$dict.load('copy_from');
this.getList()
},
diff --git a/src/view/selection/storetrack/Index.vue b/src/view/selection/storetrack/Index.vue
index ba93a2c..7b612d3 100644
--- a/src/view/selection/storetrack/Index.vue
+++ b/src/view/selection/storetrack/Index.vue
@@ -11,6 +11,7 @@
+
+
diff --git a/src/view/shipping/ShippingDesk.vue b/src/view/shipping/ShippingDesk.vue
index e067677..10e4cd8 100644
--- a/src/view/shipping/ShippingDesk.vue
+++ b/src/view/shipping/ShippingDesk.vue
@@ -298,12 +298,15 @@
Message.error("请选择备货单")
return
}
+ console.log(this.arr)
this.arr.map(item => {
let temp = this.choosedList.filter(i => {
- return i.subPurchaseOrderSn == item.subPurchaseOrderSn
+ return i.subPurchaseOrderBasicVO?.subPurchaseOrderSn == item.subPurchaseOrderBasicVO.subPurchaseOrderSn
})
+ console.log(temp)
if (temp.length == 0) {
this.choosedList.push(item)
+ console.log(this.choosedList)
}
})
Message.success("添加成功,可继续添加")
diff --git a/yarn.lock b/yarn.lock
index d17d60d..33871c2 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -6823,6 +6823,11 @@ source-map@~0.5.1:
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
integrity sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==
+spark-md5@^3.0.2:
+ version "3.0.2"
+ resolved "https://registry.yarnpkg.com/spark-md5/-/spark-md5-3.0.2.tgz#7952c4a30784347abcee73268e473b9c0167e3fc"
+ integrity sha512-wcFzz9cDfbuqe0FZzfi2or1sgyIrsDwmPwfZC4hiNidPdPINjeUwNfv5kldczoEAcjl9Y1L3SM7Uz2PUEQzxQw==
+
spdx-correct@^3.0.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.2.0.tgz#4f5ab0668f0059e34f9c00dce331784a12de4e9c"