!144 增加拒绝用户协议与隐私协议,补充相关逻辑 满足部分应用分发市场的审核需求

Merge pull request !144 from huppygo/master
pull/147/head
芋道源码 2025-04-28 14:57:49 +00:00 committed by Gitee
commit 20e7593e14
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 111 additions and 34 deletions

View File

@ -60,8 +60,8 @@
const props = defineProps({ const props = defineProps({
agreeStatus: { agreeStatus: {
type: Boolean, type: [Boolean, null],
default: false, default: null,
}, },
}); });
@ -87,10 +87,14 @@
}); });
if (!validate) return; if (!validate) return;
// //
if (!props.agreeStatus) { if (props.agreeStatus !== true) {
emits('onConfirm', true) emits('onConfirm', true);
sheep.$helper.toast('请勾选同意'); if (props.agreeStatus === false) {
sheep.$helper.toast('您已拒绝协议,无法继续登录');
} else {
sheep.$helper.toast('请选择是否同意协议');
}
return; return;
} }

View File

@ -31,9 +31,9 @@
<template v-slot:right> <template v-slot:right>
<button <button
class="ss-reset-button code-btn code-btn-start" class="ss-reset-button code-btn code-btn-start"
:disabled="state.isMobileEnd" :disabled="state.isMobileEnd || props.agreeStatus === false"
:class="{ 'code-btn-end': state.isMobileEnd }" :class="{ 'code-btn-end': state.isMobileEnd || props.agreeStatus === false }"
@tap="getSmsCode('smsLogin', state.model.mobile)" @tap="checkAgreementAndGetSmsCode"
> >
{{ getSmsTimer('smsLogin') }} {{ getSmsTimer('smsLogin') }}
</button> </button>
@ -71,8 +71,8 @@
const props = defineProps({ const props = defineProps({
agreeStatus: { agreeStatus: {
type: Boolean, type: [Boolean, null],
default: false, default: null,
}, },
}); });
@ -90,6 +90,20 @@
}, },
}); });
//
function checkAgreementAndGetSmsCode() {
if (props.agreeStatus !== true) {
emits('onConfirm', true);
if (props.agreeStatus === false) {
sheep.$helper.toast('您已拒绝协议,无法发送验证码');
} else {
sheep.$helper.toast('请选择是否同意协议');
}
return;
}
getSmsCode('smsLogin', state.model.mobile);
}
// //
async function smsLoginSubmit() { async function smsLoginSubmit() {
// //
@ -101,9 +115,14 @@
if (!validate) { if (!validate) {
return; return;
} }
if (!props.agreeStatus) { //
emits('onConfirm', true) if (props.agreeStatus !== true) {
sheep.$helper.toast('请勾选同意'); emits('onConfirm', true);
if (props.agreeStatus === false) {
sheep.$helper.toast('您已拒绝协议,无法继续登录');
} else {
sheep.$helper.toast('请选择是否同意协议');
}
return; return;
} }
// //

View File

@ -77,23 +77,48 @@
<!-- 用户协议的勾选 --> <!-- 用户协议的勾选 -->
<view <view
v-if="['accountLogin', 'smsLogin'].includes(authType)" v-if="['accountLogin', 'smsLogin'].includes(authType)"
class="agreement-box ss-flex ss-row-center" class="agreement-box ss-flex ss-flex-col ss-col-center"
:class="{ shake: currentProtocol }" :class="{ shake: currentProtocol }"
> >
<label class="radio ss-flex ss-col-center" @tap="onChange"> <view class="agreement-title ss-m-b-20">请选择是否同意以下协议(请联网查看)</view>
<radio
:checked="state.protocol" <view class="agreement-options-container">
color="var(--ui-BG-Main)" <!-- 同意选项 -->
style="transform: scale(0.8)" <view class="agreement-option ss-m-b-20">
@tap.stop="onChange" <label class="radio ss-flex ss-col-center" @tap="onAgree">
/> <radio
<view class="agreement-text ss-flex ss-col-center ss-m-l-8"> :checked="state.protocol === true"
我已阅读并遵守 color="var(--ui-BG-Main)"
<view class="tcp-text" @tap.stop="onProtocol('用户协议')"> 用户协议 </view> style="transform: scale(0.8)"
<view class="agreement-text"></view> @tap.stop="onAgree"
<view class="tcp-text" @tap.stop="onProtocol('隐私协议')"> 隐私协议 </view> />
<view class="agreement-text ss-flex ss-col-center ss-m-l-8">
我已阅读并同意遵守
<view class="tcp-text" @tap.stop="onProtocol('用户协议')"> 用户协议 </view>
<view class="agreement-text"></view>
<view class="tcp-text" @tap.stop="onProtocol('隐私协议')"> 隐私协议 </view>
</view>
</label>
</view> </view>
</label>
<!-- 拒绝选项 -->
<view class="agreement-option">
<label class="radio ss-flex ss-col-center" @tap="onRefuse">
<radio
:checked="state.protocol === false"
color="#ff4d4f"
style="transform: scale(0.8)"
@tap.stop="onRefuse"
/>
<view class="agreement-text ss-flex ss-col-center ss-m-l-8">
我拒绝遵守
<view class="tcp-text" @tap.stop="onProtocol('用户协议')"> 用户协议 </view>
<view class="agreement-text"></view>
<view class="tcp-text" @tap.stop="onProtocol('隐私协议')"> 隐私协议 </view>
</view>
</label>
</view>
</view>
</view> </view>
<view class="safe-box" /> <view class="safe-box" />
</view> </view>
@ -116,14 +141,19 @@
const authType = computed(() => modalStore.auth); const authType = computed(() => modalStore.auth);
const state = reactive({ const state = reactive({
protocol: false, protocol: null, // nulltruefalse
}); });
const currentProtocol = ref(false); const currentProtocol = ref(false);
// //
function onChange() { function onAgree() {
state.protocol = !state.protocol; state.protocol = true;
}
//
function onRefuse() {
state.protocol = false;
} }
// //
@ -144,12 +174,17 @@
// Apple // Apple
const thirdLogin = async (provider) => { const thirdLogin = async (provider) => {
if (!state.protocol) { if (state.protocol !== true) {
currentProtocol.value = true; currentProtocol.value = true;
setTimeout(() => { setTimeout(() => {
currentProtocol.value = false; currentProtocol.value = false;
}, 1000); }, 1000);
sheep.$helper.toast('请勾选同意');
if (state.protocol === false) {
sheep.$helper.toast('您已拒绝协议,无法继续登录');
} else {
sheep.$helper.toast('请选择是否同意协议');
}
return; return;
} }
const loginRes = await sheep.$platform.useProvider(provider).login(); const loginRes = await sheep.$platform.useProvider(provider).login();
@ -244,4 +279,23 @@
.agreement-text { .agreement-text {
color: $dark-9; color: $dark-9;
} }
.agreement-title {
font-size: 28rpx;
color: $dark-9;
text-align: left;
width: 100%;
padding-left: 60rpx;
}
.agreement-options-container {
width: 100%;
padding-left: 100rpx;
}
.agreement-option {
width: 100%;
display: flex;
justify-content: flex-start;
}
</style> </style>