Merge branch 'feature/error_page' into 'master'
Feature/error page See merge request !9
Showing
17 changed files
with
258 additions
and
188 deletions
@@ -6,7 +6,7 @@ import {API_HOST, MINI_APP_TYPE} from './libs/config'; | @@ -6,7 +6,7 @@ import {API_HOST, MINI_APP_TYPE} from './libs/config'; | ||
6 | import mta from './vendors/mta_analysis'; | 6 | import mta from './vendors/mta_analysis'; |
7 | import {Event} from '/login/utils/index.js'; | 7 | import {Event} from '/login/utils/index.js'; |
8 | import {wxLogin} from '/login/utils/login/login'; | 8 | import {wxLogin} from '/login/utils/login/login'; |
9 | -import {appReport} from './libs/appReport.js'; | 9 | +import appReport from './libs/appReport'; |
10 | import {isStringEmpty, getYHStorageSync} from './utils/util'; | 10 | import {isStringEmpty, getYHStorageSync} from './utils/util'; |
11 | import regeneratorRuntime from '/login/libs/regenerator-runtime/index'; | 11 | import regeneratorRuntime from '/login/libs/regenerator-runtime/index'; |
12 | 12 | ||
@@ -33,7 +33,7 @@ App({ | @@ -33,7 +33,7 @@ App({ | ||
33 | if (!res.screenWidth) { | 33 | if (!res.screenWidth) { |
34 | res.screenWidth = res.windowWidth; | 34 | res.screenWidth = res.windowWidth; |
35 | } | 35 | } |
36 | - | 36 | + wx.removeStorageSync('errorFlag'); |
37 | this.globalData.systemInfo = res; | 37 | this.globalData.systemInfo = res; |
38 | this.checkUDID(); | 38 | this.checkUDID(); |
39 | 39 | ||
@@ -144,11 +144,21 @@ App({ | @@ -144,11 +144,21 @@ App({ | ||
144 | } | 144 | } |
145 | 145 | ||
146 | if (options && options.scene){ | 146 | if (options && options.scene){ |
147 | - appReport('start', "LIFECYCLE", "RESUME", { | ||
148 | - 'activeWay': options.scene + "" | ||
149 | - }, this) | 147 | + appReport({ |
148 | + reportType: 'start', | ||
149 | + pt: 'LIFECYCLE', | ||
150 | + pn: 'RESUME', | ||
151 | + param: { | ||
152 | + 'activeWay': options.scene + '' | ||
153 | + } | ||
154 | + }, this); | ||
150 | }else{ | 155 | }else{ |
151 | - appReport('start', "LIFECYCLE", "RESUME", {}, this) | 156 | + appReport({ |
157 | + reportType: 'start', | ||
158 | + pt: 'LIFECYCLE', | ||
159 | + pn: 'RESUME', | ||
160 | + param: {} | ||
161 | + }, this); | ||
152 | } | 162 | } |
153 | 163 | ||
154 | let scene = options ? options.scene : ''; | 164 | let scene = options ? options.scene : ''; |
@@ -158,8 +168,13 @@ App({ | @@ -158,8 +168,13 @@ App({ | ||
158 | //当应用程序进入后台状态时触发 | 168 | //当应用程序进入后台状态时触发 |
159 | onHide () { | 169 | onHide () { |
160 | let params = {}; | 170 | let params = {}; |
161 | - yasReport(YB_ENTER_BACKGROUND,params); | ||
162 | - appReport('start', "LIFECYCLE", "STOP", {},this) | 171 | + yasReport(YB_ENTER_BACKGROUND, params); |
172 | + appReport({ | ||
173 | + reportType: 'start', | ||
174 | + pt: 'LIFECYCLE', | ||
175 | + pn: 'STOP', | ||
176 | + param: {} | ||
177 | + }, this); | ||
163 | }, | 178 | }, |
164 | 179 | ||
165 | getUserInfo: function () { | 180 | getUserInfo: function () { |
@@ -400,7 +415,6 @@ App({ | @@ -400,7 +415,6 @@ App({ | ||
400 | }, | 415 | }, |
401 | 416 | ||
402 | getShareInfo: function () { | 417 | getShareInfo: function () { |
403 | - // console.log('getShareInfo'); | ||
404 | let param = { | 418 | let param = { |
405 | share_id: this.globalData.shareId, | 419 | share_id: this.globalData.shareId, |
406 | } | 420 | } |
@@ -468,10 +482,14 @@ App({ | @@ -468,10 +482,14 @@ App({ | ||
468 | } else { | 482 | } else { |
469 | net = '0'; | 483 | net = '0'; |
470 | } | 484 | } |
471 | - // console.log("network:",net) | ||
472 | }, | 485 | }, |
473 | complete:function(res){ | 486 | complete:function(res){ |
474 | - appReport('start', "LIFECYCLE", "START", {}, that) | 487 | + appReport({ |
488 | + reportType: 'start', | ||
489 | + pt: 'LIFECYCLE', | ||
490 | + pn: 'START', | ||
491 | + param: {} | ||
492 | + }, that); | ||
475 | } | 493 | } |
476 | }) | 494 | }) |
477 | that.globalData.networkType = net; | 495 | that.globalData.networkType = net; |
@@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
4 | "pages/zeroSell/detail", | 4 | "pages/zeroSell/detail", |
5 | "pages/zeroSell/snapshootShare", | 5 | "pages/zeroSell/snapshootShare", |
6 | "pages/zeroSell/h5Page", | 6 | "pages/zeroSell/h5Page", |
7 | + "pages/zeroSell/error", | ||
7 | "pages/bindPhoneNumber/bindPhoneNumber", | 8 | "pages/bindPhoneNumber/bindPhoneNumber", |
8 | "pages/choosecountry/choosecountry", | 9 | "pages/choosecountry/choosecountry", |
9 | "login/login-page/login-page" | 10 | "login/login-page/login-page" |
1 | -'use strict' | ||
2 | -import { APP_REPORT_HOST, APP_VERSION, APP_BUILD} from '../libs/config'; | ||
3 | -import { APP_REPORT } from '../libs/request'; | ||
4 | import md5 from '../vendors/md5'; | 1 | import md5 from '../vendors/md5'; |
2 | +import Promise from '../vendors/es6-promise'; | ||
3 | +import { APP_REPORT_HOST, APP_VERSION, APP_BUILD } from '../libs/config'; | ||
5 | 4 | ||
6 | let getDeviceInfo = function (app) { | 5 | let getDeviceInfo = function (app) { |
7 | - let ak = 'yoholuck_mp';// | 6 | + let ak = 'yoholuck_mp'; // 小程序标识 |
8 | 7 | ||
9 | let systemInfo = app.globalData.systemInfo | 8 | let systemInfo = app.globalData.systemInfo |
10 | let device = {} | 9 | let device = {} |
@@ -12,12 +11,12 @@ let getDeviceInfo = function (app) { | @@ -12,12 +11,12 @@ let getDeviceInfo = function (app) { | ||
12 | let union_type = app.getUnion_type(); | 11 | let union_type = app.getUnion_type(); |
13 | device.ak = ak | 12 | device.ak = ak |
14 | device.udid = app.globalData.udid ? app.globalData.udid : ''; | 13 | device.udid = app.globalData.udid ? app.globalData.udid : ''; |
15 | - device.ch = union_type ? union_type: app.globalData.ch; | 14 | + device.ch = union_type ? union_type : app.globalData.ch; |
16 | device.os = "weixinapp" | 15 | device.os = "weixinapp" |
17 | - device.osv = systemInfo && systemInfo.version ? systemInfo.version:'' | ||
18 | - device.dm = systemInfo && systemInfo.model ? systemInfo.model.replace(' ', '_'):'' | 16 | + device.osv = systemInfo && systemInfo.version ? systemInfo.version : '' |
17 | + device.dm = systemInfo && systemInfo.model ? systemInfo.model.replace(' ', '_') : '' | ||
19 | 18 | ||
20 | - if (systemInfo.platform == 'ios'){ | 19 | + if (systemInfo.platform == 'ios') { |
21 | //针对ios设备,特殊处理dm,转为iphone_7这种格式 | 20 | //针对ios设备,特殊处理dm,转为iphone_7这种格式 |
22 | var start_num = device.dm.indexOf('<') | 21 | var start_num = device.dm.indexOf('<') |
23 | var end_num = device.dm.indexOf('>') | 22 | var end_num = device.dm.indexOf('>') |
@@ -30,61 +29,66 @@ let getDeviceInfo = function (app) { | @@ -30,61 +29,66 @@ let getDeviceInfo = function (app) { | ||
30 | } | 29 | } |
31 | } | 30 | } |
32 | } | 31 | } |
33 | - | ||
34 | return device; | 32 | return device; |
35 | } | 33 | } |
36 | 34 | ||
37 | -let appReport = function(reportType, pt, pn, param,appObject) { | ||
38 | - let app = appObject; | 35 | +let appReport = function ({ reportType = 'hb', pt, pn, param = {} } = {}, _this) { |
36 | + let app = _this || getApp(); | ||
39 | 37 | ||
40 | let deviceInfo = getDeviceInfo(app) | 38 | let deviceInfo = getDeviceInfo(app) |
41 | if (!pt || !pn || !deviceInfo || !deviceInfo.dm) return; | 39 | if (!pt || !pn || !deviceInfo || !deviceInfo.dm) return; |
42 | - if(!param)param = {}; | ||
43 | - if(!reportType)reportType='hb'; | 40 | + if (!reportType) reportType = 'hb'; |
44 | 41 | ||
45 | let ts = new Date().getTime() + '000000'; | 42 | let ts = new Date().getTime() + '000000'; |
46 | let uid = app && app.globalData && app.globalData.userInfo && app.globalData.userInfo.uid ? md5(app.globalData.userInfo.uid) : ''; | 43 | let uid = app && app.globalData && app.globalData.userInfo && app.globalData.userInfo.uid ? md5(app.globalData.userInfo.uid) : ''; |
47 | 44 | ||
48 | - if(!uid){ | 45 | + if (!uid) { |
49 | uid = md5(app.getUid()); | 46 | uid = md5(app.getUid()); |
50 | } | 47 | } |
51 | 48 | ||
49 | + let event = {}; | ||
52 | let sid = app && app.globalData && app.globalData.sid ? app.globalData.sid : ''; | 50 | let sid = app && app.globalData && app.globalData.sid ? app.globalData.sid : ''; |
53 | - | ||
54 | let networkType = app && app.globalData && app.globalData.networkType ? app.globalData.networkType : '0'; | 51 | let networkType = app && app.globalData && app.globalData.networkType ? app.globalData.networkType : '0'; |
55 | 52 | ||
56 | - let event = {} | ||
57 | - event.ps = '0', | ||
58 | - event.av = APP_VERSION, | ||
59 | - event.ab = APP_BUILD, | ||
60 | - event.ca = '0', | ||
61 | - event.net = networkType, | ||
62 | - event.sid = sid, | ||
63 | - event.uid = uid, | ||
64 | - event.ts = ts, | ||
65 | - event.pt = pt, | ||
66 | - event.pn = pn, | ||
67 | - event.param = param | 53 | + event.ps = '0'; |
54 | + event.av = APP_VERSION; | ||
55 | + event.ab = APP_BUILD; | ||
56 | + event.ca = '0'; | ||
57 | + event.net = networkType; | ||
58 | + event.sid = sid; | ||
59 | + event.uid = uid; | ||
60 | + event.ts = ts; | ||
61 | + event.pt = pt; | ||
62 | + event.pn = pn; | ||
63 | + event.param = param; | ||
68 | 64 | ||
69 | let events = []; | 65 | let events = []; |
70 | events.push(event) | 66 | events.push(event) |
71 | 67 | ||
72 | //组装最终要上报的数据 | 68 | //组装最终要上报的数据 |
73 | let parameters = {}; | 69 | let parameters = {}; |
74 | - parameters.type = reportType, | ||
75 | - parameters.device = deviceInfo, | ||
76 | - parameters.events = events, | ||
77 | - | ||
78 | - | ||
79 | - APP_REPORT(APP_REPORT_HOST, parameters) | ||
80 | - .then(function (data) { | ||
81 | - // console.log(data) | ||
82 | - }) | ||
83 | - .catch(function (error) { | 70 | + parameters.type = reportType; |
71 | + parameters.device = deviceInfo; | ||
72 | + parameters.events = events; | ||
73 | + | ||
74 | + let _appReport = function (url, params = {}) { | ||
75 | + return new Promise(function (resolve, reject) { | ||
76 | + let app = getApp(); | ||
77 | + let data = JSON.stringify(params) | ||
78 | + let sid = app && app.globalData && app.globalData.sid ? app.globalData.sid : ''; | ||
79 | + let header = { | ||
80 | + 'content-type': "application/json", | ||
81 | + 'x-yoho-sid': md5(sid), | ||
82 | + } | ||
83 | + wx.request({ | ||
84 | + url, | ||
85 | + data, | ||
86 | + header, | ||
87 | + method: 'POST' | ||
84 | }); | 88 | }); |
85 | - | 89 | + }) |
90 | + }; | ||
91 | + _appReport(APP_REPORT_HOST, parameters); | ||
86 | } | 92 | } |
87 | 93 | ||
88 | -module.exports = { | ||
89 | - appReport, | ||
90 | -} | ||
94 | +export default appReport; |
@@ -2,35 +2,21 @@ | @@ -2,35 +2,21 @@ | ||
2 | export const API_HOST = 'https://api.yoho.cn'; | 2 | export const API_HOST = 'https://api.yoho.cn'; |
3 | export const SERVICE_HOST = 'https://api.yoho.cn'; | 3 | export const SERVICE_HOST = 'https://api.yoho.cn'; |
4 | export const ACTIVITY_HOST = 'https://action.yoho.cn'; | 4 | export const ACTIVITY_HOST = 'https://action.yoho.cn'; |
5 | +export const APP_REPORT_HOST = 'https://app.yoho.cn/collect/v3'; | ||
6 | +export const LOG_EVENT_HOST = 'https://analysis.yohobuy.com/yas_mobile'; | ||
5 | 7 | ||
6 | // 测试环境 | 8 | // 测试环境 |
7 | // export const API_HOST = 'http://api-test3.dev.yohocorp.com'; | 9 | // export const API_HOST = 'http://api-test3.dev.yohocorp.com'; |
8 | // export const SERVICE_HOST = 'http://api-test3.dev.yohocorp.com'; | 10 | // export const SERVICE_HOST = 'http://api-test3.dev.yohocorp.com'; |
9 | // export const ACTIVITY_HOST = 'http://yoho-activity-platform.test3.ingress.dev.yohocorp.com'; | 11 | // export const ACTIVITY_HOST = 'http://yoho-activity-platform.test3.ingress.dev.yohocorp.com'; |
10 | -// export const ACTIVITY_HOST = 'http://192.168.102.49:6006'; | ||
11 | - | ||
12 | -// export const API_HOST = 'http://dev-api.yohops.com:9999'; | ||
13 | -// export const SERVICE_HOST = 'http://dev-api.yohops.com:9999/'; | ||
14 | - | ||
15 | -// export const API_HOST = 'http://api-test1.yohops.com:9999'; | ||
16 | -// export const SERVICE_HOST = 'http://api-test1.yohops.com:9999/'; | ||
17 | - | ||
18 | - | ||
19 | -// export const API_HOST = 'http://api-test2.dev.yohocorp.com'; | ||
20 | -// export const SERVICE_HOST = 'http://api-test2.dev.yohocorp.com'; | 12 | +// export const ACTIVITY_HOST = 'http://limit-yoho-activity-platform.test3.ingress.dev.yohocorp.com'; |
21 | // export const APP_REPORT_HOST = 'http://app.yoho.cn/collect/v3'; | 13 | // export const APP_REPORT_HOST = 'http://app.yoho.cn/collect/v3'; |
22 | - | ||
23 | -// export const API_HOST = 'https://apigray.yoho.cn'; | ||
24 | -// export const SERVICE_HOST = 'https://apigray.yoho.cn'; | ||
25 | - | ||
26 | -export const APP_REPORT_HOST = 'https://app.yoho.cn/collect/v3'; | ||
27 | -export const LOG_EVENT_HOST = 'https://analysis.yohobuy.com/yas_mobile'; | 14 | +// export const LOG_EVENT_HOST = 'https://analysis.yohobuy.com/yas_mobile'; |
28 | 15 | ||
29 | export const MINI_APP_TYPE = 29; | 16 | export const MINI_APP_TYPE = 29; |
30 | export const MINI_QR_TYPE = 16; | 17 | export const MINI_QR_TYPE = 16; |
31 | 18 | ||
32 | export const OS_VERSION = 'yohobuy:h5'; | 19 | export const OS_VERSION = 'yohobuy:h5'; |
33 | - | ||
34 | export const APP_VERSION = '2.9.0'; | 20 | export const APP_VERSION = '2.9.0'; |
35 | export const APP_BUILD = '1041'; | 21 | export const APP_BUILD = '1041'; |
36 | 22 |
1 | +import md5 from '../vendors/md5'; | ||
1 | import Promise from '../vendors/es6-promise'; | 2 | import Promise from '../vendors/es6-promise'; |
2 | import objectAssign from '../vendors/object-assign'; | 3 | import objectAssign from '../vendors/object-assign'; |
3 | import trimObject from '../utils/trimObject'; | 4 | import trimObject from '../utils/trimObject'; |
4 | import queryString from '../vendors/query-string'; | 5 | import queryString from '../vendors/query-string'; |
5 | -import md5 from '../vendors/md5'; | ||
6 | -import {API_HOST,APP_VERSION, CLIENT_TYPE, PRIVATE_KEY} from '../libs/config'; | ||
7 | import { getYHStorageSync } from '../utils/util'; | 6 | import { getYHStorageSync } from '../utils/util'; |
7 | +import {API_HOST,APP_VERSION, CLIENT_TYPE, PRIVATE_KEY} from '../libs/config'; | ||
8 | +import appReport from './appReport'; | ||
8 | 9 | ||
9 | let crypto = require('./cryptojs/cryptojs.js').Crypto | 10 | let crypto = require('./cryptojs/cryptojs.js').Crypto |
10 | let p1SecretKey = "yoho9646yoho9646" | 11 | let p1SecretKey = "yoho9646yoho9646" |
@@ -38,14 +39,12 @@ function getPrivateKey(){ | @@ -38,14 +39,12 @@ function getPrivateKey(){ | ||
38 | method, | 39 | method, |
39 | header: header, | 40 | header: header, |
40 | success: function (res) { | 41 | success: function (res) { |
41 | - // console.log("res:", res) | ||
42 | if (res && res.data && res.data.data && res.data.data.sk) { | 42 | if (res && res.data && res.data.data && res.data.data.sk) { |
43 | app.globalData.p2SecretKey = res.data.data.sk; | 43 | app.globalData.p2SecretKey = res.data.data.sk; |
44 | wx.setStorage({ | 44 | wx.setStorage({ |
45 | key: "p2SecretKey", | 45 | key: "p2SecretKey", |
46 | data: res.data.data.sk | 46 | data: res.data.data.sk |
47 | }); | 47 | }); |
48 | - | ||
49 | resolve(app.globalData.p2SecretKey) | 48 | resolve(app.globalData.p2SecretKey) |
50 | } | 49 | } |
51 | }, | 50 | }, |
@@ -54,19 +53,18 @@ function getPrivateKey(){ | @@ -54,19 +53,18 @@ function getPrivateKey(){ | ||
54 | let message = err.message ? err.message : ''; | 53 | let message = err.message ? err.message : ''; |
55 | let isPrivatekeyError = true | 54 | let isPrivatekeyError = true |
56 | reject({ code, message, isPrivatekeyError}); | 55 | reject({ code, message, isPrivatekeyError}); |
57 | - // console.log("err:",err) | ||
58 | } | 56 | } |
59 | }); | 57 | }); |
60 | 58 | ||
61 | } | 59 | } |
62 | }) | 60 | }) |
63 | } | 61 | } |
64 | - | ||
65 | function request(method = 'GET') { | 62 | function request(method = 'GET') { |
66 | return function(url, params = {}) { | 63 | return function(url, params = {}) { |
67 | return getPrivateKey() | 64 | return getPrivateKey() |
68 | .then(key => { | 65 | .then(key => { |
69 | return new Promise(function (resolve, reject) { | 66 | return new Promise(function (resolve, reject) { |
67 | + | ||
70 | let app = getApp(); | 68 | let app = getApp(); |
71 | if (params && !params.hasOwnProperty('uid')) { | 69 | if (params && !params.hasOwnProperty('uid')) { |
72 | let uid = app && app.globalData && app.globalData.userInfo && app.globalData.userInfo.uid ? app.globalData.userInfo.uid : 0; | 70 | 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') { | @@ -88,7 +86,6 @@ function request(method = 'GET') { | ||
88 | } | 86 | } |
89 | params.udid = udid; | 87 | params.udid = udid; |
90 | } | 88 | } |
91 | - | ||
92 | let body = _createBody(params); | 89 | let body = _createBody(params); |
93 | let queryStrigPair = _signParam(body, true); | 90 | let queryStrigPair = _signParam(body, true); |
94 | let data = ''; | 91 | let data = ''; |
@@ -127,32 +124,48 @@ function request(method = 'GET') { | @@ -127,32 +124,48 @@ function request(method = 'GET') { | ||
127 | errMsg = res.errMsg, | 124 | errMsg = res.errMsg, |
128 | data = res.data; | 125 | data = res.data; |
129 | 126 | ||
127 | + if (statusCode !== 200) { | ||
128 | + appReport({ | ||
129 | + pt: 'NETWORK', | ||
130 | + pn: 'NETWORK_API_CODE_ERR', | ||
131 | + param: { | ||
132 | + url: url, | ||
133 | + ec: statusCode | ||
134 | + } | ||
135 | + }); | ||
136 | + } | ||
130 | if (statusCode == 200) { | 137 | if (statusCode == 200) { |
131 | resolve(data); | 138 | resolve(data); |
132 | } else { | 139 | } else { |
133 | let code = statusCode; | 140 | let code = statusCode; |
134 | let message = res.errMsg ? res.errMsg : ''; | 141 | let message = res.errMsg ? res.errMsg : ''; |
135 | if(statusCode === 503) { | 142 | if(statusCode === 503) { |
136 | - wx.showToast({ | ||
137 | - title: '目前参与人数过多请下拉刷新', | ||
138 | - icon: 'none', | ||
139 | - duration: 2000 | ||
140 | - }); | 143 | + if(!wx.getStorageSync('errorFlag')) { |
144 | + wx.setStorageSync('errorFlag',true); | ||
145 | + wx.navigateTo({ | ||
146 | + url: '/pages/zeroSell/error', | ||
147 | + }) | ||
148 | + | ||
149 | + } | ||
141 | } | 150 | } |
142 | reject({ code, message }); | 151 | reject({ code, message }); |
143 | } | 152 | } |
144 | }, | 153 | }, |
145 | fail: function (err) { | 154 | fail: function (err) { |
146 | - let code = err.code ? err.code : 800; | ||
147 | - let message = err.message ? err.message : ''; | ||
148 | - if(code === 503) { | ||
149 | - wx.showToast({ | ||
150 | - title: '目前参与人数过多请下拉刷新', | ||
151 | - icon: 'none', | ||
152 | - duration: 2000 | ||
153 | - }); | 155 | + const ERROR_TYPE = { |
156 | + ['request:fail']: 'NETWORK_API_CODE_ERR', | ||
157 | + ['request:fail timeout']: 'NETWORK_API_TIMEOUT' | ||
158 | + }; | ||
159 | + const errType = ERROR_TYPE[err && err.errMsg || ''] || ''; | ||
160 | + | ||
161 | + appReport({ | ||
162 | + pt: 'NETWORK', | ||
163 | + pn: errType, | ||
164 | + param: { | ||
165 | + url: url, | ||
166 | + st: JSON.stringify(err || {}) | ||
154 | } | 167 | } |
155 | - reject({code, message}); | 168 | + }); |
156 | } | 169 | } |
157 | }); | 170 | }); |
158 | }) | 171 | }) |
@@ -218,32 +231,47 @@ function request(method = 'GET') { | @@ -218,32 +231,47 @@ function request(method = 'GET') { | ||
218 | errMsg = res.errMsg, | 231 | errMsg = res.errMsg, |
219 | data = res.data; | 232 | data = res.data; |
220 | 233 | ||
234 | + if (statusCode !== 200) { | ||
235 | + appReport({ | ||
236 | + pt: 'NETWORK', | ||
237 | + pn: 'NETWORK_API_CODE_ERR', | ||
238 | + param: { | ||
239 | + url: url, | ||
240 | + ec: statusCode | ||
241 | + } | ||
242 | + }); | ||
243 | + } | ||
221 | if (statusCode == 200) { | 244 | if (statusCode == 200) { |
222 | resolve(data); | 245 | resolve(data); |
223 | } else { | 246 | } else { |
224 | let code = statusCode; | 247 | let code = statusCode; |
225 | let message = res.errMsg ? res.errMsg : ''; | 248 | let message = res.errMsg ? res.errMsg : ''; |
226 | if(statusCode === 503) { | 249 | if(statusCode === 503) { |
227 | - wx.showToast({ | ||
228 | - title: '目前参与人数过多请下拉刷新', | ||
229 | - icon: 'none', | ||
230 | - duration: 2000 | ||
231 | - }); | 250 | + if(!wx.getStorageSync('errorFlag')) { |
251 | + wx.setStorageSync('errorFlag',true); | ||
252 | + wx.navigateTo({ | ||
253 | + url: '/pages/zeroSell/error', | ||
254 | + }) | ||
255 | + } | ||
232 | } | 256 | } |
233 | reject({ code, message }); | 257 | reject({ code, message }); |
234 | } | 258 | } |
235 | }, | 259 | }, |
236 | fail: function (err) { | 260 | fail: function (err) { |
237 | - let code = err.code ? err.code : 800; | ||
238 | - let message = err.message ? err.message : ''; | ||
239 | - if(code === 503){ | ||
240 | - wx.showToast({ | ||
241 | - title: '目前参与人数过多请下拉刷新', | ||
242 | - icon: 'none', | ||
243 | - duration: 2000 | ||
244 | - }); | 261 | + const ERROR_TYPE = { |
262 | + ['request:fail']: 'NETWORK_API_CODE_ERR', | ||
263 | + ['request:fail timeout']: 'NETWORK_API_TIMEOUT' | ||
264 | + }; | ||
265 | + const errType = ERROR_TYPE[err && err.errMsg || ''] || ''; | ||
266 | + | ||
267 | + appReport({ | ||
268 | + pt: 'NETWORK', | ||
269 | + pn: errType, | ||
270 | + param: { | ||
271 | + url: url, | ||
272 | + st: JSON.stringify(err || {}) | ||
245 | } | 273 | } |
246 | - reject({ code, message }); | 274 | + }); |
247 | } | 275 | } |
248 | }); | 276 | }); |
249 | }) | 277 | }) |
@@ -271,26 +299,6 @@ function uploadLogData(method = 'POST') { | @@ -271,26 +299,6 @@ function uploadLogData(method = 'POST') { | ||
271 | } | 299 | } |
272 | } | 300 | } |
273 | 301 | ||
274 | -function appReport(method = 'POST') { | ||
275 | - return function (url, params = {}) { | ||
276 | - return new Promise(function (resolve, reject) { | ||
277 | - let app = getApp(); | ||
278 | - let data = JSON.stringify(params) | ||
279 | - let sid = app && app.globalData && app.globalData.sid ? app.globalData.sid : ''; | ||
280 | - let header = { | ||
281 | - 'content-type': "application/json", | ||
282 | - 'x-yoho-sid': md5(sid), | ||
283 | - } | ||
284 | - wx.request({ | ||
285 | - url, | ||
286 | - data, | ||
287 | - method, | ||
288 | - header, | ||
289 | - }); | ||
290 | - }) | ||
291 | - } | ||
292 | -} | ||
293 | - | ||
294 | function _publicParams() { | 302 | function _publicParams() { |
295 | let app_version = APP_VERSION; | 303 | let app_version = APP_VERSION; |
296 | let os_version = ''; | 304 | let os_version = ''; |
@@ -307,14 +315,6 @@ function _publicParams() { | @@ -307,14 +315,6 @@ function _publicParams() { | ||
307 | // Do something when catch error | 315 | // Do something when catch error |
308 | } | 316 | } |
309 | 317 | ||
310 | - // app_version = '5.6.0'; | ||
311 | - // os_version = '10.3'; | ||
312 | - // screen_size = '320x568'; | ||
313 | - // let uid = '0'; | ||
314 | - // let udid = 'acea1c6170ecca417c67979a406156950bcf4fe5'; | ||
315 | - // let physical_channel = 1; | ||
316 | - | ||
317 | - | ||
318 | return { | 318 | return { |
319 | app_version, | 319 | app_version, |
320 | os_version, | 320 | os_version, |
@@ -402,12 +402,10 @@ export const GET = request('GET'); | @@ -402,12 +402,10 @@ export const GET = request('GET'); | ||
402 | export const POST = request('POST'); | 402 | export const POST = request('POST'); |
403 | export const PUT = request('PUT'); | 403 | export const PUT = request('PUT'); |
404 | export const DELETE = request('DELETE'); | 404 | export const DELETE = request('DELETE'); |
405 | -export const UPLOAD_LOG = uploadLogData('POST') | ||
406 | -export const APP_REPORT = appReport('POST') | 405 | +export const UPLOAD_LOG = uploadLogData('POST'); |
407 | 406 | ||
408 | module.exports = { | 407 | module.exports = { |
409 | sign_body, | 408 | sign_body, |
410 | - APP_REPORT, | ||
411 | UPLOAD_LOG, | 409 | UPLOAD_LOG, |
412 | GET, | 410 | GET, |
413 | POST, | 411 | POST, |
@@ -25,6 +25,6 @@ | @@ -25,6 +25,6 @@ | ||
25 | </view> | 25 | </view> |
26 | <view class="product_price">原价:<text class="line">{{product.price}}</text></view> | 26 | <view class="product_price">原价:<text class="line">{{product.price}}</text></view> |
27 | </view> | 27 | </view> |
28 | -<view wx:if="{{product.status !== 2}}" class="product_time">{{helper.formatTime(product.start_time, | 28 | +<view wx:if="{{product.status !== 2 && product.start_time}}" class="product_time">{{helper.formatTime(product.start_time, |
29 | product.end_time)}} | 29 | product.end_time)}} |
30 | </view> | 30 | </view> |
@@ -62,7 +62,6 @@ Page(Object.assign({ | @@ -62,7 +62,6 @@ Page(Object.assign({ | ||
62 | */ | 62 | */ |
63 | data: { | 63 | data: { |
64 | tabIdx: '', | 64 | tabIdx: '', |
65 | - show: false, | ||
66 | showAuth: false, | 65 | showAuth: false, |
67 | actPrizeId: '', | 66 | actPrizeId: '', |
68 | shareUid: 0, | 67 | shareUid: 0, |
@@ -189,7 +188,7 @@ Page(Object.assign({ | @@ -189,7 +188,7 @@ Page(Object.assign({ | ||
189 | * 生命周期函数--监听页面隐藏 | 188 | * 生命周期函数--监听页面隐藏 |
190 | */ | 189 | */ |
191 | onHide: function () { | 190 | onHide: function () { |
192 | - | 191 | + wx.hideLoading(); |
193 | }, | 192 | }, |
194 | 193 | ||
195 | /** | 194 | /** |
@@ -330,6 +329,7 @@ Page(Object.assign({ | @@ -330,6 +329,7 @@ Page(Object.assign({ | ||
330 | this.service.getRecommend(params), | 329 | this.service.getRecommend(params), |
331 | this.service.getRecentAvatars(params) | 330 | this.service.getRecentAvatars(params) |
332 | ]).then(([r1, r2, r3]) => { | 331 | ]).then(([r1, r2, r3]) => { |
332 | + wx.hideLoading(); | ||
333 | if (r1.code === 200 && r1.data) { | 333 | if (r1.code === 200 && r1.data) { |
334 | let product = r1.data; | 334 | let product = r1.data; |
335 | 335 | ||
@@ -358,7 +358,6 @@ Page(Object.assign({ | @@ -358,7 +358,6 @@ Page(Object.assign({ | ||
358 | 358 | ||
359 | myPrizeCount: r1.code === 200 ? r1.data.myCodeNum : 0, | 359 | myPrizeCount: r1.code === 200 ? r1.data.myCodeNum : 0, |
360 | participantCount, | 360 | participantCount, |
361 | - show: true, | ||
362 | snapData, | 361 | snapData, |
363 | notice: JSON.parse(product.notice || '{}'), | 362 | notice: JSON.parse(product.notice || '{}'), |
364 | lottery: JSON.parse(product.lottery_info || '{}') | 363 | lottery: JSON.parse(product.lottery_info || '{}') |
@@ -366,13 +365,12 @@ Page(Object.assign({ | @@ -366,13 +365,12 @@ Page(Object.assign({ | ||
366 | 365 | ||
367 | this._setActionStatus(); | 366 | this._setActionStatus(); |
368 | this._setStep(); | 367 | this._setStep(); |
369 | - wx.hideLoading(); | ||
370 | } else { | 368 | } else { |
371 | return Promise.reject(); | 369 | return Promise.reject(); |
372 | } | 370 | } |
373 | }).catch((e) => { | 371 | }).catch((e) => { |
374 | - console.error(e); | ||
375 | wx.hideLoading(); | 372 | wx.hideLoading(); |
373 | + console.error(e); | ||
376 | }); | 374 | }); |
377 | }, | 375 | }, |
378 | 376 |
1 | -<block wx:if="{{show}}"> | ||
2 | - | ||
3 | - <view class="header {{shareFlag || 'mt-header'}}" > | 1 | +<view class="header {{shareFlag || 'mt-header'}}"> |
4 | 2 | ||
5 | <product-header product="{{product}}" shareFlag="{{shareFlag}}" avatars="{{avatars}}"></product-header> | 3 | <product-header product="{{product}}" shareFlag="{{shareFlag}}" avatars="{{avatars}}"></product-header> |
6 | - </view> | ||
7 | - <block wx:if="{{false}}"> | 4 | +</view> |
5 | +<block wx:if="{{false}}"> | ||
8 | <counter count="{{participantCount}}" num="{{product.limit}}" status="{{product.status}}"></counter> | 6 | <counter count="{{participantCount}}" num="{{product.limit}}" status="{{product.status}}"></counter> |
9 | <prize-progress step="{{step}}"></prize-progress> | 7 | <prize-progress step="{{step}}"></prize-progress> |
10 | - </block> | ||
11 | - <view class="machine {{shareFlag ? 'machine-t-m' : 'machine-t-l'}}"> | 8 | +</block> |
9 | +<view class="machine {{shareFlag ? 'machine-t-m' : 'machine-t-l'}}"> | ||
12 | <view class="open-shadow"></view> | 10 | <view class="open-shadow"></view> |
13 | <view class="code-list" animation="{{animation}}"> | 11 | <view class="code-list" animation="{{animation}}"> |
14 | <view class="code-list-item-container"> | 12 | <view class="code-list-item-container"> |
15 | - <view class="code-list-item"><view class="content"></view></view> | 13 | + <view class="code-list-item"> |
14 | + <view class="content"></view> | ||
15 | + </view> | ||
16 | <view class="code-list-item" wx:for="{{codeList}}" wx:if="{{index < 3}}" wx:key="{{index}}"> | 16 | <view class="code-list-item" wx:for="{{codeList}}" wx:if="{{index < 3}}" wx:key="{{index}}"> |
17 | <view class="content"> | 17 | <view class="content"> |
18 | <image class="thumb" mode="widthFix" src="{{item.user_thumb}}"></image> | 18 | <image class="thumb" mode="widthFix" src="{{item.user_thumb}}"></image> |
@@ -22,34 +22,37 @@ | @@ -22,34 +22,37 @@ | ||
22 | </view> | 22 | </view> |
23 | <view class="my-code">{{item.prize_code}}</view> | 23 | <view class="my-code">{{item.prize_code}}</view> |
24 | </view> | 24 | </view> |
25 | - <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> | ||
26 | - </view> | ||
27 | - <image src="./images/down.png" bindtap="goList" data-index="3" mode="widthFix" class="down" wx:if="{{codeList.length>3}}"></image> | 25 | + <image class="shadow" |
26 | + src="https://img11.static.yhbimg.com/yhb-img01/2018/12/27/19/0140fa3243af949068d2aabeedb0ea0666.png" | ||
27 | + mode="widthFix" wx:if="{{index == 2 && codeList.length>3 }}"></image> | ||
28 | </view> | 28 | </view> |
29 | + <image src="./images/down.png" bindtap="goList" data-index="3" mode="widthFix" class="down" | ||
30 | + wx:if="{{codeList.length>3}}"></image> | ||
29 | </view> | 31 | </view> |
30 | </view> | 32 | </view> |
31 | - <view class="help"> | 33 | +</view> |
34 | +<view class="help"> | ||
32 | <help></help> | 35 | <help></help> |
33 | - </view> | ||
34 | - <desc list="{{product.content}}" bind:tapUrl="_jumpBanner" bannerSrc="{{bannerSrc}}" bannerUrl="{{bannerUrl}}"></desc> | 36 | +</view> |
37 | +<desc list="{{product.content}}" bind:tapUrl="_jumpBanner" bannerSrc="{{bannerSrc}}" bannerUrl="{{bannerUrl}}"></desc> | ||
35 | 38 | ||
36 | - <view class="line"></view> | 39 | +<view class="line"></view> |
37 | 40 | ||
38 | - <more wx:if="{{recommends.length > 0}}"> | 41 | +<more wx:if="{{recommends.length > 0}}"> |
39 | <block wx:for="{{recommends}}" wx:key="{{index}}"> | 42 | <block wx:for="{{recommends}}" wx:key="{{index}}"> |
40 | <view class="product-item"> | 43 | <view class="product-item"> |
41 | <product-item product="{{item}}" tab-idx="{{tabIdx - 1}}"></product-item> | 44 | <product-item product="{{item}}" tab-idx="{{tabIdx - 1}}"></product-item> |
42 | </view> | 45 | </view> |
43 | </block> | 46 | </block> |
44 | - </more> | 47 | +</more> |
45 | 48 | ||
46 | - <view class="fellow-bar" wx:if="{{product.status && !shareFlag}}"> | 49 | +<view class="fellow-bar" wx:if="{{product.status && !shareFlag}}"> |
47 | <fellow-bar notice="{{notice}}"></fellow-bar> | 50 | <fellow-bar notice="{{notice}}"></fellow-bar> |
48 | - </view> | ||
49 | - <group-recommend groupRecommendList="{{groupList}}" bindgoToGroupMiniApp="goToGroupMiniApp"> | ||
50 | - </group-recommend> | 51 | +</view> |
52 | +<group-recommend groupRecommendList="{{groupList}}" bindgoToGroupMiniApp="goToGroupMiniApp"> | ||
53 | +</group-recommend> | ||
51 | 54 | ||
52 | - <view class="action-bar"> | 55 | +<view class="action-bar"> |
53 | <action-bar wx:if="{{isLogin}}" status="{{actionStatus}}" num="{{myPrizeCount}}" share-uid="{{shareUid}}" | 56 | <action-bar wx:if="{{isLogin}}" status="{{actionStatus}}" num="{{myPrizeCount}}" share-uid="{{shareUid}}" |
54 | act-prize-id="{{actPrizeId}}" bindgetcode="changeActionStatus" bindshare="share" | 57 | act-prize-id="{{actPrizeId}}" bindgetcode="changeActionStatus" bindshare="share" |
55 | copyText="{{lottery.miniappCopy}}" text="{{lottery.miniappTip}}" | 58 | copyText="{{lottery.miniappCopy}}" text="{{lottery.miniappTip}}" |
@@ -71,10 +74,8 @@ | @@ -71,10 +74,8 @@ | ||
71 | </block> | 74 | </block> |
72 | </view> | 75 | </view> |
73 | </block> | 76 | </block> |
74 | - </view> | ||
75 | - <view class="foot"></view> | ||
76 | - | ||
77 | -</block> | 77 | +</view> |
78 | +<view class="foot"></view> | ||
78 | 79 | ||
79 | <import src="../../vendors/zanui/actionsheet/index.wxml"/> | 80 | <import src="../../vendors/zanui/actionsheet/index.wxml"/> |
80 | <template is="zan-actionsheet" data="{{...actionsheet}}"/> | 81 | <template is="zan-actionsheet" data="{{...actionsheet}}"/> |
pages/zeroSell/error.js
0 → 100644
1 | +const event = global.event; | ||
2 | +Page({ | ||
3 | + data: { | ||
4 | + | ||
5 | + }, | ||
6 | + onShow: function () { | ||
7 | + | ||
8 | + }, | ||
9 | + onUnload:function(){ | ||
10 | + wx.removeStorageSync('errorFlag'); | ||
11 | + event.once('errorPage', function(fun){ fun && fun()}); | ||
12 | + }, | ||
13 | + back: function () { | ||
14 | + wx.navigateBack({ | ||
15 | + delta: 1, | ||
16 | + success:()=>{ | ||
17 | + wx.removeStorageSync('errorFlag') | ||
18 | + } | ||
19 | + }) | ||
20 | + } | ||
21 | +}) |
pages/zeroSell/error.json
0 → 100644
pages/zeroSell/error.wxml
0 → 100644
pages/zeroSell/error.wxss
0 → 100644
1 | +.offline-box { | ||
2 | + font-size: 32rpx; | ||
3 | + width: 100%; | ||
4 | + position: fixed; | ||
5 | + top: 50%; | ||
6 | + text-align: center; | ||
7 | + transform: translateY(-50%); | ||
8 | +} | ||
9 | + | ||
10 | +.offline-bg { | ||
11 | + height: 280rpx; | ||
12 | + width: 280rpx; | ||
13 | +} | ||
14 | + | ||
15 | +.slogan { | ||
16 | + margin-top: 80rpx; | ||
17 | +} | ||
18 | + | ||
19 | +.refresh { | ||
20 | + margin-left: 50%; | ||
21 | + transform: translate(-50%); | ||
22 | + width: 240rpx; | ||
23 | + margin-top: 40rpx; | ||
24 | + padding: 20rpx; | ||
25 | + border-radius: 4rpx; | ||
26 | + background-color: #444; | ||
27 | + color: #fff; | ||
28 | +} |
@@ -34,7 +34,7 @@ Page(Object.assign({ | @@ -34,7 +34,7 @@ Page(Object.assign({ | ||
34 | }, { | 34 | }, { |
35 | page: 1, | 35 | page: 1, |
36 | products: [] | 36 | products: [] |
37 | - },{ | 37 | + }, { |
38 | page: 1, | 38 | page: 1, |
39 | products: [] | 39 | products: [] |
40 | }], | 40 | }], |
@@ -105,8 +105,9 @@ Page(Object.assign({ | @@ -105,8 +105,9 @@ Page(Object.assign({ | ||
105 | } else { | 105 | } else { |
106 | this._init(); | 106 | this._init(); |
107 | } | 107 | } |
108 | + | ||
108 | new app.WeToast(); | 109 | new app.WeToast(); |
109 | - if(options && (Number(options.reload) !== 0)) { | 110 | + if (options && (Number(options.reload) !== 0)) { |
110 | this._getResouceCode() | 111 | this._getResouceCode() |
111 | } | 112 | } |
112 | this._getBottomBanner(); | 113 | this._getBottomBanner(); |
@@ -115,6 +116,8 @@ Page(Object.assign({ | @@ -115,6 +116,8 @@ Page(Object.assign({ | ||
115 | 116 | ||
116 | onShow() { | 117 | onShow() { |
117 | let uid = app.globalData.userInfo.uid > 0 ? app.globalData.userInfo.uid : 0; | 118 | let uid = app.globalData.userInfo.uid > 0 ? app.globalData.userInfo.uid : 0; |
119 | + event.emit('errorPage',this._refresh.bind(this)); | ||
120 | + | ||
118 | 121 | ||
119 | this.setData({ | 122 | this.setData({ |
120 | hasUnionID: app.globalData.WXUnion_ID !== null && app.globalData.WXUnion_ID !== '' && app.globalData.WXUnion_ID !== undefined ? true : false, | 123 | hasUnionID: app.globalData.WXUnion_ID !== null && app.globalData.WXUnion_ID !== '' && app.globalData.WXUnion_ID !== undefined ? true : false, |
@@ -309,7 +312,7 @@ Page(Object.assign({ | @@ -309,7 +312,7 @@ Page(Object.assign({ | ||
309 | let oldData = my_zero_list[type].data; | 312 | let oldData = my_zero_list[type].data; |
310 | let key = `my_zero_list[${type}].data`; | 313 | let key = `my_zero_list[${type}].data`; |
311 | let keyPage = `my_zero_list[${type}].page`; | 314 | let keyPage = `my_zero_list[${type}].page`; |
312 | - this.service.getMyList({ type, page }).then(res => { | 315 | + this.service.getMyList({type, page}).then(res => { |
313 | let data = [] | 316 | let data = [] |
314 | if (res && res.code === 200) { | 317 | if (res && res.code === 200) { |
315 | data = res.data; | 318 | data = res.data; |
@@ -347,10 +350,10 @@ Page(Object.assign({ | @@ -347,10 +350,10 @@ Page(Object.assign({ | ||
347 | this._init(); | 350 | this._init(); |
348 | }, | 351 | }, |
349 | 352 | ||
350 | - getUserInfo: function(e) { | 353 | + getUserInfo: function (e) { |
351 | var that = this; | 354 | var that = this; |
352 | if (e.detail.errMsg === 'getUserInfo:ok') { | 355 | if (e.detail.errMsg === 'getUserInfo:ok') { |
353 | - decodeUnionId(app.getWechatThirdSession(), e, function(response) { | 356 | + decodeUnionId(app.getWechatThirdSession(), e, function (response) { |
354 | if (response.isHaveUnionID) { | 357 | if (response.isHaveUnionID) { |
355 | that.setData({ | 358 | that.setData({ |
356 | hasUnionID: true, | 359 | hasUnionID: true, |
@@ -358,27 +361,28 @@ Page(Object.assign({ | @@ -358,27 +361,28 @@ Page(Object.assign({ | ||
358 | } | 361 | } |
359 | }); | 362 | }); |
360 | } else { | 363 | } else { |
361 | - openAuthorizeSettings(function(response) { | 364 | + openAuthorizeSettings(function (response) { |
362 | if (response.isHaveUnionID) { | 365 | if (response.isHaveUnionID) { |
363 | that.setData({ | 366 | that.setData({ |
364 | hasUnionID: true, | 367 | hasUnionID: true, |
365 | }) | 368 | }) |
366 | - }; | 369 | + } |
370 | + ; | ||
367 | }); | 371 | }); |
368 | } | 372 | } |
369 | }, | 373 | }, |
370 | 374 | ||
371 | - getPhoneNumber: function(e) { | 375 | + getPhoneNumber: function (e) { |
372 | var that = this; | 376 | var that = this; |
373 | if (e.detail.errMsg === 'getPhoneNumber:ok') { | 377 | if (e.detail.errMsg === 'getPhoneNumber:ok') { |
374 | - decodePhoneNumber(e.detail.iv, e.detail.encryptedData, '', function(result) { | 378 | + decodePhoneNumber(e.detail.iv, e.detail.encryptedData, '', function (result) { |
375 | // console.log('!!!!result',result) | 379 | // console.log('!!!!result',result) |
376 | if (result.code != 200) { | 380 | if (result.code != 200) { |
377 | that.wetoast.toast({ | 381 | that.wetoast.toast({ |
378 | title: result.message, | 382 | title: result.message, |
379 | titleClassName: 'wetoast-title', | 383 | titleClassName: 'wetoast-title', |
380 | duration: 1000, | 384 | duration: 1000, |
381 | - success: function() { | 385 | + success: function () { |
382 | that.loginAndRegisterTapped() | 386 | that.loginAndRegisterTapped() |
383 | }.bind(that) | 387 | }.bind(that) |
384 | }); | 388 | }); |
@@ -386,7 +390,7 @@ Page(Object.assign({ | @@ -386,7 +390,7 @@ Page(Object.assign({ | ||
386 | if (result.is_register) { | 390 | if (result.is_register) { |
387 | that.showZanToast({ | 391 | that.showZanToast({ |
388 | title: '欢迎加入Yoho!Family!新人礼包已发放到个人中心-优惠券,请注意查收', | 392 | title: '欢迎加入Yoho!Family!新人礼包已发放到个人中心-优惠券,请注意查收', |
389 | - success: function() { | 393 | + success: function () { |
390 | let uid = app.globalData.userInfo.uid > 0 ? app.globalData.userInfo.uid : 0; | 394 | let uid = app.globalData.userInfo.uid > 0 ? app.globalData.userInfo.uid : 0; |
391 | that.setData({ | 395 | that.setData({ |
392 | uid, | 396 | uid, |
@@ -427,13 +431,13 @@ Page(Object.assign({ | @@ -427,13 +431,13 @@ Page(Object.assign({ | ||
427 | content: '检测到您未打开微信用户信息授权,开启后即可进行登录', | 431 | content: '检测到您未打开微信用户信息授权,开启后即可进行登录', |
428 | confirmText: "去开启", | 432 | confirmText: "去开启", |
429 | confirmColor: "#000000", | 433 | confirmColor: "#000000", |
430 | - success: function(res) { | 434 | + success: function (res) { |
431 | if (res.confirm) { | 435 | if (res.confirm) { |
432 | wx.openSetting({ | 436 | wx.openSetting({ |
433 | success: (res) => { | 437 | success: (res) => { |
434 | // console.log(res.authSetting["scope.userInfo"]) | 438 | // console.log(res.authSetting["scope.userInfo"]) |
435 | if (res.authSetting["scope.userInfo"] !== null && res.authSetting["scope.userInfo"] !== undefined && res.authSetting["scope.userInfo"] === true) { | 439 | if (res.authSetting["scope.userInfo"] !== null && res.authSetting["scope.userInfo"] !== undefined && res.authSetting["scope.userInfo"] === true) { |
436 | - getUnionID(app.getWechatThirdSession(), function(response) { | 440 | + getUnionID(app.getWechatThirdSession(), function (response) { |
437 | // console.log(response) | 441 | // console.log(response) |
438 | }) | 442 | }) |
439 | } | 443 | } |
@@ -485,7 +489,7 @@ Page(Object.assign({ | @@ -485,7 +489,7 @@ Page(Object.assign({ | ||
485 | }, | 489 | }, |
486 | 490 | ||
487 | loginChangeStatus(params) { | 491 | loginChangeStatus(params) { |
488 | - let { openType } = params; | 492 | + let {openType} = params; |
489 | this.setData({ | 493 | this.setData({ |
490 | openType | 494 | openType |
491 | }) | 495 | }) |
@@ -513,20 +517,20 @@ Page(Object.assign({ | @@ -513,20 +517,20 @@ Page(Object.assign({ | ||
513 | }); | 517 | }); |
514 | }, | 518 | }, |
515 | 519 | ||
516 | - share({ detail }) { | 520 | + share({detail}) { |
517 | this.setData({ | 521 | this.setData({ |
518 | 'actionsheet.show': true, | 522 | 'actionsheet.show': true, |
519 | 'shareProduct': detail | 523 | 'shareProduct': detail |
520 | }) | 524 | }) |
521 | }, | 525 | }, |
522 | 526 | ||
523 | - handleZanActionsheetCancel({ componentId }) { | 527 | + handleZanActionsheetCancel({componentId}) { |
524 | this.setData({ | 528 | this.setData({ |
525 | 'actionsheet.show': false | 529 | 'actionsheet.show': false |
526 | }) | 530 | }) |
527 | }, | 531 | }, |
528 | 532 | ||
529 | - handleZanActionsheetClick({ componentId, index }) { | 533 | + handleZanActionsheetClick({componentId, index}) { |
530 | this.setData({ | 534 | this.setData({ |
531 | 'actionsheet.show': false | 535 | 'actionsheet.show': false |
532 | }); | 536 | }); |
@@ -545,7 +549,8 @@ Page(Object.assign({ | @@ -545,7 +549,8 @@ Page(Object.assign({ | ||
545 | product_qrCode: qrcode | 549 | product_qrCode: qrcode |
546 | }); | 550 | }); |
547 | } | 551 | } |
548 | - }; | 552 | + } |
553 | + ; | ||
549 | }, | 554 | }, |
550 | onShareAppMessage(res) { | 555 | onShareAppMessage(res) { |
551 | let params = { | 556 | let params = { |
-
Please register or login to post a comment