Authored by 李奇

Merge branch 'feature/error_page' into 'master'

Feature/error page



See merge request !9
... ... @@ -6,7 +6,7 @@ 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 appReport from './libs/appReport';
import {isStringEmpty, getYHStorageSync} from './utils/util';
import regeneratorRuntime from '/login/libs/regenerator-runtime/index';
... ... @@ -33,7 +33,7 @@ App({
if (!res.screenWidth) {
res.screenWidth = res.windowWidth;
}
wx.removeStorageSync('errorFlag');
this.globalData.systemInfo = res;
this.checkUDID();
... ... @@ -144,11 +144,21 @@ App({
}
if (options && options.scene){
appReport('start', "LIFECYCLE", "RESUME", {
'activeWay': options.scene + ""
}, this)
appReport({
reportType: 'start',
pt: 'LIFECYCLE',
pn: 'RESUME',
param: {
'activeWay': options.scene + ''
}
}, this);
}else{
appReport('start', "LIFECYCLE", "RESUME", {}, this)
appReport({
reportType: 'start',
pt: 'LIFECYCLE',
pn: 'RESUME',
param: {}
}, this);
}
let scene = options ? options.scene : '';
... ... @@ -157,9 +167,14 @@ App({
//当应用程序进入后台状态时触发
onHide () {
let params = {};
yasReport(YB_ENTER_BACKGROUND,params);
appReport('start', "LIFECYCLE", "STOP", {},this)
let params = {};
yasReport(YB_ENTER_BACKGROUND, params);
appReport({
reportType: 'start',
pt: 'LIFECYCLE',
pn: 'STOP',
param: {}
}, this);
},
getUserInfo: function () {
... ... @@ -400,7 +415,6 @@ App({
},
getShareInfo: function () {
// console.log('getShareInfo');
let param = {
share_id: this.globalData.shareId,
}
... ... @@ -468,10 +482,14 @@ App({
} else {
net = '0';
}
// console.log("network:",net)
},
complete:function(res){
appReport('start', "LIFECYCLE", "START", {}, that)
appReport({
reportType: 'start',
pt: 'LIFECYCLE',
pn: 'START',
param: {}
}, that);
}
})
that.globalData.networkType = net;
... ...
... ... @@ -4,6 +4,7 @@
"pages/zeroSell/detail",
"pages/zeroSell/snapshootShare",
"pages/zeroSell/h5Page",
"pages/zeroSell/error",
"pages/bindPhoneNumber/bindPhoneNumber",
"pages/choosecountry/choosecountry",
"login/login-page/login-page"
... ...
'use strict'
import { APP_REPORT_HOST, APP_VERSION, APP_BUILD} from '../libs/config';
import { APP_REPORT } from '../libs/request';
import md5 from '../vendors/md5';
import Promise from '../vendors/es6-promise';
import { APP_REPORT_HOST, APP_VERSION, APP_BUILD } from '../libs/config';
let getDeviceInfo = function (app) {
let ak = 'yoholuck_mp';//
let ak = 'yoholuck_mp'; // 小程序标识
let systemInfo = app.globalData.systemInfo
let device = {}
... ... @@ -12,12 +11,12 @@ let getDeviceInfo = function (app) {
let union_type = app.getUnion_type();
device.ak = ak
device.udid = app.globalData.udid ? app.globalData.udid : '';
device.ch = union_type ? union_type: app.globalData.ch;
device.ch = union_type ? union_type : app.globalData.ch;
device.os = "weixinapp"
device.osv = systemInfo && systemInfo.version ? systemInfo.version:''
device.dm = systemInfo && systemInfo.model ? systemInfo.model.replace(' ', '_'):''
device.osv = systemInfo && systemInfo.version ? systemInfo.version : ''
device.dm = systemInfo && systemInfo.model ? systemInfo.model.replace(' ', '_') : ''
if (systemInfo.platform == 'ios'){
if (systemInfo.platform == 'ios') {
//针对ios设备,特殊处理dm,转为iphone_7这种格式
var start_num = device.dm.indexOf('<')
var end_num = device.dm.indexOf('>')
... ... @@ -30,61 +29,66 @@ let getDeviceInfo = function (app) {
}
}
}
return device;
}
let appReport = function(reportType, pt, pn, param,appObject) {
let app = appObject;
let appReport = function ({ reportType = 'hb', pt, pn, param = {} } = {}, _this) {
let app = _this || getApp();
let deviceInfo = getDeviceInfo(app)
if (!pt || !pn || !deviceInfo || !deviceInfo.dm) return;
if(!param)param = {};
if(!reportType)reportType='hb';
if (!reportType) reportType = 'hb';
let ts = new Date().getTime() + '000000';
let uid = app && app.globalData && app.globalData.userInfo && app.globalData.userInfo.uid ? md5(app.globalData.userInfo.uid) : '';
if(!uid){
if (!uid) {
uid = md5(app.getUid());
}
let event = {};
let sid = app && app.globalData && app.globalData.sid ? app.globalData.sid : '';
let networkType = app && app.globalData && app.globalData.networkType ? app.globalData.networkType : '0';
let event = {}
event.ps = '0',
event.av = APP_VERSION,
event.ab = APP_BUILD,
event.ca = '0',
event.net = networkType,
event.sid = sid,
event.uid = uid,
event.ts = ts,
event.pt = pt,
event.pn = pn,
event.param = param
event.ps = '0';
event.av = APP_VERSION;
event.ab = APP_BUILD;
event.ca = '0';
event.net = networkType;
event.sid = sid;
event.uid = uid;
event.ts = ts;
event.pt = pt;
event.pn = pn;
event.param = param;
let events = [];
events.push(event)
//组装最终要上报的数据
let parameters = {};
parameters.type = reportType,
parameters.device = deviceInfo,
parameters.events = events,
APP_REPORT(APP_REPORT_HOST, parameters)
.then(function (data) {
// console.log(data)
parameters.type = reportType;
parameters.device = deviceInfo;
parameters.events = events;
let _appReport = function (url, params = {}) {
return new Promise(function (resolve, reject) {
let app = getApp();
let data = JSON.stringify(params)
let sid = app && app.globalData && app.globalData.sid ? app.globalData.sid : '';
let header = {
'content-type': "application/json",
'x-yoho-sid': md5(sid),
}
wx.request({
url,
data,
header,
method: 'POST'
});
})
.catch(function (error) {
});
};
_appReport(APP_REPORT_HOST, parameters);
}
module.exports = {
appReport,
}
\ No newline at end of file
export default appReport;
\ No newline at end of file
... ...
... ... @@ -2,35 +2,21 @@
export const API_HOST = 'https://api.yoho.cn';
export const SERVICE_HOST = 'https://api.yoho.cn';
export const ACTIVITY_HOST = 'https://action.yoho.cn';
export const APP_REPORT_HOST = 'https://app.yoho.cn/collect/v3';
export const LOG_EVENT_HOST = 'https://analysis.yohobuy.com/yas_mobile';
// 测试环境
// export const API_HOST = 'http://api-test3.dev.yohocorp.com';
// export const SERVICE_HOST = 'http://api-test3.dev.yohocorp.com';
// export const ACTIVITY_HOST = 'http://yoho-activity-platform.test3.ingress.dev.yohocorp.com';
// export const ACTIVITY_HOST = 'http://192.168.102.49:6006';
// export const API_HOST = 'http://dev-api.yohops.com:9999';
// export const SERVICE_HOST = 'http://dev-api.yohops.com:9999/';
// export const API_HOST = 'http://api-test1.yohops.com:9999';
// export const SERVICE_HOST = 'http://api-test1.yohops.com:9999/';
// export const API_HOST = 'http://api-test2.dev.yohocorp.com';
// export const SERVICE_HOST = 'http://api-test2.dev.yohocorp.com';
// export const ACTIVITY_HOST = 'http://limit-yoho-activity-platform.test3.ingress.dev.yohocorp.com';
// export const APP_REPORT_HOST = 'http://app.yoho.cn/collect/v3';
// export const API_HOST = 'https://apigray.yoho.cn';
// export const SERVICE_HOST = 'https://apigray.yoho.cn';
export const APP_REPORT_HOST = 'https://app.yoho.cn/collect/v3';
export const LOG_EVENT_HOST = 'https://analysis.yohobuy.com/yas_mobile';
// export const LOG_EVENT_HOST = 'https://analysis.yohobuy.com/yas_mobile';
export const MINI_APP_TYPE = 29;
export const MINI_QR_TYPE = 16;
export const OS_VERSION = 'yohobuy:h5';
export const APP_VERSION = '2.9.0';
export const APP_BUILD = '1041';
... ...
import md5 from '../vendors/md5';
import Promise from '../vendors/es6-promise';
import objectAssign from '../vendors/object-assign';
import trimObject from '../utils/trimObject';
import queryString from '../vendors/query-string';
import md5 from '../vendors/md5';
import {API_HOST,APP_VERSION, CLIENT_TYPE, PRIVATE_KEY} from '../libs/config';
import { getYHStorageSync } from '../utils/util';
import {API_HOST,APP_VERSION, CLIENT_TYPE, PRIVATE_KEY} from '../libs/config';
import appReport from './appReport';
let crypto = require('./cryptojs/cryptojs.js').Crypto
let p1SecretKey = "yoho9646yoho9646"
... ... @@ -38,14 +39,12 @@ function getPrivateKey(){
method,
header: header,
success: function (res) {
// console.log("res:", res)
if (res && res.data && res.data.data && res.data.data.sk) {
app.globalData.p2SecretKey = res.data.data.sk;
wx.setStorage({
key: "p2SecretKey",
data: res.data.data.sk
});
resolve(app.globalData.p2SecretKey)
}
},
... ... @@ -54,19 +53,18 @@ function getPrivateKey(){
let message = err.message ? err.message : '';
let isPrivatekeyError = true
reject({ code, message, isPrivatekeyError});
// console.log("err:",err)
}
});
}
})
}
function request(method = 'GET') {
return function(url, params = {}) {
return getPrivateKey()
.then(key => {
return new Promise(function (resolve, reject) {
let app = getApp();
if (params && !params.hasOwnProperty('uid')) {
let uid = app && app.globalData && app.globalData.userInfo && app.globalData.userInfo.uid ? app.globalData.userInfo.uid : 0;
... ... @@ -88,7 +86,6 @@ function request(method = 'GET') {
}
params.udid = udid;
}
let body = _createBody(params);
let queryStrigPair = _signParam(body, true);
let data = '';
... ... @@ -127,32 +124,48 @@ function request(method = 'GET') {
errMsg = res.errMsg,
data = res.data;
if (statusCode !== 200) {
appReport({
pt: 'NETWORK',
pn: 'NETWORK_API_CODE_ERR',
param: {
url: url,
ec: statusCode
}
});
}
if (statusCode == 200) {
resolve(data);
} else {
let code = statusCode;
let message = res.errMsg ? res.errMsg : '';
if(statusCode === 503) {
wx.showToast({
title: '目前参与人数过多请下拉刷新',
icon: 'none',
duration: 2000
});
if(!wx.getStorageSync('errorFlag')) {
wx.setStorageSync('errorFlag',true);
wx.navigateTo({
url: '/pages/zeroSell/error',
})
}
}
reject({ code, message });
}
},
fail: function (err) {
let code = err.code ? err.code : 800;
let message = err.message ? err.message : '';
if(code === 503) {
wx.showToast({
title: '目前参与人数过多请下拉刷新',
icon: 'none',
duration: 2000
});
}
reject({code, message});
const ERROR_TYPE = {
['request:fail']: 'NETWORK_API_CODE_ERR',
['request:fail timeout']: 'NETWORK_API_TIMEOUT'
};
const errType = ERROR_TYPE[err && err.errMsg || ''] || '';
appReport({
pt: 'NETWORK',
pn: errType,
param: {
url: url,
st: JSON.stringify(err || {})
}
});
}
});
})
... ... @@ -218,32 +231,47 @@ function request(method = 'GET') {
errMsg = res.errMsg,
data = res.data;
if (statusCode !== 200) {
appReport({
pt: 'NETWORK',
pn: 'NETWORK_API_CODE_ERR',
param: {
url: url,
ec: statusCode
}
});
}
if (statusCode == 200) {
resolve(data);
} else {
let code = statusCode;
let message = res.errMsg ? res.errMsg : '';
if(statusCode === 503) {
wx.showToast({
title: '目前参与人数过多请下拉刷新',
icon: 'none',
duration: 2000
});
if(!wx.getStorageSync('errorFlag')) {
wx.setStorageSync('errorFlag',true);
wx.navigateTo({
url: '/pages/zeroSell/error',
})
}
}
reject({ code, message });
}
},
fail: function (err) {
let code = err.code ? err.code : 800;
let message = err.message ? err.message : '';
if(code === 503){
wx.showToast({
title: '目前参与人数过多请下拉刷新',
icon: 'none',
duration: 2000
});
}
reject({ code, message });
const ERROR_TYPE = {
['request:fail']: 'NETWORK_API_CODE_ERR',
['request:fail timeout']: 'NETWORK_API_TIMEOUT'
};
const errType = ERROR_TYPE[err && err.errMsg || ''] || '';
appReport({
pt: 'NETWORK',
pn: errType,
param: {
url: url,
st: JSON.stringify(err || {})
}
});
}
});
})
... ... @@ -271,26 +299,6 @@ function uploadLogData(method = 'POST') {
}
}
function appReport(method = 'POST') {
return function (url, params = {}) {
return new Promise(function (resolve, reject) {
let app = getApp();
let data = JSON.stringify(params)
let sid = app && app.globalData && app.globalData.sid ? app.globalData.sid : '';
let header = {
'content-type': "application/json",
'x-yoho-sid': md5(sid),
}
wx.request({
url,
data,
method,
header,
});
})
}
}
function _publicParams() {
let app_version = APP_VERSION;
let os_version = '';
... ... @@ -307,14 +315,6 @@ function _publicParams() {
// Do something when catch error
}
// app_version = '5.6.0';
// os_version = '10.3';
// screen_size = '320x568';
// let uid = '0';
// let udid = 'acea1c6170ecca417c67979a406156950bcf4fe5';
// let physical_channel = 1;
return {
app_version,
os_version,
... ... @@ -402,12 +402,10 @@ export const GET = request('GET');
export const POST = request('POST');
export const PUT = request('PUT');
export const DELETE = request('DELETE');
export const UPLOAD_LOG = uploadLogData('POST')
export const APP_REPORT = appReport('POST')
export const UPLOAD_LOG = uploadLogData('POST');
module.exports = {
sign_body,
APP_REPORT,
UPLOAD_LOG,
GET,
POST,
... ...
... ... @@ -29,4 +29,5 @@
justify-content: center;/*水平居中*/
height: 290rpx;
margin: 0 75rpx;
text-align:center;
}
\ No newline at end of file
... ...
... ... @@ -28,4 +28,5 @@
justify-content: center;/*水平居中*/
height: 290rpx;
margin: 0 75rpx;
text-align:center;
}
\ No newline at end of file
... ...
... ... @@ -25,6 +25,6 @@
</view>
<view class="product_price">原价:<text class="line">{{product.price}}</text></view>
</view>
<view wx:if="{{product.status !== 2}}" class="product_time">{{helper.formatTime(product.start_time,
<view wx:if="{{product.status !== 2 && product.start_time}}" class="product_time">{{helper.formatTime(product.start_time,
product.end_time)}}
</view>
... ...
<view>
<block wx:if="{{product.status === 0 || product.is_full === 1}}">
<block wx:if="{{product.status === 0}}">
<view class="btn cancel" >活动结束</view>
</block>
... ...
... ... @@ -62,7 +62,6 @@ Page(Object.assign({
*/
data: {
tabIdx: '',
show: false,
showAuth: false,
actPrizeId: '',
shareUid: 0,
... ... @@ -189,7 +188,7 @@ Page(Object.assign({
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
wx.hideLoading();
},
/**
... ... @@ -330,6 +329,7 @@ Page(Object.assign({
this.service.getRecommend(params),
this.service.getRecentAvatars(params)
]).then(([r1, r2, r3]) => {
wx.hideLoading();
if (r1.code === 200 && r1.data) {
let product = r1.data;
... ... @@ -358,7 +358,6 @@ Page(Object.assign({
myPrizeCount: r1.code === 200 ? r1.data.myCodeNum : 0,
participantCount,
show: true,
snapData,
notice: JSON.parse(product.notice || '{}'),
lottery: JSON.parse(product.lottery_info || '{}')
... ... @@ -366,13 +365,12 @@ Page(Object.assign({
this._setActionStatus();
this._setStep();
wx.hideLoading();
} else {
return Promise.reject();
}
}).catch((e) => {
console.error(e);
wx.hideLoading();
console.error(e);
});
},
... ...
<block wx:if="{{show}}">
<view class="header {{shareFlag || 'mt-header'}}">
<view class="header {{shareFlag || 'mt-header'}}" >
<product-header product="{{product}}" shareFlag="{{shareFlag}}" avatars="{{avatars}}"></product-header>
</view>
<block wx:if="{{false}}">
<counter count="{{participantCount}}" num="{{product.limit}}" status="{{product.status}}"></counter>
<prize-progress step="{{step}}"></prize-progress>
</block>
<view class="machine {{shareFlag ? 'machine-t-m' : 'machine-t-l'}}">
<view class="open-shadow"></view>
<view class="code-list" animation="{{animation}}">
<view class="code-list-item-container">
<view class="code-list-item"><view class="content"></view></view>
<view class="code-list-item" wx:for="{{codeList}}" wx:if="{{index < 3}}" wx:key="{{index}}">
<view class="content">
<image class="thumb" mode="widthFix" src="{{item.user_thumb}}"></image>
<view class="text">
<view>我的</view>
<view>抽奖码</view>
</view>
<view class="my-code">{{item.prize_code}}</view>
<product-header product="{{product}}" shareFlag="{{shareFlag}}" avatars="{{avatars}}"></product-header>
</view>
<block wx:if="{{false}}">
<counter count="{{participantCount}}" num="{{product.limit}}" status="{{product.status}}"></counter>
<prize-progress step="{{step}}"></prize-progress>
</block>
<view class="machine {{shareFlag ? 'machine-t-m' : 'machine-t-l'}}">
<view class="open-shadow"></view>
<view class="code-list" animation="{{animation}}">
<view class="code-list-item-container">
<view class="code-list-item">
<view class="content"></view>
</view>
<view class="code-list-item" wx:for="{{codeList}}" wx:if="{{index < 3}}" wx:key="{{index}}">
<view class="content">
<image class="thumb" mode="widthFix" src="{{item.user_thumb}}"></image>
<view class="text">
<view>我的</view>
<view>抽奖码</view>
</view>
<image class="shadow" src="https://img11.static.yhbimg.com/yhb-img01/2018/12/27/19/0140fa3243af949068d2aabeedb0ea0666.png" mode="widthFix" wx:if="{{index == 2 && codeList.length>3 }}"></image>
<view class="my-code">{{item.prize_code}}</view>
</view>
<image src="./images/down.png" bindtap="goList" data-index="3" mode="widthFix" class="down" wx:if="{{codeList.length>3}}"></image>
<image class="shadow"
src="https://img11.static.yhbimg.com/yhb-img01/2018/12/27/19/0140fa3243af949068d2aabeedb0ea0666.png"
mode="widthFix" wx:if="{{index == 2 && codeList.length>3 }}"></image>
</view>
<image src="./images/down.png" bindtap="goList" data-index="3" mode="widthFix" class="down"
wx:if="{{codeList.length>3}}"></image>
</view>
</view>
<view class="help">
<help></help>
</view>
<desc list="{{product.content}}" bind:tapUrl="_jumpBanner" bannerSrc="{{bannerSrc}}" bannerUrl="{{bannerUrl}}"></desc>
<view class="line"></view>
<more wx:if="{{recommends.length > 0}}">
<block wx:for="{{recommends}}" wx:key="{{index}}">
<view class="product-item">
<product-item product="{{item}}" tab-idx="{{tabIdx - 1}}"></product-item>
</view>
</block>
</more>
</view>
<view class="help">
<help></help>
</view>
<desc list="{{product.content}}" bind:tapUrl="_jumpBanner" bannerSrc="{{bannerSrc}}" bannerUrl="{{bannerUrl}}"></desc>
<view class="fellow-bar" wx:if="{{product.status && !shareFlag}}">
<fellow-bar notice="{{notice}}"></fellow-bar>
</view>
<group-recommend groupRecommendList="{{groupList}}" bindgoToGroupMiniApp="goToGroupMiniApp">
</group-recommend>
<view class="line"></view>
<view class="action-bar">
<action-bar wx:if="{{isLogin}}" status="{{actionStatus}}" num="{{myPrizeCount}}" share-uid="{{shareUid}}"
act-prize-id="{{actPrizeId}}" bindgetcode="changeActionStatus" bindshare="share"
copyText="{{lottery.miniappCopy}}" text="{{lottery.miniappTip}}"
bindgaincodesuccess="reportSuccess" type="{{lottery.miniappType}}"
></action-bar>
<more wx:if="{{recommends.length > 0}}">
<block wx:for="{{recommends}}" wx:key="{{index}}">
<view class="product-item">
<product-item product="{{item}}" tab-idx="{{tabIdx - 1}}"></product-item>
</view>
</block>
</more>
<block wx:else>
<view class="action-bar2">
<view class="action-item action-list" bindtap="goList">
<image class="action-image" src="./images/list_icon@2x.png"></image>
</view>
<view class="fellow-bar" wx:if="{{product.status && !shareFlag}}">
<fellow-bar notice="{{notice}}"></fellow-bar>
</view>
<group-recommend groupRecommendList="{{groupList}}" bindgoToGroupMiniApp="goToGroupMiniApp">
</group-recommend>
<block wx:if="{{product.status === 2}}">
<button class="action-item confirm" bindtap="goLogin">0元参加抽奖</button>
</block>
<view class="action-bar">
<action-bar wx:if="{{isLogin}}" status="{{actionStatus}}" num="{{myPrizeCount}}" share-uid="{{shareUid}}"
act-prize-id="{{actPrizeId}}" bindgetcode="changeActionStatus" bindshare="share"
copyText="{{lottery.miniappCopy}}" text="{{lottery.miniappTip}}"
bindgaincodesuccess="reportSuccess" type="{{lottery.miniappType}}"
></action-bar>
<block wx:else>
<view class="action-item over">活动已结束</view>
</block>
<block wx:else>
<view class="action-bar2">
<view class="action-item action-list" bindtap="goList">
<image class="action-image" src="./images/list_icon@2x.png"></image>
</view>
</block>
</view>
<view class="foot"></view>
</block>
<block wx:if="{{product.status === 2}}">
<button class="action-item confirm" bindtap="goLogin">0元参加抽奖</button>
</block>
<block wx:else>
<view class="action-item over">活动已结束</view>
</block>
</view>
</block>
</view>
<view class="foot"></view>
<import src="../../vendors/zanui/actionsheet/index.wxml"/>
<template is="zan-actionsheet" data="{{...actionsheet}}"/>
... ...
const event = global.event;
Page({
data: {
},
onShow: function () {
},
onUnload:function(){
wx.removeStorageSync('errorFlag');
event.once('errorPage', function(fun){ fun && fun()});
},
back: function () {
wx.navigateBack({
delta: 1,
success:()=>{
wx.removeStorageSync('errorFlag')
}
})
}
})
\ No newline at end of file
... ...
{
"navigationBarTitleText": "YO!LUCK"
}
\ No newline at end of file
... ...
<view class="offline-box">
<image class="offline-bg" src="https://cdn.yoho.cn/miniapp/yoluck/404.png" mode="aspectFit"></image>
<view class="slogan">目前参与人数过多请点击刷新</view>
<view class="refresh" bindtap="back">刷新重试</view>
</view>
... ...
.offline-box {
font-size: 32rpx;
width: 100%;
position: fixed;
top: 50%;
text-align: center;
transform: translateY(-50%);
}
.offline-bg {
height: 280rpx;
width: 280rpx;
}
.slogan {
margin-top: 80rpx;
}
.refresh {
margin-left: 50%;
transform: translate(-50%);
width: 240rpx;
margin-top: 40rpx;
padding: 20rpx;
border-radius: 4rpx;
background-color: #444;
color: #fff;
}
\ No newline at end of file
... ...
... ... @@ -34,7 +34,7 @@ Page(Object.assign({
}, {
page: 1,
products: []
},{
}, {
page: 1,
products: []
}],
... ... @@ -71,12 +71,12 @@ Page(Object.assign({
openType: 'share',
image_src: '../../images/share_wechat@2x.png',
},
{
name: '生成海报分享',
className: 'action-class',
loading: false,
image_src: '../../images/share_wxpeng@2x.png'
}]
{
name: '生成海报分享',
className: 'action-class',
loading: false,
image_src: '../../images/share_wxpeng@2x.png'
}]
},
},
... ... @@ -105,8 +105,9 @@ Page(Object.assign({
} else {
this._init();
}
new app.WeToast();
if(options && (Number(options.reload) !== 0)) {
if (options && (Number(options.reload) !== 0)) {
this._getResouceCode()
}
this._getBottomBanner();
... ... @@ -115,6 +116,8 @@ Page(Object.assign({
onShow() {
let uid = app.globalData.userInfo.uid > 0 ? app.globalData.userInfo.uid : 0;
event.emit('errorPage',this._refresh.bind(this));
this.setData({
hasUnionID: app.globalData.WXUnion_ID !== null && app.globalData.WXUnion_ID !== '' && app.globalData.WXUnion_ID !== undefined ? true : false,
... ... @@ -144,10 +147,10 @@ Page(Object.assign({
let page = this.data.list[tabIndex].page;
let pageKey = `list[${tabIndex}].page`;
let productsKey = `list[${tabIndex}].products`
this._getPage(page).then((list) => {
let oldList = this.data.list[tabIndex].products;
if (list.length > 0) {
this.setData({
[productsKey]: oldList.concat(list),
... ... @@ -213,7 +216,7 @@ Page(Object.assign({
_getUser() {
const userInfo = app.getUserInfo();
if (app.isLogin() && (!userInfo || !userInfo.nickName)) {
return this.service.getUserProfile({uid: app.getUid()}).then(json => {
if (json && json.code && json.code === 200) {
... ... @@ -229,28 +232,28 @@ Page(Object.assign({
_getResouceCode() {
this.commonService.getResourceCode('194ffd46254d6ad20e6c538bea4d89d7')
.then(data => {
this.setData({
dialogSrc: formatImageUrl(data.src, 340 * app.globalData.systemInfo.pixelRatio, 340 * app.globalData.systemInfo.pixelRatio, 2),
dialogUrl: data.url
.then(data => {
this.setData({
dialogSrc: formatImageUrl(data.src, 340 * app.globalData.systemInfo.pixelRatio, 340 * app.globalData.systemInfo.pixelRatio, 2),
dialogUrl: data.url
})
this.dialog.showDialog();
})
this.dialog.showDialog();
})
.catch(error => {
})
.catch(error => {
})
},
_getBottomBanner() {
this.commonService.getResourceCode('5a2203f5656fbc9788bd8af70f2823d3')
.then(data => {
// console.log(data)
this.setData({
bannerSrc: formatImageUrl(data.src, 750, 234, 2),
bannerUrl: data.url
.then(data => {
// console.log(data)
this.setData({
bannerSrc: formatImageUrl(data.src, 750, 234, 2),
bannerUrl: data.url
})
})
.catch(error => {
})
})
.catch(error => {
})
},
_getProceedingData() {
... ... @@ -273,7 +276,7 @@ Page(Object.assign({
},
_getReleaseData(my_page) {
if (!this.data.isLogin) {
if (!this.data.isLogin) {
return;
}
let type = 1;
... ... @@ -309,7 +312,7 @@ Page(Object.assign({
let oldData = my_zero_list[type].data;
let key = `my_zero_list[${type}].data`;
let keyPage = `my_zero_list[${type}].page`;
this.service.getMyList({ type, page }).then(res => {
this.service.getMyList({type, page}).then(res => {
let data = []
if (res && res.code === 200) {
data = res.data;
... ... @@ -331,7 +334,7 @@ Page(Object.assign({
return;
}
jumpByUrl(this.data.bannerUrl);
},
onTabChange({detail}) {
... ... @@ -347,10 +350,10 @@ Page(Object.assign({
this._init();
},
getUserInfo: function(e) {
getUserInfo: function (e) {
var that = this;
if (e.detail.errMsg === 'getUserInfo:ok') {
decodeUnionId(app.getWechatThirdSession(), e, function(response) {
decodeUnionId(app.getWechatThirdSession(), e, function (response) {
if (response.isHaveUnionID) {
that.setData({
hasUnionID: true,
... ... @@ -358,27 +361,28 @@ Page(Object.assign({
}
});
} else {
openAuthorizeSettings(function(response) {
openAuthorizeSettings(function (response) {
if (response.isHaveUnionID) {
that.setData({
hasUnionID: true,
})
};
}
;
});
}
},
getPhoneNumber: function(e) {
getPhoneNumber: function (e) {
var that = this;
if (e.detail.errMsg === 'getPhoneNumber:ok') {
decodePhoneNumber(e.detail.iv, e.detail.encryptedData, '', function(result) {
decodePhoneNumber(e.detail.iv, e.detail.encryptedData, '', function (result) {
// console.log('!!!!result',result)
if (result.code != 200) {
that.wetoast.toast({
title: result.message,
titleClassName: 'wetoast-title',
duration: 1000,
success: function() {
success: function () {
that.loginAndRegisterTapped()
}.bind(that)
});
... ... @@ -386,7 +390,7 @@ Page(Object.assign({
if (result.is_register) {
that.showZanToast({
title: '欢迎加入Yoho!Family!新人礼包已发放到个人中心-优惠券,请注意查收',
success: function() {
success: function () {
let uid = app.globalData.userInfo.uid > 0 ? app.globalData.userInfo.uid : 0;
that.setData({
uid,
... ... @@ -427,13 +431,13 @@ Page(Object.assign({
content: '检测到您未打开微信用户信息授权,开启后即可进行登录',
confirmText: "去开启",
confirmColor: "#000000",
success: function(res) {
success: function (res) {
if (res.confirm) {
wx.openSetting({
success: (res) => {
// console.log(res.authSetting["scope.userInfo"])
if (res.authSetting["scope.userInfo"] !== null && res.authSetting["scope.userInfo"] !== undefined && res.authSetting["scope.userInfo"] === true) {
getUnionID(app.getWechatThirdSession(), function(response) {
getUnionID(app.getWechatThirdSession(), function (response) {
// console.log(response)
})
}
... ... @@ -450,7 +454,7 @@ Page(Object.assign({
wx.navigateTo({
url: '/pages/bindPhoneNumber/bindPhoneNumber'
});
}
}
}
})
} else {
... ... @@ -465,18 +469,18 @@ Page(Object.assign({
let union_id = wx.getStorageSync('union_id');
let res = await getSettingPromise();
if (res.authSetting["scope.userInfo"] !== null &&
res.authSetting["scope.userInfo"] !== undefined &&
res.authSetting["scope.userInfo"] === true) {
if (union_id) {
this.setData({
openType: 'none-open-type',
})
} else {
this.setData({
openType: 'getUserInfo'
})
}
if (res.authSetting["scope.userInfo"] !== null &&
res.authSetting["scope.userInfo"] !== undefined &&
res.authSetting["scope.userInfo"] === true) {
if (union_id) {
this.setData({
openType: 'none-open-type',
})
} else {
this.setData({
openType: 'getUserInfo'
})
}
} else {
this.setData({
openType: 'getUserInfo'
... ... @@ -485,7 +489,7 @@ Page(Object.assign({
},
loginChangeStatus(params) {
let { openType } = params;
let {openType} = params;
this.setData({
openType
})
... ... @@ -513,20 +517,20 @@ Page(Object.assign({
});
},
share({ detail }) {
share({detail}) {
this.setData({
'actionsheet.show': true,
'shareProduct': detail
})
},
handleZanActionsheetCancel({ componentId }) {
handleZanActionsheetCancel({componentId}) {
this.setData({
'actionsheet.show': false
})
},
handleZanActionsheetClick({ componentId, index }) {
handleZanActionsheetClick({componentId, index}) {
this.setData({
'actionsheet.show': false
});
... ... @@ -545,7 +549,8 @@ Page(Object.assign({
product_qrCode: qrcode
});
}
};
}
;
},
onShareAppMessage(res) {
let params = {
... ...
{
"description": "项目配置文件。",
"setting": {
"urlCheck": true,
"urlCheck": false,
"es6": true,
"postcss": true,
"minified": true,
... ...