Files
h5-uniapp/pages/login/register.vue
T
li e31adaaba8 feat: 注册页改版 - 匹配目标设计稿
- 移除C1 fund Logo顶部品牌区
- 新增Mailbox tab标签
- 新增Mobile手机号输入框
- 移除Trading Password(交易密码)字段
- 新增用户协议勾选框(必须勾选才能注册)
- 新增Already have an account? Login底部链接
- 按钮文字改为Register
- 输入框背景改为浅蓝#F0F4FA
- 保留代理专属注册链接(?code=自动填入)
2026-03-30 15:24:04 +08:00

345 lines
7.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="regPage" :style="'background-color: '+theme.bg+';color: '+theme.text">
<myNav :title="''"></myNav>
<view class="regBody">
<!-- 标题 -->
<text class="regTitle">{{i18n.regist.navTitle}}</text>
<!-- Tab -->
<view class="regTabs">
<view class="regTab regTabActive">
<text class="font-26 color-white">{{i18n.regist.phone}}</text>
</view>
</view>
<!-- 邮箱 -->
<view class="regField">
<text class="regLabel">{{i18n.regist.phone}}</text>
<view class="regInputBox">
<input class="regInput" type="text" v-model="email" :placeholder="i18n.regist.phoneTag" />
</view>
</view>
<!-- 手机号(可选) -->
<view class="regField">
<text class="regLabel">{{i18n.regist.mobile}}</text>
<view class="regInputBox">
<input class="regInput" type="text" v-model="mobile" :placeholder="i18n.regist.mobileTag" />
</view>
</view>
<!-- 密码 -->
<view class="regField">
<text class="regLabel">{{i18n.regist.login}}</text>
<view class="regInputBox">
<input class="regInput" type="text" v-model="password" password :placeholder="i18n.regist.loginTag" />
</view>
</view>
<!-- 确认密码 -->
<view class="regField">
<text class="regLabel">{{i18n.regist.confirm}}</text>
<view class="regInputBox">
<input class="regInput" type="text" v-model="password2" password :placeholder="i18n.regist.confirmTag" />
</view>
</view>
<!-- 邀请码 -->
<view class="regField">
<text class="regLabel">{{i18n.regist.invitation}}</text>
<view class="regInputBox">
<input class="regInput" type="text" v-model="referral_code" :placeholder="i18n.regist.invitationTag" />
</view>
</view>
<!-- 验证码 -->
<view class="regField">
<text class="regLabel">{{i18n.regist.code}}</text>
<view class="regInputBox regInputRow">
<input class="regInput" type="text" v-model="code" :placeholder="i18n.regist.codeTag" />
<text class="regCodeBtn" @click="cutTime()">{{codeText}}</text>
</view>
</view>
<!-- 协议 -->
<view class="regAgree" @click="agreed=!agreed">
<view class="regCheckbox" :class="agreed?'regChecked':''">
<text v-if="agreed" class="font-24 color-white">✓</text>
</view>
<text class="font-24 color-999">{{i18n.login.tag}}</text>
<text class="font-24 regLink" @click.stop="router.push('/pages/my/aboutUs/agreement')">{{i18n.login.tag1}}</text>
</view>
<!-- 注册按钮 -->
<button @click="register" class="cu-btn regBtn">{{i18n.regist.navTitle}}</button>
<!-- 已有账号 -->
<view class="regFooter">
<text class="font-26 color-999">{{i18n.login.noAccount}}</text>
<text class="font-26 regLink" @click="router.push('/pages/login/index')">{{i18n.login.login}}</text>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
email: '',
mobile: '',
password: '',
password2: '',
code: '',
referral_code: '',
flag: true,
time: '获取验证码',
timeFlag: true,
agreed: false,
theme: '',
}
},
computed: {
i18n() {
return this.$t('message');
},
codeText() {
if (this.time > 0) {
return this.time + " s"
} else {
return this.i18n.regist.get
}
}
},
onLoad(e) {
// 代理专属注册链接: 自动填入邀请码
if (e && e.code) {
this.referral_code = e.code
}
},
onShow() {
if (uni.getStorageSync("theme") == "dark") {
this.theme = this.$store.state.darkTheme
} else {
this.theme = this.$store.state.lightTheme
}
},
methods: {
onClose() {
uni.navigateBack({ delta: 1 })
},
register() {
if (!this.flag) return
if (this.email == '') {
this.tos(this.i18n.regist.phoneTag)
return
}
if (this.code == '') {
this.tos(this.i18n.regist.codeTag)
return
}
if (this.password == '') {
this.tos(this.i18n.regist.loginTag)
return
}
if (this.password2 == '') {
this.tos(this.i18n.regist.confirmTag)
return
}
if (this.password != this.password2) {
this.tos(this.i18n.regist.tos1)
return
}
if (!this.agreed) {
this.tos(this.i18n.login.tos1)
return
}
uni.showLoading({
title: this.i18n.regist.loading,
mask: true
})
this.flag = false
var obj = {
email: this.email,
password: this.password,
code: this.code,
referral_code: this.referral_code,
}
if (this.mobile) {
obj.mobile = this.mobile
}
this.post('/user/register', obj).then(res => {
console.log(res)
uni.hideLoading()
this.flag = true
if (res.code == 1) {
this.tos(res.msg)
setTimeout(() => {
uni.reLaunch({
url: '/pages/login/index?email=' + this.email
})
}, 500)
}
})
},
cutTime() {
if (!this.timeFlag) return
if (this.email == "") {
this.tos(this.i18n.regist.phoneTag)
return
}
uni.showLoading({
title: this.i18n.regist.loading,
mask: true
})
this.timeFlag = false
this.post('/ems/send', {
email: this.email,
event: "register",
}).then(res => {
uni.hideLoading()
if (res.code == 1) {
this.tos(res.msg)
this.time = 120
var that = this
let timeName = setInterval(() => {
if (that.time > 0) {
that.time--
} else {
that.time = 0
that.timeFlag = true
clearInterval(timeName)
}
}, 1000)
} else {
this.timeFlag = true
}
})
}
}
}
</script>
<style lang="scss">
.regPage {
min-height: 100vh;
}
.regBody {
padding: 30rpx 50rpx 60rpx;
}
.regTitle {
font-size: 48rpx;
font-weight: 700;
color: #111111;
display: block;
margin-bottom: 36rpx;
}
.regTabs {
display: flex;
margin-bottom: 36rpx;
}
.regTab {
height: 60rpx;
padding: 0 30rpx;
border-radius: 8rpx;
display: flex;
align-items: center;
justify-content: center;
background: #D1D3D8;
margin-right: 20rpx;
}
.regTabActive {
background: #10C7A0;
}
.regField {
margin-bottom: 28rpx;
}
.regLabel {
font-size: 28rpx;
font-weight: 700;
color: #333333;
margin-bottom: 12rpx;
display: block;
}
.regInputBox {
height: 88rpx;
background: #F0F4FA;
border-radius: 10rpx;
padding: 0 24rpx;
display: flex;
align-items: center;
}
.regInputRow {
justify-content: space-between;
}
.regInput {
flex: 1;
height: 88rpx;
font-size: 28rpx;
color: #111111;
}
.regCodeBtn {
font-size: 26rpx;
font-weight: 700;
color: #1A74FF;
margin-left: 18rpx;
flex: 0 0 auto;
white-space: nowrap;
}
.regAgree {
display: flex;
align-items: center;
margin: 30rpx 0;
}
.regCheckbox {
width: 36rpx;
height: 36rpx;
border: 2rpx solid #CCCCCC;
border-radius: 50%;
margin-right: 14rpx;
display: flex;
align-items: center;
justify-content: center;
}
.regChecked {
background: #1A74FF;
border-color: #1A74FF;
}
.regLink {
color: #1A74FF;
margin-left: 6rpx;
}
.regBtn {
width: 100%;
height: 90rpx;
background: #1A74FF !important;
border-radius: 10rpx;
line-height: 90rpx;
color: #FFFFFF;
font-size: 32rpx;
text-align: center;
margin-top: 10rpx;
}
.regFooter {
text-align: center;
margin-top: 30rpx;
}
</style>