功能模块: - 用户注册/登录/KYC - 资金账户/交易账户 - 实时行情/币种管理 - 即时交易/充提审核 - 管理后台 技术栈: - 后端: SpringBoot 2.2.4 + MyBatis Plus - 前端: uni-app x (Vue3 + UTS) - 数据库: MySQL Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
204 lines
4.4 KiB
Plaintext
204 lines
4.4 KiB
Plaintext
<template>
|
|
<view class="register-container">
|
|
<!-- Logo区域 -->
|
|
<view class="logo-section">
|
|
<text class="logo-text">₿</text>
|
|
<text class="app-name">注册账号</text>
|
|
</view>
|
|
|
|
<!-- 注册表单 -->
|
|
<view class="form-section">
|
|
<view class="form-item">
|
|
<text class="form-label">账号</text>
|
|
<input
|
|
class="form-input"
|
|
type="text"
|
|
v-model="username"
|
|
placeholder="请输入账号(4-20位字母数字)"
|
|
placeholder-class="placeholder"
|
|
/>
|
|
</view>
|
|
|
|
<view class="form-item">
|
|
<text class="form-label">密码</text>
|
|
<input
|
|
class="form-input"
|
|
type="password"
|
|
v-model="password"
|
|
placeholder="请输入密码(至少6位)"
|
|
placeholder-class="placeholder"
|
|
/>
|
|
</view>
|
|
|
|
<view class="form-item">
|
|
<text class="form-label">确认密码</text>
|
|
<input
|
|
class="form-input"
|
|
type="password"
|
|
v-model="confirmPassword"
|
|
placeholder="请再次输入密码"
|
|
placeholder-class="placeholder"
|
|
/>
|
|
</view>
|
|
|
|
<!-- 注册按钮 -->
|
|
<button class="register-btn" :disabled="loading" @click="handleRegister">
|
|
<text class="btn-text">{{ loading ? '注册中...' : '注 册' }}</text>
|
|
</button>
|
|
|
|
<!-- 登录入口 -->
|
|
<view class="login-row">
|
|
<text class="login-text">已有账号?</text>
|
|
<text class="login-link" @click="goLogin">立即登录</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script lang="uts">
|
|
import { register } from '@/api/user.uts'
|
|
|
|
const username = ref('')
|
|
const password = ref('')
|
|
const confirmPassword = ref('')
|
|
const loading = ref(false)
|
|
|
|
func handleRegister () {
|
|
const usernameValue = username.value.trim()
|
|
const passwordValue = password.value.trim()
|
|
const confirmPasswordValue = confirmPassword.value.trim()
|
|
|
|
if (usernameValue === '' || usernameValue.length < 4) {
|
|
uni.showToast({ title: '账号至少4位', icon: 'none' })
|
|
return
|
|
}
|
|
if (passwordValue === '' || passwordValue.length < 6) {
|
|
uni.showToast({ title: '密码至少6位', icon: 'none' })
|
|
return
|
|
}
|
|
if (passwordValue !== confirmPasswordValue) {
|
|
uni.showToast({ title: '两次密码不一致', icon: 'none' })
|
|
return
|
|
}
|
|
|
|
loading.value = true
|
|
|
|
register(usernameValue, passwordValue)
|
|
.then((res) => {
|
|
const data = res.data as UTSJSONObject
|
|
uni.setStorageSync('token', data['token'] as string)
|
|
uni.setStorageSync('userInfo', JSON.stringify(data['userInfo']))
|
|
|
|
uni.showToast({ title: '注册成功', icon: 'success' })
|
|
|
|
setTimeout(() => {
|
|
uni.switchTab({ url: '/pages/index/index' })
|
|
}, 1000)
|
|
})
|
|
.catch((error) => {
|
|
console.error('注册失败:', error)
|
|
})
|
|
.finally(() => {
|
|
loading.value = false
|
|
})
|
|
}
|
|
|
|
func goLogin () {
|
|
uni.navigateBack()
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.register-container {
|
|
min-height: 100vh;
|
|
background: linear-gradient(180deg, #1A1A2E 0%, #16213E 100%);
|
|
padding: 0 60rpx;
|
|
}
|
|
|
|
.logo-section {
|
|
padding-top: 120rpx;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
}
|
|
|
|
.logo-text {
|
|
font-size: 80rpx;
|
|
color: #00D4AA;
|
|
margin-bottom: 24rpx;
|
|
}
|
|
|
|
.app-name {
|
|
font-size: 40rpx;
|
|
font-weight: bold;
|
|
color: #fff;
|
|
margin-bottom: 48rpx;
|
|
}
|
|
|
|
.form-section {
|
|
margin-top: 48rpx;
|
|
}
|
|
|
|
.form-item {
|
|
margin-bottom: 32rpx;
|
|
}
|
|
|
|
.form-label {
|
|
font-size: 28rpx;
|
|
color: rgba(255, 255, 255, 0.8);
|
|
margin-bottom: 16rpx;
|
|
display: block;
|
|
}
|
|
|
|
.form-input {
|
|
width: 100%;
|
|
height: 96rpx;
|
|
background: rgba(255, 255, 255, 0.08);
|
|
border: 2rpx solid rgba(255, 255, 255, 0.1);
|
|
border-radius: 16rpx;
|
|
padding: 0 32rpx;
|
|
font-size: 32rpx;
|
|
color: #fff;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.placeholder {
|
|
color: rgba(255, 255, 255, 0.3);
|
|
}
|
|
|
|
.register-btn {
|
|
margin-top: 48rpx;
|
|
height: 96rpx;
|
|
background: linear-gradient(90deg, #00D4AA 0%, #00B894 100%);
|
|
border-radius: 48rpx;
|
|
border: none;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.btn-text {
|
|
font-size: 34rpx;
|
|
font-weight: bold;
|
|
color: #fff;
|
|
}
|
|
|
|
.login-row {
|
|
margin-top: 32rpx;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
|
|
.login-text {
|
|
font-size: 26rpx;
|
|
color: rgba(255, 255, 255, 0.5);
|
|
}
|
|
|
|
.login-link {
|
|
font-size: 26rpx;
|
|
color: #00D4AA;
|
|
margin-left: 8rpx;
|
|
}
|
|
</style>
|