Commit 5949681d authored by 刘燕芳's avatar 刘燕芳

save

parent 9f17e335
...@@ -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"
......
{ {
"name": "linkfahuoyi-exension", "name": "linkfahuoyi-exension",
"version": "1.0.0", "version": "1.1.6",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
......
...@@ -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) {
......
...@@ -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);
} }
})(); })();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment