Files
jjx-web/pages/auth/register/register.vue
T
2023-11-17 13:50:18 +08:00

681 lines
14 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>
<top-bar></top-bar>
<common-header></common-header>
<category-bar></category-bar>
<div class="outter-wrapper">
<div class="login-page">
<div class="main-container">
<div class="w-1180 flex-h-e">
<div class="login-container">
<h2 style="margin-bottom: 15px;">免费注册会员</h2>
<view id="from" action="">
<div class="input-grouptabs clear">
<span @click="form1.accountType = 1"
:class="{'tab-active': form1.accountType == 1}" class="normal" data-id="0"
id="normal"><i></i>个人用户</span>
<span @click="form1.accountType = 2"
:class="{'tab-active': form1.accountType == 2}" class="nopassword" data-id="1"
id="nopw"><i></i>企业用户</span>
</div>
<div class="tabContent">
<div class="login-con active" id="rc">
<div class="input-group clear">
<div class="input-group-addon">
<i class="icon_user"></i>
</div>
<input v-model="form1.mobile" type="text" class="form-control" name="mobile"
placeholder="请输入手机号" autocomplete="off">
</div>
<div class="input-group clear">
<div class="input-group-addon">
<i class="icon_phone"></i>
</div>
<input type="text" class="form-control" v-model="form1.smsCode" name="smsCode"
placeholder="请输入短信验证码" autocomplete="off" />
<view @click="sendSmsCode" id="btnSendCode1" type="button"
class="btn-default" value="">{{smsTips}}</view>
</div>
<div class="input-group clear">
<div class="input-group-addon">
<i class="icon_password"></i>
</div>
<input type="password" class="form-control" v-model="form1.password" name="password"
placeholder="设置登录密码" autocomplete="off">
</div>
<div class="input-group clear">
<div class="input-group-addon">
<i class="icon_password"></i>
</div>
<input type="password" class="form-control" v-model="form1.repassword"
placeholder="确认登录密码" autocomplete="off">
</div>
<div v-show="form1.accountType == 1" class="input-group clear">
<div class="input-group-addon">
<i class="icon_yaoqingma"></i>
</div>
<input type="text" class="form-control" v-model="form1.person.personName"
placeholder="请输入姓名" autocomplete="off">
</div>
<div v-show="form1.accountType == 2" class="input-group clear">
<div class="input-group-addon">
<i class="icon_yaoqingma"></i>
</div>
<input type="text" class="form-control" v-model="form1.company.companyName"
placeholder="请输入公司名称" autocomplete="off">
</div>
<div class="input-group clear">
<div class="input-group-addon">
<i class="icon_yaoqingma"></i>
</div>
<input type="text" class="form-control" v-model="form1.inviteCode"
placeholder="请输入邀请码,选填" autocomplete="off">
</div>
</div>
</div>
<div class="input-groupread clear">
<input id="check" type="checkbox" class="check" name="is_read">
<label>阅读并同意<a href="javascript:;" style="display: inline-block;"
id="register-xieyi">
<span style="color: #3288b2">《金久信注册协议》</span></a></label>
</div>
<div class="input-groupp clear">
<button @click="handleSubmit" type="button" class="btnMarymt"
style="width: 100%;">立即免费注册</button>
</div>
</view>
<div class="input-groupwp clear">
<navigator url="/pages/auth/login/login">已有账号?<span style="color: #a92924">去登录</span></navigator>
</div>
</div>
</div>
</div>
</div>
</div>
</view>
</template>
<script>
let timer = null
let timeS = 60
var vk = uni.vk;
export default {
data() {
return {
smsTips: '点击获取',
form1: {
accountType: 1, // business 企业 、、personal个人
mobile: '',
smsCode: '',
password: '',
repassword: '',
inviteCode: '',
person: {
personName: ''
},
company: {
companyName: ''
}
}
};
},
methods: {
sendSmsCode() {
if (timer != null) {
return
}
vk.userCenter.sendSmsCode({
loading: false,
data: {
mobile: this.form1.mobile,
type: 'register',
},
success: (data) => {
this.$message({
message: "验证码已发送",
type: 'success'
})
timeS = 60
timer = setInterval(() => {
timeS--
if (timeS <= 0) {
this.smsTips = "重新发送"
this.stopTimer()
} else {
this.smsTips = timeS + "秒"
}
}, 1000)
}
});
},
handleSubmit() {
if (this.testForm()) {
const {
mobile, // 手机号
smsCode, // 短信验证码4-8位
password, // 密码 6-20位
repassword, // 重复输入密码
inviteCode, // 邀请码
accountType,
company,
person
} = this.form1
vk.userCenter.loginBySms({
data: {
type: 'register',
mobile: mobile,
code: smsCode,
password,
inviteCode,
accountType,
company,
person
},
success: (data) => {
uni.reLaunch({
url: '/'
})
}
});
}
},
testForm() {
const {
mobile, // 手机号
smsCode, // 短信验证码4-8位
password, // 密码 6-20位
repassword, // 重复输入密码
inviteCode, // 邀请码
accountType,
company,
person
} = this.form1;
// 手机号验证
if (!mobile || !/^1[3456789]\d{9}$/.test(mobile)) {
this.$message({
message: '手机号为空或格式不正确',
type: 'error'
})
return false
}
// 短信验证码验证
if (!smsCode || !/^\d{4,8}$/.test(smsCode)) {
// 短信验证码为空或格式不正确
// 处理错误逻辑
this.$message({
message: '短信验证码为空或格式不正确',
type: 'error'
})
return false
}
// 密码验证
if (!password || password.length < 6 || password.length > 20) {
// 密码为空或长度不符合要求
this.$message({
message: '密码长度不符合要求',
type: 'error'
})
return false
// 处理错误逻辑
}
// 重复输入密码验证
if (password !== repassword) {
// 两次输入的密码不一致
this.$message({
message: '两次输入的密码不一致',
type: 'error'
})
return false
// 处理错误逻辑
}
if(accountType == 1 && !person.personName) {
this.$message({
message: '请输入姓名',
type: 'error'
})
return false
}
if(accountType == 2 && !company.companyName) {
this.$message({
message: '请输入公司名称',
type: 'error'
})
return false
}
return true
},
stopTimer() {
if (timer != null) {
clearInterval(timer)
timer = null
}
},
},
onUnload() {
if (timer != null) {
clearInterval(timer)
timer = null
}
}
}
</script>
<style lang="scss">
@charset "utf-8";
.zg-logo img {
width: 230px;
border: none;
}
.layout-common-footer {
text-align: center;
margin: 15px 0px 10px;
}
.layout-common-footer .copyright .link>a {
color: #666;
padding: 0 10px;
display: inline-block;
line-height: 2
}
.w-1180 {
width: 1200px;
margin: 0px auto;
box-sizing: border-box;
}
.flex-h-ac {
display: flex;
align-items: center;
}
.header {
height: 90px;
}
.main-container {
min-width: 1200px;
padding: 60px 0;
background: #e8f5fd url(/static/images/login-bg.jpg)50% no-repeat;
}
.flex-h-e,
.flex-h-e-ac {
display: flex;
flex-direction: row;
justify-content: flex-end;
}
.main-container .login-container {
width: 350px;
box-sizing: border-box;
padding: 30px 35px 30px;
background-color: #fff;
}
.login-container h2 {
text-align: center;
line-height: 2;
color: #000;
font-size: 25px;
margin-bottom: 25px;
}
.btnMarymt {
height: 48px;
line-height: 48px;
background: #a92924;
color: #fff !important;
text-align: center;
width: 100%;
background: linear-gradient(90deg, #f0242e, #d0111a);
font-size: 16px;
cursor: pointer;
text-align: center;
}
.btnMarymt:hover {
background: #f12d36
}
.input-group {
width: 100%;
height: 46px;
}
.input-group-addon {}
.input-group .form-control {
flex: 1;
height: 100%;
border: none;
background: none;
margin-left: 12px;
outline: none;
font-size: 13px;
color: #333;
}
.input-group {
display: flex;
align-items: center;
border: 1px solid #d4d4d4;
margin-bottom: 15px;
position: relative;
}
.input-group-addon i {
background: url(/static/images/iconsmall.png)no-repeat center center;
width: 38px;
border-right: 1px solid #d4d4d4;
height: 26px;
overflow: hidden;
display: inline-block
}
.input-group-addon .icon_user {
background-position: -212px -35px;
}
.input-group-addon .icon_phone {
background-position: -212px -67px;
}
.input-group-addon .icon_password {
background-position: -212px -100px;
}
.input-group-addon .icon_yaoqingma {
background-position: -209px -318px;
}
.input-groupp {
width: 100%;
}
#btnSendCode1 {
position: absolute;
right: 1px;
top: 8px;
line-height: 31px;
color: #d0111a;
width: 79px;
text-align: center;
cursor: pointer;
border-left: 1px solid;
background: none;
font-size: 14px;
}
.input-group.focus {
background-color: #fff;
box-shadow: 0 2px 11px 0 rgba(0, 0, 0, .04)
}
.input-groupwp {
width: 100%;
text-align: center;
height: 60px;
line-height: 60px;
font-size: 14px;
margin-bottom: 10px;
}
.input-groupwpg a {
display: inline-block;
}
.input-groupwpg .dsf-wetChat i {
background: url(/static/images/iconsmall.png)no-repeat;
width: 50px;
height: 40px;
display: block;
background-position: -218px -132px;
}
.input-groupwpg .dsf-qq i {
background: url(/static/images/iconsmall.png)no-repeat;
width: 50px;
height: 40px;
display: block;
background-position: -216px -178px;
margin: 0px 24px;
}
.input-groupwpg .dsf-dx i {
background: url(/static/images/iconsmall.png)no-repeat;
width: 50px;
height: 40px;
display: block;
background-position: -215px -224px;
}
.threeBorder {
position: relative;
text-align: center;
}
.threeBorder:after {
content: '';
position: absolute;
z-index: 0;
bottom: 10px;
left: 10px;
width: 95%;
height: 1px;
border-bottom: 1px solid #CCCCCC;
-webkit-transform: scaleY(0.5);
transform: scaleY(0.5);
-webkit-transform-origin: 0 100%;
transform-origin: 0 100%;
}
.threeBorder span {
color: #888888;
background: #fff;
width: 90px;
margin: 0 auto;
z-index: 1002;
position: relative;
display: block;
}
.input-groupwpg {
width: 100%;
text-align: center;
height: 48px;
font-size: 14px;
margin-top: 22px;
}
.login-con {
display: none;
}
.input-grouptabs span {
color: #666;
cursor: pointer;
font-size: 16px;
line-height: 23px;
font-weight: normal;
display: inline-block;
padding: 0px 18px;
text-align: center;
margin: 0px auto;
}
.input-grouptabs {
text-align: center;
margin: 0px auto 30px;
width: 100%;
}
.input-grouptabs i {
background: url(/static/images/iconsmall.png)no-repeat;
width: 25px;
height: 25px;
float: left;
margin-right: 5px;
}
.input-grouptabs .tab-active#normal i {
background-position: -218px -269px;
}
.input-grouptabs .tab-active#nopw i {
background-position: -218px -269px;
}
.input-grouptabs #normal i {
background-position: -218px -293px;
}
.input-grouptabs #nopw i {
background-position: -218px -293px;
}
.input-grouptabs span.tab-active {
color: #a92924
}
.active {
display: block;
}
.input-groupread {
height: 40px;
line-height: 30px;
width: 100%;
text-align: left;
}
.agreement_dialogs {
position: fixed;
top: 0px;
left: 0px;
right: 0px;
bottom: 0px;
width: 100%;
height: 100%;
z-index: 99999;
text-align: center;
display: none;
background-color: rgba(35, 35, 35, 0.4);
-webkit-transition: all 0.5s linear;
transition: all 0.5s linear;
}
.agreement_dialogs .dialog_lay_1syd {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
display: inline-block;
width: 750px;
color: #656565;
font-size: 12px;
line-height: 20px;
background-color: #fff;
text-align: left;
vertical-align: middle;
-webkit-transition: all 0.2s linear;
transition: all 0.2s linear;
}
.agreement_dialogs .dialog_foot_1hHfr {
height: 80px;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
border-top: 1px solid #d5d5d5;
margin: 0;
text-align: center;
}
.agreement_dialogs .dialog_minorBtn_1u8nf {
display: inline-block;
-webkit-box-sizing: border-box;
box-sizing: border-box;
border: 1px #316ccb solid;
padding: 0 30px;
height: 40px;
background: #a92924;
background: linear-gradient(90deg, #f0242e, #d0111a);
line-height: 40px;
cursor: pointer;
font-size: 16px;
vertical-align: top;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
color: #fff;
border-color: #fff;
}
.agreement_titley {
height: 55px;
line-height: 55px;
font-size: 16px;
color: #666;
text-align: center;
border-bottom: 1px solid #d5d5d5;
font-weight: 400;
}
.agreement_content {
margin: 23px 32px;
}
.con-subhead {
font-size: 14px;
font-weight: 500;
color: #333;
margin-bottom: 16px;
}
.con-content {
height: 240px;
overflow-y: scroll;
line-height: 2;
font-size: 13px;
}
#btnSendCode1 {
cursor: pointer;
}
</style>