|
@@ -8,22 +8,40 @@
|
|
|
|
|
|
|
|
<!-- 登录按钮 -->
|
|
<!-- 登录按钮 -->
|
|
|
<div class="login-box">
|
|
<div class="login-box">
|
|
|
-<!-- <div class="wechat-login-btn" @click="handleWechatLogin">
|
|
|
|
|
- <img src="@/assets/wechat-icon.png" alt="微信" class="wechat-icon">
|
|
|
|
|
- 微信一键登录
|
|
|
|
|
- </div>-->
|
|
|
|
|
- <uv-button :disabled="!isAgreePrivacy||isAgreePrivacy.length===0"
|
|
|
|
|
- class="phone-login-btn" type="primary" color="#C6171E"
|
|
|
|
|
- shape="circle"
|
|
|
|
|
- @getphonenumber="handleGetPhone" open-type="getPhoneNumber">
|
|
|
|
|
- 手机号一键登录
|
|
|
|
|
|
|
+ <!-- <div class="wechat-login-btn" @click="handleWechatLogin">
|
|
|
|
|
+ <img src="@/assets/wechat-icon.png" alt="微信" class="wechat-icon">
|
|
|
|
|
+ 微信一键登录
|
|
|
|
|
+ </div>-->
|
|
|
|
|
+<!-- <uv-button
|
|
|
|
|
+ class="phone-login-btn" type="primary" color="#C6171E"
|
|
|
|
|
+ shape="circle"
|
|
|
|
|
+ @click="handleShowModal"
|
|
|
|
|
+ >
|
|
|
|
|
+ 一键登录
|
|
|
|
|
+ </uv-button>-->
|
|
|
|
|
+ <uv-button
|
|
|
|
|
+ class="phone-login-btn" type="primary" color="#C6171E"
|
|
|
|
|
+ shape="circle"
|
|
|
|
|
+ @getphonenumber="handleGetPhone" open-type="getPhoneNumber|agreePrivacyAuthorization">
|
|
|
|
|
+ 一键登录
|
|
|
</uv-button>
|
|
</uv-button>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
+<!--
|
|
|
|
|
+ <uv-button
|
|
|
|
|
+ ref="phone_ref"
|
|
|
|
|
+ style="visibility: hidden;"
|
|
|
|
|
+ class="phone-login-btn" type="primary" color="#C6171E"
|
|
|
|
|
+ shape="circle"
|
|
|
|
|
+ @getphonenumber="handleGetPhone" open-type="getPhoneNumber">
|
|
|
|
|
+ 一键登录
|
|
|
|
|
+ </uv-button>
|
|
|
|
|
+-->
|
|
|
|
|
+
|
|
|
<!-- 隐私协议 -->
|
|
<!-- 隐私协议 -->
|
|
|
- <div class="privacy-box">
|
|
|
|
|
|
|
+ <div class="privacy-box" style="display: none;">
|
|
|
<view style="display: inline-flex" class="agreement">
|
|
<view style="display: inline-flex" class="agreement">
|
|
|
-<!-- <uv-checkbox v-model="isAgreePrivacy" @change="handlePrivacyChange"></uv-checkbox>-->
|
|
|
|
|
|
|
+ <!-- <uv-checkbox v-model="isAgreePrivacy" @change="handlePrivacyChange"></uv-checkbox>-->
|
|
|
<uv-checkbox-group
|
|
<uv-checkbox-group
|
|
|
v-model="isAgreePrivacy"
|
|
v-model="isAgreePrivacy"
|
|
|
shape="circle">
|
|
shape="circle">
|
|
@@ -44,18 +62,18 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
-import { ref } from 'vue'
|
|
|
|
|
|
|
+import {ref} from 'vue'
|
|
|
import {login} from "@/utils/auth";
|
|
import {login} from "@/utils/auth";
|
|
|
import {onLoad} from "@dcloudio/uni-app";
|
|
import {onLoad} from "@dcloudio/uni-app";
|
|
|
|
|
|
|
|
const isAgreePrivacy = ref([])
|
|
const isAgreePrivacy = ref([])
|
|
|
-const redirectUrl =ref ("")
|
|
|
|
|
-const shortId =ref (null)
|
|
|
|
|
-const stationId =ref (null)
|
|
|
|
|
-
|
|
|
|
|
|
|
+const redirectUrl = ref("")
|
|
|
|
|
+const shortId = ref(null)
|
|
|
|
|
+const stationId = ref(null)
|
|
|
|
|
+const phone_ref = ref(null)
|
|
|
|
|
|
|
|
|
|
|
|
|
-onLoad((options:any)=>{
|
|
|
|
|
|
|
+onLoad((options: any) => {
|
|
|
console.log(options)
|
|
console.log(options)
|
|
|
redirectUrl.value = options?.redirectUrl
|
|
redirectUrl.value = options?.redirectUrl
|
|
|
shortId.value = options?.shortId
|
|
shortId.value = options?.shortId
|
|
@@ -71,6 +89,41 @@ const handleWechatLogin = () => {
|
|
|
console.log('微信登录')
|
|
console.log('微信登录')
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const handleShowModal = () => {
|
|
|
|
|
+ // #ifdef MP-WEIXIN
|
|
|
|
|
+ // 1. 检查是否需要弹隐私协议(微信自动弹)
|
|
|
|
|
+ wx.getPrivacySetting({
|
|
|
|
|
+ success: res => {
|
|
|
|
|
+ if (res.needAuthorization) {
|
|
|
|
|
+ // 2. 拉起官方隐私协议弹窗
|
|
|
|
|
+ wx.requirePrivacyAuthorize({
|
|
|
|
|
+ success: () =>handleGetPhone1, // 同意后立即走授权
|
|
|
|
|
+ fail: () => uni.showToast({ title: '需同意协议', icon: 'none' })
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 已经同意过,直接拿手机号
|
|
|
|
|
+ handleGetPhone1()
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ // uni.showModal({
|
|
|
|
|
+ // title: '提示',
|
|
|
|
|
+ // content: '请先阅读用户协议和隐私政策?',
|
|
|
|
|
+ // success: (res) => {
|
|
|
|
|
+ // if (res.confirm) {
|
|
|
|
|
+ // console.log("确认")
|
|
|
|
|
+ // isAgreePrivacy.value = ["aa"];
|
|
|
|
|
+ // } else {
|
|
|
|
|
+ // isAgreePrivacy.value = [];
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+ // })
|
|
|
|
|
+ // #endif
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const handleGetPhone1 =async () => {
|
|
|
|
|
+ phone_ref.value?.click();
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
// 处理隐私协议变更
|
|
// 处理隐私协议变更
|
|
|
const handlePrivacyChange = () => {
|
|
const handlePrivacyChange = () => {
|
|
@@ -80,24 +133,28 @@ const handlePrivacyChange = () => {
|
|
|
// 显示用户协议
|
|
// 显示用户协议
|
|
|
const showUserAgreement = () => {
|
|
const showUserAgreement = () => {
|
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
|
- url:'/pages-user/agreement/index'
|
|
|
|
|
|
|
+ url: '/pages-user/agreement/index'
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 显示隐私政策
|
|
// 显示隐私政策
|
|
|
const showPrivacyPolicy = () => {
|
|
const showPrivacyPolicy = () => {
|
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
|
- url:'/pages-user/policy/index'
|
|
|
|
|
|
|
+ url: '/pages-user/policy/index'
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const handleGetPhone = (e:any) => {
|
|
|
|
|
|
|
+const handleClickLoginBtn = () => {
|
|
|
|
|
+ console.log("handleClickLoginBtn")
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const handleGetPhone = (e: any) => {
|
|
|
console.log(e)
|
|
console.log(e)
|
|
|
- if(shortId.value){
|
|
|
|
|
- e.shortId=shortId.value;
|
|
|
|
|
|
|
+ if (shortId.value) {
|
|
|
|
|
+ e.shortId = shortId.value;
|
|
|
}
|
|
}
|
|
|
login(e).then((token: string) => {
|
|
login(e).then((token: string) => {
|
|
|
- console.log(">>>>>>>>>",token)
|
|
|
|
|
|
|
+ console.log(">>>>>>>>>", token)
|
|
|
uni.navigateBack()
|
|
uni.navigateBack()
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
@@ -138,7 +195,7 @@ const handleGetPhone = (e:any) => {
|
|
|
|
|
|
|
|
.wechat-login-btn,
|
|
.wechat-login-btn,
|
|
|
.phone-login-btn {
|
|
.phone-login-btn {
|
|
|
- color:#C6171E !important;
|
|
|
|
|
|
|
+ color: #C6171E !important;
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
height: 44px;
|
|
height: 44px;
|
|
|
border-radius: 2px;
|
|
border-radius: 2px;
|
|
@@ -197,6 +254,6 @@ const handleGetPhone = (e:any) => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.link {
|
|
.link {
|
|
|
- color:$uni-color-primary
|
|
|
|
|
|
|
+ color: $uni-color-primary
|
|
|
}
|
|
}
|
|
|
</style>
|
|
</style>
|