Authored by htoooth

fix

... ... @@ -27,28 +27,6 @@ Page({
isBound: false,
myQrCodeUrl: 'https://m.yohobuy.com/home/newQrcode?needLogin=1',
loginText: '点击登录',
test_uid: [
349709, // 测试用
500030924,
500030922,
500030918,
500030916,
500030914,
500030912,
500030910,
500030908,
500030906,
500030904,
500030890,
500030888,
500030886,
500030884,
500030876,
500030830,
500030694,
500030690,
500030688
],
now_test_uid_index: 1,
containerHeight: '1006rpx',
h5PageUrl: [
... ... @@ -61,11 +39,30 @@ Page({
codes: [],
invalidCodes: []
},
isShow: 0
isShow: 0,
referer: '',
needBind: 1,
},
onLoad: function() {
onLoad: function(options) {
let that = this;
if (options.referer) {
console.log('referer:', options.referer);
let referer = decodeURIComponent(options.referer);
if (referer.indexOf('/') !== 0) {
referer = '/' + referer;
}
this.setData({
referer: referer
});
}
if (options.login !== undefined) {
this.setData({
needBind: (options.login === '0' || !options.login) ? 0 : true
});
}
yas = new Yas(app); // 实例化埋点
yas.pageOpenReport();
event.on('user-login-success', this.showBindUserInfo);
... ... @@ -95,6 +92,7 @@ Page({
this.setData({
loginButtonType: getLoginButtonType()
});
this.goReferer(); // 如果不需要绑定手机则返回前一页
},
showBindUserInfo: function() {
let that = this;
... ... @@ -133,6 +131,8 @@ Page({
});
that.setLimitCodeList(res[2]);
that.goBack(); // 如果有referer则返回前一个页面
}).catch({});
}
},
... ... @@ -206,5 +206,20 @@ Page({
},
navigateToLimitListPage: function() {
router.go('home');
},
navigateToDetail: function(e) {
let limitProductCode = e.currentTarget.dataset.code;
router.go('productDetail', { limitProductCode });
},
goReferer: function() { // 无需绑定的获取用户信息后返回
if (this.data.referer && !this.data.needBind) {
router.goUrl(`${config.MINI_APP_DOMAIN}${this.data.referer}`);
}
},
goBack: function() {
if (this.data.referer) {
router.goUrl(`${config.MINI_APP_DOMAIN}${this.data.referer}`);
}
}
});
... ...
... ... @@ -45,7 +45,7 @@
<block wx:else>
<block wx:for='{{limitCodes.codes}}' wx:key='item.limitCode'>
<view class='limit-code-item'>
<view class='item-container'>
<view class='item-container' data-code="{{item.limitProductCode}}" bindtap='navigateToDetail'>
<view class='item-head'>
<image src='../../static/images/limit/lock_s.png'></image>
<text>限购码:{{item.limitCode}}</text>
... ... @@ -77,8 +77,8 @@
<view class='gray-space'></view>
</block>
<block wx:for='{{limitCodes.invalidCodes}}' wx:key='item.limitCode'>
<view class='limit-code-item' data->
<view class='item-container'>
<view class='limit-code-item'>
<view class='item-container' data-code="{{item.limitProductCode}}" bindtap='navigateToDetail'>
<view class='item-head'>
<image src='../../static/images/limit/lock_s.png'></image>
<text>限购码:{{item.limitCode}}</text>
... ...
... ... @@ -141,7 +141,13 @@ Page({
let id = e.currentTarget.dataset.id;
let limitProductCode = e.currentTarget.dataset.code;
router.go('productDetail', {limitProductCode});
if (app.getUid() && app.getUserInfo().wechat) {
router.go('productDetail', { limitProductCode });
} else {
let referer = getCurrentPages()[0].route;
router.go('userCenter', { referer });
}
},
navigateToHome: function(e) { // 跳转到我的限购码
router.go('userCenter');
... ...