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
22d1556d
Commit
22d1556d
authored
Mar 18, 2024
by
刘燕芳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save
parent
5919c7e2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
21 deletions
+11
-21
index.ts
src/background/index.ts
+5
-6
bookingV2.ts
src/content/bookingV2.ts
+6
-12
index.tsx
src/popup/components/WayBillModel/index.tsx
+0
-3
No files found.
src/background/index.ts
View file @
22d1556d
...
@@ -16,12 +16,12 @@ let taIssueId:any = null
...
@@ -16,12 +16,12 @@ let taIssueId:any = null
chrome
.
runtime
.
onMessage
.
addListener
(
function
(
message
,
sender
,
sendResponse
)
{
chrome
.
runtime
.
onMessage
.
addListener
(
function
(
message
,
sender
,
sendResponse
)
{
// console.log('message1',message,sender);
// console.log('message1',message,sender);
if
(
message
.
action
===
ACTION
.
task
)
{
if
(
message
.
action
===
ACTION
.
task
)
{
if
(
JSON
.
stringify
(
tb_user
)
===
"{}"
)
{
if
(
JSON
.
stringify
(
tb_user
)
===
"{}"
)
{
chrome
.
storage
.
sync
.
set
({
"info"
:
'当前千牛登录账号信息获取失败'
})
chrome
.
storage
.
sync
.
set
({
"info"
:
'当前千牛登录账号信息获取失败'
})
console
.
log
(
111
);
console
.
log
(
111
);
sendResponse
({
status
:
-
200
,
task_id
:
message
.
value
.
task_id
,
msg
:
"当前千牛登录账号信息获取失败,请登录千牛账号后重试!"
});
sendResponse
({
status
:
-
200
,
task_id
:
message
.
value
.
task_id
,
msg
:
"当前千牛登录账号信息获取失败,请登录千牛账号后重试!"
});
return
true
return
true
}
else
{
}
else
{
chrome
.
storage
.
sync
.
remove
(
"info"
)
chrome
.
storage
.
sync
.
remove
(
"info"
)
if
(
message
.
value
.
seller
.
seller_name
!==
tb_user
.
userNick
){
if
(
message
.
value
.
seller
.
seller_name
!==
tb_user
.
userNick
){
chrome
.
storage
.
sync
.
set
({
"info"
:
'当前登录的千牛账号与图动力授权的账号信息不一致,请统一登录后重试!'
})
chrome
.
storage
.
sync
.
set
({
"info"
:
'当前登录的千牛账号与图动力授权的账号信息不一致,请统一登录后重试!'
})
...
@@ -29,8 +29,8 @@ chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) {
...
@@ -29,8 +29,8 @@ chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) {
sendResponse
({
status
:
-
200
,
task_id
:
message
.
value
.
task_id
,
msg
:
"当前登录的千牛账号与图动力授权的账号信息不一致,请统一登录后重试!"
});
sendResponse
({
status
:
-
200
,
task_id
:
message
.
value
.
task_id
,
msg
:
"当前登录的千牛账号与图动力授权的账号信息不一致,请统一登录后重试!"
});
return
true
return
true
}
}
}
}
chrome
.
tabs
.
query
({
chrome
.
tabs
.
query
({
url
:
tbIssueUrls
url
:
tbIssueUrls
},
function
(
tabs
)
{
},
function
(
tabs
)
{
// 如果图动力登录的账号和千牛云登录的账号不一致,则popup页面爆红
// 如果图动力登录的账号和千牛云登录的账号不一致,则popup页面爆红
...
@@ -51,7 +51,7 @@ chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) {
...
@@ -51,7 +51,7 @@ chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) {
sendResponse
({
status
:
-
200
,
task_id
:
message
.
value
.
task_id
,
msg
:
"请打开千牛商家工作台"
});
sendResponse
({
status
:
-
200
,
task_id
:
message
.
value
.
task_id
,
msg
:
"请打开千牛商家工作台"
});
alert
(
'请打开千牛商家工作台'
)
alert
(
'请打开千牛商家工作台'
)
}
}
})
})
}
else
if
(
message
.
action
===
'getUserLoginData'
){
}
else
if
(
message
.
action
===
'getUserLoginData'
){
getUserLoginData
()
getUserLoginData
()
let
awaitResultFun
=
()
=>
{
let
awaitResultFun
=
()
=>
{
...
@@ -145,7 +145,6 @@ chrome.tabs.onUpdated.addListener(async (tabId, changeInfo, tab) => {
...
@@ -145,7 +145,6 @@ chrome.tabs.onUpdated.addListener(async (tabId, changeInfo, tab) => {
chrome
.
tabs
.
remove
(
id
);
chrome
.
tabs
.
remove
(
id
);
}
}
}
}
})
})
async
function
getUserLoginData
(){
async
function
getUserLoginData
(){
...
...
src/content/bookingV2.ts
View file @
22d1556d
...
@@ -24,14 +24,8 @@ async function booking(info: any) {
...
@@ -24,14 +24,8 @@ async function booking(info: any) {
let
default_info
=
JSON
.
parse
(
goods
)
let
default_info
=
JSON
.
parse
(
goods
)
tbIssueJsonDataV2
=
default_info
tbIssueJsonDataV2
=
default_info
result
=
await
tbDataJoinAndIssueV2
(
userDataJson
,
goodsData
,
goodsId
);
result
=
await
tbDataJoinAndIssueV2
(
userDataJson
,
goodsData
,
goodsId
);
// let {data:result} = await axios.post('https://item.upload.taobao.com/sell/v2/submit.htm', data, {
// headers: {
// 'Content-Type': 'application/x-www-form-urlencoded',
// 'Accept':'application/json',
// 'x-xsrf-token': userDataJson.token
// }
// })
let
rJson
=
result
let
rJson
=
result
console
.
log
(
'rJson'
,
rJson
);
try
{
try
{
if
(
rJson
.
hasOwnProperty
(
"ret"
))
{
if
(
rJson
.
hasOwnProperty
(
"ret"
))
{
if
(
JSON
.
stringify
(
rJson
.
ret
).
indexOf
(
"被挤爆啦"
)
!=
-
1
)
{
if
(
JSON
.
stringify
(
rJson
.
ret
).
indexOf
(
"被挤爆啦"
)
!=
-
1
)
{
...
@@ -45,8 +39,8 @@ async function booking(info: any) {
...
@@ -45,8 +39,8 @@ async function booking(info: any) {
let
rmg
=
rJson
.
models
.
globalMessage
;
let
rmg
=
rJson
.
models
.
globalMessage
;
let
rSuccessUrl
=
rmg
.
successUrl
;
let
rSuccessUrl
=
rmg
.
successUrl
;
let
rType
=
rmg
.
type
;
let
rType
=
rmg
.
type
;
reqMsg
.
status
=
rType
==
"s
tatu
s"
?
10
:
-
200
reqMsg
.
status
=
rType
==
"s
ucces
s"
?
10
:
-
200
if
(
rType
!=
"s
tatu
s"
)
{
if
(
rType
!=
"s
ucces
s"
)
{
let
msg
=
JSON
.
stringify
(
rJson
.
models
);
let
msg
=
JSON
.
stringify
(
rJson
.
models
);
reqMsg
.
msg
=
msg
;
reqMsg
.
msg
=
msg
;
}
}
...
@@ -342,7 +336,7 @@ async function tbDataJoinAndIssueV2(userData:any, goodsData:any, goodsId:number)
...
@@ -342,7 +336,7 @@ async function tbDataJoinAndIssueV2(userData:any, goodsData:any, goodsId:number)
console
.
log
(
'tbDataJoinAndIssueV2'
,
tbIssueJsonDataV2
,
goodsId
);
console
.
log
(
'tbDataJoinAndIssueV2'
,
tbIssueJsonDataV2
,
goodsId
);
let
data
=
{
let
data
=
{
jsonBody
:
JSON
.
stringify
(
tbIssueJsonDataV2
),
jsonBody
:
JSON
.
stringify
(
tbIssueJsonDataV2
),
catId
:
150704
,
//
tbIssueJsonDataV2.catId,
catId
:
tbIssueJsonDataV2
.
catId
,
itemId
:
goodsId
,
itemId
:
goodsId
,
copyItemMode
:
0
copyItemMode
:
0
}
}
...
@@ -382,10 +376,10 @@ async function tbGetIssueGoodsIdV2(userData:any, goodsData:any,data:any) {
...
@@ -382,10 +376,10 @@ async function tbGetIssueGoodsIdV2(userData:any, goodsData:any,data:any) {
}
}
})
})
let
issueGoodsIdRd
=
result
.
data
let
issueGoodsIdRd
=
result
.
data
console
.
log
(
'issueGoodsIdRd'
,
issueGoodsIdRd
);
//
console.log('issueGoodsIdRd',issueGoodsIdRd);
let
link
=
"https:"
+
issueGoodsIdRd
.
link
;
let
link
=
"https:"
+
issueGoodsIdRd
.
link
;
let
{
data
:
goodsHtml
}:
any
=
await
axios
.
get
(
link
);
let
{
data
:
goodsHtml
}:
any
=
await
axios
.
get
(
link
);
console
.
log
(
"goodsHtml"
,
goodsHtml
);
//
console.log("goodsHtml",goodsHtml);
let
index
=
goodsHtml
.
indexOf
(
'data":{"itemId":'
);
let
index
=
goodsHtml
.
indexOf
(
'data":{"itemId":'
);
let
startIndex
=
index
+
16
;
let
startIndex
=
index
+
16
;
let
goodsId
=
goodsHtml
.
substring
(
startIndex
,
startIndex
+
12
);
let
goodsId
=
goodsHtml
.
substring
(
startIndex
,
startIndex
+
12
);
...
...
src/popup/components/WayBillModel/index.tsx
View file @
22d1556d
...
@@ -89,9 +89,6 @@ const WayBillModel = function () {
...
@@ -89,9 +89,6 @@ const WayBillModel = function () {
initTime
++
initTime
++
getLogin
()
getLogin
()
chrome
.
runtime
.
sendMessage
({
action
:
'getUserLoginData'
},
async
()
=>
{
chrome
.
runtime
.
sendMessage
({
action
:
'getUserLoginData'
},
async
()
=>
{
console
.
log
(
111
,
new
Date
().
getTime
());
// await delayDate(1000)
// console.log(222,new Date().getTime());
let
userData
:
any
=
await
getStorageItem
(
"tb_user"
)
let
userData
:
any
=
await
getStorageItem
(
"tb_user"
)
console
.
log
(
'userData'
,
userData
,
new
Date
().
getMinutes
(),
new
Date
().
getSeconds
());
console
.
log
(
'userData'
,
userData
,
new
Date
().
getMinutes
(),
new
Date
().
getSeconds
());
if
(
userData
==
null
)
{
if
(
userData
==
null
)
{
...
...
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