commit
20e7593e14
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
// 提交数据
|
// 提交数据
|
||||||
|
|
|
@ -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, // null表示未选择,true表示同意,false表示拒绝
|
||||||
});
|
});
|
||||||
|
|
||||||
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>
|
||||||
|
|
Loading…
Reference in New Issue