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
5949681d
Commit
5949681d
authored
Mar 21, 2024
by
刘燕芳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save
parent
9f17e335
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
5 deletions
+9
-5
manifest.json
manifest.json
+2
-1
package-lock.json
package-lock.json
+1
-1
index.ts
src/background/index.ts
+3
-3
index.ts
src/content/index.ts
+3
-0
No files found.
manifest.json
View file @
5949681d
...
@@ -25,7 +25,8 @@
...
@@ -25,7 +25,8 @@
"*://admin.rtxmdz.com/*"
,
"*://admin.rtxmdz.com/*"
,
"http://localhost:8082/*"
,
"http://localhost:8082/*"
,
"http://localhost:8083/*"
,
"http://localhost:8083/*"
,
"*://*.rtxmdz.com/*"
"*://*.rtxmdz.com/*"
,
"http://localhost:10823/*"
],
],
"js"
:
[
"content.js"
],
"js"
:
[
"content.js"
],
"run_at"
:
"document_idle"
"run_at"
:
"document_idle"
...
...
package-lock.json
View file @
5949681d
{
{
"name"
:
"linkfahuoyi-exension"
,
"name"
:
"linkfahuoyi-exension"
,
"version"
:
"1.
0.0
"
,
"version"
:
"1.
1.6
"
,
"lockfileVersion"
:
1
,
"lockfileVersion"
:
1
,
"requires"
:
true
,
"requires"
:
true
,
"dependencies"
:
{
"dependencies"
:
{
...
...
src/background/index.ts
View file @
5949681d
...
@@ -59,16 +59,15 @@ chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) {
...
@@ -59,16 +59,15 @@ chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) {
// let port = chrome.runtime.connect({ name: "bgSendMessage" })
// let port = chrome.runtime.connect({ name: "bgSendMessage" })
// port.postMessage(message)
// port.postMessage(message)
}
else
if
(
message
.
action
===
ACTION
.
BookingV2
)
{
}
else
if
(
message
.
action
===
ACTION
.
BookingV2
)
{
// 从bg页面转发给厂家页面的content.js
// 从bg页面转发给厂家页面的content.js
chrome
.
tabs
.
query
({
chrome
.
tabs
.
query
({
url
:
bookingV2Urls
url
:
bookingV2Urls
},
function
(
tabs
)
{
},
function
(
tabs
)
{
tabs
&&
tabs
.
forEach
(
tab
=>
{
tabs
&&
tabs
.
forEach
(
tab
=>
{
// chrome.tabs.sendMessage(tab.id!, message)
// chrome.tabs.sendMessage(tab.id!, message)
chrome
.
tabs
.
update
(
tab
.
id
!
,
{
active
:
true
},
function
(
tab1
)
{});
chrome
.
tabs
.
update
(
tab
.
id
!
,
{
active
:
true
},
function
(
tab1
)
{});
chrome
.
tabs
.
sendMessage
(
tab
.
id
!
,
{
action
:
ACTION
.
BookingV2
,
value
:
message
.
value
},
res
=>
{
chrome
.
tabs
.
sendMessage
(
tab
.
id
!
,
{
action
:
ACTION
.
BookingV2
,
value
:
message
.
value
},
res
=>
{
console
.
log
(
333
,
res
,
new
Date
().
getTime
(),
new
Date
().
getSeconds
());
if
(
res
){
if
(
res
){
sendResponse
(
res
);
sendResponse
(
res
);
chrome
.
tabs
.
update
(
sender
.
tab
!
.
id
!
,
{
active
:
true
},
function
(
tab1
)
{});
chrome
.
tabs
.
update
(
sender
.
tab
!
.
id
!
,
{
active
:
true
},
function
(
tab1
)
{});
...
@@ -102,7 +101,8 @@ chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) {
...
@@ -102,7 +101,8 @@ chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) {
// let port = chrome.runtime.connect({ name: "bgSendMessage" })
// let port = chrome.runtime.connect({ name: "bgSendMessage" })
// port.postMessage(message)
// port.postMessage(message)
}
}
console
.
log
(
555
);
return
true
;
return
true
;
})
})
// chrome.runtime.onConnect.addListener(function (msg) {
// chrome.runtime.onConnect.addListener(function (msg) {
...
...
src/content/index.ts
View file @
5949681d
...
@@ -208,6 +208,7 @@ window.addEventListener("message",function(message:any){
...
@@ -208,6 +208,7 @@ window.addEventListener("message",function(message:any){
if
(
message
.
data
.
action
==
ACTION
.
BookingApp
){
if
(
message
.
data
.
action
==
ACTION
.
BookingApp
){
chrome
.
runtime
.
sendMessage
(
message
.
data
,(
ret
)
=>
{
chrome
.
runtime
.
sendMessage
(
message
.
data
,(
ret
)
=>
{
console
.
log
(
'ret'
,
ret
,
new
Date
().
getTime
(),
new
Date
().
getSeconds
());
window
.
postMessage
({
isResult
:
1
,...
ret
},
"*"
)
window
.
postMessage
({
isResult
:
1
,...
ret
},
"*"
)
console
.
log
(
"message ret:"
,
ret
,
message
.
data
);
console
.
log
(
"message ret:"
,
ret
,
message
.
data
);
})
})
...
@@ -223,6 +224,7 @@ window.addEventListener("message",function(message:any){
...
@@ -223,6 +224,7 @@ window.addEventListener("message",function(message:any){
//发货易页面
//发货易页面
chrome
.
runtime
.
onMessage
.
addListener
(
function
(
message
:
Message
,
sender
,
response
)
{
chrome
.
runtime
.
onMessage
.
addListener
(
function
(
message
:
Message
,
sender
,
response
)
{
console
.
log
(
'发货易页面'
,
message
,
sender
,
new
Date
().
getTime
(),
new
Date
().
getSeconds
());
if
(
message
.
action
===
Print
)
{
if
(
message
.
action
===
Print
)
{
if
(
message
.
value
.
waybillNo
)
{
if
(
message
.
value
.
waybillNo
)
{
printWayBillByOld
(
message
.
value
.
waybillNo
,
message
.
value
.
wayCompanyId
)
printWayBillByOld
(
message
.
value
.
waybillNo
,
message
.
value
.
wayCompanyId
)
...
@@ -241,6 +243,7 @@ chrome.runtime.onMessage.addListener(function (message: Message, sender, respons
...
@@ -241,6 +243,7 @@ chrome.runtime.onMessage.addListener(function (message: Message, sender, respons
result
=
await
BookingV2
.
booking
(
message
.
value
.
waybillTemplateTitle
,
message
.
value
.
orderNo
,
message
.
value
.
shopId
,
message
.
value
.
fhy_type
);
result
=
await
BookingV2
.
booking
(
message
.
value
.
waybillTemplateTitle
,
message
.
value
.
orderNo
,
message
.
value
.
shopId
,
message
.
value
.
fhy_type
);
result
.
action
=
'V2'
result
.
action
=
'V2'
coming
=
false
coming
=
false
console
.
log
(
'BookingV2'
,
result
,
new
Date
().
getTime
(),
new
Date
().
getSeconds
());
response
(
result
);
response
(
result
);
}
}
})();
})();
...
...
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