jiangping
2023-12-29 f9691d544e62d6c04dbfe45d05a6c7bc5e004291
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
<script>
    import { mapState } from 'vuex'
    export default {
        computed: {
            ...mapState(['userInfo'])
        },
        onLaunch: function() {
            var that = this;
            if (JSON.stringify(this.userInfo) == '{}') {
                uni.login({
                    provider: 'weixin',
                    success: async function (loginRes) {
                        let { code } = loginRes;
                        let res = await that.$u.api.wxLogin({ code })
                        if (res.code === 200) {
                            that.$store.commit('setToken', res.data.token)
                            that.$store.commit('setUserInfo', res.data.userResponse)
                            console.log('1')
                            that.$isResolve()
                        }
                    }
                });
            }
        },
        onShow: function() {
            console.log('App Show')
        },
        onHide: function() {
            console.log('App Hide')
        }
    }
</script>
 
<style lang="scss">
    @import "uview-ui/index.scss";
    @import "static/css/lib.css";
</style>