作者 韩昌

提交

... ... @@ -120,47 +120,61 @@ const oneClickLoginHandler = () => {
},
otherLoginButton: {
visible: false
},
privacyTerms: {
defaultCheckBoxState: false // 条款勾选框初始状态 默认值: true
}
},
async success(res) {
// 登录成功
console.log(res, '成功')
try {
const { result } = await doctorPhoneEasyLogin({ ...res.authResult, cid: uni.getStorageSync('cid') || '' })
uni.closeAuthView()
console.log(result, '一键登录')
// message.value = JSON.stringify(result)
// showMessage.value = true
// setTimeout(() => {
uni.setStorageSync('token', result.token)
uni.setStorageSync('UserInfo', result.userInfo)
setTimeout(() => {
uni.$u.toast('登录成功')
}, 1000)
uni.reLaunch({ url: '/pages/index/index' })
// }, 800)
} catch (error) {
uni.$u.toast(error)
setTimeout(() => {
uni.closeAuthView()
}, 1000)
}
uni.getCheckBoxState({
async success(res) {
if (res.state) {
// 登录成功
console.log(res, '成功')
try {
const { result } = await doctorPhoneEasyLogin({ ...res.authResult, cid: uni.getStorageSync('cid') || '' })
uni.closeAuthView()
console.log(result, '一键登录')
// message.value = JSON.stringify(result)
// showMessage.value = true
// setTimeout(() => {
uni.setStorageSync('token', result.token)
uni.setStorageSync('UserInfo', result.userInfo)
setTimeout(() => {
uni.$u.toast('登录成功')
}, 1000)
uni.reLaunch({ url: '/pages/index/index' })
// }, 800)
} catch (error) {
uni.$u.toast(error)
setTimeout(() => {
uni.closeAuthView()
}, 1000)
}
} else {
uni.$u.toast('请先同意阅读隐私协议')
}
console.log(res) // Boolean 用户是否勾选了选框
},
fail(res) {
console.log(res)
}
})
},
fail(res) {
uni.$u.toast('网络错误')
console.log(res, '失败')
console.log(res.errMsg)
}
})
}
defineExpose({ oneClickLoginHandler })
defineExpose({ oneClickLoginHandler, isConfirmProtocol })
</script>
<style lang="scss" scoped>
... ...
... ... @@ -9,10 +9,20 @@
<image class="login-logo flexC" src="/static/images/logo.png" mode="aspectFill"></image>
</template>
<template v-if="loginState === 2">
<PhoneLogin @editLoginStateHandler="(state: number) => loginState = state" ref="phoneLoginRef" />
<PhoneLogin
@editLoginStateHandler="(state: number) => {
loginState = state,confirmProtocolRef.isConfirmProtocol = false
}"
ref="phoneLoginRef"
/>
</template>
<template v-if="loginState === 3">
<AccountLogin @editLoginStateHandler="(state: number) => loginState = state" ref="accountLoginRef" />
<AccountLogin
@editLoginStateHandler="(state: number) => {
loginState = state,confirmProtocolRef.isConfirmProtocol = false
}"
ref="accountLoginRef"
/>
</template>
<template v-if="loginState === 4">
<view></view>
... ... @@ -21,7 +31,7 @@
<template v-if="loginState === 1 && iosVersion >= 13">
<AppleLogin v-if="false" ref="AppleLoginRef" />
</template>
<view v-if="loginState === 1" class="login-other flexC" @click="loginState = 2">其他登录方式</view>
<view v-if="loginState === 1" class="login-other flexC" @click="otherLoginHandler">其他登录方式</view>
</view>
</template>
... ... @@ -64,6 +74,12 @@ onShow(() => {
})
})
const otherLoginHandler = () => {
loginState.value = 2
confirmProtocolRef.value.isConfirmProtocol = false
}
const loginHandler = (state: number) => {
useSetCidHandler()
... ...