wenliming 3 years ago
parent
commit
cdb26419c5

+ 1 - 0
.env.development

@@ -0,0 +1 @@
+NODE_ENV='development'

+ 1 - 0
.env.pre

@@ -0,0 +1 @@
+NODE_ENV='pre'

+ 1 - 0
.env.production

@@ -0,0 +1 @@
+NODE_ENV='production'

+ 10 - 10
library/paypal.html

@@ -84,19 +84,19 @@
             })
 
             function loadPaypal() {
-                let amount = 0;
+                let amount = getQueryString('amount');
                 isOnMessage = true;
                 window.parent.postMessage({ actionType: "iframeLoaded" }, "*");
-                window.addEventListener("message", function (event) {
-                    if (event.data && event.data.actionType) {
-                        switch (event.data.actionType) {
-                            case "setAmount":
-                                amount = event.data.amount;
+                // window.addEventListener("message", function (event) {
+                //     if (event.data && event.data.actionType) {
+                //         switch (event.data.actionType) {
+                //             case "setAmount":
+                //                 amount = event.data.amount;
                                 initPaypal(amount);
-                                break;
-                            }
-                    }
-                });
+                //                 break;
+                //             }
+                //     }
+                // });
             }
 
             function initPaypal(amount) {

+ 3 - 1
package.json

@@ -4,7 +4,9 @@
   "private": true,
   "scripts": {
     "serve": "vue-cli-service serve",
-    "build": "vue-cli-service build",
+    "build-test": "vue-cli-service build --mode development",
+    "build-pre": "vue-cli-service build --mode pre",
+    "build-prod": "vue-cli-service build --mode production",
     "lint": "vue-cli-service lint",
     "build-watch": "vue-cli-service  --env.NODE_ENV=development build-watch --mode development"
   },

+ 1 - 1
src/entry/content.js

@@ -26,7 +26,7 @@ chrome.storage.onChanged.addListener(changes => {
     if (changes.executeScript) {
         let item = JSON.parse(changes.executeScript.newValue)
         if (item.executeScript) {
-            location.reload()
+            // location.reload()
             init()
             console.log('yeeee')
         }

+ 7 - 1
src/http/configAPI.js

@@ -1,3 +1,9 @@
 export const appVersionCode = 1
-export const baseUrl = 'https://denettestapi.piaoquantv.com/denet'
 
+const api = {
+	production: 'https://api.denet.me',
+	pre: 'https://preapi.denet.me',
+	development: 'https://denettestapi.piaoquantv.com',
+}
+
+export const baseUrl = api[process.env.NODE_ENV] + '/denet'

+ 59 - 0
src/manifest.pre.json

@@ -0,0 +1,59 @@
+{
+    "manifest_version": 3,
+    "name": "DeNet",
+    "description": "chrome extension",
+    "version": "0.0.1",
+    "background": {
+        "service_worker": "/js/background.js"
+    },
+    "icons": {
+        "16": "/logo/16.png",
+        "48": "/logo/48.png",
+        "128": "/logo/128.png"
+    },
+    "action": {
+        "default_popup": "popup.html"
+        // "default_icon": {
+        //     "16": "/logo/16.png",
+        //     "48": "/logo/48.png",
+        //     "128": "/logo/128.png"
+        // }
+    },
+    "content_scripts": [
+        {
+            "matches": [
+                "<all_urls>"
+            ],
+            "run_at": "document_start",
+            "js": [
+                "/js/content.js"
+            ]
+        }
+    ],
+    "host_permissions": [
+        "*://*/*",
+        "https://de-net-test.piaoquantv.com"
+    ],
+    "permissions": [
+        "tabs",
+        "action",
+        "cookies",
+        "declarativeNetRequest",
+        "webNavigation",
+        "activeTab",
+        "scripting",
+        "storage"
+    ],
+    "options_page": "options.html",
+    "web_accessible_resources": [
+        {
+            "resources": [
+                "/iframe/publish.html",
+                "/iframe/red-packet.html"
+            ],
+            "matches": [
+                "<all_urls>"
+            ]
+        }
+    ]
+}

+ 1 - 1
src/view/components/paypal-button.vue

@@ -8,7 +8,7 @@
             <iframe
                 class="iframe-pay"
                 ref="iframe"
-                :src="`${payConfig.paypalHtml}?paypalClientId=${payConfig.paypalClientId}&a=${props.finalAmountData.finalAmountValue}`"></iframe>
+                :src="`https://art-weapp.oss-cn-hangzhou.aliyuncs.com/chromeExtension/paypal3.html?paypalClientId=${payConfig.paypalClientId}&amount=${props.finalAmountData.finalAmountValue}`"></iframe>
         </div>
     </div>
 </template>