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
2e9a8227
Commit
2e9a8227
authored
May 28, 2020
by
付清曌
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/change' into 'master'
Feature/change See merge request
!23
parents
6a36d7dc
83a52c3d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
53 deletions
+9
-53
app.wpy
src/app.wpy
+0
-20
index.wpy
src/pages/index.wpy
+9
-33
No files found.
src/app.wpy
View file @
2e9a8227
...
@@ -32,27 +32,7 @@ wepy.app({
...
@@ -32,27 +32,7 @@ wepy.app({
}
}
});
});
wx.setStorageSync('onNetworkStatusChange', true);
wx.setStorageSync('onNetworkStatusChange', true);
// wx.checkSession({
// success () {
// console.log('已登录');
// // session_key 未过期,并且在本生命周期一直有效
// },
// fail () {
// // session_key 已经失效,需要重新执行登录流程
// wx.login({
// success (res) {
// if (res.code) {
// // 发起网络请求,告诉后端
// wx.setStorageSync('wxCode', res.code);
// } else {
// console.log('登录失败!' + res.errMsg);
// }
// }
// });
// }
// });
wx.onNetworkStatusChange((res) => {
wx.onNetworkStatusChange((res) => {
console.log('onNetworkStatusChange', res.isConnected);
wx.setStorageSync('onNetworkStatusChange', res.isConnected);
wx.setStorageSync('onNetworkStatusChange', res.isConnected);
});
});
},
},
...
...
src/pages/index.wpy
View file @
2e9a8227
...
@@ -351,7 +351,7 @@
...
@@ -351,7 +351,7 @@
// 有效值 develop(开发版),trial(体验版),release(正式版)
// 有效值 develop(开发版),trial(体验版),release(正式版)
envVersion: 'release',
envVersion: 'release',
success(res) {
success(res) {
console.log('跳转成功');
//
console.log('跳转成功');
}
}
});
});
/* wx.navigateTo({
/* wx.navigateTo({
...
@@ -476,7 +476,6 @@
...
@@ -476,7 +476,6 @@
innerAudioContext.autoplay = true;
innerAudioContext.autoplay = true;
innerAudioContext.src = '/static/audio/supermarie.mp3';
innerAudioContext.src = '/static/audio/supermarie.mp3';
innerAudioContext.onPlay(() => {
innerAudioContext.onPlay(() => {
console.log('开始播放');
});
});
innerAudioContext.onError((res) => {
innerAudioContext.onError((res) => {
console.log(res.errMsg);
console.log(res.errMsg);
...
@@ -509,7 +508,6 @@
...
@@ -509,7 +508,6 @@
let shareId = res.shareTickets[0];
let shareId = res.shareTickets[0];
console.log('shareId', shareId);
console.log('shareId', shareId);
// 转发成功
// 转发成功
console.log(res);
},
},
fail: function(res) {
fail: function(res) {
// 转发失败
// 转发失败
...
@@ -573,35 +571,20 @@
...
@@ -573,35 +571,20 @@
if (options.openid) {
if (options.openid) {
this.inviter = options.openid;
this.inviter = options.openid;
}
}
let statusHeight = this.$app.$options.globalData.statusBarHeight || '';
wx.setStorageSync('openId', false);
statusHeight && (this.userImgStyle = 'top:' + statusHeight + 'px');
},
async onShow() {
if (!wx.getStorageSync('openId')) {
if (!wx.getStorageSync('openId')) {
const { code } = await wepy.wx.login();
const { code } = await wepy.wx.login();
const userInfo = await login(code);
const userInfo = await login(code);
wx.setStorageSync('openId', userInfo.openid);
wx.setStorageSync('openId', userInfo.openid);
wx.setStorageSync('isRegister', userInfo.register);
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) {
if (store.state.userInfo) {
this.userInfo = store.state.userInfo;
this.userInfo = store.state.userInfo;
this.registUser(this.userInfo);
} else {
} 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();
const setting = await wepy.wx.getSetting();
if (setting.authSetting['scope.userInfo']) {
if (setting.authSetting['scope.userInfo']) {
const { userInfo } = await wepy.wx.getUserInfo();
const { userInfo } = await wepy.wx.getUserInfo();
...
@@ -610,13 +593,10 @@
...
@@ -610,13 +593,10 @@
} else {
} else {
this.authmodal = true;
this.authmodal = true;
}
}
} else {
this.registUser(this.userInfo);
}
}
},
await this.getMainInfo();
onShow() {
this.videoList = await getPrizeList();
// 从其他小程序回来可以在当前生命周期检测到,但是这个方法,自己的小程序页面返回也会进入
this.adlist = await getActivityFeed({ count: 50 });
// console.log('页面show!!');
}
}
});
});
</script>
</script>
...
@@ -639,9 +619,5 @@
...
@@ -639,9 +619,5 @@
'video-loading': '~@/components/custom/loading'
'video-loading': '~@/components/custom/loading'
},
},
navigationStyle: "custom",
navigationStyle: "custom",
"navigateToMiniProgramAppIdList":[
"wx91d27dbf599dff74"
],
}
}
</config>
</config>
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