Review changes batch 5 of 6

This commit is contained in:
2026-07-20 06:52:26 +08:00
parent 0d0645a112
commit db97d3da27
41 changed files with 6672 additions and 1124 deletions
+298 -118
View File
@@ -2,97 +2,252 @@
<template>
<view class="auth-page login-page">
<view class="page-canvas">
<image class="page-backdrop" src="/static/assets/modules/auth/opaque/a01-red-hall-ink-backdrop-v1.png" mode="scaleToFill" />
<image class="brand-seal" src="/static/assets/foundation/transparent/brand-seal.png" mode="aspectFit" />
<image
class="page-backdrop"
src="/static/assets/modules/auth/opaque/a01-red-hall-ink-backdrop-v1.png"
mode="scaleToFill"
/>
<image
class="brand-seal"
src="/static/assets/foundation/transparent/brand-seal.png"
mode="aspectFit"
/>
<view class="login-content">
<view class="login-heading">
<text class="login-title">登录家谱</text>
<image class="title-divider" src="/static/assets/modules/auth/transparent/a01-vnext-divider-v1.png" mode="aspectFit" />
<image
class="title-divider"
src="/static/assets/modules/auth/transparent/a01-vnext-divider-v1.png"
mode="aspectFit"
/>
</view>
<view class="login-tabs">
<view class="login-tab" :class="{ active: activeLoginMethod === 'password' }" hover-class="tap-fade" @click="switchLoginMethod('password')">密码登录</view>
<view class="login-tab" :class="{ active: activeLoginMethod === 'sms' }" hover-class="tap-fade" @click="switchLoginMethod('sms')">验证码登录</view>
<view
class="login-tab"
:class="{ active: activeLoginMethod === 'password' }"
hover-class="tap-fade"
@click="switchLoginMethod('password')"
>密码登录</view
>
<view
class="login-tab"
:class="{ active: activeLoginMethod === 'sms' }"
hover-class="tap-fade"
@click="switchLoginMethod('sms')"
>验证码登录</view
>
</view>
<view class="form-content">
<view class="input-row">
<image class="input-icon" src="/static/assets/modules/auth/transparent/a01-icon-phone-v1.png" mode="aspectFit" />
<input v-model.trim="phone" class="auth-input" type="number" maxlength="11" placeholder="手机号" placeholder-class="input-placeholder" confirm-type="next" />
<image
class="input-icon"
src="/static/assets/modules/auth/transparent/a01-icon-phone-v1.png"
mode="aspectFit"
/>
<input
v-model.trim="phone"
class="auth-input"
type="number"
maxlength="11"
placeholder="手机号"
placeholder-class="input-placeholder"
confirm-type="next"
/>
</view>
<view v-if="activeLoginMethod === 'password'" class="input-row">
<image class="input-icon" src="/static/assets/modules/auth/transparent/a01-icon-lock-v1.png" mode="aspectFit" />
<input v-model="password" class="auth-input" :password="!passwordVisible" maxlength="32" placeholder="密码" placeholder-class="input-placeholder" confirm-type="done" @confirm="submitLogin" />
<view class="password-toggle" hover-class="tap-fade" @click="togglePasswordVisibility">
<image class="password-toggle__icon" :src="passwordVisible ? '/static/assets/modules/auth/transparent/a01-icon-eye-open-v1.png' : '/static/assets/modules/auth/transparent/a01-icon-eye-closed-pupil-v2.png'" mode="aspectFit" />
<image
class="input-icon"
src="/static/assets/modules/auth/transparent/a01-icon-lock-v1.png"
mode="aspectFit"
/>
<input
v-model="password"
class="auth-input"
:password="!passwordVisible"
maxlength="32"
placeholder="密码"
placeholder-class="input-placeholder"
confirm-type="done"
@confirm="submitLogin"
/>
<view
class="password-toggle"
hover-class="tap-fade"
@click="togglePasswordVisibility"
>
<image
class="password-toggle__icon"
:src="
passwordVisible
? '/static/assets/modules/auth/transparent/a01-icon-eye-open-v1.png'
: '/static/assets/modules/auth/transparent/a01-icon-eye-closed-pupil-v2.png'
"
mode="aspectFit"
/>
</view>
</view>
<view v-else class="input-row">
<image class="input-icon input-icon--sms" src="/static/assets/modules/auth/transparent/a01-icon-sms-code-v2.png" mode="aspectFit" />
<input v-model.trim="verificationCode" class="auth-input" type="number" maxlength="6" placeholder="短信验证码" placeholder-class="input-placeholder" confirm-type="done" @confirm="submitLogin" />
<view class="get-code" hover-class="tap-fade" @click="prepareGetCode">获取验证码</view>
<image
class="input-icon input-icon--sms"
src="/static/assets/modules/auth/transparent/a01-icon-sms-code-v2.png"
mode="aspectFit"
/>
<input
v-model.trim="verificationCode"
class="auth-input"
type="number"
maxlength="6"
placeholder="短信验证码"
placeholder-class="input-placeholder"
confirm-type="done"
@confirm="submitLogin"
/>
<view
class="get-code"
hover-class="tap-fade"
@click="prepareGetCode"
>获取验证码</view
>
</view>
<view class="form-secondary-row">
<view v-if="activeLoginMethod === 'password'" class="forgot-password" hover-class="tap-fade" @click="prepareForgotPassword">忘记密码</view>
<view
v-if="activeLoginMethod === 'password'"
class="forgot-password"
hover-class="tap-fade"
@click="prepareForgotPassword"
>忘记密码</view
>
</view>
</view>
<view class="login-submit" hover-class="button-pressed" @click="submitLogin">
<image class="button-skin" src="/static/assets/foundation/transparent/a01-scroll-primary-v3.png" mode="aspectFit" />
<view
class="login-submit"
hover-class="button-pressed"
@click="submitLogin"
>
<image
class="button-skin"
src="/static/assets/foundation/transparent/a01-scroll-primary-v3.png"
mode="aspectFit"
/>
<text class="login-submit__copy">登录</text>
</view>
<view class="other-login-divider">
<view class="divider-line" />
<image class="divider-knot" src="/static/assets/foundation/transparent/auth-divider-knot.png" mode="aspectFit" />
<image
class="divider-knot"
src="/static/assets/foundation/transparent/auth-divider-knot.png"
mode="aspectFit"
/>
<text>其他登录方式</text>
<image class="divider-knot divider-knot--right" src="/static/assets/foundation/transparent/auth-divider-knot.png" mode="aspectFit" />
<image
class="divider-knot divider-knot--right"
src="/static/assets/foundation/transparent/auth-divider-knot.png"
mode="aspectFit"
/>
<view class="divider-line" />
</view>
<view class="wechat-login" hover-class="button-pressed" @click="prepareWechatLogin">
<image class="button-skin" src="/static/assets/foundation/transparent/a01-scroll-secondary-v3.png" mode="aspectFit" />
<view
class="wechat-login"
hover-class="button-pressed"
@click="prepareWechatLogin"
>
<image
class="button-skin"
src="/static/assets/foundation/transparent/a01-scroll-secondary-v3.png"
mode="aspectFit"
/>
<view class="wechat-login__content">
<image class="wechat-icon" src="/static/assets/foundation/transparent/auth-wechat.png" mode="aspectFit" />
<image
class="wechat-icon"
src="/static/assets/foundation/transparent/auth-wechat.png"
mode="aspectFit"
/>
<text>微信登录</text>
</view>
</view>
<view class="register-entry">
<text>还没有账号</text>
<view class="register-link" hover-class="tap-fade" @click="prepareRegister">注册账号</view>
<view
class="register-link"
hover-class="tap-fade"
@click="prepareRegister"
>注册账号</view
>
</view>
<view class="agreement-area" :class="{ 'agreement-area--error': agreementError }">
<view
class="agreement-area"
:class="{ 'agreement-area--error': agreementError }"
>
<view class="agreement-row" @click="toggleAgreement">
<image class="agreement-icon" :src="agreed ? '/static/assets/modules/auth/transparent/a02-agreement-checked.png' : '/static/assets/modules/auth/transparent/a02-agreement-unchecked.png'" mode="aspectFit" />
<image
class="agreement-icon"
:src="
agreed
? '/static/assets/modules/auth/transparent/a02-agreement-checked.png'
: '/static/assets/modules/auth/transparent/a02-agreement-unchecked.png'
"
mode="aspectFit"
/>
<view class="agreement-copy">
<text>我已阅读并同意</text>
<text class="agreement-link" @click.stop="prepareAgreement">用户协议</text>
<text class="agreement-link" @click.stop="prepareAgreement"
>用户协议</text
>
<text></text>
<text class="agreement-link" @click.stop="prepareAgreement">隐私政策</text>
<text class="agreement-link" @click.stop="prepareAgreement"
>隐私政策</text
>
</view>
</view>
<text v-if="agreementError" class="agreement-error">请先阅读并同意用户协议与隐私政策</text>
<text v-if="agreementError" class="agreement-error"
>请先阅读并同意用户协议与隐私政策</text
>
</view>
</view>
</view>
<!-- 当前只验收自定义容器外观真实行为验证数据留到接口阶段接入 -->
<view v-if="verificationVisible" class="verification-layer" @click="closeVerification">
<view
v-if="verificationVisible"
class="verification-layer"
@click="closeVerification"
>
<view class="verification-dialog" @click.stop>
<image class="verification-dialog__skin" src="/static/assets/modules/auth/transparent/a01-scroll-dialog-v3.png" mode="aspectFit" />
<image
class="verification-dialog__skin"
src="/static/assets/modules/auth/transparent/a01-scroll-dialog-v3.png"
mode="aspectFit"
/>
<view class="verification-dialog__content">
<text class="verification-title">安全验证</text>
<text class="verification-copy">{{ verificationPurpose }}前需要完成行为验证</text>
<text class="verification-copy"
>{{ verificationPurpose }}前需要完成行为验证</text
>
<text class="verification-note">验证数据将在接口接入后启用</text>
<view class="verification-actions">
<view class="verification-action" hover-class="tap-fade" @click="closeVerification">取消</view>
<view class="verification-action verification-action--primary" hover-class="tap-fade" @click="confirmVerification">知道了</view>
<view
class="verification-action"
hover-class="tap-fade"
@click="closeVerification"
>取消</view
>
<view
class="verification-action verification-action--primary"
hover-class="tap-fade"
@click="confirmVerification"
>知道了</view
>
</view>
</view>
</view>
@@ -105,111 +260,116 @@
</template>
<script setup>
import { ref } from 'vue'
import { onLoad, onUnload } from '@dcloudio/uni-app'
import { ref } from "vue";
import { onLoad, onUnload } from "@dcloudio/uni-app";
const LOGIN_METHOD_STORAGE_KEY = 'a01:last-login-method'
const activeLoginMethod = ref('password')
const passwordVisible = ref(false)
const phone = ref('')
const password = ref('')
const verificationCode = ref('')
const agreed = ref(false)
const agreementError = ref(false)
const verificationVisible = ref(false)
const verificationPurpose = ref('登录')
const feedbackVisible = ref(false)
const feedbackMessage = ref('')
let feedbackTimer = null
const LOGIN_METHOD_STORAGE_KEY = "a01:last-login-method";
const activeLoginMethod = ref("password");
const passwordVisible = ref(false);
const phone = ref("");
const password = ref("");
const verificationCode = ref("");
const agreed = ref(false);
const agreementError = ref(false);
const verificationVisible = ref(false);
const verificationPurpose = ref("登录");
const feedbackVisible = ref(false);
const feedbackMessage = ref("");
let feedbackTimer = null;
onLoad(() => {
const storedMethod = uni.getStorageSync(LOGIN_METHOD_STORAGE_KEY)
if (storedMethod === 'sms') activeLoginMethod.value = 'sms'
})
const storedMethod = uni.getStorageSync(LOGIN_METHOD_STORAGE_KEY);
if (storedMethod === "sms") activeLoginMethod.value = "sms";
});
onUnload(() => {
if (feedbackTimer) clearTimeout(feedbackTimer)
})
if (feedbackTimer) clearTimeout(feedbackTimer);
});
const showFeedback = (message) => {
feedbackMessage.value = message
feedbackVisible.value = true
if (feedbackTimer) clearTimeout(feedbackTimer)
feedbackMessage.value = message;
feedbackVisible.value = true;
if (feedbackTimer) clearTimeout(feedbackTimer);
feedbackTimer = setTimeout(() => {
feedbackVisible.value = false
feedbackTimer = null
}, 2200)
}
feedbackVisible.value = false;
feedbackTimer = null;
}, 2200);
};
const switchLoginMethod = (method) => {
if (method !== 'password' && method !== 'sms') return
activeLoginMethod.value = method
uni.setStorageSync(LOGIN_METHOD_STORAGE_KEY, method)
}
if (method !== "password" && method !== "sms") return;
activeLoginMethod.value = method;
uni.setStorageSync(LOGIN_METHOD_STORAGE_KEY, method);
};
const togglePasswordVisibility = () => {
passwordVisible.value = !passwordVisible.value
}
passwordVisible.value = !passwordVisible.value;
};
const toggleAgreement = () => {
agreed.value = !agreed.value
if (agreed.value) agreementError.value = false
}
agreed.value = !agreed.value;
if (agreed.value) agreementError.value = false;
};
const validatePhone = () => {
if (/^1\d{10}$/.test(phone.value)) return true
showFeedback('请输入正确的手机号')
return false
}
if (/^1\d{10}$/.test(phone.value)) return true;
showFeedback("请输入正确的手机号");
return false;
};
const requireAgreement = () => {
if (agreed.value) return true
agreementError.value = true
return false
}
if (agreed.value) return true;
agreementError.value = true;
return false;
};
const openVerification = (purpose) => {
verificationPurpose.value = purpose
verificationVisible.value = true
}
verificationPurpose.value = purpose;
verificationVisible.value = true;
};
const closeVerification = () => {
verificationVisible.value = false
}
verificationVisible.value = false;
};
const confirmVerification = () => {
closeVerification()
showFeedback('行为验证接口待接入')
}
closeVerification();
showFeedback("行为验证接口待接入");
};
const prepareGetCode = () => {
if (!validatePhone() || !requireAgreement()) return
openVerification('发送验证码')
}
if (!validatePhone() || !requireAgreement()) return;
openVerification("发送验证码");
};
const submitLogin = () => {
if (!validatePhone()) return
if (activeLoginMethod.value === 'password' && !password.value) {
showFeedback('请输入密码')
return
if (!validatePhone()) return;
if (activeLoginMethod.value === "password" && !password.value) {
showFeedback("请输入密码");
return;
}
if (activeLoginMethod.value === 'sms' && !/^\d{6}$/.test(verificationCode.value)) {
showFeedback('请输入 6 位验证码')
return
if (
activeLoginMethod.value === "sms" &&
!/^\d{6}$/.test(verificationCode.value)
) {
showFeedback("请输入 6 位验证码");
return;
}
if (!requireAgreement()) return
openVerification('登录')
}
if (!requireAgreement()) return;
openVerification("登录");
};
const prepareForgotPassword = () => uni.navigateTo({ url: '/pages/auth/a05-reset-password' })
const prepareRegister = () => uni.navigateTo({ url: '/pages/auth/a04-register' })
const prepareForgotPassword = () =>
uni.navigateTo({ url: "/pages/auth/a05-reset-password" });
const prepareRegister = () =>
uni.navigateTo({ url: "/pages/auth/a04-register" });
const prepareWechatLogin = () => {
if (!requireAgreement()) return
showFeedback('微信登录功能准备中')
}
if (!requireAgreement()) return;
showFeedback("微信登录功能准备中");
};
const prepareAgreement = () => showFeedback('协议页面准备中')
const prepareAgreement = () => showFeedback("协议页面准备中");
</script>
<style scoped lang="scss">
@@ -310,7 +470,7 @@ const prepareAgreement = () => showFeedback('协议页面准备中')
width: 1rpx;
height: 36rpx;
background: rgba(176, 120, 52, 0.58);
content: '';
content: "";
transform: translateY(-50%);
}
@@ -327,10 +487,12 @@ const prepareAgreement = () => showFeedback('协议页面准备中')
height: 5rpx;
border-radius: 5rpx;
background: #ad160d;
content: '';
content: "";
}
.form-content { margin-top: 10rpx; }
.form-content {
margin-top: 10rpx;
}
.input-row {
display: flex;
@@ -349,7 +511,9 @@ const prepareAgreement = () => showFeedback('协议页面准备中')
transform: translateX(-12rpx);
}
.input-icon--sms { transform: translateX(-12rpx) scale(1.45); }
.input-icon--sms {
transform: translateX(-12rpx) scale(1.45);
}
.auth-input {
flex: 1;
@@ -359,7 +523,9 @@ const prepareAgreement = () => showFeedback('协议页面准备中')
font-size: 40rpx;
}
.input-placeholder { color: #9f968d; }
.input-placeholder {
color: #9f968d;
}
.password-toggle {
display: flex;
@@ -411,7 +577,9 @@ const prepareAgreement = () => showFeedback('协议页面准备中')
overflow: hidden;
}
.login-submit { height: 92rpx; }
.login-submit {
height: 92rpx;
}
.button-skin {
position: absolute;
@@ -524,7 +692,9 @@ const prepareAgreement = () => showFeedback('协议页面准备中')
white-space: nowrap;
}
.agreement-link { color: #a9160d; }
.agreement-link {
color: #a9160d;
}
.agreement-error {
display: block;
@@ -539,13 +709,24 @@ const prepareAgreement = () => showFeedback('协议页面准备中')
}
@keyframes agreement-shake {
0%, 100% { transform: translateX(0); }
33% { transform: translateX(-8rpx); }
66% { transform: translateX(8rpx); }
0%,
100% {
transform: translateX(0);
}
33% {
transform: translateX(-8rpx);
}
66% {
transform: translateX(8rpx);
}
}
.tap-fade { opacity: 0.62; }
.button-pressed { opacity: 0.82; }
.tap-fade {
opacity: 0.62;
}
.button-pressed {
opacity: 0.82;
}
.feedback-toast {
position: fixed;
@@ -560,7 +741,7 @@ const prepareAgreement = () => showFeedback('协议页面准备中')
min-height: 82rpx;
border: 16rpx solid transparent;
border-width: 16rpx 74rpx;
border-image-source: url('/static/assets/foundation/transparent/a01-scroll-toast-v3.png');
border-image-source: url("/static/assets/foundation/transparent/a01-scroll-toast-v3.png");
border-image-slice: 58 280 fill;
border-image-width: 16rpx 74rpx;
border-image-repeat: stretch;
@@ -651,5 +832,4 @@ const prepareAgreement = () => showFeedback('协议页面准备中')
color: #a9160d;
font-weight: 700;
}
</style>