MrShi
2023-10-17 3452e25c5312f986cdfe2431c67ca5358c4ffc61
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
<template>
    <view class="box">
        <u-loading-page :loading="true"></u-loading-page>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                
            };
        },
        onLoad() {
            var that = this;
            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)
                        uni.reLaunch({ url: '/pages/index/index' });
                    }
                }
            });
        }
    }
</script>
 
<style lang="scss" scoped>
    .box {
        width: 100vw;
        height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
    }
</style>