|
@@ -6,14 +6,13 @@
|
|
<view class="ss-m-t-100">
|
|
<view class="ss-m-t-100">
|
|
<view>
|
|
<view>
|
|
<button
|
|
<button
|
|
- v-if="!protocol"
|
|
|
|
class="send-button MiSans-Medium"
|
|
class="send-button MiSans-Medium"
|
|
- @click="showProtocolToast"
|
|
|
|
|
|
+ @click="handleLogin"
|
|
>
|
|
>
|
|
微信授权注册/登录
|
|
微信授权注册/登录
|
|
</button>
|
|
</button>
|
|
- <button
|
|
|
|
- v-else
|
|
|
|
|
|
+ <!-- <button
|
|
|
|
+ v-else
|
|
class="send-button MiSans-Medium"
|
|
class="send-button MiSans-Medium"
|
|
:loading="phoneNumberLoading"
|
|
:loading="phoneNumberLoading"
|
|
:disabled="phoneNumberLoading"
|
|
:disabled="phoneNumberLoading"
|
|
@@ -21,7 +20,7 @@
|
|
@getphonenumber="getPhoneNumber"
|
|
@getphonenumber="getPhoneNumber"
|
|
>
|
|
>
|
|
微信授权注册/登录
|
|
微信授权注册/登录
|
|
- </button>
|
|
|
|
|
|
+ </button> -->
|
|
</view>
|
|
</view>
|
|
|
|
|
|
<view class="ss-flex ss-row-center ss-m-y-50">
|
|
<view class="ss-flex ss-row-center ss-m-y-50">
|
|
@@ -60,8 +59,27 @@ const handleToDetail = (type) => {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
-const showProtocolToast = () => {
|
|
|
|
- uni.showToast({ title: '请先阅读并同意用户协议和隐私政策', icon: 'none' })
|
|
|
|
|
|
+// 授权
|
|
|
|
+const handleLogin = () => {
|
|
|
|
+ if (!protocol.value) return uni.showToast({ title: '请先阅读并同意用户协议和隐私政策', icon: 'none' })
|
|
|
|
+ phoneNumberLoading.value = true
|
|
|
|
+ wx.login({
|
|
|
|
+ success: async (res) => {
|
|
|
|
+ try {
|
|
|
|
+ const { result } = await weChatRegister({ wechat_code: res?.code })
|
|
|
|
+ console.log(result, '用户注册返回结果')
|
|
|
|
+ uni.setStorageSync('wechat_user', result)
|
|
|
|
+ uni.$emit && uni.$emit('auth:login', result)
|
|
|
|
+ closeAuthModal()
|
|
|
|
+ } finally {
|
|
|
|
+ phoneNumberLoading.value = false
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ fail:(res)=> {
|
|
|
|
+ phoneNumberLoading.value = false
|
|
|
|
+ console.log("获取登录凭证code失败!", res)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
|
|
|
|
// 微信登录/注册
|
|
// 微信登录/注册
|