From 9f64cad51bc477753b792f5aeda349bda3d6a99e Mon Sep 17 00:00:00 2001 From: zhl Date: Wed, 21 Aug 2019 19:55:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E4=BA=8E=E8=B7=B3=E8=BD=AC=E7=9A=84,?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E8=B7=B3=E8=BD=AC=E5=8F=82=E6=95=B0=E4=B8=AD?= =?UTF-8?q?=E7=9A=84isoffice=E6=9D=A5=E7=A1=AE=E5=AE=9A=E6=98=AF=E8=AE=BF?= =?UTF-8?q?=E9=97=AE=E6=AD=A3=E5=BC=8F=E6=9C=8D=E8=BF=98=E6=98=AF=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E6=9C=8D=E7=9A=84=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project.config.json | 2 +- src/app.wpy | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/project.config.json b/project.config.json index 44259d3..2682e18 100644 --- a/project.config.json +++ b/project.config.json @@ -1,7 +1,7 @@ { "description": "游戏电商小程序", "setting": { - "urlCheck": false, + "urlCheck": true, "es6": false, "postcss": false, "minified": false, diff --git a/src/app.wpy b/src/app.wpy index ca7d44e..b0d8bb0 100644 --- a/src/app.wpy +++ b/src/app.wpy @@ -21,6 +21,8 @@ import wepy from 'wepy' import 'wepy-async-function' import jcEvent from './common/jc-event'; +import global from './common/global'; +var g = require('./common/global').default; let sdkManage = require('./jcfw/SDKManage'); @@ -53,11 +55,6 @@ export default class extends wepy.app { super() this.use('requestfix'); this.use('promisify'); - sdkManage.init(); - sdkManage.Login(() => { - jcEvent.emit(jcEvent.events.LOGIN_FINISHED, {}); - console.log('finish parse jcfw'); - }); //全局拦截器 this.intercept('request', { config(p) { @@ -92,6 +89,7 @@ export default class extends wepy.app { onShow(options) { console.log('app.onShow'); console.log(options); + let isoffical = g.env === 'product'; if (options.scene === 1037 || options.scene === 1038) { let params = options.query; this.globalData.gameToken = params.token; @@ -100,8 +98,16 @@ export default class extends wepy.app { let referrerInfo = options.referrerInfo; this.globalData.fromAppId = referrerInfo.appId; this.globalData.extraData = referrerInfo.extraData; + isoffical = referrerInfo.extraData.isoffical } } + sdkManage.isoffical = isoffical; + g.env = isoffical ? 'product' : 'test'; + sdkManage.init(); + sdkManage.Login(() => { + jcEvent.emit(jcEvent.events.LOGIN_FINISHED, {}); + console.log('finish parse jcfw'); + }); }