<template>
|
<div class="login_page">
|
<headers :mess="loginWay" />
|
<div class="img_mess">
|
<div class="logo_content animated fadeInRight">
|
<img :src="Logo" alt />
|
</div>
|
</div>
|
<div class="logins_content">
|
<div class="login_title animated slideInDown">
|
<span>{{ '邮箱注册' }}</span>
|
</div>
|
<div class="login_forms">
|
<div class="top_forms">
|
<div class="user_name">
|
<input type="text" :placeholder="placeholder" v-model="phone" />
|
</div>
|
<div class="captcha">
|
<input type="text" :placeholder="verification" v-model="code" />
|
<div v-if="codeshow" @click="checkCodeBox">获取验证码</div>
|
<div v-if="!codeshow" class="getcode">{{count}}s</div>
|
</div>
|
<div class="password">
|
<input type="password" placeholder="密码为6~12位数字、字母或符号" v-model="userPassword" />
|
<!-- @input="handleInput()" -->
|
</div>
|
<div class="password">
|
<input type="password" placeholder="请再次确认密码" v-model="rePassword" />
|
</div>
|
<div class="user_name">
|
<input type="text" placeholder="机构代码" v-model="userName" />
|
</div>
|
</div>
|
<div class="bottom_btns">
|
<div class="top_btn" @click="gook" :class="btnClass ? 'on' : 'off'">
|
<span>{{ '安全注册' }}</span>
|
</div>
|
<div
|
class="register-form-item agree-model"
|
>
|
<i @click="isAgree"
|
:class="agree?'glyphicon glyphicon glyphicon-ok-sign blue':'glyphicon glyphicon-ok-circle'"></i>
|
我已阅读并同意
|
<a style="color:#fff">《注册协议》</a>
|
</div>
|
<div class="mes">
|
<span>{{ '已有账户?' }}</span>
|
<span @click="$router.push('/NewLogin')" style="color: rgb(54,124,248);">{{ '登录>' }}</span>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import headers from "./components/header.vue";
|
import Logo from "@/assets/img/LOGO2.png";
|
import { isNull, isPhone, pwdReg } from '@/utils/utils'
|
import { Toast } from 'mint-ui'
|
import * as api from '@/axios/api'
|
export default {
|
components: {
|
headers
|
},
|
name: "newRegister",
|
data () {
|
return{
|
verification:"验证码",
|
loginWay: "手机号注册",
|
loginWay: "手机号注册",
|
placeholder: "手机号",
|
Logo,
|
phone:"",
|
userName: "",
|
code:"",
|
userPassword: "",
|
btnClass: true,
|
codeshow: true,
|
count: '', // 倒计时
|
clickFalg: 0, // 点击次数
|
rePassword:"",
|
agree:false,
|
}},
|
mounted(){
|
|
},
|
methods:{
|
checkCodeBox () {
|
if (isNull(this.phone) || !isPhone(this.phone)) {
|
Toast('请输入正确的手机号')
|
} else {
|
this.checkPhone()
|
}
|
},
|
async getcode () {
|
// if(!this.checkCode()){
|
// // 验证图形码是否正确
|
// Toast('请输入正确图形验证码')
|
// return
|
// }
|
// 获取验证码
|
if (this.clickFalg !== 0) {
|
this.clickFalg = 0
|
return
|
}
|
this.clickFalg++
|
// var reg = 11 && /^((13|14|15|17|18)[0-9]{1}\d{8})$/
|
let reg = /^[0-9]{11}$/ // 手机号码验证
|
if (isNull(this.phone)) {
|
Toast('手机号不可为空')
|
} else {
|
if (!reg.test(this.phone)) {
|
Toast('请输入正确的手机号码')
|
} else {
|
// var sign = this.$md5(this.phone+'W&WzL42v').toUpperCase()
|
let result = await api.getCode({ phoneNum: this.phone })
|
if (result.status === 0) {
|
const TIME_COUNT = 60
|
if (!this.timer) {
|
this.count = TIME_COUNT
|
this.codeshow = false
|
this.clickFalg = 0
|
this.timer = setInterval(() => {
|
if (this.count > 0 && this.count <= TIME_COUNT) {
|
this.count--
|
} else {
|
this.codeshow = true
|
clearInterval(this.timer)
|
this.timer = null
|
}
|
}, 1000)
|
} else {
|
Toast(result.msg)
|
}
|
} else {
|
Toast(result.msg)
|
}
|
}
|
}
|
},
|
async gook () {
|
// 注册
|
if (!this.agree) {
|
Toast('需同意注册协议才能注册!')
|
} else if (isNull(this.phone) || !isPhone(this.phone)) {
|
Toast('请输入正确的手机号码')
|
} else if (isNull(this.userPassword)) {
|
Toast('请输入密码')
|
} else if (isNull(this.rePassword)) {
|
Toast('请确认密码')
|
} else if (isNull(this.code)) {
|
Toast('请输入验证码')
|
} else if (this.userPassword !== this.rePassword) {
|
Toast('两次输入的密码不一致')
|
this.password = 0
|
this.password2 = 0
|
} else if (!pwdReg(this.userPassword)) {
|
Toast('密码为6~12位,数字、字母或符号')
|
} else if (isNull(this.userName)) {
|
Toast('请输入机构代码')
|
} else {
|
let opts = {
|
// agentCode:'4023', // SR330001
|
phone: this.phone,
|
yzmCode: this.code,
|
userPwd: this.userPassword,
|
agentCode: this.userName
|
}
|
let data = await api.register(opts)
|
if (data.status === 0) {
|
Toast('注册成功,请登录')
|
this.$router.push('/NewLogin')
|
} else {
|
Toast(data.msg)
|
}
|
}
|
},
|
isAgree () {
|
this.agree=!this.agree
|
},
|
async checkPhone () {
|
// 先验证是否已经注册
|
let data = await api.checkPhone({ phoneNum: this.phone })
|
if (data.status === 0) {
|
// 如果用户已存在返回 0
|
Toast('用户已注册,请登录')
|
this.$router.push('/login')
|
} else {
|
// this.dialogShow = false
|
// this.adminUrl = process.env.API_HOST
|
// if (this.adminUrl === undefined) {
|
// this.adminUrl = ''
|
// }
|
// this.gook()
|
this.getcode()
|
}
|
},
|
},
|
|
}
|
</script>
|
|
<style scoped lang="less">
|
.logins_content {
|
width: 100%;
|
height: 9.7436rem;
|
margin-top: 0.4359rem;
|
padding: 0 0.2564rem;
|
.login_title {
|
width: 100%;
|
height: 2.0513rem;
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
font-size: 0.6923rem;
|
color: #fff;
|
}
|
.login_forms {
|
width: 100%;
|
height: 7.9231rem;
|
.top_forms {
|
width: 100%;
|
height: 4.5128rem;
|
display: flex;
|
align-items: center;
|
flex-wrap: wrap;
|
.user_name,.captcha,
|
.password {
|
width: 100%;
|
height: 35%;
|
background: #1e1e1e;
|
border-radius: 0.3564rem;
|
margin-top: 0.2rem;
|
> input {
|
width: 100%;
|
height: 100%;
|
padding-left: 0.3564rem;
|
font-size: 0.4615rem;
|
}
|
}
|
.captcha{
|
display: flex;
|
align-items: center;
|
> input {
|
width: 80%!important;
|
|
}
|
}
|
}
|
.bottom_btns {
|
width: 100%;
|
height: 3.3333rem;
|
display: flex;
|
flex-wrap: wrap;
|
align-items: center;
|
margin-top: 4.8128rem;
|
.top_btn {
|
width: 100%;
|
height: 40%;
|
border-radius: 0.3564rem;
|
background: rgb(131, 174, 243);
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
font-size: 0.5128rem;
|
}
|
.top_btn.on {
|
background: rgb(0, 71, 187);
|
}
|
.mes {
|
width: 100%;
|
height: 40%;
|
display: flex;
|
justify-content: flex-end;
|
align-items: center;
|
font-size: 0.3846rem;
|
}
|
}
|
}
|
}
|
.img_mess {
|
width: 100%;
|
height: 4.0513rem;
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
.logo_content {
|
width: 3rem;
|
height: 3.5769rem;
|
> img {
|
width: 100%;
|
height: 100%;
|
}
|
}
|
}
|
.agree-model{
|
margin-top: 0.2rem;
|
}
|
</style>
|