From d6e3d7bbe19350b0e0a51ec1ffc14e8b40ab14c3 Mon Sep 17 00:00:00 2001
From: liushiwei <499672082@qq.com>
Date: Fri, 25 Oct 2024 18:33:12 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/js/temuSeller.js | 6 +-
public/rules_12.json | 24 +
src/api/chromeApi.js | 13 +
src/api/index.js | 2 +-
src/entry/background.js | 44 ++
src/manifest.development.json | 8 +-
src/manifest.production.json | 8 +-
src/router/index.js | 6 +
src/view/Home.vue | 7 +
src/view/login/Forget.vue | 2 +-
src/view/semi/SemiSendGoods_XC.vue | 810 +++++++++++++++++++++++++++++
src/view/shipping/WaitCreate.vue | 2 +-
12 files changed, 924 insertions(+), 8 deletions(-)
create mode 100644 public/rules_12.json
create mode 100644 src/view/semi/SemiSendGoods_XC.vue
diff --git a/public/js/temuSeller.js b/public/js/temuSeller.js
index 76b6abf..4a7c9a4 100644
--- a/public/js/temuSeller.js
+++ b/public/js/temuSeller.js
@@ -123,8 +123,8 @@ function init() {
}
let models3 = document.querySelectorAll('div[class^="modal-content_content"]')
- for (let i = 0; i < models2.length; i++) {
- let tipsObj = models2[i].parentElement.querySelector('div[class^="modal-content_content"]')
+ for (let i = 0; i < models3.length; i++) {
+ let tipsObj = models3[i].parentElement.querySelector('div[class^="modal-content_content"]')
let spanObj = tipsObj.querySelector('div span:last-child')
if (spanObj) {
const popup = document.createElement("div")
@@ -143,7 +143,7 @@ function init() {
spanObj.appendChild(popup)
popup.addEventListener('click', async () => {
- let tbodyObj = models2[i].parentElement.querySelector('tbody')
+ let tbodyObj = models3[i].parentElement.querySelector('tbody')
let trList = tbodyObj.querySelectorAll('tr')
for (let i = 0; i < trList.length; i++) {
let tdObj = trList[i].querySelector('td:last-child')
diff --git a/public/rules_12.json b/public/rules_12.json
new file mode 100644
index 0000000..05d05b4
--- /dev/null
+++ b/public/rules_12.json
@@ -0,0 +1,24 @@
+[
+ {
+ "id": 23,
+ "priority": 1,
+ "action": {
+ "type": "modifyHeaders",
+ "requestHeaders": [
+ {
+ "header": "Origin",
+ "operation": "set",
+ "value": "http://xc.rqlis.com:888"
+ },
+ {
+ "header": "Host",
+ "operation": "set",
+ "value": "xc.rqlis.com:888"
+ }
+ ]
+ },
+ "condition": {
+ "urlFilter": "||xc.rqlis.com:888"
+ }
+ }
+]
\ No newline at end of file
diff --git a/src/api/chromeApi.js b/src/api/chromeApi.js
index b90203a..5b6bcb3 100644
--- a/src/api/chromeApi.js
+++ b/src/api/chromeApi.js
@@ -152,3 +152,16 @@ export function sendGoodcangAPIMessage(message) {
chrome.runtime.sendMessage(message, resolve)
})
}
+
+/**
+ * 向Chrome发送消息
+ * @param message 消息
+ */
+export async function sendXcAPIMessage(message) {
+ message.type = 'xcApi'
+ message.url = "http://xc.rqlis.com:888/" + message.url;
+ return new Promise((resolve) => {
+ // @ts-ignore
+ chrome.runtime.sendMessage(message, resolve)
+ })
+}
\ No newline at end of file
diff --git a/src/api/index.js b/src/api/index.js
index 030265f..dae2761 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -4,7 +4,7 @@ import store from '@/store'
var instance = axios.create({
- baseURL: process.env.NODE_ENV === 'production' ? 'http://124.71.2.127:8888' : 'http://124.71.2.127:10248',
+ baseURL: process.env.NODE_ENV === 'production' ? 'http://124.71.2.127:8888' : 'http://124.71.2.127:8888',
timeout: 50000,
validateStatus: function (status) {
return status < 500
diff --git a/src/entry/background.js b/src/entry/background.js
index b41b85d..5a5e59a 100644
--- a/src/entry/background.js
+++ b/src/entry/background.js
@@ -197,6 +197,38 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
resolve({success: false, errorCode: -1})
});
}).then(sendResponse);
+ } else if (request.type == 'xcApi') {
+ new Promise(async (resolve) => {
+ let headers = {}, data;
+ headers.cookie = await getXcCookie();
+ console.log(headers)
+ if (!request.isFormData) {
+ headers['Content-Type'] = 'application/json';
+ data = JSON.stringify(request.data)
+ } else {
+ 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") {
+ //跳过image的处理
+ } else formData.append(key, request.data[key])
+ }
+ })
+ data = formData
+ }
+ Promise.resolve().then(() => fetch(request.url, {
+ 'headers': headers, 'method': request.method, 'referrerPolicy': 'strict-origin-when-cross-origin', 'credentials': 'include', 'body': data, 'mode': 'cors'
+ })).then((res) => {
+ resolve(res.json());
+ }).catch(() => {
+ resolve({success: false, errorCode: -1})
+ });
+ }).then(sendResponse);
} else if (request.type == 'notify') {
chrome.notifications.create("" + Math.random(), {
type: "basic", title: "TEMU助手", message: "您店铺【" + request.mallName + "】的商品【" + request.productName + "】成功加入发货台,请尽快处理", iconUrl: "./icons/48.png"
@@ -285,6 +317,18 @@ function getAliexpressCookie(link = "https://csp.aliexpress.com/") {
})
}
+function getXcCookie(link = "http://xc.rqlis.com:888/") {
+ let cStr = '';
+ return new Promise((resolve, reject) => {
+ chrome.cookies.getAll({url: link}, (cookie) => {
+ cookie.map((c) => {
+ cStr += c.name + '=' + c.value + ';';
+ });
+ resolve(cStr);
+ });
+ })
+}
+
function formatParams(data) {
const arr = []
for (let name in data) {
diff --git a/src/manifest.development.json b/src/manifest.development.json
index 8844028..06001b6 100644
--- a/src/manifest.development.json
+++ b/src/manifest.development.json
@@ -22,7 +22,8 @@
"*://*.shein.com/",
"*://*.geiwohuo.com/",
"*://*.ltwebstatic.com/",
- "*://*.goodcang.com/"
+ "*://*.goodcang.com/",
+ "*://*.rqlis.com*"
],
"permissions": [
"cookies",
@@ -82,6 +83,11 @@
"id": "11",
"enabled": true,
"path": "rules_11.json"
+ },
+ {
+ "id": "12",
+ "enabled": true,
+ "path": "rules_12.json"
}
]
},
diff --git a/src/manifest.production.json b/src/manifest.production.json
index 32e6251..d522e48 100644
--- a/src/manifest.production.json
+++ b/src/manifest.production.json
@@ -21,7 +21,8 @@
"*://*.amazon.com/",
"*://*.shein.com/",
"*://*.geiwohuo.com/",
- "*://*.ltwebstatic.com/"
+ "*://*.ltwebstatic.com/",
+ "*://*.rqlis.com*"
],
"permissions": [
"cookies",
@@ -81,6 +82,11 @@
"id": "11",
"enabled": true,
"path": "rules_11.json"
+ },
+ {
+ "id": "12",
+ "enabled": true,
+ "path": "rules_12.json"
}
]
},
diff --git a/src/router/index.js b/src/router/index.js
index 31210c1..ec70d14 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -287,6 +287,12 @@ const router = new VueRouter({
name: 'syncDataTemu',
component: () => import('../view/data/SyncDataTemu.vue')
},
+
+ {
+ path: 'sendGoods_xc',
+ name: 'sendGoods_xc',
+ component: () => import('../view/semi/SemiSendGoods_XC.vue')
+ },
// {
// path: 'statistics',
diff --git a/src/view/Home.vue b/src/view/Home.vue
index 6770735..cb2214a 100644
--- a/src/view/Home.vue
+++ b/src/view/Home.vue
@@ -169,6 +169,13 @@
数据同步(TEMU)
+
+
+
+ 半托管
+
+ 发货(芯仓)
+
弹窗消息
diff --git a/src/view/login/Forget.vue b/src/view/login/Forget.vue
index 70cf9a0..b1ed9e1 100644
--- a/src/view/login/Forget.vue
+++ b/src/view/login/Forget.vue
@@ -28,7 +28,7 @@
{{ isStart ? time + ' S' : '发送验证码' }}
- 重置设置
+ 设置