登录添加隐私协议弹窗

This commit is contained in:
zhouyanli
2026-06-18 16:40:19 +08:00
parent 9bcbfa8ec5
commit 3bd7809c25
5 changed files with 219 additions and 23 deletions

View File

@@ -67,10 +67,14 @@
<uni-icons type="checkbox" size="24" color="#999" v-else></uni-icons>
</view>
<text class="agreement-text" @click.stop="goToPrivacy"
<!-- <text class="agreement-text" @click.stop="goToPrivacy"
>我已阅读并同意
<text class="agreePrivacy">《用户隐私政策》</text>
</text>
</text> -->
<text class="agreement-text" >我已阅读并同意
<text class="agreePrivacy" @click.stop="">《用户协议》</text>和
<text class="agreePrivacy" @click.stop="goToPrivacy">《隐私政策》</text>
</text>
</view>
<!-- 登录按钮 -->
@@ -81,12 +85,16 @@
<navigator class="link-item" url="/pageSubPack/loginSub/pwd-login">账号密码登录</navigator>
<!-- <navigator class="link-item" url="/pageSubPack/loginSub/register-new-user">注册新用户</navigator> -->
</view>
<!-- 隐私协议弹窗 -->
<privacy-popup v-model:show="showPrivacyPopup" @agree="agreePrivacy" @disagree="disagreePrivacy" />
</view>
</template>
<script setup>
import { ref, computed, onUnmounted } from 'vue'
import { getLoginBySms, getSendCode } from '../../api/api.js'
import PrivacyPopup from '@/components/privacy-popup/privacy-popup.vue'
// ========== 响应式数据 ==========
// 手机号
@@ -96,6 +104,7 @@ const verifyCode = ref('')
const placeholderStyle = ref('font-size:24rpx')
// 是否同意协议
const agreeAgreement = ref(false) // 默认勾选
const showPrivacyPopup = ref(false)
// 倒计时(秒)
const countDown = ref(0)
// 定时器
@@ -130,13 +139,16 @@ const checkForm = () => {
const toggleAgreement = () => {
agreeAgreement.value = !agreeAgreement.value
}
// 跳转隐私协议
// 打开隐私协议弹窗
const goToPrivacy = () => {
// 点击变色
// isClicked.value = true
uni.navigateTo({
url: '/pageSubPack/loginSub/privacy'
})
showPrivacyPopup.value = true
}
// 不同意隐私协议
const disagreePrivacy = () => {
agreeAgreement.value = false
showPrivacyPopup.value = false
}
// 获取验证码
@@ -201,7 +213,7 @@ const handleLogin = () => {
return
}
if (!agreeAgreement.value) {
uni.showToast({ title: '请勾选协议', icon: 'none' })
showPrivacyPopup.value = true
return
}
uni.showLoading({
@@ -260,6 +272,13 @@ const handleLogin = () => {
})
}
// 同意隐私协议(弹窗中点击同意 → 直接登录)
const agreePrivacy = () => {
agreeAgreement.value = true
showPrivacyPopup.value = false
handleLogin()
}
// ========== 生命周期 ==========
// 页面卸载时清除定时器
onUnmounted(() => {