Browse Source

腾讯验证码

wangxin 5 years ago
parent
commit
cbfd970cc3
4 changed files with 9 additions and 3 deletions
  1. 4 0
      .env.staging
  2. 1 0
      package.json
  3. 3 2
      src/utils/util.js
  4. 1 1
      src/view/captcha/captcha.vue

+ 4 - 0
.env.staging

@@ -0,0 +1,4 @@
+NODE_ENV = staging
+
+# just a flag
+ENV = 'staging'

+ 1 - 0
package.json

@@ -7,6 +7,7 @@
   "scripts": {
     "serve": "vue-cli-service serve",
     "build": "vue-cli-service build",
+    "build:stage": "vue-cli-service build --mode staging",
     "lint": "vue-cli-service lint"
   },
   "dependencies": {

+ 3 - 2
src/utils/util.js

@@ -313,7 +313,8 @@ export function cssExpand(css, id) {
 export function getAppId(env) {
     const json = {
         'production': '2078399419',
-        'development': '2078399419'
+        'staging': '2078399419',
+        'development': '2078399419',
     }
-    return env ? json[env] : json.production
+    return json[env]
 }

+ 1 - 1
src/view/captcha/captcha.vue

@@ -63,7 +63,7 @@
             this.phone = location.href.split('?')[1].split('&')[0].split('=')[1];
             this.number = this.phone.substring(0, 3) + ' ' + this.phone.substring(3, 7) + ' ' + this.phone.substring(7, 11);
             this.TencentCaptcha = new window.TencentCaptcha(
-                getAppId('development'),
+                getAppId(process.env.NODE_ENV),
                 function (res) {/* callback */
                     if (that.isiOS) {
                         window.webkit.messageHandlers.returnVerificationCode.postMessage(res.ret.toString());