...
|
...
|
@@ -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 = {
|
...
|
...
|
|