소스 검색

[edit][pre]

zhangwei 3 년 전
부모
커밋
21fba0dfac
8개의 변경된 파일81개의 추가작업 그리고 18개의 파일을 삭제
  1. 1 0
      package.json
  2. 7 1
      src/http/configAPI.js
  3. 2 2
      src/http/request.js
  4. 1 1
      src/manifest.development.json
  5. 58 0
      src/manifest.preview.json
  6. 3 4
      src/manifest.production.json
  7. 3 4
      src/server/twitter.js
  8. 6 6
      src/view/red-packet.vue

+ 1 - 0
package.json

@@ -5,6 +5,7 @@
   "scripts": {
     "serve": "vue-cli-service serve",
     "build": "vue-cli-service build",
+    "pre": "vue-cli-service build --env.NODE_ENV=preview build-watch --mode preview",
     "lint": "vue-cli-service lint",
     "build-watch": "vue-cli-service  --env.NODE_ENV=development build-watch --mode development"
   },

+ 7 - 1
src/http/configAPI.js

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

+ 2 - 2
src/http/request.js

@@ -1,13 +1,13 @@
 import axios from 'axios'
 import { getChromeStorage } from '../uilts/chromeExtension.js'
-import { baseUrl, appVersionCode } from '../http/configAPI.js'
+import { baseAPIUrl, appVersionCode } from '../http/configAPI.js'
 
 let userInfo = '';
 let storage_mid = ''
 
 // 创建axios实例
 export const service = axios.create({
-  baseURL: baseUrl, // api的base_url
+  baseURL: baseAPIUrl, // api的base_url
   timeout: 240000, // 请求超时时间
   headers: {
     'Content-Type': 'application/json', //指定消息格式

+ 1 - 1
src/manifest.development.json

@@ -32,7 +32,7 @@
     ],
     "host_permissions": [
         "*://*/*",
-        "https://de-net-test.piaoquantv.com"
+        "https://testh5.denet.me"
     ],
     "permissions": [
         "tabs",

+ 58 - 0
src/manifest.preview.json

@@ -0,0 +1,58 @@
+{
+    "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://preh5.denet.me"
+    ],
+    "permissions": [
+        "tabs",
+        "action",
+        "cookies",
+        "activeTab",
+        "scripting",
+        "storage"
+    ],
+    "options_page": "options.html",
+    "web_accessible_resources": [
+        {
+            "resources": [
+                "/iframe/publish.html",
+                "/iframe/red-packet.html",
+                "/iframe/home.html"
+            ],
+            "matches": [
+                "<all_urls>"
+            ]
+        }
+    ]
+}

+ 3 - 4
src/manifest.production.json

@@ -32,14 +32,12 @@
     ],
     "host_permissions": [
         "*://*/*",
-        "https://de-net-test.piaoquantv.com"
+        "https://h5.denet.me"
     ],
     "permissions": [
         "tabs",
         "action",
         "cookies",
-        "declarativeNetRequest",
-        "webNavigation",
         "activeTab",
         "scripting",
         "storage"
@@ -49,7 +47,8 @@
         {
             "resources": [
                 "/iframe/publish.html",
-                "/iframe/red-packet.html"
+                "/iframe/red-packet.html",
+                "/iframe/home.html"
             ],
             "matches": [
                 "<all_urls>"

+ 3 - 4
src/server/twitter.js

@@ -1,12 +1,11 @@
-import { appVersionCode } from '../http/configAPI.js'
-let base_url = 'http://testapi.denet.me/denet'
+import { appVersionCode,baseAPIUrl} from '../http/configAPI.js'
 import {getChromeStorage } from '../uilts/chromeExtension.js'
 
 export async function getTtwitterRequestToken() {
     let storage_mid = await getChromeStorage('mid') || ''
     const { mid } = storage_mid || {}
     return new Promise(function (resolve, reject) {
-        let _url = `${base_url}/user/twitterRequestToken`
+        let _url = `${baseAPIUrl}/user/twitterRequestToken`
         fetch(_url, {
             method: 'POST', // or 'PUT'
             headers: {
@@ -36,7 +35,7 @@ export async function twitterLogin(oauthToken, oauthVerifier, receivedIds = [])
     let storage_mid = await getChromeStorage('mid') || ''
     const { mid } = storage_mid || {}
     return new Promise(function (resolve, reject) {
-        let _url = `${base_url}/user/twitterLogin`
+        let _url = `${baseAPIUrl}/user/twitterLogin`
         fetch(_url, {
             method: 'POST', // or 'PUT'
             headers: {

+ 6 - 6
src/view/red-packet.vue

@@ -68,7 +68,7 @@
           <div class="validity">Validity</div>
           <div class="time">{{ data.detail.validity || '' }}</div>
         </div>
-        <div class="btn" @click="clickGetGiveways">Get Giveaways</div>
+        <div class="btn" @click="clickGetGiveaways">Get Giveaways</div>
       </div>
     </div>
 
@@ -397,7 +397,7 @@ function myReceivedState() {
   // 大红包不能领取了
   if (data.detail.receiveTimeExpired) {
     data.status = 'close'
-    data.close_title = `This Giveways`
+    data.close_title = `This Giveaways`
     data.close_text = `expired on ${moment(data.detail.endTimestamp).format('MM-DD')}`
   }
   // 任务已经被领完了
@@ -425,7 +425,7 @@ function init() {
       case "0":
         data.srcContentId = res.data.srcContentId
         // if (data.tweetId != data.srcContentId) {
-        //   data.error_txt = 'Giveways link Error'
+        //   data.error_txt = 'Giveaways link Error'
         //   data.status = 'error'
         //   return
         // }
@@ -446,7 +446,7 @@ function init() {
             // 大红包不可以领取了
             if (data.detail.receiveTimeExpired) {
               data.status = 'close'
-              data.close_title = `This Giveways`
+              data.close_title = `This Giveaways`
               data.close_text = `expired on ${moment(data.detail.endTimestamp).format('MM-DD')}`
             }
             // 任务已经被领完了
@@ -463,7 +463,7 @@ function init() {
             myReceivedState()
           } else {
             data.status = 'close'
-            data.close_title = `This Giveways`
+            data.close_title = `This Giveaways`
             data.close_text = `expired on ${moment(data.detail.endTimestamp).format('MM-DD')}`
           }
         }
@@ -559,7 +559,7 @@ function checkIsLogin() {
   })
 }
 
-async function clickGetGiveways() {
+async function clickGetGiveaways() {
   let _userInfo = await checkIsLogin()
   if (_userInfo) {
     handleFinishRedPacket()