feat:登录页面

This commit is contained in:
李伊帆
2026-09-09 14:08:40 +08:00
parent 4a0cd543af
commit f44e6ce1a1
40 changed files with 3031 additions and 11 deletions

View File

@@ -0,0 +1,273 @@
<script setup lang="ts">
import { ref } from 'vue'
import { navigateToResultPage } from '@/utils/navigate-result'
import CodeInput from './components/CodeInput.vue'
import ForgotInput from './components/ForgotInput.vue'
import PasswordField from './components/PasswordField.vue'
const phone = ref('')
const code = ref('')
const newPassword = ref('')
const confirmPassword = ref('')
const agreed = ref(false)
function toggleAgreed() {
agreed.value = !agreed.value
}
function handleSubmit() {
if (!agreed.value) {
uni.showToast({ title: '请先同意用户协议', icon: 'none' })
return
}
if (!phone.value || !code.value || !newPassword.value || !confirmPassword.value) {
uni.showToast({ title: '请填写完整信息', icon: 'none' })
return
}
if (newPassword.value !== confirmPassword.value) {
uni.showToast({ title: '两次密码输入不一致', icon: 'none' })
return
}
navigateToResultPage('resetPassword')
}
function handleLogin() {
uni.navigateBack()
}
function handleUserAgreement() {
uni.navigateTo({
url: '/pages/Login/user-agreement/index',
})
}
</script>
<template>
<view class="forgot-page">
<view class="forgot-page__header">
<text class="forgot-page__title">
找回密码
</text>
<text class="forgot-page__subtitle">
使用手机号重新设置您的密码
</text>
</view>
<view class="forgot-page__form">
<view class="forgot-page__field">
<ForgotInput
v-model="phone"
placeholder="请输入手机号"
input-type="number"
/>
</view>
<view class="forgot-page__field">
<CodeInput v-model="code" />
</view>
<view class="forgot-page__field">
<PasswordField
v-model="newPassword"
placeholder="请输入新密码"
/>
</view>
<view class="forgot-page__field">
<PasswordField
v-model="confirmPassword"
placeholder="请再次输入新密码"
/>
</view>
<view
class="forgot-page__agreement"
@tap="toggleAgreed"
>
<view
class="forgot-page__checkbox"
:class="{ 'forgot-page__checkbox--checked': agreed }"
>
<text
v-if="agreed"
class="forgot-page__checkmark"
>
✓
</text>
</view>
<view class="forgot-page__agreement-text">
<text class="forgot-page__agreement-normal">
我已阅读并同意
</text>
<text
class="forgot-page__agreement-link"
@tap.stop="handleUserAgreement"
>
用户协议
</text>
<text class="forgot-page__agreement-normal">
和
</text>
<text class="forgot-page__agreement-link">
隐私政策
</text>
<text class="forgot-page__agreement-normal">
以及
</text>
<text class="forgot-page__agreement-link">
定制条款
</text>
</view>
</view>
<button
class="forgot-page__submit"
@tap="handleSubmit"
>
确认修改
</button>
</view>
<view class="forgot-page__footer">
<text class="forgot-page__footer-normal">
已有账号?
</text>
<text
class="forgot-page__footer-link"
@tap="handleLogin"
>
立即登录
</text>
</view>
</view>
</template>
<style scoped lang="scss">
@import '@/styles/variables.scss';
.forgot-page {
display: flex;
flex-direction: column;
min-height: 100vh;
padding: 0 64rpx;
background: $color-bg-page;
}
.forgot-page__header {
padding-top: 120rpx;
text-align: center;
}
.forgot-page__title {
display: block;
font-size: 56rpx;
font-weight: 700;
color: $color-text-primary;
letter-spacing: 2rpx;
}
.forgot-page__subtitle {
display: block;
margin-top: 16rpx;
font-size: 28rpx;
font-weight: 400;
color: $color-text-secondary;
}
.forgot-page__form {
width: 100%;
margin-top: 80rpx;
box-sizing: border-box;
}
.forgot-page__field {
width: 100%;
margin-top: 24rpx;
box-sizing: border-box;
}
.forgot-page__agreement {
display: flex;
align-items: flex-start;
margin-top: 32rpx;
}
.forgot-page__checkbox {
display: flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
width: 32rpx;
height: 32rpx;
margin-top: 4rpx;
margin-right: 12rpx;
border: 2rpx solid #cccccc;
border-radius: 50%;
transition: all 0.2s;
&--checked {
background: $color-primary;
border-color: $color-primary;
}
}
.forgot-page__checkmark {
font-size: 20rpx;
font-weight: 700;
color: #ffffff;
line-height: 1;
}
.forgot-page__agreement-text {
flex: 1;
font-size: 24rpx;
line-height: 1.6;
}
.forgot-page__agreement-normal {
color: $color-text-secondary;
}
.forgot-page__agreement-link {
color: $color-text-link;
}
.forgot-page__submit {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 96rpx;
margin-top: 48rpx;
font-size: 32rpx;
font-weight: 600;
color: #ffffff;
background: $color-primary;
border: none;
border-radius: 48rpx;
line-height: 96rpx;
&::after {
border: none;
}
}
.forgot-page__footer {
display: flex;
align-items: center;
justify-content: center;
margin-top: auto;
padding: 60rpx 0 calc(60rpx + env(safe-area-inset-bottom));
}
.forgot-page__footer-normal {
font-size: 28rpx;
color: $color-text-secondary;
}
.forgot-page__footer-link {
margin-left: 4rpx;
font-size: 28rpx;
color: $color-text-link;
}
</style>