|
|
@@ -1,4 +1,4 @@
|
|
|
-import { View, Input, Button, Text } from '@tarojs/components'
|
|
|
+import { View, Input, Button, Text, Image } from '@tarojs/components'
|
|
|
import { useState } from 'react'
|
|
|
import Taro from '@tarojs/taro'
|
|
|
import { authManager } from '../../utils/auth'
|
|
|
@@ -70,68 +70,100 @@ export default function Register() {
|
|
|
return (
|
|
|
<View className="register-container">
|
|
|
<View className="register-header">
|
|
|
- <Text className="register-title">创建账号</Text>
|
|
|
- <Text className="register-subtitle">欢迎来到我们的小程序</Text>
|
|
|
+ <Image
|
|
|
+ className="register-logo"
|
|
|
+ src="https://source.unsplash.com/200x200/?avatar"
|
|
|
+ mode="aspectFit"
|
|
|
+ />
|
|
|
+ <View className="register-title-container">
|
|
|
+ <Text className="register-title">创建账号</Text>
|
|
|
+ <Text className="register-subtitle">欢迎加入我们的小程序</Text>
|
|
|
+ </View>
|
|
|
</View>
|
|
|
|
|
|
<View className="register-form">
|
|
|
<View className="form-item">
|
|
|
<Text className="form-label">用户名</Text>
|
|
|
- <Input
|
|
|
- className="form-input"
|
|
|
- placeholder="请输入用户名"
|
|
|
- value={username}
|
|
|
- onInput={(e) => setUsername(e.detail.value)}
|
|
|
- />
|
|
|
+ <View className="input-wrapper">
|
|
|
+ <Input
|
|
|
+ className="form-input"
|
|
|
+ placeholder="请输入用户名(3-20个字符)"
|
|
|
+ value={username}
|
|
|
+ onInput={(e) => setUsername(e.detail.value)}
|
|
|
+ maxlength={20}
|
|
|
+ />
|
|
|
+ </View>
|
|
|
</View>
|
|
|
|
|
|
<View className="form-item">
|
|
|
<Text className="form-label">邮箱(可选)</Text>
|
|
|
- <Input
|
|
|
- className="form-input"
|
|
|
- placeholder="请输入邮箱地址"
|
|
|
- type="text"
|
|
|
- value={email}
|
|
|
- onInput={(e) => setEmail(e.detail.value)}
|
|
|
- />
|
|
|
+ <View className="input-wrapper">
|
|
|
+ <Input
|
|
|
+ className="form-input"
|
|
|
+ placeholder="请输入邮箱地址"
|
|
|
+ type="text"
|
|
|
+ value={email}
|
|
|
+ onInput={(e) => setEmail(e.detail.value)}
|
|
|
+ maxlength={50}
|
|
|
+ />
|
|
|
+ </View>
|
|
|
</View>
|
|
|
|
|
|
<View className="form-item">
|
|
|
<Text className="form-label">密码</Text>
|
|
|
- <Input
|
|
|
- className="form-input"
|
|
|
- placeholder="请输入密码(至少6位)"
|
|
|
- password
|
|
|
- value={password}
|
|
|
- onInput={(e) => setPassword(e.detail.value)}
|
|
|
- />
|
|
|
+ <View className="input-wrapper">
|
|
|
+ <Input
|
|
|
+ className="form-input"
|
|
|
+ placeholder="请输入密码(至少6位)"
|
|
|
+ password
|
|
|
+ value={password}
|
|
|
+ onInput={(e) => setPassword(e.detail.value)}
|
|
|
+ maxlength={20}
|
|
|
+ />
|
|
|
+ </View>
|
|
|
</View>
|
|
|
|
|
|
<View className="form-item">
|
|
|
<Text className="form-label">确认密码</Text>
|
|
|
- <Input
|
|
|
- className="form-input"
|
|
|
- placeholder="请再次输入密码"
|
|
|
- password
|
|
|
- value={confirmPassword}
|
|
|
- onInput={(e) => setConfirmPassword(e.detail.value)}
|
|
|
- />
|
|
|
+ <View className="input-wrapper">
|
|
|
+ <Input
|
|
|
+ className="form-input"
|
|
|
+ placeholder="请再次输入密码"
|
|
|
+ password
|
|
|
+ value={confirmPassword}
|
|
|
+ onInput={(e) => setConfirmPassword(e.detail.value)}
|
|
|
+ maxlength={20}
|
|
|
+ />
|
|
|
+ </View>
|
|
|
</View>
|
|
|
|
|
|
<Button
|
|
|
- className="register-button"
|
|
|
+ className={`register-button ${loading ? 'loading' : ''}`}
|
|
|
loading={loading}
|
|
|
onClick={handleRegister}
|
|
|
+ disabled={loading}
|
|
|
>
|
|
|
- 注册
|
|
|
+ {loading ? '注册中...' : '立即注册'}
|
|
|
</Button>
|
|
|
|
|
|
<View className="register-footer">
|
|
|
- <Text className="login-link" onClick={goToLogin}>
|
|
|
- 已有账号?立即登录
|
|
|
+ <Text className="footer-text">
|
|
|
+ 已有账号?
|
|
|
+ <Text className="link-text" onClick={goToLogin}>
|
|
|
+ 立即登录
|
|
|
+ </Text>
|
|
|
</Text>
|
|
|
</View>
|
|
|
</View>
|
|
|
+
|
|
|
+ <View className="register-footer-info">
|
|
|
+ <Text className="footer-tip">注册即表示您同意我们的</Text>
|
|
|
+ <View className="footer-links">
|
|
|
+ <Text className="link-text">用户协议</Text>
|
|
|
+ <Text className="link-separator">和</Text>
|
|
|
+ <Text className="link-text">隐私政策</Text>
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
</View>
|
|
|
)
|
|
|
}
|