45
chenyc
2022-10-21 dc336b246060ce15fa21ae131830b6f22bb71aa7
src/views/login/index.vue
@@ -63,8 +63,12 @@
        })
    }
    const onSubmit3=(values:any)=>{
        if (userInfo.info.openid===''){
            Toast('没有获取到openid')
            return
        }
        console.log('提交表单',ruleForm3.value,values)
        ajaxPost('patient/info/isValidCodeOK',`phoneNo=${ruleForm3.value.userPhone}&validCode=${ruleForm3.value.validateCode}`,config).then((re:any)=>{
        ajaxPost('patient/info/isValidCodeOK',`phoneNo=${ruleForm3.value.userPhone}&validCode=${ruleForm3.value.validateCode}&openId=${userInfo.info.openid}`,config).then((re:any)=>{
            console.log(re)
            if (re===false){
                Toast('登录失败,请重新登录')
@@ -78,8 +82,11 @@
            Toast('手机号码不能为空')
            return
        }
        ajaxPost('patient/info/sendValidCode','phoneNo='+ruleForm3.value.userPhone,config).then(re=>{
        ajaxPost('patient/info/sendValidCode','phoneNo='+ruleForm3.value.userPhone,config).then((re:any)=>{
            console.log(re)
            if (re.code===200){
                return
            }
            const timer= setInterval(() => {
                if (seconds.value > 0) {
                    seconds.value--
@@ -113,11 +120,11 @@
            console.log(code)
            if (code){ // 得到code换取openid
                ajaxGet('wechat/code',{code}).then((re:any)=>{
                    console.log(re)
                    console.log(re,'获取openid')
                    userInfo.setUserInfo({openid:re.openid,nickname:re.nickname,headimgurl:re.headimgurl})
                    const openid = re.openid
                    if (openid) { // 检查登录
                        ajaxPost('patient/info/wechatLogin',{openid},config).then((re:any)=>{
                    const openId = re.openid
                    if (openId) { // 检查登录
                        ajaxPost('patient/info/wechatLogin','openId='+openId,config).then((re:any)=>{
                            console.log('openid换的accesstoken=',re)
                            if (re===''){
                                Toast('请填写表单登录。。')