release: prepare August 1 Android RC
This commit is contained in:
@@ -74,9 +74,9 @@
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
|
||||
<view class="dev-hint-pill" @click="fillDevCredentials">
|
||||
<view v-if="showDevSmsHint" class="dev-hint-pill" @click="fillDevCredentials">
|
||||
<uni-icons type="info-filled" size="14" color="#d97706" />
|
||||
<text class="dev-hint-text">测试验证码: 123456</text>
|
||||
<text class="dev-hint-text">测试验证码: {{ devSmsHintValue }}</text>
|
||||
<text class="dev-fill-btn">快捷填入</text>
|
||||
</view>
|
||||
|
||||
@@ -93,12 +93,25 @@
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="agreement-row" @click="agreed = !agreed">
|
||||
<view class="checkbox-box" :class="{ checked: agreed }">
|
||||
<uni-icons v-if="agreed" type="checkmarkempty" size="12" color="#ffffff" />
|
||||
<view class="agreement-row">
|
||||
<view
|
||||
class="agreement-consent"
|
||||
role="checkbox"
|
||||
:aria-checked="agreed"
|
||||
@click="agreed = !agreed"
|
||||
>
|
||||
<view class="checkbox-box" :class="{ checked: agreed }">
|
||||
<uni-icons v-if="agreed" type="checkmarkempty" size="12" color="#ffffff" />
|
||||
</view>
|
||||
<text class="agreement-text">已阅读并同意</text>
|
||||
</view>
|
||||
<text class="agreement-text">已阅读并同意《服务协议》与《隐私政策》</text>
|
||||
<text class="agreement-link" @click.stop="openLegalDocument('terms')">《服务协议》</text>
|
||||
<text class="agreement-text">与</text>
|
||||
<text class="agreement-link" @click.stop="openLegalDocument('privacy')">《隐私政策》</text>
|
||||
</view>
|
||||
<text v-if="!legalLinksReady" class="agreement-error">
|
||||
协议地址尚未完成法务配置,当前暂停验证码发送与登录。
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -109,6 +122,11 @@ import { onHide, onShow, onUnload } from '@dcloudio/uni-app';
|
||||
import type { LoginResult } from '@/types/api';
|
||||
import { apiRequest } from '@/services/api';
|
||||
import { consumeLoginRedirect, getAuth, isLoggedIn, phoneKey, saveAuth } from '@/services/auth';
|
||||
import {
|
||||
legalDocumentUrl,
|
||||
legalLinksReady,
|
||||
type LegalDocumentKind
|
||||
} from '@/services/legal';
|
||||
import { resetPageScroll } from '@/services/navigation';
|
||||
import { goToMobileTarget, nextUserRouteAfterLogin } from '@/services/position';
|
||||
|
||||
@@ -135,8 +153,14 @@ const formRules = {
|
||||
const sending = ref(false);
|
||||
const loggingIn = ref(false);
|
||||
const countdown = ref(0);
|
||||
const agreed = ref(true);
|
||||
const agreed = ref(false);
|
||||
const message = ref('');
|
||||
const devSmsHintValue = import.meta.env.DEV
|
||||
? String(import.meta.env.VITE_DEV_SMS_HINT_VALUE || '').replace(/\D/g, '').slice(0, 6)
|
||||
: '';
|
||||
const showDevSmsHint = import.meta.env.DEV
|
||||
&& import.meta.env.VITE_DEV_SMS_HINT_ENABLED === 'true'
|
||||
&& /^\d{4,6}$/.test(devSmsHintValue);
|
||||
let timer: ReturnType<typeof setInterval> | null = null;
|
||||
|
||||
const inputStyles = {
|
||||
@@ -166,8 +190,9 @@ const startCountdown = () => {
|
||||
};
|
||||
|
||||
const fillDevCredentials = () => {
|
||||
formData.smsCode = '123456';
|
||||
message.value = '已自动填入测试验证码 123456';
|
||||
if (!showDevSmsHint) return;
|
||||
formData.smsCode = devSmsHintValue;
|
||||
message.value = '已自动填入本地测试验证码';
|
||||
};
|
||||
|
||||
const normalizeDigits = (value: string | number, maxLength: number) =>
|
||||
@@ -183,6 +208,33 @@ const onSmsCodeInput = (value: string | number) => {
|
||||
formData.smsCode = normalizeDigits(value, 6);
|
||||
};
|
||||
|
||||
const ensureLegalConsent = () => {
|
||||
if (!legalLinksReady) {
|
||||
message.value = '服务协议和隐私政策地址尚未配置,暂不能发送验证码或登录';
|
||||
return false;
|
||||
}
|
||||
if (!agreed.value) {
|
||||
message.value = '请先阅读并勾选同意《服务协议》与《隐私政策》';
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
const openLegalDocument = (kind: LegalDocumentKind) => {
|
||||
const url = legalDocumentUrl(kind);
|
||||
if (!url) {
|
||||
message.value = '协议地址尚未完成法务配置';
|
||||
return;
|
||||
}
|
||||
if (typeof plus !== 'undefined') {
|
||||
plus.runtime.openURL(url);
|
||||
return;
|
||||
}
|
||||
if (typeof window !== 'undefined') {
|
||||
window.open(url, '_blank', 'noopener,noreferrer');
|
||||
}
|
||||
};
|
||||
|
||||
const goAfterLogin = async () => {
|
||||
const redirect = consumeLoginRedirect() || '/pages/user/today/index';
|
||||
goToMobileTarget(await nextUserRouteAfterLogin(redirect));
|
||||
@@ -190,6 +242,7 @@ const goAfterLogin = async () => {
|
||||
|
||||
const sendCode = async () => {
|
||||
if (sending.value || countdown.value > 0) return;
|
||||
if (!ensureLegalConsent()) return;
|
||||
try {
|
||||
await loginForm.value?.validateField(['phone']);
|
||||
} catch {
|
||||
@@ -215,10 +268,7 @@ const sendCode = async () => {
|
||||
|
||||
const login = async () => {
|
||||
if (loggingIn.value) return;
|
||||
if (!agreed.value) {
|
||||
message.value = '请先勾选同意《服务协议》与《隐私政策》';
|
||||
return;
|
||||
}
|
||||
if (!ensureLegalConsent()) return;
|
||||
try {
|
||||
await loginForm.value?.validate();
|
||||
} catch {
|
||||
@@ -616,9 +666,16 @@ onUnmounted(() => {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
gap: 2px;
|
||||
max-width: 720px;
|
||||
margin: 18px auto 0;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.agreement-consent {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@@ -647,6 +704,24 @@ onUnmounted(() => {
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.agreement-link {
|
||||
color: var(--employee-primary, #e60012);
|
||||
font-size: 12px;
|
||||
font-weight: 650;
|
||||
line-height: 1.4;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.agreement-error {
|
||||
display: block;
|
||||
max-width: 720px;
|
||||
margin: 8px auto 0;
|
||||
color: #b45309;
|
||||
font-size: 11px;
|
||||
line-height: 1.5;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@media (max-width: 375px) {
|
||||
.login-shell {
|
||||
padding-right: 20px;
|
||||
|
||||
Reference in New Issue
Block a user