forked from SloppyJack/SimpleRecord_UniApp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.vue
48 lines (46 loc) · 1.09 KB
/
App.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<script>
import {mapMutations} from 'vuex'
export default {
methods:{
...mapMutations(['login']),
},
onLaunch: function() {
console.log('App Launch');
let userInfo = uni.getStorageSync("userInfo");
if(userInfo.openId) {
// 如果本地有存储的用户信息
this.$u.api.wxLogin({
openId : userInfo.openId,
username: userInfo.name,
nickname: userInfo.nike,
sex: userInfo.sex,
avatar: userInfo.avatarUrl
}).then(res => {
this.login(res);
this.$isResolve();
}).catch(e => {
console.log('login error');
this.$isResolve();
});
}else {
// tips:微信审核不通过,取消强制登录
// 立即跳转到登录页面
// uni.redirectTo({
// url: '/pages/login/index'
// });
this.$isResolve();
}
},
onShow: function() {
console.log('App Show');
},
onHide: function() {
console.log('App Hide');
}
};
</script>
<style lang="scss">
/* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
@import "uview-ui/index.scss";
@import "./static/css/iconfont.css";
</style>