|
|
import objectAssign from './vendors/object-assign';
|
|
|
import {WeToast} from './vendors/toast/wetoast';
|
|
|
import { API_HOST, MINI_APP_TYPE} from './libs/config';
|
|
|
import {GET} from './libs/request';
|
|
|
import md5 from './vendors/md5';
|
|
|
var mta = require('./vendors/mta_analysis.js');
|
|
|
import regeneratorRuntime from '/login/libs/regenerator-runtime/index.js';
|
|
|
import { isStringEmpty, getYHStorageSync} from './utils/util';
|
|
|
import { Event } from '/login/utils/index.js';
|
|
|
import { wxLogin } from '/login/utils/login/login.js';
|
|
|
import { appReport } from './libs/appReport.js';
|
|
|
import {GET} from './libs/request';
|
|
|
import {WeToast} from './vendors/toast/wetoast';
|
|
|
import objectAssign from './vendors/object-assign';
|
|
|
import {API_HOST, MINI_APP_TYPE} from './libs/config';
|
|
|
import mta from './vendors/mta_analysis';
|
|
|
import {Event} from '/login/utils/index.js';
|
|
|
import {wxLogin} from '/login/utils/login/login';
|
|
|
import {appReport} from './libs/appReport.js';
|
|
|
import {isStringEmpty, getYHStorageSync} from './utils/util';
|
|
|
import regeneratorRuntime from '/login/libs/regenerator-runtime/index';
|
|
|
|
|
|
import {
|
|
|
yasReport,
|
|
|
YB_LAUNCH_APP,
|
|
|
YB_ENTER_FOREGROUND,
|
|
|
YB_ENTER_BACKGROUND,
|
|
|
YB_AWAKE_MP
|
|
|
} from './libs/analytics';
|
|
|
import router from './pages/zeroSell/router/router';
|
|
|
|
|
|
const event = new Event();
|
|
|
global.event = event;
|
|
|
|
|
|
import { logEvent,
|
|
|
YB_LAUNCH_APP,
|
|
|
YB_ENTER_FOREGROUND,
|
|
|
YB_ENTER_BACKGROUND,
|
|
|
YB_AWAKE_MP
|
|
|
} from './libs/analytics.js';
|
|
|
import router from './pages/zeroSell/router/router';
|
|
|
|
|
|
|
|
|
App({
|
|
|
async onLaunch(options) {
|
...
|
...
|
@@ -36,8 +36,8 @@ App({ |
|
|
this.globalData.systemInfo = res;
|
|
|
this.checkUDID();
|
|
|
|
|
|
that.getSimplePise()
|
|
|
this.checkNetworkType()
|
|
|
that.getSimplePise();
|
|
|
this.checkNetworkType();
|
|
|
|
|
|
if (options && options.scene){
|
|
|
this.globalData.ch = options.scene
|
...
|
...
|
@@ -49,49 +49,42 @@ App({ |
|
|
|
|
|
wx.checkSession({
|
|
|
success: function () {
|
|
|
//登录态未过期
|
|
|
that.getWechatThirdSession();
|
|
|
that.getUserInfo();
|
|
|
that.getUnionID();
|
|
|
that.getUser_union_type();
|
|
|
},
|
|
|
fail: function () {
|
|
|
//登录态过期
|
|
|
wx.setStorage({
|
|
|
key: "WXThird_session",
|
|
|
key: 'WXThird_session',
|
|
|
data: ''
|
|
|
});
|
|
|
wx.setStorage({
|
|
|
key: "userInfo",
|
|
|
key: 'userInfo',
|
|
|
data: {}
|
|
|
});
|
|
|
|
|
|
wx.setStorage({
|
|
|
key: "unionID",
|
|
|
data: ""
|
|
|
key: 'unionID',
|
|
|
data: ''
|
|
|
});
|
|
|
|
|
|
wx.setStorage({
|
|
|
key: "user_union_type",
|
|
|
data: ""
|
|
|
key: 'user_union_type',
|
|
|
data: ''
|
|
|
});
|
|
|
}
|
|
|
})
|
|
|
});
|
|
|
this.getSessionkey();
|
|
|
let timestamp = new Date().getTime() + ''
|
|
|
let timestamp = new Date().getTime() + '';
|
|
|
this.globalData.sid = md5(timestamp);
|
|
|
|
|
|
if (options){
|
|
|
let channel = options.query.channel;
|
|
|
let channelType = options.query.type;
|
|
|
let params = { 'CHANNEL': channel, 'TYPE': channelType };
|
|
|
logEvent(YB_LAUNCH_APP, params, this);
|
|
|
yasReport(YB_LAUNCH_APP, params, this);
|
|
|
}
|
|
|
setTimeout(function () {
|
|
|
// wechatLoginAction(function (response) {
|
|
|
// that.getShareInfo();
|
|
|
// });
|
|
|
}, 1000);
|
|
|
this.mtainit(options);
|
|
|
await wxLogin();
|
|
|
event.on('wechat-login-error', () => {
|
...
|
...
|
@@ -122,7 +115,7 @@ App({ |
|
|
onShow(options) {
|
|
|
let that = this
|
|
|
let params = {};
|
|
|
logEvent(YB_ENTER_FOREGROUND, params, that)
|
|
|
yasReport(YB_ENTER_FOREGROUND, params, that)
|
|
|
if (that.globalData.hasReportAwakeAction==='false'){
|
|
|
let pathParam = ""
|
|
|
if(options && options.query) {
|
...
|
...
|
@@ -144,7 +137,7 @@ App({ |
|
|
params = {
|
|
|
PAGE_PATH: path
|
|
|
};
|
|
|
logEvent(YB_AWAKE_MP, params, this);
|
|
|
yasReport(YB_AWAKE_MP, params, this);
|
|
|
that.globalData.hasReportAwakeAction = 'true'
|
|
|
}
|
|
|
|
...
|
...
|
@@ -163,7 +156,7 @@ App({ |
|
|
//当应用程序进入后台状态时触发
|
|
|
onHide () {
|
|
|
let params = {};
|
|
|
logEvent(YB_ENTER_BACKGROUND,params)
|
|
|
yasReport(YB_ENTER_BACKGROUND,params);
|
|
|
appReport('start', "LIFECYCLE", "STOP", {},this)
|
|
|
},
|
|
|
|
...
|
...
|
@@ -376,7 +369,6 @@ App({ |
|
|
},
|
|
|
fail: function (err) {
|
|
|
|
|
|
// console.log("err:",err)
|
|
|
}
|
|
|
});
|
|
|
},
|
...
|
...
|
@@ -401,13 +393,9 @@ App({ |
|
|
}
|
|
|
})
|
|
|
.catch(error => {
|
|
|
// console.log(error)
|
|
|
});
|
|
|
},
|
|
|
|
|
|
/*
|
|
|
获取分享信息
|
|
|
*/
|
|
|
getShareInfo: function () {
|
|
|
// console.log('getShareInfo');
|
|
|
let param = {
|
...
|
...
|
@@ -416,13 +404,11 @@ App({ |
|
|
let that = this;
|
|
|
GET(API_HOST + '/operations/api/v5/webshare/getShare', param)
|
|
|
.then(data => {
|
|
|
// console.log(data)
|
|
|
if (data && data.code == 200) {
|
|
|
that.globalData.shareInfo = data.data;
|
|
|
}
|
|
|
})
|
|
|
.catch(error => {
|
|
|
// console.log(error)
|
|
|
});
|
|
|
},
|
|
|
|
...
|
...
|
@@ -433,19 +419,7 @@ App({ |
|
|
};
|
|
|
GET(API_HOST, param)
|
|
|
.then(json => {
|
|
|
// if (!json || !json.code || json.code != 200 || !json.data) return;
|
|
|
// if (!json.data || !json.data.sk) return;
|
|
|
|
|
|
// let p2SecretKey = json.data.sk;
|
|
|
// if (!p2SecretKey) return;
|
|
|
// that.globalData.p2SecretKey = p2SecretKey;
|
|
|
|
|
|
// wx.setStorage({
|
|
|
// key: "p2SecretKey",
|
|
|
// data: p2SecretKey
|
|
|
// });
|
|
|
})
|
|
|
|
|
|
.catch(error => {
|
|
|
});
|
|
|
},
|
...
|
...
|
@@ -506,32 +480,13 @@ App({ |
|
|
},
|
|
|
|
|
|
loginCallBack: function (response) {
|
|
|
// console.log(response)
|
|
|
// if (response.code === 10001) {
|
|
|
// this.showRelaunchModal();
|
|
|
// }
|
|
|
},
|
|
|
|
|
|
showRelaunchModal: function () {
|
|
|
wx.showModal({
|
|
|
title: '提示',
|
|
|
content: '使用微信小程序需要微信授权,您已经拒绝了该请求,请删除小程序重新进入。',
|
|
|
showCancel: false,
|
|
|
success: function (res) {
|
|
|
if (res.confirm) {
|
|
|
wx.navigateBack({
|
|
|
delta: 1
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
|
|
|
getSessionkey: function () {
|
|
|
if (this.isLogin) {
|
|
|
var value = getYHStorageSync('sessionkey','app')
|
|
|
var value = getYHStorageSync('sessionkey','app');
|
|
|
if (value) {
|
|
|
// console.log(value)
|
|
|
this.globalData.sessionkey = value;
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -554,15 +509,16 @@ App({ |
|
|
});
|
|
|
}
|
|
|
},
|
|
|
|
|
|
mtainit(e) {
|
|
|
getPvid() {
|
|
|
return md5(`${new Date().getTime()}${this.globalData.udid}`);
|
|
|
},
|
|
|
mtainit() {
|
|
|
mta.App.init({
|
|
|
"appID": "500570715",
|
|
|
"eventID": "500570797",
|
|
|
});
|
|
|
// console.log("init mta");
|
|
|
},
|
|
|
WeToast
|
|
|
})
|
|
|
});
|
|
|
|
|
|
|
...
|
...
|
|