Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mini-program-wepy
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
mini-program-wepy
Commits
0634c638
Commit
0634c638
authored
May 28, 2020
by
ziyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
返回页面调用接口
parent
6a36d7dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
28 deletions
+9
-28
index.wpy
src/pages/index.wpy
+9
-28
No files found.
src/pages/index.wpy
View file @
0634c638
...
...
@@ -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>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment