Commit 0634c638 authored by ziyu's avatar ziyu

返回页面调用接口

parent 6a36d7dc
......@@ -351,7 +351,7 @@
// 有效值 develop(开发版),trial(体验版),release(正式版)
envVersion: 'release',
success(res) {
console.log('跳转成功');
// console.log('跳转成功');
}
});
/* wx.navigateTo({
......@@ -509,7 +509,6 @@
let shareId = res.shareTickets[0];
console.log('shareId', shareId);
// 转发成功
console.log(res);
},
fail: function(res) {
// 转发失败
......@@ -573,35 +572,20 @@
if (options.openid) {
this.inviter = options.openid;
}
wx.setStorageSync('openId', false);
let statusHeight = this.$app.$options.globalData.statusBarHeight || '';
statusHeight && (this.userImgStyle = 'top:' + statusHeight + 'px');
},
async onShow() {
if (!wx.getStorageSync('openId')) {
const { code } = await wepy.wx.login();
const userInfo = await login(code);
wx.setStorageSync('openId', userInfo.openid);
wx.setStorageSync('isRegister', userInfo.register);
}
let self = this;
let statusHeight = this.$app.$options.globalData.statusBarHeight || '';
statusHeight && (this.userImgStyle = 'top:' + statusHeight + 'px');
if (store.state.userInfo) {
this.userInfo = store.state.userInfo;
this.registUser(this.userInfo);
} else {
wx.getUserInfo({
success (res) {
self.userInfo = res.userInfo;
store.dispatch('setUserInfo', res.userInfo);
}
});
}
await this.getMainInfo();
this.videoList = await getPrizeList();
this.adlist = await getActivityFeed({ count: 50 });
// 如果已经存在store里就不用再获取用户信息了
if (!this.userInfo) {
const setting = await wepy.wx.getSetting();
if (setting.authSetting['scope.userInfo']) {
const { userInfo } = await wepy.wx.getUserInfo();
......@@ -610,13 +594,10 @@
} else {
this.authmodal = true;
}
} else {
this.registUser(this.userInfo);
}
},
onShow() {
// 从其他小程序回来可以在当前生命周期检测到,但是这个方法,自己的小程序页面返回也会进入
// console.log('页面show!!');
await this.getMainInfo();
this.videoList = await getPrizeList();
this.adlist = await getActivityFeed({ count: 50 });
}
});
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment