feat: add static A01 A02 auth UI

This commit is contained in:
rain
2026-07-13 14:31:19 +08:00
parent 89dd20cec0
commit 134ae75c2b
8 changed files with 708 additions and 84 deletions
+304
View File
@@ -0,0 +1,304 @@
<template>
<view class="auth-page entry-page">
<image class="paper-background" src="/static/assets/backgrounds/auth-rice-paper-v1.jpg" mode="aspectFill" />
<image class="scenery-background" src="/static/assets/backgrounds/auth-ink-scenery-v1.png" mode="aspectFill" />
<view class="auth-content">
<view class="auth-header">
<image class="header-background" src="/static/assets/backgrounds/auth-ancestral-header-v1.png" mode="aspectFill" />
<image class="header-seal" src="/static/assets/icons/brand/jiapu-seal-logo-header.png" mode="aspectFit" />
</view>
<view class="brand-intro">
<view class="title-decoration">
<view class="cloud cloud-left" />
<text class="brand-title">家谱</text>
<view class="cloud cloud-right" />
</view>
<view class="gold-divider"><view class="divider-knot"></view></view>
<text class="brand-subtitle">为家族留存可传承的记忆</text>
<view class="gold-divider"><view class="divider-knot"></view></view>
</view>
<view class="entry-actions">
<view class="auth-button primary-button" hover-class="button-hover" @click="openAccountLogin">
<image class="button-icon" src="/static/assets/icons/auth/login-outline-v1.png" mode="aspectFit" />
<text>账号密码登录</text>
</view>
<view class="auth-button secondary-button" hover-class="button-hover" @click="prepareWechatLogin">
<image class="button-icon wechat-icon" src="/static/assets/icons/auth/wechat-licensed-v1.png" mode="aspectFit" />
<text>微信登录</text>
</view>
<view class="register-link" hover-class="link-hover" @click="prepareRegister">
<view class="link-line" />
<text>还没有账号注册账号</text>
<view class="link-line" />
</view>
</view>
<view class="agreement-row" @click="toggleAgreement">
<view class="agreement-check" :class="{ checked: agreed }">
<text v-if="agreed"></text>
</view>
<view class="agreement-copy">
<text>我已阅读并同意</text>
<text class="agreement-link" @click.stop="prepareAgreement">家谱用户协议</text>
<text></text>
<text class="agreement-link" @click.stop="prepareAgreement">隐私政策</text>
</view>
</view>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue'
const agreed = ref(false)
const toggleAgreement = () => {
agreed.value = !agreed.value
}
const requireAgreement = () => {
if (agreed.value) return true
uni.showToast({ title: '请先阅读并同意相关协议', icon: 'none' })
return false
}
const openAccountLogin = () => {
if (!requireAgreement()) return
uni.navigateTo({ url: '/pages/auth/login?agreed=1' })
}
const prepareWechatLogin = () => {
if (!requireAgreement()) return
uni.showToast({ title: '微信登录功能准备中', icon: 'none' })
}
const prepareRegister = () => {
if (!requireAgreement()) return
uni.showToast({ title: '注册页面准备中', icon: 'none' })
}
const prepareAgreement = () => {
uni.showToast({ title: '协议页面准备中', icon: 'none' })
}
</script>
<style scoped lang="scss">
.auth-page {
position: relative;
min-height: 100vh;
background: #f7f1e6;
}
.paper-background,
.scenery-background {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
}
.paper-background { opacity: 0.96; }
.scenery-background { opacity: 0.82; }
.auth-content {
position: relative;
z-index: 1;
display: flex;
flex-direction: column;
box-sizing: border-box;
min-height: 100vh;
padding-bottom: calc(44rpx + env(safe-area-inset-bottom));
}
.auth-header {
position: relative;
height: 196rpx;
overflow: hidden;
}
.header-background {
width: 100%;
height: 100%;
}
.header-seal {
position: absolute;
top: 34rpx;
left: 50%;
width: 124rpx;
height: 124rpx;
transform: translateX(-50%);
}
.brand-intro {
display: flex;
flex-direction: column;
align-items: center;
padding: 118rpx 56rpx 0;
color: #3f2c1d;
}
.title-decoration {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
}
.brand-title {
margin: 0 22rpx;
font-family: STKaiti, KaiTi, serif;
font-size: 96rpx;
font-weight: 700;
letter-spacing: 12rpx;
line-height: 1;
}
.cloud {
position: relative;
width: 54rpx;
height: 24rpx;
border: 3rpx solid #dca34d;
border-top: 0;
border-radius: 0 0 26rpx 26rpx;
}
.cloud::before,
.cloud::after {
position: absolute;
bottom: -3rpx;
width: 22rpx;
height: 22rpx;
border: 3rpx solid #dca34d;
border-bottom: 0;
border-radius: 50% 50% 0 0;
content: '';
}
.cloud::before { left: 5rpx; }
.cloud::after { right: 5rpx; }
.cloud-right { transform: scaleX(-1); }
.gold-divider {
display: flex;
align-items: center;
justify-content: center;
width: 460rpx;
height: 1rpx;
margin: 30rpx 0;
background: #d5a34f;
}
.divider-knot {
padding: 0 14rpx;
color: #d5a34f;
background: #f8f2e9;
font-size: 32rpx;
line-height: 1;
}
.brand-subtitle {
color: #624631;
font-family: STKaiti, KaiTi, serif;
font-size: 32rpx;
letter-spacing: 4rpx;
}
.entry-actions {
margin: 130rpx 56rpx 0;
}
.auth-button {
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
width: 100%;
height: 108rpx;
border: 2rpx solid #d8ad63;
border-radius: 8rpx;
font-family: STKaiti, KaiTi, serif;
font-size: 36rpx;
letter-spacing: 3rpx;
}
.primary-button {
border-color: #9e170e;
background: #b7170d;
box-shadow: inset 0 0 0 4rpx #d69b5f;
color: #fffaf0;
}
.secondary-button {
margin-top: 30rpx;
background: rgba(255, 252, 245, 0.82);
box-shadow: inset 0 0 0 3rpx rgba(229, 190, 133, 0.45);
color: #60442f;
}
.button-icon {
width: 48rpx;
height: 48rpx;
margin-right: 24rpx;
}
.wechat-icon { width: 52rpx; }
.button-hover { opacity: 0.84; }
.register-link {
display: flex;
align-items: center;
justify-content: center;
margin-top: 66rpx;
color: #60442f;
font-family: STKaiti, KaiTi, serif;
font-size: 30rpx;
letter-spacing: 2rpx;
}
.link-line {
width: 74rpx;
height: 1rpx;
margin: 0 20rpx;
background: #d5a34f;
}
.link-hover { opacity: 0.65; }
.agreement-row {
display: flex;
align-items: flex-start;
justify-content: center;
margin-top: auto;
padding: 64rpx 44rpx 0;
color: #6b5a4a;
font-size: 24rpx;
line-height: 1.7;
}
.agreement-check {
display: flex;
flex: 0 0 auto;
align-items: center;
justify-content: center;
box-sizing: border-box;
width: 28rpx;
height: 28rpx;
margin: 7rpx 12rpx 0 0;
border: 2rpx solid #b88d4b;
border-radius: 50%;
color: #fffaf0;
font-size: 20rpx;
line-height: 1;
}
.agreement-check.checked { background: #b7170d; border-color: #b7170d; }
.agreement-copy { text-align: center; }
.agreement-link { color: #b7170d; }
</style>
+297 -62
View File
@@ -1,84 +1,319 @@
<template>
<view class="page-shell login-page">
<view class="ceremony-top">
<text class="seal-word"></text>
<text class="eyebrow">家脉绵延 · 生生不息</text>
<text class="brand-title">家谱</text>
<text class="brand-subtitle">为家族留存可传承的记忆</text>
</view>
<view class="auth-page login-page">
<image class="paper-background" src="/static/assets/backgrounds/auth-rice-paper-v1.jpg" mode="aspectFill" />
<image class="scenery-background" src="/static/assets/backgrounds/auth-ink-scenery-v1.png" mode="aspectFill" />
<view class="login-paper">
<view class="section-title">登录家谱</view>
<text class="form-note">使用已注册手机号和密码登录</text>
<text class="form-label">手机号</text>
<input v-model="phone" class="line-input" type="number" maxlength="11" placeholder="请输入手机号" placeholder-class="placeholder" />
<text class="form-label">密码</text>
<input v-model="password" class="line-input" password placeholder="请输入密码" placeholder-class="placeholder" />
<text v-if="errorMessage" class="error-message">{{ errorMessage }}</text>
<button class="primary-button login-button" :loading="isSubmitting" :disabled="isSubmitting" @click="login">进入家谱</button>
<text class="login-tip">短信登录将在验证码服务联调后开放</text>
<text class="terms">登录即表示同意用户协议隐私政策</text>
<view class="auth-content">
<view class="auth-header">
<image class="header-background" src="/static/assets/backgrounds/auth-ancestral-header-v1.png" mode="aspectFill" />
<image class="header-seal" src="/static/assets/icons/brand/jiapu-seal-logo-header.png" mode="aspectFit" />
</view>
<view class="login-panel">
<view class="page-heading">
<view class="back-button" hover-class="back-hover" @click="goBack"></view>
<view>
<text class="page-title">登录家谱</text>
<text class="page-subtitle">欢迎回到家族记忆</text>
</view>
</view>
<view class="login-tabs">
<view class="login-tab" :class="{ active: activeTab === 'password' }" @click="activeTab = 'password'">
<text>账号密码登录</text>
</view>
<view class="login-tab" :class="{ active: activeTab === 'sms' }" @click="activeTab = 'sms'">
<text>手机验证码登录</text>
</view>
</view>
<view v-if="activeTab === 'password'" class="form-content">
<view class="input-row">
<text class="input-label">账号</text>
<input v-model.trim="account" class="auth-input" placeholder="请输入账号或手机号" placeholder-class="placeholder" />
</view>
<view class="input-row">
<text class="input-label">密码</text>
<input v-model="password" class="auth-input" password placeholder="请输入密码" placeholder-class="placeholder" />
</view>
<view class="secondary-action" hover-class="text-hover" @click="prepareForgotPassword">忘记密码</view>
</view>
<view v-else class="form-content">
<view class="input-row">
<text class="input-label">手机</text>
<input v-model.trim="smsPhone" class="auth-input" type="number" maxlength="11" placeholder="请输入手机号" placeholder-class="placeholder" />
</view>
<view class="input-row code-row">
<text class="input-label">验证码</text>
<input v-model.trim="verificationCode" class="auth-input" type="number" maxlength="6" placeholder="请输入验证码" placeholder-class="placeholder" />
<view class="get-code" hover-class="text-hover" @click="prepareGetCode">获取验证码</view>
</view>
</view>
<view class="login-submit" hover-class="button-hover" @click="submitLogin">登录</view>
<text class="agreement-reminder">请先在登录引导页阅读并确认协议</text>
</view>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue'
import { appApi } from '@/utils/api.js'
import { calcMD5 } from '@/utils/md5.js'
import { onLoad } from '@dcloudio/uni-app'
const phone = ref('')
const activeTab = ref('password')
const account = ref('')
const password = ref('')
const isSubmitting = ref(false)
const errorMessage = ref('')
const smsPhone = ref('')
const verificationCode = ref('')
const agreedFromEntry = ref(false)
const login = async () => {
if (!/^1\d{10}$/.test(phone.value)) {
uni.showToast({ title: '请输入正确手机号', icon: 'none' })
return
}
if (!password.value) {
uni.showToast({ title: '请输入登录密码', icon: 'none' })
return
onLoad((options) => {
agreedFromEntry.value = options?.agreed === '1'
})
const goBack = () => {
uni.navigateBack()
}
const prepareForgotPassword = () => {
uni.showToast({ title: '忘记密码页面准备中', icon: 'none' })
}
const prepareGetCode = () => {
uni.showToast({ title: '获取验证码功能待接入', icon: 'none' })
}
const canSubmit = () => {
if (agreedFromEntry.value) return true
uni.showToast({ title: '请先返回登录引导确认协议', icon: 'none' })
return false
}
const submitLogin = () => {
if (!canSubmit()) return
if (activeTab.value === 'password') {
if (!account.value) {
uni.showToast({ title: '请输入账号或手机号', icon: 'none' })
return
}
if (!password.value) {
uni.showToast({ title: '请输入密码', icon: 'none' })
return
}
} else {
if (!/^1\d{10}$/.test(smsPhone.value)) {
uni.showToast({ title: '请输入正确手机号', icon: 'none' })
return
}
if (!verificationCode.value) {
uni.showToast({ title: '请输入验证码', icon: 'none' })
return
}
}
isSubmitting.value = true
errorMessage.value = ''
try {
await appApi.loginWithPassword({ phone: phone.value, passwordHash: calcMD5(password.value) })
uni.reLaunch({ url: '/pages/genealogy/index' })
} catch (error) {
errorMessage.value = error.message || '登录失败,请稍后重试'
} finally {
isSubmitting.value = false
}
uni.showToast({ title: '登录接口待接入', icon: 'none' })
}
</script>
<style scoped lang="scss">
.login-page { padding-top: 108rpx; }
.ceremony-top {
display: flex;
flex-direction: column;
align-items: center;
padding: 40rpx 40rpx 76rpx;
background: $brand-red;
color: #fff9ed;
.auth-page {
position: relative;
min-height: 100vh;
background: #f7f1e6;
}
.seal-word { display: flex; width: 66rpx; height: 66rpx; align-items: center; justify-content: center; box-sizing: border-box; border: 2rpx solid #f1d494; border-radius: 50%; color: #f5ddaa; font-family: serif; font-size: 37rpx; }
.eyebrow { margin-top: 24rpx; color: #f8dfad; font-size: 22rpx; letter-spacing: 5rpx; }
.brand-title { margin-top: 24rpx; font-family: serif; font-size: 68rpx; font-weight: 700; letter-spacing: 16rpx; }
.brand-subtitle { margin-top: 18rpx; color: #f5deae; font-size: 26rpx; letter-spacing: 3rpx; }
.paper-background,
.scenery-background {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
}
.paper-background { opacity: 0.96; }
.scenery-background { opacity: 0.76; }
.auth-content {
position: relative;
z-index: 1;
box-sizing: border-box;
min-height: 100vh;
padding-bottom: calc(44rpx + env(safe-area-inset-bottom));
}
.auth-header {
position: relative;
height: 196rpx;
overflow: hidden;
}
.header-background {
width: 100%;
height: 100%;
}
.header-seal {
position: absolute;
top: 34rpx;
left: 50%;
width: 124rpx;
height: 124rpx;
transform: translateX(-50%);
}
.login-panel {
margin: 68rpx 56rpx 0;
padding: 46rpx 38rpx 54rpx;
border: 2rpx solid #d6ad6c;
border-radius: 10rpx;
background: rgba(255, 252, 246, 0.78);
box-shadow: inset 0 0 0 5rpx rgba(255, 255, 255, 0.55);
}
.page-heading {
display: flex;
align-items: center;
}
.back-button {
display: flex;
align-items: center;
justify-content: center;
width: 48rpx;
height: 48rpx;
margin-right: 20rpx;
border: 1rpx solid #d7ae70;
border-radius: 50%;
color: #9d5b28;
font-size: 52rpx;
font-weight: 300;
line-height: 40rpx;
}
.back-hover { opacity: 0.62; }
.page-title,
.page-subtitle {
display: block;
}
.page-title {
color: #3f2c1d;
font-family: STKaiti, KaiTi, serif;
font-size: 46rpx;
font-weight: 700;
letter-spacing: 4rpx;
}
.page-subtitle {
margin-top: 8rpx;
color: #8c7864;
font-size: 22rpx;
letter-spacing: 2rpx;
}
.login-tabs {
display: flex;
margin-top: 54rpx;
border-bottom: 1rpx solid #dcc29a;
}
.login-tab {
position: relative;
flex: 1;
padding: 0 0 24rpx;
color: #89715a;
font-family: STKaiti, KaiTi, serif;
font-size: 29rpx;
text-align: center;
}
.login-tab.active {
color: #a7160c;
font-weight: 700;
}
.login-tab.active::after {
position: absolute;
right: 28rpx;
bottom: -1rpx;
left: 28rpx;
height: 4rpx;
border-radius: 4rpx;
background: #b7170d;
content: '';
}
.form-content { margin-top: 26rpx; }
.input-row {
display: flex;
align-items: center;
min-height: 96rpx;
border-bottom: 1rpx solid #e5d4b7;
}
.input-label {
width: 92rpx;
color: #674b35;
font-family: STKaiti, KaiTi, serif;
font-size: 30rpx;
}
.auth-input {
flex: 1;
height: 88rpx;
color: #3f2c1d;
font-size: 28rpx;
}
.login-paper { margin: -28rpx 28rpx 0; padding: 48rpx 42rpx; border: 1rpx solid $gold-soft; border-radius: 24rpx; background: $paper-white; }
.form-note { display: block; margin-top: 14rpx; color: $ink-muted; font-size: 23rpx; }
.form-label { display: block; margin-top: 40rpx; color: $ink-muted; font-size: 25rpx; }
.line-input { height: 78rpx; border-bottom: 1rpx solid $gold-soft; color: $ink; font-size: 30rpx; }
.placeholder { color: #b3a895; }
.error-message { display: block; margin-top: 22rpx; color: $brand-red; font-size: 23rpx; line-height: 1.5; }
.login-button { margin-top: 48rpx; }
.login-tip { display: block; margin-top: 24rpx; color: $ink-muted; font-size: 22rpx; text-align: center; }
.terms { display: block; margin-top: 16rpx; color: #a39785; font-size: 21rpx; text-align: center; }
.code-row .auth-input { min-width: 0; }
.get-code {
flex: 0 0 auto;
padding-left: 20rpx;
border-left: 1rpx solid #ddc7a3;
color: #a7160c;
font-size: 25rpx;
}
.secondary-action {
margin-top: 28rpx;
color: #a7160c;
font-size: 25rpx;
text-align: right;
}
.text-hover { opacity: 0.64; }
.login-submit {
display: flex;
align-items: center;
justify-content: center;
height: 100rpx;
margin-top: 60rpx;
border: 2rpx solid #9e170e;
border-radius: 8rpx;
background: #b7170d;
box-shadow: inset 0 0 0 4rpx #d69b5f;
color: #fffaf0;
font-family: STKaiti, KaiTi, serif;
font-size: 36rpx;
letter-spacing: 6rpx;
}
.button-hover { opacity: 0.84; }
.agreement-reminder {
display: block;
margin-top: 26rpx;
color: #9a8773;
font-size: 22rpx;
text-align: center;
}
</style>