Authored by 李奇

yas上报修改

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';
const event = new Event();
global.event = event;
import { logEvent,
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.js';
} from './libs/analytics';
import router from './pages/zeroSell/router/router';
const event = new Event();
global.event = event;
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
})
});
... ...
... ... @@ -2,7 +2,7 @@ import { jumpByUrl } from '../../libs/urlRoute';
import { postFormId } from '../../libs/formIdCollectRequest.js';
import {
logEvent,
yasReport,
YB_MAIN_POP_UP_C,
} from '../../libs/analytics.js'
... ... @@ -46,7 +46,7 @@ Component({
let params = {
TO_PATH: that.properties.url
};
logEvent(YB_MAIN_POP_UP_C, params);
yasReport(YB_MAIN_POP_UP_C, params);
jumpByUrl(that.properties.url,'home');
that.hideDialog();
... ...
import {LOG_EVENT_HOST} from '../libs/config';
import {UPLOAD_LOG} from '../libs/request';
import {getYHStorageSync} from '../utils/util';
import path2Name from '../router/path-to-name';
import {stringify} from '../vendors/query-string'
const YB_ENTER_FOREGROUND = 'YB_ENTER_FOREGROUND';
const YB_ENTER_BACKGROUND = 'YB_ENTER_BACKGROUND';
const YB_LAUNCH_APP = 'YB_LAUNCH_APP';
const YB_EXIT_APP = 'YB_EXIT_APP';
const YB_PAGE_OPEN_L = 'YB_PAGE_OPEN_L';
const YB_MAIN_TAB_C = 'YB_MAIN_TAB_C';
const YB_MY_LOGIN = 'YB_MY_LOGIN';
const YB_REGISTER_SUCCESS = 'YB_REGISTER_SUCCESS';
const YB_AWAKE_MP = 'YB_AWAKE_MP';
const YB_GRP_BUY_DT_TOG_C = 'YB_GRP_BUY_DT_TOG_C';
const YB_MAIN_POP_UP_C = 'YB_MAIN_POP_UP_C';
let logEvent = function (eventId, data, appData) {
let app = appData ? appData : getApp();
let ln;//语言
let os;//系统类型
let dm;//设备型号
let re;//屏幕大小
const YB_ENTER_FOREGROUND = 'YB_ENTER_FOREGROUND'; // 系统-程序切换置前台
const YB_ENTER_BACKGROUND = 'YB_ENTER_BACKGROUND'; // 系统-程序切换置后台
const YB_LAUNCH_APP = 'YB_LAUNCH_APP'; // 系统-启动小程序
const YB_AWAKE_MP = 'YB_AWAKE_MP'; // 唤起事件,每次启动时,上报原始的页面路径,以对推广渠道数据进行监测
const YB_MAIN_TAB_C = 'YB_MAIN_TAB_C'; // 点击页面的tab时,点击时才上报,默认载入时不上报
const YB_PAGE_OPEN_L = 'YB_PAGE_OPEN_L'; // 小程序(所有)页面加载时
const YB_MY_LOGIN = 'YB_MY_LOGIN'; // 当用户使用该登录方式登录成功时
const YB_REGISTER_SUCCESS = 'YB_REGISTER_SUCCESS'; // 用户注册成功
const YB_LUCK_DT_GDS_C = 'YB_LUCK_DT_GDS_C'; // 点击抽奖详情页底部的商品时
const YB_LUCK_DT_JOIN_C = 'YB_LUCK_DT_JOIN_C'; // 点击抽奖详情页底部的"0元参加抽奖"成功时
const pageOpen = data => {
const _pageName = function(options, path) {
let hasConf = path2Name[path];
// 多入口页面依据参数设定上报页面名称
if (hasConf && hasConf.multiEntry) {
let pathName = '';
Object.keys((hasConf.multiName || {})).forEach(key => {
if (options[key]) {
pathName = hasConf.multiName[key];
return false;
}
});
return pathName;
}
return hasConf ? hasConf.pathName : '';
};
const _pageParam = function(options = {}, fromPath) {
if (!options) return '';
let hasConf = path2Name[fromPath];
if (hasConf && hasConf.multiEntry) {
let param = '';
Object.keys((hasConf.multiName || {})).forEach(key => {
if (options[key]) {
param = options[key];
return false;
}
});
return param;
}
if (path2Name[fromPath] && path2Name[fromPath].paramKey) {
return `${decodeURIComponent(options[path2Name[fromPath].paramKey])}` || '';
}
return stringify(options, '');
};
let pages = getCurrentPages();
let currentPage = pages[pages.length - 1];
let path = `${currentPage.route}`,
options = currentPage.options || {}; // 拷贝options对象,用于获取当前页面参数
// from page relevant
let fromPage, fromPath, fromOptions;
if (pages.length > 1) {
fromPage = pages[pages.length - 2];
fromPath = `${fromPage.route}`;
fromOptions = fromPage.options || {};
}
return Object.assign(data, {
PAGE_PATH: path,
PAGE_PARAM: _pageParam(options, path),
PAGE_NAME: _pageName(options, path),
FROM_PAGE_NAME: _pageName(options, fromPath),
FROM_PAGE_PARAM: _pageParam(fromOptions, fromPath)
});
};
const yasReport = function (eventId, data = {}, app) {
if (eventId === YB_PAGE_OPEN_L) {
data = pageOpen(data);
}
app = app || getApp();
let ln; // 语言
let os; // 系统类型
let dm; // 设备型号
let re; // 屏幕大小
let osv;//系统版本
let ak = 'yoholuck_mp';//
let net = '0';
let ts = new Date().getTime() + '';
//用户id
let uid = app && app.globalData && app.globalData.userInfo && app.globalData.userInfo.uid ? app.globalData.userInfo.uid : '';
//设备id
let udid = app && app.globalData && app.globalData.udid ? app.globalData.udid : '';
//会话id
let sid = app && app.globalData && app.globalData.sid ? app.globalData.sid : '';
let cid = app && app.globalData && app.globalData.cid ? app.globalData.cid : '';
... ... @@ -78,6 +143,7 @@ let logEvent = function (eventId, data, appData) {
let userParam = data;
userParam.C_ID = cid;
userParam.UNION_ID = union_id;
userParam.PV_ID = app.getPvid();
let eventParam = [{'param': userParam, 'ts': ts, 'op': eventId, 'uid': uid, 'sid': sid}]
let parameters = {'status': statusParam, 'device': deviceParam, 'events': eventParam}
... ... @@ -85,6 +151,7 @@ let logEvent = function (eventId, data, appData) {
.then(function (data) {
})
.catch(function (error) {
});
}
})
... ... @@ -93,16 +160,15 @@ let logEvent = function (eventId, data, appData) {
};
export {
logEvent,
yasReport,
YB_ENTER_FOREGROUND,
YB_ENTER_BACKGROUND,
YB_LAUNCH_APP,
YB_EXIT_APP,
YB_PAGE_OPEN_L,
YB_MAIN_TAB_C,
YB_MY_LOGIN,
YB_REGISTER_SUCCESS,
YB_AWAKE_MP,
YB_GRP_BUY_DT_TOG_C,
YB_MAIN_POP_UP_C
YB_LUCK_DT_GDS_C,
YB_LUCK_DT_JOIN_C
};
\ No newline at end of file
... ...
import ZeroSellService from './service/zero-sell'
import CommonService from './service/common'
import { getSettingPromise } from '../../login/utils/index.js'
import regeneratorRuntime from '../../login/libs/regenerator-runtime/index.js';
const event = global.event;
import {getSettingPromise} from '../../login/utils/index'
import regeneratorRuntime from '../../login/libs/regenerator-runtime/index';
import {formatImageUrl} from '../../utils/util'
import {jumpByUrl} from '../../libs/urlRoute';
import router from './router/router';
import {
decodePhoneNumber,
getUnionID,
decodeUnionId,
openAuthorizeSettings,
openAuthorizeSettings
} from '../../utils/login';
import {formatImageUrl} from '../../utils/util'
import {
Toast, Actionsheet
} from '../../vendors/zanui/index';
import router from './router/router';
import { jumpByUrl } from '../../libs/urlRoute';
import {
yasReport,
YB_PAGE_OPEN_L,
YB_MAIN_TAB_C
} from '../../libs/analytics';
let app = getApp()
const event = global.event;
let app = getApp();
Page(Object.assign({
data: {
... ... @@ -112,7 +111,8 @@ Page(Object.assign({
console.log('执行了');
this._getResouceCode()
}
this._getBottomBanner()
this._getBottomBanner();
yasReport(YB_PAGE_OPEN_L);
},
onShow() {
... ... @@ -346,6 +346,7 @@ Page(Object.assign({
tabIndex: detail,
[`list[${detail}].page`]: 1
});
yasReport(YB_MAIN_TAB_C, {TAB_ID: detail + 1});
if (detail === 3 && !this.data.isLogin) {
return;
... ...
export default {
['pages/zeroSell/index']: {
pageName: 'index'
pathName: 'index'
},
['pages/zeroSell/detail']: {
pageName: 'detail'
pathName: 'detail'
},
['pages/zeroSell/myList']: {
pageName: 'myList'
pathName: 'myList'
},
['pages/zeroSell/snapshootShare']: {
pageName: 'snapshootShare'
pathName: 'snapshootShare'
},
['pages/zeroSell/h5Page']: {
pageName: 'H5Page'
pathName: 'H5Page'
},
['pages/bindPhoneNumber/bindPhoneNumber']: {
pageName: 'bindPhoneNumber'
pathName: 'bindPhoneNumber'
},
['pages/choosecountry/choosecountry']: {
pageName: 'choosecountry'
pathName: 'choosecountry'
},
['login/login-page/login-page']: {
pageName: 'loginPage'
pathName: 'loginPage'
}
}
... ...
... ... @@ -3,7 +3,7 @@ import {GET, POST} from '../libs/request';
import {API_HOST, SERVICE_HOST} from '../libs/config';
import {Encrypt} from '../libs/aes'
import {isStringEmpty} from './util'
import { logEvent,
import { yasReport,
YB_MY_LOGIN,
YB_PAGE_OPEN_L,
YB_REGISTER_SUCCESS,
... ... @@ -54,7 +54,7 @@ function wechatLoginAction(callbackFunc) {
//如果unionID不存在(未使用过任何有货微信产品的全新用户),调用getUnionID函数,再次获取unionID
//对于已经授权过的用户,拿到unionid之后获取一次userinfo更新个人信息.
let params = { LOGIN_TYPE: 4, PV_ID: PV_ID, };
logEvent(YB_MY_LOGIN, params);
yasReport(YB_MY_LOGIN, params);
//当unionId为空或者头像为空时,调用微信接口获取用户信息
if (!isStringEmpty(responseData.unionid)) {
... ... @@ -361,7 +361,7 @@ function checkVerifyCode(phoneNumb, verifyCode, areaCode, inviteCode, callbackFu
let logParams = {
YB_REGISTER_SUCCESS: 5,
};
logEvent(YB_REGISTER_SUCCESS, logParams);
yasReport(YB_REGISTER_SUCCESS, logParams);
callbackFunc({
succeed: true,
message: "登录成功",
... ... @@ -462,7 +462,7 @@ function autoSignin(mobile, verifyCode, areaCode, inviteCode, callbackFunc) {
let logParams = {
YB_REGISTER_SUCCESS: 5,
};
logEvent(YB_REGISTER_SUCCESS, logParams);
yasReport(YB_REGISTER_SUCCESS, logParams);
}
callbackFunc({
succeed: true,
... ... @@ -558,7 +558,7 @@ function BindMiniAppByAuto(mobile, countryCode, inviteCode, callbackFunc){
let logParams = {
YB_REGISTER_SUCCESS: 5,
};
logEvent(YB_REGISTER_SUCCESS, logParams);
yasReport(YB_REGISTER_SUCCESS, logParams);
callbackFunc({
succeed: true,
message: "登录成功",
... ...