项目正常启动

This commit is contained in:
comlibmb
2026-01-22 08:54:47 +08:00
parent 9eb05253d3
commit 75fad97d5d
28 changed files with 1621 additions and 887 deletions

View File

@@ -1,114 +1,96 @@
<template>
<!-- Single scrollable container for tablet optimization -->
<scroll-view class="register-container" scroll-y="true" show-scrollbar="false"> <!-- Language switch positioned absolutely -->
<view class="language-switch">
<button class="language-btn" @click="toggleLanguage">
{{ currentLocale === 'zh-CN' ? 'EN' : '中' }}
</button>
</view>
<!-- Main content wrapper -->
<view class="content-wrapper">
<!-- Logo and title section -->
<view class="logo-section">
<text class="app-title">Akmon</text>
<text class="page-title">{{ $t('user.register.title') }}</text>
<text class="page-subtitle">{{ $t('user.register.subtitle') }}</text>
</view>
<!-- Form container with all content inside -->
<view class="form-container">
<form @submit="onSubmit">
<!-- Email input -->
<view class="input-group" :class="{ 'input-error': emailError }">
<text class="input-label">{{ $t('user.register.email') }}</text>
<input
class="input-field"
name="email"
type="text"
v-model="email"
:placeholder="$t('user.register.email_placeholder')"
@blur="validateEmail"
/>
<text v-if="emailError" class="error-text">{{ emailError }}</text>
</view>
<!-- Password input -->
<view class="input-group" :class="{ 'input-error': passwordError }">
<text class="input-label">{{ $t('user.register.password') }}</text>
<view class="password-input-container">
<input
class="input-field"
name="password"
:type="showPassword ? 'text' : 'password'"
v-model="password"
:placeholder="$t('user.register.password_placeholder')"
@blur="validatePassword" /> <view class="password-toggle" @click="togglePasswordVisibility">
<text class="toggle-icon">{{ showPassword ? '👁' : '🙈' }}</text>
</view>
</view>
<text v-if="passwordError" class="error-text">{{ passwordError }}</text>
</view>
<!-- Confirm Password input -->
<view class="input-group" :class="{ 'input-error': confirmPasswordError }">
<text class="input-label">{{ $t('user.register.confirm_password') }}</text>
<view class="password-input-container">
<input
class="input-field"
name="confirmPassword"
:type="showConfirmPassword ? 'text' : 'password'"
v-model="confirmPassword"
:placeholder="$t('user.register.confirm_password_placeholder')"
@blur="validateConfirmPassword" /> <view class="password-toggle" @click="toggleConfirmPasswordVisibility">
<text class="toggle-icon">{{ showConfirmPassword ? '👁' : '🙈' }}</text>
</view>
</view>
<text v-if="confirmPasswordError" class="error-text">{{ confirmPasswordError }}</text>
</view>
<!-- Username input (optional) -->
<view class="input-group" :class="{ 'input-error': usernameError }">
<text class="input-label">{{ $t('user.register.username') }}</text>
<input
class="input-field"
name="username"
type="text"
v-model="username"
:placeholder="$t('user.register.username_placeholder')"
@blur="validateUsername"
/>
<text v-if="usernameError" class="error-text">{{ usernameError }}</text>
</view>
<!-- Terms and conditions -->
<view class="checkbox-container" :class="{ 'input-error': termsError }">
<checkbox :checked="agreeTerms" @click="agreeTerms = !agreeTerms" color="#2196f3" />
<view class="terms-text">
<text>{{ $t('user.register.agree_terms_part1') }} </text>
<text class="terms-link" @click="showTerms">{{ $t('user.register.terms_link') }}</text>
<text>{{ $t('user.register.agree_terms_part2') }}</text>
</view>
</view>
<text v-if="termsError" class="error-text terms-error">{{ termsError }}</text>
<!-- Register button -->
<button form-type="submit" class="register-button" :disabled="isLoading" :loading="isLoading">
{{ $t('user.register.button') }}
</button>
<!-- General error message -->
<text v-if="generalError" class="general-error">{{ generalError }}</text>
</form>
<!-- Login option -->
<view class="login-option">
<text class="login-text">{{ $t('user.register.already_account') }}</text>
<text class="login-link" @click="navigateToLogin">{{ $t('user.register.login') }}</text>
</view>
</view>
</view>
</scroll-view>
<view class="page">
<scroll-view class="scroll" scroll-y="true" show-scrollbar="false">
<view class="top-actions">
<button class="lang-btn" @click="toggleLanguage">
{{ currentLocale === 'zh-CN' ? 'EN' : '中' }}
</button>
</view>
<view class="hero">
<view class="brand-row">
<view class="brand-mark"></view>
<view class="brand-text">
<text class="brand-name">Mall</text>
<text class="brand-slogan">注册后默认成为消费者账号</text>
</view>
</view>
<view class="title-block">
<text class="page-title">{{ $t('user.register.title') }}</text>
<text class="page-subtitle">{{ $t('user.register.subtitle') }}</text>
</view>
</view>
<view class="card">
<form @submit="onSubmit">
<view class="field" :class="{ 'field-error': emailError }">
<text class="label">{{ $t('user.register.email') }}</text>
<view class="input-wrap">
<input class="input" name="email" type="text" v-model="email" :placeholder="$t('user.register.email_placeholder')" @blur="validateEmail" />
</view>
<text v-if="emailError" class="support error">{{ emailError }}</text>
</view>
<view class="field" :class="{ 'field-error': passwordError }">
<text class="label">{{ $t('user.register.password') }}</text>
<view class="input-wrap">
<input class="input" name="password" :type="showPassword ? 'text' : 'password'" v-model="password" :placeholder="$t('user.register.password_placeholder')" @blur="validatePassword" />
<view class="suffix" @click="togglePasswordVisibility">
<text class="suffix-text">{{ showPassword ? '隐藏' : '显示' }}</text>
</view>
</view>
<text v-if="passwordError" class="support error">{{ passwordError }}</text>
</view>
<view class="field" :class="{ 'field-error': confirmPasswordError }">
<text class="label">{{ $t('user.register.confirm_password') }}</text>
<view class="input-wrap">
<input class="input" name="confirmPassword" :type="showConfirmPassword ? 'text' : 'password'" v-model="confirmPassword" :placeholder="$t('user.register.confirm_password_placeholder')" @blur="validateConfirmPassword" />
<view class="suffix" @click="toggleConfirmPasswordVisibility">
<text class="suffix-text">{{ showConfirmPassword ? '隐藏' : '显示' }}</text>
</view>
</view>
<text v-if="confirmPasswordError" class="support error">{{ confirmPasswordError }}</text>
</view>
<view class="field" :class="{ 'field-error': usernameError }">
<text class="label">{{ $t('user.register.username') }}</text>
<view class="input-wrap">
<input class="input" name="username" type="text" v-model="username" :placeholder="$t('user.register.username_placeholder')" @blur="validateUsername" />
</view>
<text v-if="usernameError" class="support error">{{ usernameError }}</text>
</view>
<view class="terms" :class="{ 'field-error': termsError }">
<view class="terms-row" @click="agreeTerms = !agreeTerms">
<checkbox :checked="agreeTerms" color="#FF4D4F" />
<view class="terms-text">
<text>{{ $t('user.register.agree_terms_part1') }} </text>
<text class="terms-link" @click="showTerms">{{ $t('user.register.terms_link') }}</text>
<text>{{ $t('user.register.agree_terms_part2') }}</text>
</view>
</view>
<text v-if="termsError" class="support error">{{ termsError }}</text>
</view>
<button form-type="submit" class="primary" :disabled="isLoading" :loading="isLoading">
{{ $t('user.register.button') }}
</button>
<text v-if="generalError" class="support error center">{{ generalError }}</text>
</form>
<view class="footer">
<text class="footer-text">{{ $t('user.register.already_account') }}</text>
<text class="footer-link" @click="navigateToLogin">{{ $t('user.register.login') }}</text>
</view>
</view>
<view class="trust">
<text class="trust-text">注册即代表你同意用户协议与隐私政策</text>
</view>
</scroll-view>
</view>
</template>
<script lang="uts">
@@ -298,337 +280,227 @@ export default {
</script>
<style>
/* Single scrollable container for tablet optimization */
.register-container {
width: 100%; /* #ifdef APP-PLUS */
padding: 20rpx;
/* #endif */
/* #ifndef APP-PLUS */
padding: 40rpx;
/* #endif */
background-color: #f8f9fa;
box-sizing: border-box;
}
.page {
min-height: 100vh;
background: #f7f8fa;
}
/* Content wrapper for centered layout */
.content-wrapper {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
padding-bottom: 40rpx;
/* 确保内容足够高以触发滚动 */
/* #ifdef APP-PLUS */
min-height: 1000rpx;
/* #endif */
/* #ifndef APP-PLUS */
min-height: 1200rpx;
/* #endif */
}
.scroll {
min-height: 100vh;
background: radial-gradient(900rpx 700rpx at 20% 10%, rgba(255, 77, 79, 0.16), rgba(255, 77, 79, 0) 60%),
linear-gradient(180deg, #ffffff 0%, #f7f8fa 45%, #f7f8fa 100%);
}
/* Language switch button - positioned absolutely */
.language-switch {
position: absolute;
/* #ifdef APP*/
top: 30rpx;
right: 50rpx;
/* #endif */
/* #ifndef APP-PLUS */
top: 40rpx;
right: 40rpx;
/* #endif */
z-index: 10;
}
.top-actions {
position: relative;
padding: 24rpx 24rpx 0;
display: flex;
justify-content: flex-end;
}
.language-btn {
/* #ifdef APP-PLUS */
width: 50rpx;
height: 50rpx;
border-radius: 25rpx;
font-size: 18rpx;
/* #endif */
/* #ifndef APP-PLUS */
width: 80rpx;
height: 80rpx;
border-radius: 40rpx;
font-size: 28rpx;
/* #endif */ background-color: rgba(33, 150, 243, 0.8);
color: #fff;
font-weight: normal;
border: 2rpx solid rgba(255, 255, 255, 0.3);
text-align: center;
box-shadow: 0 4rpx 12rpx rgba(33, 150, 243, 0.3);
}
.lang-btn {
width: 76rpx;
height: 76rpx;
border-radius: 38rpx;
background: rgba(255, 255, 255, 0.9);
border: 1rpx solid rgba(0, 0, 0, 0.06);
color: #111;
font-size: 26rpx;
line-height: 76rpx;
text-align: center;
box-shadow: 0 10rpx 24rpx rgba(0, 0, 0, 0.06);
}
/* Logo and title section */
.logo-section {
display: flex;
flex-direction: column;
align-items: center;
/* #ifdef APP-PLUS */
margin-top: 60rpx;
margin-bottom: 25rpx;
/* #endif */
/* #ifndef APP-PLUS */
margin-top: 80rpx;
margin-bottom: 40rpx;
/* #endif */
}
.hero {
padding: 26rpx 24rpx 14rpx;
}
.app-title {
/* #ifdef APP-PLUS */
font-size: 28rpx;
/* #endif */
/* #ifndef APP-PLUS */
font-size: 36rpx;
/* #endif */
font-weight: bold;
color: #2196f3;
}
.brand-row {
display: flex;
align-items: center;
}
.page-title {
/* #ifdef APP-PLUS */
font-size: 32rpx;
margin-top: 12rpx;
/* #endif */
/* #ifndef APP-PLUS */
font-size: 48rpx;
margin-top: 20rpx;
/* #endif */
font-weight: bold;
color: #333;
}
.brand-mark {
width: 72rpx;
height: 72rpx;
border-radius: 20rpx;
background: linear-gradient(135deg, #ff4d4f 0%, #ff8a65 100%);
box-shadow: 0 12rpx 26rpx rgba(255, 77, 79, 0.28);
}
.page-subtitle {
/* #ifdef APP-PLUS */
font-size: 18rpx;
margin-top: 6rpx;
/* #endif */
/* #ifndef APP-PLUS */
font-size: 28rpx;
margin-top: 10rpx;
/* #endif */
color: #666;
}
.brand-text {
margin-left: 18rpx;
display: flex;
flex-direction: column;
}
/* Form container */
.form-container {
width: 100%;
/* #ifdef APP-PLUS */
max-width: 500rpx;
padding: 25rpx;
/* #endif */
/* #ifndef APP-PLUS */
max-width: 680rpx;
padding: 40rpx;
/* #endif */
background-color: #ffffff;
border-radius: 20rpx;
box-shadow: 0 10rpx 30rpx rgba(0, 0, 0, 0.1);
box-sizing: border-box;
}
.brand-name {
font-size: 40rpx;
font-weight: 700;
color: #111;
letter-spacing: 1rpx;
}
/* Input groups */
.input-group {
/* #ifdef APP-PLUS */
margin-bottom: 15rpx;
/* #endif */
/* #ifndef APP-PLUS */
margin-bottom: 30rpx;
/* #endif */
}
.brand-slogan {
margin-top: 6rpx;
font-size: 24rpx;
color: rgba(0, 0, 0, 0.55);
}
.input-label {
/* #ifdef APP-PLUS */
font-size: 20rpx;
margin-bottom: 6rpx;
/* #endif */
/* #ifndef APP-PLUS */
font-size: 28rpx;
margin-bottom: 10rpx;
/* #endif */
font-weight: 400;
color: #333;
display: block;
}
.title-block {
margin-top: 26rpx;
}
.input-field {
width: 100%;
/* #ifdef APP-PLUS */
height: 60rpx;
padding: 0 20rpx;
font-size: 22rpx;
/* #endif */
/* #ifndef APP-PLUS */
height: 90rpx;
padding: 0 30rpx;
font-size: 28rpx;
/* #endif */
border-radius: 10rpx;
border: 2rpx solid #ddd;
background-color: #f9f9f9;
box-sizing: border-box;
}
.page-title {
font-size: 46rpx;
font-weight: 700;
color: #111;
}
.input-error .input-field {
border-color: #f44336;
}
.page-subtitle {
margin-top: 10rpx;
font-size: 26rpx;
color: rgba(0, 0, 0, 0.55);
}
.error-text {
/* #ifdef APP-PLUS */
font-size: 18rpx;
margin-top: 4rpx;
/* #endif */
/* #ifndef APP-PLUS */
font-size: 24rpx;
margin-top: 6rpx;
/* #endif */
color: #f44336;
}
.card {
margin: 18rpx 24rpx 0;
padding: 26rpx 22rpx;
background: rgba(255, 255, 255, 0.96);
border-radius: 20rpx;
border: 1rpx solid rgba(0, 0, 0, 0.06);
box-shadow: 0 16rpx 36rpx rgba(0, 0, 0, 0.06);
}
/* Password input */
.password-input-container {
position: relative;
}
.field {
margin-bottom: 18rpx;
}
.password-toggle {
position: absolute;
/* #ifdef APP-PLUS */
right: 12rpx;
top: 17rpx;
/* #endif */
/* #ifndef APP-PLUS */
right: 20rpx;
top: 25rpx;
/* #endif */
z-index: 1;
}
.label {
font-size: 24rpx;
color: rgba(0, 0, 0, 0.78);
margin-bottom: 10rpx;
display: block;
}
.toggle-icon {
/* #ifdef APP-PLUS */
font-size: 20rpx;
/* #endif */
/* #ifndef APP-PLUS */
font-size: 30rpx;
/* #endif */
color: #666;
}
.input-wrap {
position: relative;
display: flex;
align-items: center;
background: #f6f7f9;
border: 2rpx solid rgba(0, 0, 0, 0.06);
border-radius: 14rpx;
padding: 0 14rpx;
}
/* Checkbox for terms */
.checkbox-container {
display: flex;
flex-direction: row;
/* #ifdef APP-PLUS */
margin-bottom: 6rpx;
/* #endif */
/* #ifndef APP-PLUS */
margin-bottom: 10rpx;
/* #endif */
}
.field-error .input-wrap {
border-color: rgba(255, 77, 79, 0.55);
background: rgba(255, 77, 79, 0.06);
}
.terms-text {
/* #ifdef APP-PLUS */
font-size: 18rpx;
margin-left: 6rpx;
/* #endif */
/* #ifndef APP-PLUS */
font-size: 26rpx;
margin-left: 10rpx;
/* #endif */
color: #666;
flex: 1;
flex-direction: row;
flex-wrap: wrap;
}
.input {
flex: 1;
height: 84rpx;
font-size: 28rpx;
color: #111;
padding: 0 6rpx;
}
.terms-link {
color: #2196f3;
}
.suffix {
height: 84rpx;
padding: 0 10rpx;
display: flex;
align-items: center;
justify-content: center;
}
.terms-error {
/* #ifdef APP-PLUS */
margin-bottom: 12rpx;
/* #endif */
/* #ifndef APP-PLUS */
margin-bottom: 20rpx;
/* #endif */
}
.suffix-text {
font-size: 24rpx;
color: rgba(0, 0, 0, 0.55);
}
/* Register button */
.register-button {
width: 100%;
/* #ifdef APP-PLUS */
height: 60rpx;
font-size: 24rpx;
margin: 12rpx 0;
border-radius: 30rpx;
/* #endif */
/* #ifndef APP-PLUS */
height: 90rpx;
font-size: 32rpx;
margin: 20rpx 0; border-radius: 45rpx;
/* #endif */
background-image: linear-gradient(to right, #2196f3, #03a9f4);
color: #fff;
font-weight: normal;
text-align: center;
box-shadow: 0 10rpx 20rpx rgba(3, 169, 244, 0.2);
}
.support {
margin-top: 10rpx;
font-size: 22rpx;
color: rgba(0, 0, 0, 0.52);
}
.register-button[disabled] {
background: #ccc;
box-shadow: none;
}
.error {
color: #ff4d4f;
}
/* General error */
.general-error {
width: 100%;
text-align: center;
color: #f44336;
/* #ifdef APP-PLUS */
font-size: 20rpx;
margin-top: 12rpx;
/* #endif */
/* #ifndef APP-PLUS */
font-size: 28rpx;
margin-top: 20rpx;
/* #endif */
}
.center {
text-align: center;
width: 100%;
display: block;
}
/* Login option */
.login-option {
display: flex;
flex-direction: row;
justify-content: center;
/* #ifdef APP-PLUS */
margin-top: 25rpx;
/* #endif */
/* #ifndef APP-PLUS */
margin-top: 40rpx;
/* #endif */
}
.terms {
margin: 12rpx 0 18rpx;
}
.login-text {
/* #ifdef APP-PLUS */
font-size: 20rpx;
margin-right: 5rpx;
/* #endif */
/* #ifndef APP-PLUS */
font-size: 28rpx;
margin-right: 8rpx;
/* #endif */
color: #666;
}
.terms-row {
display: flex;
align-items: flex-start;
}
.login-link {
/* #ifdef APP-PLUS */
font-size: 20rpx;
/* #endif */
/* #ifndef APP-PLUS */
font-size: 28rpx;
/* #endif */
color: #2196f3;
font-weight: normal;
}
.terms-text {
margin-left: 10rpx;
font-size: 24rpx;
color: rgba(0, 0, 0, 0.55);
flex: 1;
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.terms-link {
color: #ff4d4f;
font-weight: 600;
}
.primary {
width: 100%;
height: 92rpx;
border-radius: 18rpx;
background: linear-gradient(135deg, #ff4d4f 0%, #ff7a45 100%);
color: #fff;
font-size: 30rpx;
font-weight: 600;
box-shadow: 0 16rpx 32rpx rgba(255, 77, 79, 0.24);
}
.primary:disabled {
background: #d9d9d9;
box-shadow: none;
}
.footer {
margin-top: 22rpx;
display: flex;
align-items: center;
justify-content: center;
}
.footer-text {
font-size: 24rpx;
color: rgba(0, 0, 0, 0.55);
}
.footer-link {
margin-left: 8rpx;
font-size: 24rpx;
color: #ff4d4f;
font-weight: 600;
}
.trust {
padding: 18rpx 24rpx 36rpx;
}
.trust-text {
font-size: 22rpx;
color: rgba(0, 0, 0, 0.4);
text-align: center;
}
</style>