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

View File

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

View File

@ -77,23 +77,48 @@
<!-- 用户协议的勾选 -->
<view
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 }"
>
<label class="radio ss-flex ss-col-center" @tap="onChange">
<radio
:checked="state.protocol"
color="var(--ui-BG-Main)"
style="transform: scale(0.8)"
@tap.stop="onChange"
/>
<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 class="agreement-title ss-m-b-20">请选择是否同意以下协议(请联网查看)</view>
<view class="agreement-options-container">
<!-- 同意选项 -->
<view class="agreement-option ss-m-b-20">
<label class="radio ss-flex ss-col-center" @tap="onAgree">
<radio
:checked="state.protocol === true"
color="var(--ui-BG-Main)"
style="transform: scale(0.8)"
@tap.stop="onAgree"
/>
<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>
</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 class="safe-box" />
</view>
@ -116,14 +141,19 @@
const authType = computed(() => modalStore.auth);
const state = reactive({
protocol: false,
protocol: null, // nulltruefalse
});
const currentProtocol = ref(false);
//
function onChange() {
state.protocol = !state.protocol;
//
function onAgree() {
state.protocol = true;
}
//
function onRefuse() {
state.protocol = false;
}
//
@ -144,12 +174,17 @@
// Apple
const thirdLogin = async (provider) => {
if (!state.protocol) {
if (state.protocol !== true) {
currentProtocol.value = true;
setTimeout(() => {
currentProtocol.value = false;
}, 1000);
sheep.$helper.toast('请勾选同意');
if (state.protocol === false) {
sheep.$helper.toast('您已拒绝协议,无法继续登录');
} else {
sheep.$helper.toast('请选择是否同意协议');
}
return;
}
const loginRes = await sheep.$platform.useProvider(provider).login();
@ -244,4 +279,23 @@
.agreement-text {
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>