登录添加隐私协议弹窗

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

@@ -45,9 +45,10 @@
<uni-icons type="checkbox-filled" size="24" color="#4D5DFA" v-if="agreeAgreement"></uni-icons>
<uni-icons type="checkbox" size="24" color="#999" v-else></uni-icons>
</view>
<text class="agreement-text" @click.stop="goToPrivacy">我已阅读并同意
<text class="agreePrivacy">《用户隐私政策》</text>
</text>
<text class="agreement-text" >我已阅读并同意
<text class="agreePrivacy" @click.stop="">《用户协议》</text>和
<text class="agreePrivacy" @click.stop="goToPrivacy">《隐私政策》</text>
</text>
</view>
<navigator class="forget-pwd" url="/pageSubPack/loginSub/forget-pwd">忘记密码?</navigator>
</view>
@@ -63,6 +64,8 @@
<!-- <navigator class="link-item" url="/pageSubPack/loginSub/register-new-user">注册新用户</navigator> -->
</view>
</view>
<!-- 隐私协议弹窗 -->
<privacy-popup v-model:show="showPrivacyPopup" @agree="agreePrivacy" @disagree="disagreePrivacy" @close="showPrivacyPopup = false" />
</template>
<script setup>
@@ -76,6 +79,7 @@
import {
getLoginPassword
} from '../../api/api.js'
import PrivacyPopup from '@/components/privacy-popup/privacy-popup.vue'
// 响应式数据
const phoneNumber = ref('');
@@ -83,6 +87,7 @@
const agreeAgreement = ref(false); // 默认勾选
const rememberPwd = ref(false);
const placeholderStyle = ref('font-size:24rpx')
const showPrivacyPopup = ref(false)
// 控制点击变色
// const isClicked = ref(false)
@@ -101,13 +106,16 @@
const toggleRemember = () => {
rememberPwd.value = !rememberPwd.value;
};
// 跳转隐私协议
// 打开隐私协议弹窗
const goToPrivacy = () => {
showPrivacyPopup.value = true
}
// isClicked.value = true
uni.navigateTo({
url:'/pageSubPack/loginSub/privacy',
})
// 不同意隐私协议
const disagreePrivacy = () => {
agreeAgreement.value = false
showPrivacyPopup.value = false
}
// 检查表单
@@ -146,7 +154,7 @@
return;
}
if(!agreeAgreement.value){
uni.showToast({ title: '请勾选协议', icon: 'none' });
showPrivacyPopup.value = true;
return;
}
uni.showLoading({ title: '登录中...', mask: true });
@@ -198,6 +206,13 @@
};
// 同意隐私协议(弹窗中点击同意 → 直接登录)
const agreePrivacy = () => {
agreeAgreement.value = true
showPrivacyPopup.value = false
handleLogin()
}
</script>
<style scoped>
@@ -292,12 +307,15 @@
.agreement-item {
display: flex;
align-items: center;
flex: 1;
min-width: 0;
}
.agreement-text {
font-size: 24rpx;
color: #666;
margin-left: 10rpx;
line-height: 1.5;
}
.agreePrivacy{
color: #4D5DFA;
@@ -310,6 +328,9 @@
font-size: 24rpx;
color: #666;
text-decoration: none;
flex-shrink: 0;
margin-left: 16rpx;
line-height: 1.5;
}
.login-btn {