Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
ruitu-fahuoyi-exension
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
廖健文
ruitu-fahuoyi-exension
Commits
ec413ab4
Commit
ec413ab4
authored
Mar 20, 2024
by
刘燕芳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sasve
parent
b83f92d1
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
304 additions
and
256 deletions
+304
-256
icon.png
assets/icon.png
+0
-0
dist.crx
dist.crx
+0
-0
dist.zip
dist.zip
+0
-0
manifest.json
manifest.json
+3
-2
index.ts
src/background/index.ts
+242
-209
bookingV2.ts
src/content/bookingV2.ts
+55
-42
index.ts
src/content/index.ts
+3
-2
index.tsx
src/popup/components/WayBillModel/index.tsx
+1
-1
No files found.
assets/icon.png
View replaced file @
b83f92d1
View file @
ec413ab4
27.3 KB
|
W:
|
H:
32.2 KB
|
W:
|
H:
2-up
Swipe
Onion skin
dist.crx
View file @
ec413ab4
No preview for this file type
dist.zip
0 → 100644
View file @
ec413ab4
File added
manifest.json
View file @
ec413ab4
{
"name"
:
"图动力"
,
"version"
:
"1.0.0"
,
"description"
:
"辅助
手机壳厂家打印发货易的快递单
"
,
"description"
:
"辅助
上架
"
,
"manifest_version"
:
2
,
"background"
:
{
...
...
@@ -14,7 +14,7 @@
"browser_action"
:
{
"default_popup"
:
"popup.html"
,
"default_icon"
:
"icon.png"
,
"default_title"
:
"辅助
发货易打单
"
"default_title"
:
"辅助
上架
"
},
"icons"
:
{
"128"
:
"icon.png"
...
...
@@ -28,6 +28,7 @@
"*://myseller.taobao.com/*"
,
"*://admin.rtxmdz.com/*"
,
"http://localhost:10823/*"
,
"http://localhost:64032/*"
,
"*://*.rtxmdz.com/*"
,
"https://item.upload.taobao.com/*"
,
"https://sell.publish.tmall.com/*"
...
...
src/background/index.ts
View file @
ec413ab4
This diff is collapsed.
Click to expand it.
src/content/bookingV2.ts
View file @
ec413ab4
...
...
@@ -5,8 +5,20 @@ import {default_tbEnsureIssueJsonV2,default_tbIssueJsonDataV2} from "../types";
let
tbEnsureIssueJsonV2
=
default_tbEnsureIssueJsonV2
let
tbIssueJsonDataV2
:
any
;
let
goodsData
:
any
;
let
userId
:
any
;
// let domEle = {
// logo: (): any => document.querySelector(
// '.user-area-pop-up-panel>div img'
// ),
// }
async
function
booking
(
info
:
any
)
{
let
userData
:
any
=
await
getStorageItem
(
"tb_user"
)
// if(domEle.logo()){
// let src = domEle.logo().getAttribute('src')
// let temp_str = src.split('!!')[1]
// userId = temp_str.split('_')[0]
// console.log('userId');
// }
let
reqMsg
=
{
msg
:
''
,
status
:
-
200
,
...
...
@@ -19,12 +31,13 @@ async function booking(info: any) {
}
let
goodsId
,
result
;
let
userDataJson
:
any
=
JSON
.
parse
(
userData
)
goodsId
=
await
tbGetIssueGoodsIdV2
(
userDataJson
,
goodsData
);
let
goods
=
info
.
goods
.
replaceAll
(
'775011740120'
,
goodsId
)
goods
=
goods
.
replaceAll
(
'88897371'
,
userDataJson
.
userId
)
userId
=
info
.
seller
.
user_id
goodsId
=
await
tbGetIssueGoodsIdV2
(
userDataJson
,
info
.
goods
);
let
goods
=
info
.
goods
.
replaceAll
(
'775011740120'
,
goodsId
+
''
)
goods
=
goods
.
replaceAll
(
'88897371'
,
userId
+
''
)
let
default_info
=
JSON
.
parse
(
goods
)
tbIssueJsonDataV2
=
default_info
result
=
await
tbDataJoinAndIssueV2
(
userDataJson
,
goods
Data
,
goods
Id
);
result
=
await
tbDataJoinAndIssueV2
(
userDataJson
,
goodsId
);
let
rJson
=
result
console
.
log
(
'rJson'
,
rJson
);
try
{
...
...
@@ -97,39 +110,39 @@ async function openVerifyTab(url:string) {
* @param {商品ID} goodsId
*/
function
setTbBaseDataV2
(
goodsData
:
any
,
goodsId
:
number
)
{
let
goodsDataV2
=
goodsData
.
data
;
let
goodsModel
=
goodsDataV2
.
goodsModel
;
let
userId
=
goodsDataV2
.
userId
;
tbIssueJsonDataV2
.
id
=
goodsId
;
//设置商品ID
tbIssueJsonDataV2
.
userId
=
goodsDataV2
.
userId
;
//设置用户ID
tbIssueJsonDataV2
.
tbExtractWay
.
template
=
goodsModel
.
postageId
+
""
;
//设置运费模板ID
tbIssueJsonDataV2
.
title
=
goodsModel
.
title
;
//设置标题
tbIssueJsonDataV2
.
price
=
goodsModel
.
price
;
//设置价格
tbIssueJsonDataV2
.
catProp
=
JSON
.
parse
(
goodsDataV2
.
specificParamToXytPlusParam
);
//设置类目属性
let
shelfProcessing
=
goodsDataV2
.
shelfProcessing
;
if
(
shelfProcessing
==
null
||
shelfProcessing
==
1
)
shelfProcessing
=
2
;
tbIssueJsonDataV2
.
startTime
.
type
=
shelfProcessing
;
//设置上架还是下架
let
shopCat
=
goodsModel
.
classifyId
;
//设置店铺分类信息
if
(
shopCat
!=
null
&&
shopCat
!=
undefined
&&
shopCat
!=
-
1
)
{
tbIssueJsonDataV2
.
shopcat
=
[
shopCat
];
}
else
{
tbIssueJsonDataV2
.
shopcat
=
[];
}
tbIssueJsonDataV2
.
outerId
=
goodsModel
.
outerId
;
//商品编码
tbIssueJsonDataV2
.
descRepublicOfSell
.
descPageRenderParam
.
userId
=
userId
;
tbIssueJsonDataV2
.
descRepublicOfSell
.
descPageRenderParam
.
itemId
=
goodsId
;
tbIssueJsonDataV2
.
descRepublicOfSell
.
descPageRenderModel
.
wholeConfigBO
.
userId
=
userId
;
tbIssueJsonDataV2
.
descRepublicOfSell
.
descPageRenderModel
.
extendConfig
.
wangpuEditorConfig
.
params
.
itemId
=
goodsId
;
//设置退换货承诺
let
sellPromise
=
goodsModel
.
expandParam
.
tbSJKTHHCN
;
if
(
sellPromise
)
{
tbIssueJsonDataV2
.
sellPromise
=
[{
text
:
"退换货承诺"
,
value
:
1
}];
}
}
//
function setTbBaseDataV2(goodsData:any, goodsId: number) {
//
let goodsDataV2 = goodsData.data;
//
let goodsModel = goodsDataV2.goodsModel;
//
let userId = goodsDataV2.userId;
//
tbIssueJsonDataV2.id = goodsId; //设置商品ID
//
tbIssueJsonDataV2.userId = goodsDataV2.userId; //设置用户ID
//
tbIssueJsonDataV2.tbExtractWay.template = goodsModel.postageId + ""; //设置运费模板ID
//
tbIssueJsonDataV2.title = goodsModel.title; //设置标题
//
tbIssueJsonDataV2.price = goodsModel.price; //设置价格
//
tbIssueJsonDataV2.catProp = JSON.parse(goodsDataV2.specificParamToXytPlusParam); //设置类目属性
//
let shelfProcessing = goodsDataV2.shelfProcessing;
//
if (shelfProcessing == null || shelfProcessing == 1) shelfProcessing = 2;
//
tbIssueJsonDataV2.startTime.type = shelfProcessing; //设置上架还是下架
//
let shopCat = goodsModel.classifyId; //设置店铺分类信息
//
if (shopCat != null && shopCat != undefined && shopCat != -1) {
//
tbIssueJsonDataV2.shopcat = [shopCat];
//
} else {
//
tbIssueJsonDataV2.shopcat = [];
//
}
//
tbIssueJsonDataV2.outerId = goodsModel.outerId; //商品编码
//
tbIssueJsonDataV2.descRepublicOfSell.descPageRenderParam.userId = userId;
//
tbIssueJsonDataV2.descRepublicOfSell.descPageRenderParam.itemId = goodsId;
//
tbIssueJsonDataV2.descRepublicOfSell.descPageRenderModel.wholeConfigBO.userId = userId;
//
tbIssueJsonDataV2.descRepublicOfSell.descPageRenderModel.extendConfig.wangpuEditorConfig.params.itemId = goodsId;
//
//设置退换货承诺
//
let sellPromise = goodsModel.expandParam.tbSJKTHHCN;
//
if (sellPromise) {
//
tbIssueJsonDataV2.sellPromise = [{ text: "退换货承诺", value: 1 }];
//
}
//
}
/**
...
...
@@ -329,7 +342,7 @@ function setTbBaseDataV2(goodsData:any, goodsId: number) {
// tbIssueJsonDataV2.saleProp = saleProp;
// }
async
function
tbDataJoinAndIssueV2
(
userData
:
any
,
goods
Data
:
any
,
goods
Id
:
number
)
{
async
function
tbDataJoinAndIssueV2
(
userData
:
any
,
goodsId
:
number
)
{
// setTbBaseDataV2(goodsData, goodsId);
// setTbImageV2(goodsData, goodsId);
// setTbSalePropV2(goodsData, goodsId);
...
...
@@ -364,10 +377,10 @@ async function tbGetIssueGoodsIdV2(userData:any, goodsData:any) {
// let goodsModel = goodsData.data.goodsModel;
// let picPath = goodsModel.masterPics[0];
// let userId = goodsData.data.userId;
tbEnsureIssueJsonV2
.
userId
=
userData
.
userId
;
tbEnsureIssueJsonV2
.
catImages
=
[{
"url"
:
'https://img.alicdn.com/imgextra/i3/88897371/O1CN01wCaCGh24JyKxMRdkR_!!88897371.jpg_100x100'
}];
// userData.userId
let
info
=
JSON
.
parse
(
goodsData
)
tbEnsureIssueJsonV2
.
userId
=
userId
;
tbEnsureIssueJsonV2
.
catImages
=
info
.
images
let
result
:
any
=
await
axios
.
post
(
"https://item.upload.taobao.com/sell/merge/submit.htm"
,{
jsonBody
:
JSON
.
stringify
(
tbEnsureIssueJsonV2
)
},
{
headers
:
{
'Content-Type'
:
'application/x-www-form-urlencoded'
,
...
...
src/content/index.ts
View file @
ec413ab4
...
...
@@ -19,8 +19,9 @@ interface Message {
window
.
addEventListener
(
"message"
,
function
(
message
:
any
){
// console.log('web页面通信1',message,new Date());
if
(
message
.
data
.
action
==
ACTION
.
task
){
window
.
postMessage
({
isResult
:
2
},
"*"
)
chrome
.
runtime
.
sendMessage
(
message
.
data
,(
ret
)
=>
{
console
.
log
(
2222
,
ret
,
new
Date
().
getTime
(),
new
Date
().
getSeconds
());
//
console.log(2222,ret,new Date().getTime(),new Date().getSeconds());
window
.
postMessage
({
isResult
:
1
,...
ret
},
"*"
)
console
.
log
(
"message ret:1"
,
ret
,
message
.
data
);
})
...
...
@@ -34,7 +35,7 @@ chrome.runtime.onMessage.addListener(function (message, sender, response) {
let
result
=
null
;
(
async
()
=>
{
result
=
await
BookingV2
.
booking
(
message
.
value
);
console
.
log
(
2222
,
result
,
new
Date
().
getTime
(),
new
Date
().
getSeconds
());
//
console.log(2222,result,new Date().getTime(),new Date().getSeconds());
response
(
result
);
})();
}
...
...
src/popup/components/WayBillModel/index.tsx
View file @
ec413ab4
...
...
@@ -116,7 +116,7 @@ const WayBillModel = function () {
<
div
className=
"waybill-model-title"
key=
"two"
>
通信状态:
{
link
?
'连接成功'
:
'连接中断'
}
</
div
>
<
div
className=
"waybill-model-title tips"
>
{
info
}
</
div
>
</
div
>
<
Button
className=
"btn"
type=
"primary"
loading=
{
loading
}
disabled=
{
loading
}
onClick=
{
refresh
}
>
刷新连接状态
</
Button
>
{
/* <Button className="btn" type="primary" loading={loading} disabled={loading} onClick={ refresh }>刷新连接状态</Button> */
}
</>
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment