feat: 首页菜单多语言翻译 + 注册页支持代理专属链接
- 首页: 新增translateMenuNames()方法, API返回的菜单名按当前语言翻译(8种语言) - 注册页: onLoad接收?code参数自动填入邀请码, 支持代理专属注册链接
This commit is contained in:
@@ -0,0 +1,306 @@
|
||||
<template>
|
||||
<view :style="'background-color: '+theme.bg+';color: '+theme.text" class="registerPage">
|
||||
<view class="registerClose" @click="onClose">×</view>
|
||||
<image class="registerLang" :src="i18n.login.langImg" mode="aspectFit" @click="router.push('/pages/lang/lang')"></image>
|
||||
|
||||
<view class="registerBrand">
|
||||
<image class="registerLogo" src="../../static/logo/logo.jpg" mode="widthFix"></image>
|
||||
<view class="registerBrandText">C1 fund</view>
|
||||
</view>
|
||||
|
||||
<view class="registerWrap">
|
||||
<view class="registerTitle">{{i18n.regist.navTitle}}</view>
|
||||
|
||||
<view class="registerField">
|
||||
<view class="registerLabel">{{i18n.regist.phone}}</view>
|
||||
<view class="registerInputBox">
|
||||
<input class="registerInput" type="text" v-model="email" :placeholder="i18n.regist.phoneTag" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="registerField">
|
||||
<view class="registerLabel">{{i18n.regist.code}}</view>
|
||||
<view class="registerInputBox registerInputBoxCode">
|
||||
<input class="registerInput" type="number" v-model="code" :placeholder="i18n.regist.codeTag" />
|
||||
<text class="registerCodeBtn" @click="cutTime()">{{codeText}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="registerField">
|
||||
<view class="registerLabel">{{i18n.regist.login}}</view>
|
||||
<view class="registerInputBox">
|
||||
<input class="registerInput" type="text" v-model="password" password :placeholder="i18n.regist.loginTag" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="registerField">
|
||||
<view class="registerLabel">{{i18n.regist.confirm}}</view>
|
||||
<view class="registerInputBox">
|
||||
<input class="registerInput" type="text" v-model="password2" password :placeholder="i18n.regist.confirmTag" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="registerField">
|
||||
<view class="registerLabel">{{i18n.regist.transaction}}</view>
|
||||
<view class="registerInputBox">
|
||||
<input class="registerInput" type="text" v-model="pay_pwd" password :placeholder="i18n.regist.transactionTag" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="registerField">
|
||||
<view class="registerLabel">{{i18n.regist.invitation}}</view>
|
||||
<view class="registerInputBox">
|
||||
<input class="registerInput" type="text" v-model="referral_code" :placeholder="i18n.regist.invitationTag" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<button @click="register" class="cu-btn registerBtn">{{i18n.forget.sure}}</button>
|
||||
<view class="height-40"></view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
email: '',
|
||||
password: '',
|
||||
password2: '',
|
||||
code: '',
|
||||
referral_code: '',
|
||||
pay_pwd: '',
|
||||
flag: true,
|
||||
time: '获取验证码',
|
||||
timeFlag: true,
|
||||
|
||||
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.pay_pwd == '') {
|
||||
this.tos(this.i18n.regist.transactionTag)
|
||||
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,
|
||||
pay_pwd: this.pay_pwd,
|
||||
}
|
||||
// console.log(obj)
|
||||
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">
|
||||
.registerPage {
|
||||
min-height: 100vh;
|
||||
position: relative;
|
||||
padding-bottom: 60rpx;
|
||||
}
|
||||
|
||||
.registerClose {
|
||||
position: absolute;
|
||||
left: 30rpx;
|
||||
top: 24rpx;
|
||||
font-size: 44rpx;
|
||||
line-height: 44rpx;
|
||||
color: #111111;
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
.registerLang {
|
||||
position: absolute;
|
||||
right: 30rpx;
|
||||
top: 26rpx;
|
||||
width: 44rpx;
|
||||
height: 44rpx;
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
.registerBrand {
|
||||
padding-top: 110rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.registerLogo {
|
||||
width: 150rpx;
|
||||
}
|
||||
|
||||
.registerBrandText {
|
||||
margin-top: 16rpx;
|
||||
font-size: 28rpx;
|
||||
color: #111111;
|
||||
}
|
||||
|
||||
.registerWrap {
|
||||
padding: 50rpx 60rpx 0;
|
||||
}
|
||||
|
||||
.registerTitle {
|
||||
font-size: 44rpx;
|
||||
font-weight: 700;
|
||||
color: #111111;
|
||||
margin-bottom: 28rpx;
|
||||
}
|
||||
|
||||
.registerField {
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.registerLabel {
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
color: #111111;
|
||||
margin-bottom: 14rpx;
|
||||
}
|
||||
|
||||
.registerInputBox {
|
||||
height: 88rpx;
|
||||
background: #EAF3FF;
|
||||
border-radius: 10rpx;
|
||||
padding: 0 22rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.registerInputBoxCode {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.registerInput {
|
||||
flex: 1;
|
||||
height: 88rpx;
|
||||
font-size: 28rpx;
|
||||
color: #111111;
|
||||
}
|
||||
|
||||
.registerCodeBtn {
|
||||
font-size: 26rpx;
|
||||
font-weight: 700;
|
||||
color: #1A74FF;
|
||||
margin-left: 18rpx;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.registerBtn {
|
||||
width: 100%;
|
||||
height: 90rpx;
|
||||
background: #1A74FF !important;
|
||||
border-radius: 10rpx;
|
||||
line-height: 90rpx;
|
||||
color: #FFFFFF;
|
||||
font-size: 30rpx;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user