Authored by huangyi

Merge branch 'feature/code-style' of http://git.yoho.cn/fe/yoho-luck into feature/code-style

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/yas';
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
})
});
... ...
... ... @@ -2,7 +2,6 @@
"pages": [
"pages/zeroSell/index",
"pages/zeroSell/detail",
"pages/zeroSell/myList",
"pages/zeroSell/snapshootShare",
"pages/zeroSell/h5Page",
"pages/bindPhoneNumber/bindPhoneNumber",
... ...
... ... @@ -2,9 +2,9 @@ import { jumpByUrl } from '../../libs/urlRoute';
import { postFormId } from '../../libs/formIdCollectRequest.js';
import {
logEvent,
yasReport,
YB_MAIN_POP_UP_C,
} from '../../libs/analytics.js'
} from '../../libs/yas.js'
Component({
options: {
... ... @@ -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';
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;//屏幕大小
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 : '';
let open_id = app && app.globalData && app.globalData.openID ? app.globalData.openID : getYHStorageSync('openID', 'analytics');
let union_id = app && app.globalData && app.globalData.WXUnion_ID ? app.globalData.WXUnion_ID : getYHStorageSync('unionID', 'analytics');
let ch = app && app.globalData && app.globalData.ch ? app.globalData.ch : '';
wx.getSystemInfo({
success: function (res) {
//返回设备信息
dm = res.model;
ln = res.language;
os = res.platform;
osv = res.system;
re = res.screenWidth + '*' + res.screenHeight;
},
complete: function () {
wx.getNetworkType({
success: function (res) {
var networkType = res.networkType
if (networkType === 'wifi') {
net = '1';
} else if (networkType === '2g') {
net = '2';
} else if (networkType === '3g') {
net = '3';
} else if (networkType === '4g') {
net = '4';
} else {
net = '0';
}
},
complete: function () {
let union_type = app.getUnion_type();
let statusParam = {'net': net, 'ln': ln};
let deviceParam = {
'res': re,
'osv': osv,
'os': os,
'ak': ak,
'dm': dm,
'udid': udid,
'ch': union_type !== '' ? union_type + "" : ch + ""
};
let userParam = data;
userParam.C_ID = cid;
userParam.UNION_ID = union_id;
let eventParam = [{'param': userParam, 'ts': ts, 'op': eventId, 'uid': uid, 'sid': sid}]
let parameters = {'status': statusParam, 'device': deviceParam, 'events': eventParam}
UPLOAD_LOG(LOG_EVENT_HOST, parameters)
.then(function (data) {
})
.catch(function (error) {
});
}
})
}
})
};
export {
logEvent,
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
};
\ No newline at end of file
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_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() + '';
let uid = app && app.globalData && app.globalData.userInfo && app.globalData.userInfo.uid ? app.globalData.userInfo.uid : '';
let udid = app && app.globalData && app.globalData.udid ? app.globalData.udid : '';
let sid = app && app.globalData && app.globalData.sid ? app.globalData.sid : '';
let cid = app && app.globalData && app.globalData.cid ? app.globalData.cid : '';
let open_id = app && app.globalData && app.globalData.openID ? app.globalData.openID : getYHStorageSync('openID', 'analytics');
let union_id = app && app.globalData && app.globalData.WXUnion_ID ? app.globalData.WXUnion_ID : getYHStorageSync('union_id', 'analytics');
let ch = app && app.globalData && app.globalData.ch ? app.globalData.ch : '';
wx.getSystemInfo({
success: function (res) {
//返回设备信息
dm = res.model;
ln = res.language;
os = res.platform;
osv = res.system;
re = res.screenWidth + '*' + res.screenHeight;
},
complete: function () {
wx.getNetworkType({
success: function (res) {
var networkType = res.networkType
if (networkType === 'wifi') {
net = '1';
} else if (networkType === '2g') {
net = '2';
} else if (networkType === '3g') {
net = '3';
} else if (networkType === '4g') {
net = '4';
} else {
net = '0';
}
},
complete: function () {
let union_type = app.getUnion_type();
let statusParam = {'net': net, 'ln': ln};
let deviceParam = {
'res': re,
'osv': osv,
'os': os,
'ak': ak,
'dm': dm,
'udid': udid,
'ch': union_type !== '' ? union_type + "" : ch + ""
};
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}
UPLOAD_LOG(LOG_EVENT_HOST, parameters)
.then(function (data) {
})
.catch(function (error) {
});
}
})
}
})
};
export {
yasReport,
YB_ENTER_FOREGROUND,
YB_ENTER_BACKGROUND,
YB_LAUNCH_APP,
YB_PAGE_OPEN_L,
YB_MAIN_TAB_C,
YB_MY_LOGIN,
YB_REGISTER_SUCCESS,
YB_AWAKE_MP,
YB_LUCK_DT_GDS_C,
YB_LUCK_DT_JOIN_C
};
\ No newline at end of file
... ...
// pages/login-page/login-page.js
import regeneratorRuntime from '../libs/regenerator-runtime/index.js';
import { getSettingPromise } from '../utils/index.js'
import {
yasReport,
YB_PAGE_OPEN_L
} from '../../libs/yas';
const event = global.event;
Page({
... ... @@ -20,6 +25,7 @@ Page({
event.on('wechat-login-callback', this.loginCallback);
event.on('wechat-login-change-status', this.loginChangeStatus);
event.on('wechat-login-error', this.loginError);
yasReport(YB_PAGE_OPEN_L);
},
async checkUnionId() {
... ...
// pages/choosecountry/choosecountry.js
'use strict';
import { API_HOST, SERVICE_HOST } from '../../libs/config';
import { GET, POST } from '../../libs/request';
import { API_HOST } from '../../libs/config';
import { GET } from '../../libs/request';
import { getVerifyKey, bindAction, decodePhoneNumber, getUnionID, decodeUnionId, openAuthorizeSettings} from '../../utils/login';
import {
yasReport,
YB_PAGE_OPEN_L
} from '../../libs/yas';
let CHOOSED_COUNTRY_ID = 'CHOOSED_COUNTRY_ID'
let CHOOSED_COUNTRY_NAME = 'CHOOSED_COUNTRY_NAME'
... ... @@ -58,6 +60,7 @@ Page(extend({},Toast,{
new app.WeToast();
this.fetchImageCheck_SwitchOn();
yasReport(YB_PAGE_OPEN_L);
},
onShow: function () {
... ...
// pages/choosecountry/choosecountry.js
import { API_HOST, SERVICE_HOST } from '../../libs/config';
import { GET, POST } from '../../libs/request';
import { getYHStorageSync } from '../../utils/util';
import {
yasReport,
YB_PAGE_OPEN_L
} from '../../libs/yas';
let CACH_KEY = 'country_cach';
let CHOOSED_COUNTRY_ID = 'CHOOSED_COUNTRY_ID'
... ... @@ -73,6 +76,7 @@ Page({
*/
onLoad: function (options) {
this.getArea();
yasReport(YB_PAGE_OPEN_L);
},
/**
... ...
... ... @@ -16,10 +16,6 @@
</block>
<block wx:elif="{{status === 3}}">
<!-- <view class="action-item confirm" bindtap="goMyList">
我的抽奖码({{num}})
</view> -->
<view class="action-item ok" bindtap="goShare">
分享得更多抽奖码,增加中奖率
</view>
... ...
... ... @@ -19,6 +19,10 @@ import router from './router/router'
import {wrapperName} from './helper'
import {formatImageUrl} from '../../utils/util'
import {jumpByUrl} from '../../libs/urlRoute';
import {
yasReport,
YB_PAGE_OPEN_L
} from '../../libs/yas';
const ACTIVITY = {
UNKNOWN: 0,
... ... @@ -131,7 +135,8 @@ Page(Object.assign({
new app.WeToast();
this._getDetailBanner()
this._getDetailBanner();
yasReport(YB_PAGE_OPEN_L);
},
/**
... ...
import {
yasReport,
YB_PAGE_OPEN_L
} from '../../libs/yas';
Page({
data: {
url: '',
... ... @@ -7,6 +12,7 @@ Page({
let url = decodeURIComponent(options.url);
let title = decodeURIComponent(options.title);
yasReport(YB_PAGE_OPEN_L);
this.setData({
url,
});
... ...
export function wrapperName(name) {
if (!name) {
return ''
... ...
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/yas';
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;
... ...
// page/subPackage/pages/zeroSell/myList.js
import ZeroSellService from './service/zero-sell'
import { Actionsheet} from '../../vendors/zanui/index';
import router from './router/router';
import {wrapperName} from './helper'
let app = null;
Page(Object.assign({
/**
* 页面的初始数据
*/
data: {
shareProduct: {},
recommends: [],
list: [{
page: 1,
data: []
}, {
page: 1,
data: []
}],
tabIndex: 0,
footText: '',
actionsheet: {
componentId: 'shareActionSheet',
show: false,
closeOnClickOverlay: true,
cancelText: '取消',
isNewShareStyle:true,
unionUserImageUrl:'http://img12.static.yhbimg.com/sns/2018/08/02/15/029b6acc4f8bc0620ecd7ec2133fcf900c.png',
actions: [{
name: '分享给好友',
className: 'action-class',
loading: false,
openType: 'share',
image_src: '../../images/share_wechat@2x.png',
},
{
name: '生成海报分享',
className: 'action-class',
loading: false,
image_src: '../../images/share_wxpeng@2x.png'
}]
},
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.service = new ZeroSellService()
app = getApp();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.setData({
[`list[${this.data.tabIndex}].page`]: 1
});
this._init();
this._getRecommend();
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
let key = `list[${this.data.tabIndex}].page`;
this.setData({
[key]: 1
});
this._init().then(() => {
wx.stopPullDownRefresh();
});
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
let type = this.data.tabIndex;
let list = this.data.list;
let page = list[type].page;
let oldData = list[type].data;
let key = `list[${type}].data`;
let keyPage = `list[${type}].page`;
return this._getPage(type, page).then(data => {
this.setData({
[key]: oldData.concat(data),
[keyPage]: ++page
});
});
},
onTabChange({detail}) {
this.setData({
tabIndex: detail,
[`list[${detail}].page`]: 1
});
this._init();
},
_init(){
let type = this.data.tabIndex;
let list = this.data.list;
let page = list[type].page
let key = `list[${type}].data`
let keyPage = `list[${type}].page`
return this._getPage(type, page).then(data => {
this.setData({
[key]: data,
[keyPage]: ++page
});
});
},
_getPage(type, page) {
this.setData({
footText: '内容加载中...'
});
return this.service.getMyList({type, page}).then(result => {
if(result.code !== 200 || result.data.length === 0) {
if(type == 0) {
this.setData({
footText: '您还没有参与的抽奖,赶紧去参加吧'
});
} else {
this.setData({
footText: '暂无已公布活动,请继续参加活动'
});
}
} else {
this.setData({
footText: ''
});
}
if (result.code !== 200) {
return [];
}
return result.data;
});
},
_getRecommend() {
this.service.getRecommend({
actPrizeId: 0
})
.then(response => {
if (response && response.code === 200 && response.data){
this.setData({
recommends: response.data,
})
}
})
.catch(error => {
console.log(error)
})
},
share({detail}){
this.setData({
'actionsheet.show': true,
'shareProduct': detail
})
},
handleZanActionsheetCancel({ componentId }) {
this.setData({
'actionsheet.show': false
})
},
handleZanActionsheetClick({ componentId, index }) {
this.setData({
'actionsheet.show': false
});
let qrcode = this.service.getQrCode({
shareUid: app.getUid(),
actPrizeId: this.data.shareProduct.act_prize_id
});
if (index === 1) {
if (this.data.shareProduct.name) {
router.go('snapShare', {
product_name: this.data.shareProduct.name,
default_image: this.data.shareProduct.cover_img,
product_price: this.data.shareProduct.price,
product_qrCode: qrcode
});
}
};
},
onShareAppMessage(res) {
let params = {
TITLE: `【0元抽奖】点一下,免费拿走${this.data.shareProduct.name}`,
DESC: '我在YO!LUCK发现一个不错的商品赶快来看看吧!'
};
if (res.from === 'menu') {
// 用户点击右上角分享
return {
title: params.TITLE, // 分享标题
desc: params.DESC, // 分享描述
path: `pages/zeroSell/detail?actPrizeId=${this.data.shareProduct.act_prize_id}`,
imageUrl: this.data.shareProduct.cover_img,
success: function() {
},
fail: function() {
}
};
} else if (res.from === 'button') {
// 用户点击分享按钮
return {
title: params.TITLE, // 分享标题
desc: params.DESC, // 分享描述
path: `/pages/zeroSell/detail?actPrizeId=${this.data.shareProduct.act_prize_id}&shareUid=${app.getUid()}`,
imageUrl: this.data.shareProduct.cover_img,
success: function() {
},
fail: function() {
}
};
}
}
}, Actionsheet))
\ No newline at end of file
{
"navigationBarTitleText": "YO!LUCK",
"enablePullDownRefresh": true,
"backgroundColor": "#ebebeb",
"backgroundTextStyle": "light",
"usingComponents": {
"tabs": "./components/tabs",
"tabs-pane": "./components/tabs-pane",
"prize-item": "./components/prize-item",
"fellow-bar": "./components/fellow-bar",
"quickNavigation": "/pages/quickNavigation/quickNavigation",
"more": "./components/more",
"product-item": "./components/product-item",
"product-header": "./components/product-detail-header"
}
}
\ No newline at end of file
<!--page/subPackage/pages/zeroSell/myList.wxml-->
<import src="../../vendors/zanui/actionsheet/index.wxml" />
<tabs current-key="{{tabIndex}}" bindchange="onTabChange">
<view class="fellow-bar">
<fellow-bar></fellow-bar>
</view>
<view class="list-head-blank"></view>
<tabs-pane name="进行中">
<block wx:for="{{list[0].data}}" wx:key="{{index}}">
<prize-item item="{{item}}" bindshare="share"></prize-item>
</block>
</tabs-pane>
<tabs-pane name="已公布">
<block wx:for="{{list[1].data}}" wx:key="{{index}}">
<prize-item item="{{item}}"></prize-item>
</block>
</tabs-pane>
<view class="list-foot-blank" wx:if="{{footText && footText.length > 0}}">{{footText}}</view>
</tabs>
<view style="height: 20rpx;background-color:#F0F0F0"></view>
<more wx:if="{{recommends.length > 0}}">
<block wx:for="{{recommends}}" wx:key="{{index}}">
<view class="product-item" >
<product-item product="{{item}}"></product-item>
</view>
</block>
</more>
<template is="zan-actionsheet" data="{{...actionsheet}}" />
\ No newline at end of file
/* page/subPackage/pages/zeroSell/myList.wxss */
@import '../../vendors/zanui/actionsheet/index.wxss';
.list-foot-blank
{
width: 100%;
height: 88rpx;
text-align: center;
line-height: 88rpx;
font-size: 30rpx;
color: #ccc;
}
.list-head-blank {
width: 100%;
height: 156rpx;
}
.fellow-bar {
position: fixed;
top: 90rpx;
left: 0;
width: 100%;
z-index: 2;
}
\ No newline at end of file
... ... @@ -11,8 +11,10 @@ const scale = windowWidth / 375;
screenHeight = windowWidth / (canvasWidth / canvasHeight);
import {wrapperName} from './helper'
// const scale = 0.5;
import {
yasReport,
YB_PAGE_OPEN_L
} from '../../libs/yas';
var Point = function(x, y) {
return {
... ... @@ -56,6 +58,7 @@ Page({
this.creatSnapshoot();
this.getAuth();
yasReport(YB_PAGE_OPEN_L);
},
creatSnapshoot() {
... ...
export default {
['pages/zeroSell/index']: {
pageName: 'index'
pathName: 'index'
},
['pages/zeroSell/detail']: {
pageName: 'detail'
},
['pages/zeroSell/myList']: {
pageName: 'myList'
pathName: 'detail',
paramKey: 'actPrizeId'
},
['pages/zeroSell/snapshootShare']: {
pageName: 'snapshootShare'
pathName: 'snapshootShare',
paramKey: 'product_qrCode'
},
['pages/zeroSell/h5Page']: {
pageName: 'H5Page'
pathName: 'H5Page',
paramKey: 'url'
},
['pages/bindPhoneNumber/bindPhoneNumber']: {
pageName: 'bindPhoneNumber'
pathName: 'bindPhoneNumber'
},
['pages/choosecountry/choosecountry']: {
pageName: 'choosecountry'
pathName: 'choosecountry'
},
['login/login-page/login-page']: {
pageName: 'loginPage'
pathName: 'loginPage'
}
}
... ...
... ... @@ -3,11 +3,11 @@ 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,
} from '../libs/analytics.js'
} from '../libs/yas.js'
//获取应用实例
var app = getApp()
... ... @@ -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: "登录成功",
... ...