chenyc
2025-08-26 bbb63ca88862e4639e1e8cc866f098efb1155e1b
gx登录初始化
2个文件已修改
10 ■■■■ 已修改文件
src/views/HomeLoading/index.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/login/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/HomeLoading/index.vue
@@ -41,9 +41,9 @@
        })
    }
    onMounted(() => {
        alert('请在微信中打开本小程序')
        // alert('请在微信中打开本小程序')
        const token=Session.get('token')
        alert('token='+token)
        // alert('token='+token)
        if (token && userInfo.info.openid!==''){
            console.log('已经登录了')
            getUserinfo()
@@ -53,7 +53,7 @@
        const queryInfo=route.query
        const {code}=queryInfo
        console.log(code)
        alert('code='+code)
        // alert('code='+code)
        if (code){// 得到code换取openid
            ajaxGet('wechat/code',{code}).then((re)=>{
                console.log(re,'获取openid')
@@ -75,7 +75,7 @@
            })
        }
        else { // 没有code 就重新进入微信url获取code
            alert('没有code,重新进入微信授权')
            // alert('没有code,重新进入微信授权')
            const appid = 'wx790bd67db6206070' // 微信APPid
            const local = window.location.href
            window.location.href =
src/views/login/index.vue
@@ -132,7 +132,7 @@
        // Session.remove('token')
        // 判断是否有token 和userinfo
        const token=Session.get('token')
        alert(token)
        // alert(token)
        if (token && userInfo.info.openid!==''){
            console.log('已经登录了')
            getUserinfo()