|
|
@ -4,7 +4,7 @@ |
|
|
|
<view class="body"> |
|
|
|
<view class="welcomeText">{{ i18n.registerWelcomeText }}</view> |
|
|
|
<view class="signInText">{{ i18n.registerCreate }}</view> |
|
|
|
<u--form class="form" :model="userInfo" :rules="rules" ref="form1" errorType="toast"> |
|
|
|
<u--form class="form" :model="userInfo" :rules="rules" ref="uForm" errorType="toast"> |
|
|
|
<!-- 邮箱 --> |
|
|
|
<u-form-item class="input-item" prop="email" ref="item1"> |
|
|
|
<u-icon class="icon" |
|
|
@ -15,22 +15,26 @@ |
|
|
|
</u-input> |
|
|
|
</u-form-item> |
|
|
|
<!-- 验证码 --> |
|
|
|
<u-form-item class="input-item vCode" prop="verificationCode" ref="item1"> |
|
|
|
<u-form-item class="input-item vCode" prop="code" ref="item1"> |
|
|
|
<u-icon class="icon" |
|
|
|
:name="userInfo.verificationCode ? '../../static/login/code_pr.png' : '../../static/login/code_de.png'" |
|
|
|
:name="userInfo.code ? '../../static/login/code_pr.png' : '../../static/login/code_de.png'" |
|
|
|
size="48rpx" width="48rpx"></u-icon> |
|
|
|
<u-input class="input" v-model="userInfo.verificationCode" color="#fff" fontSize="32rpx" |
|
|
|
border="none" :placeholder="i18n.registerWelcomeText" maxlength="6"> |
|
|
|
|
|
|
|
<u-input class="input" v-model="userInfo.code" color="#fff" fontSize="32rpx" border="none" |
|
|
|
:placeholder="i18n.registerWelcomeText" maxlength="6"> |
|
|
|
</u-input> |
|
|
|
<u-button class="getVCodeBtn" color="#323045">Get code</u-button> |
|
|
|
<u-code startText="Get code" :seconds="seconds" ref="uCode" keep-running unique-key="login" |
|
|
|
@change="codeChange"> |
|
|
|
</u-code> |
|
|
|
<u-button class="getVCodeBtn" color="#323045" @tap="getCode">{{tips}}</u-button> |
|
|
|
</u-form-item> |
|
|
|
<!-- 密码 --> |
|
|
|
<u-form-item class="input-item" prop="password" ref="item1"> |
|
|
|
<u-icon class="icon" |
|
|
|
:name="userInfo.password ? '../../static/login/Password_pr.png' : '../../static/login/Password_de.png'" |
|
|
|
size="48rpx" width="48rpx"></u-icon> |
|
|
|
<u-input class="input" type="password" v-model="userInfo.password" color="#fff" fontSize="32rpx" border="none" |
|
|
|
:placeholder="i18n.passwordText"> |
|
|
|
<u-input class="input" type="password" v-model="userInfo.password" color="#fff" fontSize="32rpx" |
|
|
|
border="none" :placeholder="i18n.passwordText"> |
|
|
|
</u-input> |
|
|
|
</u-form-item> |
|
|
|
<!-- 重复密码 --> |
|
|
@ -38,16 +42,16 @@ |
|
|
|
<u-icon class="icon" |
|
|
|
:name="userInfo.confirmPassword ? '../../static/login/Password_pr.png' : '../../static/login/Password_de.png'" |
|
|
|
size="48rpx" width="48rpx"></u-icon> |
|
|
|
<u-input class="input" type="password" v-model="userInfo.confirmPassword" color="#fff" fontSize="32rpx" |
|
|
|
border="none" :placeholder="i18n.confirmPasswordText"> |
|
|
|
<u-input class="input" type="password" v-model="userInfo.confirmPassword" color="#fff" |
|
|
|
fontSize="32rpx" border="none" :placeholder="i18n.confirmPasswordText"> |
|
|
|
</u-input> |
|
|
|
</u-form-item> |
|
|
|
<!-- 取款密码 --> |
|
|
|
<u-form-item class="input-item" prop="withdrawalPassword" ref="item1"> |
|
|
|
<u-form-item class="input-item" prop="payPassword" ref="item1"> |
|
|
|
<u-icon class="icon" |
|
|
|
:name="userInfo.withdrawalPassword ? '../../static/login/WithdrawalPassword_pr.png' : '../../static/login/WithdrawalPassword_de.png'" |
|
|
|
:name="userInfo.payPassword ? '../../static/login/WithdrawalPassword_pr.png' : '../../static/login/WithdrawalPassword_de.png'" |
|
|
|
size="48rpx" width="48rpx"></u-icon> |
|
|
|
<u-input class="input" type="password" v-model="userInfo.withdrawalPassword" color="#fff" fontSize="32rpx" |
|
|
|
<u-input class="input" type="password" v-model="userInfo.payPassword" color="#fff" fontSize="32rpx" |
|
|
|
border="none" :placeholder="i18n.withdrawalPasswordText"> |
|
|
|
</u-input> |
|
|
|
</u-form-item> |
|
|
@ -69,9 +73,11 @@ |
|
|
|
i18n.Conditions |
|
|
|
}}</span></view> |
|
|
|
</view> |
|
|
|
<u-button class="button" color="#00E8A2" throttleTime="500" :disabled="!agreeFlag">{{ i18n.SignUp }} |
|
|
|
<u-button class="button" color="#00E8A2" throttleTime="500" :disabled="!agreeFlag" @click="register" :throttleTime="500"> |
|
|
|
{{ i18n.SignUp }} |
|
|
|
</u-button> |
|
|
|
<view class="signUp">{{ i18n.haveAccount }}<navigator class="navigator" url="./index">{{ i18n.Login }} |
|
|
|
<view class="signUp">{{ i18n.haveAccount }} |
|
|
|
<navigator class="navigator" url="./index">{{ i18n.Login }} |
|
|
|
</navigator> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -86,18 +92,33 @@ export default { |
|
|
|
name: "register", |
|
|
|
data() { |
|
|
|
return { |
|
|
|
// 验证码倒计时 |
|
|
|
tips: '', |
|
|
|
seconds: 60, |
|
|
|
// 邮箱号码是否正确 |
|
|
|
isCanGetCode: false, |
|
|
|
userInfo: { |
|
|
|
name: "", |
|
|
|
password: "", |
|
|
|
email: '', |
|
|
|
payPassword: '', |
|
|
|
inviteCode: '', |
|
|
|
code: '', |
|
|
|
lang: '', |
|
|
|
}, |
|
|
|
rules: { |
|
|
|
payPassword: { |
|
|
|
type: "string", |
|
|
|
required: true, |
|
|
|
message: this.$t("login.withdrawalPasswordMessage"), |
|
|
|
trigger: ["blur", "change"], |
|
|
|
}, |
|
|
|
email: { |
|
|
|
type: "string", |
|
|
|
required: true, |
|
|
|
message: this.$t("login.emailInputMessage"), |
|
|
|
trigger: ["blur", "change"], |
|
|
|
}, |
|
|
|
verificationCode: { |
|
|
|
code: { |
|
|
|
type: "string", |
|
|
|
required: true, |
|
|
|
message: this.$t("login.verificationCodeMessage"), |
|
|
@ -109,6 +130,19 @@ export default { |
|
|
|
message: this.$t("login.passwordInputMessage"), |
|
|
|
trigger: ["blur", "change"] |
|
|
|
}, |
|
|
|
InvitationCode: { |
|
|
|
type: "string", |
|
|
|
required: true, |
|
|
|
message: this.$t("login.InvitationCodeMessage"), |
|
|
|
trigger: ["blur", "change"] |
|
|
|
}, |
|
|
|
confirmPassword: { |
|
|
|
type: "string", |
|
|
|
required: true, |
|
|
|
message: this.$t("login.confirmPasswordMessage"), |
|
|
|
trigger: ["blur", "change"] |
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
agreeFlag: false, |
|
|
|
}; |
|
|
@ -121,9 +155,80 @@ export default { |
|
|
|
onLoad() { |
|
|
|
// console.log(this.$t('login.emailInputMessage')); |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
'userInfo.email': { |
|
|
|
handler(newValue) { |
|
|
|
this.isCanGetCode = uni.$u.test.email(newValue); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
onShow() {}, |
|
|
|
methods: {}, |
|
|
|
components: { UButton } |
|
|
|
methods: { |
|
|
|
// 验证码相关 |
|
|
|
codeChange(text) { |
|
|
|
this.tips = text; |
|
|
|
}, |
|
|
|
// 验证码获取 |
|
|
|
getCode() { |
|
|
|
if (!this.userInfo.email) { |
|
|
|
uni.$u.toast(this.$t("login.Emailempty")) |
|
|
|
return |
|
|
|
} |
|
|
|
if (!this.isCanGetCode) { |
|
|
|
uni.$u.toast(this.$t("login.Emailincorrect")) |
|
|
|
return |
|
|
|
} |
|
|
|
if (this.$refs.uCode.canGetCode) { |
|
|
|
const data = { |
|
|
|
email: this.userInfo.email, |
|
|
|
type: 0, |
|
|
|
} |
|
|
|
// 模拟向后端请求验证码 |
|
|
|
uni.showLoading({ |
|
|
|
title: this.$t("login.GettingVerificationCode") |
|
|
|
}) |
|
|
|
this.$api.sendEmailCode(data).then(res => { |
|
|
|
if (res.code === 200) { |
|
|
|
uni.hideLoading(); |
|
|
|
// 这里此提示会被this.start()方法中的提示覆盖 |
|
|
|
uni.$u.toast(this.$t("login.CodeHasSent")); |
|
|
|
// 通知验证码组件内部开始倒计时 |
|
|
|
this.$refs.uCode.start(); |
|
|
|
} else { |
|
|
|
uni.$u.toast(res.msg) |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
uni.$u.toast(this.$t("login.SendAfter")); |
|
|
|
} |
|
|
|
}, |
|
|
|
// 注册 |
|
|
|
register() { |
|
|
|
this.$refs.uForm.validate().then(res => { |
|
|
|
this.$api.register(this.userInfo).then(res => { |
|
|
|
if (res.errCode === 'SUCCESS') { |
|
|
|
setTimeout(() => { |
|
|
|
uni.showToast({ |
|
|
|
title: this.$t("login.resSuccess") |
|
|
|
}) |
|
|
|
}, 600) |
|
|
|
uni.switchTab({ |
|
|
|
url: '/pages/login/index' |
|
|
|
}) |
|
|
|
} else { |
|
|
|
uni.$u.toast(res.msg) |
|
|
|
} |
|
|
|
}) |
|
|
|
}).catch(errors => { |
|
|
|
console.log('err') |
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
components: { |
|
|
|
UButton |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|