红绿项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

260 lines
6.8 KiB

<template>
<view class="">
<navigation>Register</navigation>
<view class="login-body">
<view class="input-item flex">
<view class="login-sigh flex">
<view class="imgcon">
<image src="../../static/login/[email protected]" mode=""></image>
</view>
<span class="quhao">+{{areacode}}</span>
</view>
<input type="text" value="" @focus="btnNum=1" @blur="btnNum=0" placeholder="mobile number" placeholder-style="color: #BFC2CCFF;font-size:14px;text-transform: capitalize;" v-model="mobile"/>
</view>
<view class="input-item flex">
<view class="login-sigh login-sigh2 flex">
<view class="imgcon">
<image src="../../static/login/[email protected]" mode=""></image>
</view>
</view>
<input class="input_pcod" @focus="btnNum=1" @blur="btnNum=0" value="" placeholder="Picture Code" placeholder-style="color: #BFC2CCFF;font-size:14px;text-transform: capitalize;" v-model="picCode"/>
<view class="login-sigh3 flex">
<image :src="imgcodeUrl" mode="scaleToFill" class="img1"></image>
<image src="../../static/login/[email protected]" mode="" class="img2" @click="getPicCode()"></image>
</view>
</view>
<view class="input-item flex">
<view class="login-sigh login-sigh2 flex">
<view class="imgcon">
<image src="../../static/login/[email protected]" mode=""></image>
</view>
</view>
<input @focus="btnNum=1" @blur="btnNum=0" value="" placeholder="Verification code" placeholder-style="color: #BFC2CCFF;font-size:14px;text-transform: capitalize;" v-model="infoCode"/>
<view class="otp" @click="getInfoCode()">
OTP
</view>
</view>
<view class="input-item flex">
<view class="login-sigh login-sigh2 flex">
<view class="imgcon">
<image src="../../static/login/[email protected]" mode=""></image>
</view>
</view>
<input @focus="btnNum=1" @blur="btnNum=0" type="password" value="" placeholder="password" placeholder-style="color: #BFC2CCFF;font-size:14px;text-transform: capitalize;" v-model="password"/>
</view>
<view class="input-item flex">
<view class="login-sigh login-sigh2 flex">
<view class="imgcon">
<image src="../../static/login/[email protected]" mode=""></image>
</view>
</view>
<input @focus="btnNum=1" @blur="btnNum=0" type="password" value="" placeholder="Confirm Password" placeholder-style="color: #BFC2CCFF;font-size:14px;text-transform: capitalize;" v-model="password2"/>
</view>
<view class="input-item flex">
<view class="login-sigh login-sigh2 flex">
<view class="imgcon">
<image src="../../static/login/[email protected]" mode=""></image>
</view>
</view>
<input @focus="btnNum=1" @blur="btnNum=0" value="" placeholder="Invite code" placeholder-style="color: #BFC2CCFF;font-size:14px;" v-model="inviteCode"/>
</view>
<view class="login-btn" @click="regist()" :class="btnNum==1?'login-btnon':''">
Register
</view>
<view class="login-re" @click="goLogin()">
Login
</view>
</view>
</view>
</template>
<script>
import api from '@/utils/api'
import utils from '@/utils'
import md5 from 'js-md5'
import store from '@/store'
import cont from "@/components/navigation/navigation.vue"
export default{
data(){
return{
mobile:'',
mark:'sms_user_register',
countryCode: '',
password:'',
password2:'',
inviteCode:'',
infoCode:'',
picCode:'',
imgcodeUrl: '',
btnNum:0,
rawData:'',
siteInfo:{},
areacode:''
}
},
onLoad() {
this.getPicCode();
this.areacode=uni.getStorageSync('siteInfo').areaCode;
},
methods:{
goLogin(){
uni.navigateTo({
url:'../login/index'
})
},
checPas(){
},
getInfoCode(){
if(this.picCode==''){
uni.showToast({
title: 'The graphic verification code is empty',
icon: 'none',
duration: 1500
})
return;
}
this.countryCode= uni.getStorageSync('siteInfo').countryCode
uni.request({
url: '/start/api/home/sendSmsCode',
data: {
"mobile":this.mobile,
"mark": this.mark,
"countryCode":this.countryCode,
"code": this.picCode
},
header: {
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8' //自定义请求头信息
},
method:'POST',//请求方式 或GET,必须为大写
success: (res) => {
uni.showToast({
title: res.data.errMsg,
icon: 'none',
duration: 2500
})
console.log(res.data);
},
fail:(res)=>{
uni.showToast({
title: res.data.errMsg,
icon: 'none',
duration: 2500
})
console.log(res.data);
}
});
},
getPicCode(){
this.imgcodeUrl ="/start/api/home/imgCode?uuid="+ this.$u.guid(20);
console.log();
console.log(this.imgcodeUrl)
},
regist() {
var a= /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{5,19}$/;
if(!a.test(this.password)){
uni.showToast({
title: 'Incorrect password format,a password requires a combination of numbers and letters',
icon: 'none',
duration: 1500
})
return;
}
if(this.password.length<6||this.password.length>20){
uni.showToast({
title: 'The login password requires 6-20 digits',
icon: 'none',
duration: 1500
})
return;
}
if (this.inviteCode == '') {
uni.showToast({
title: 'inviteCode Code is empty',
icon: 'none',
duration: 1500
})
return;
}
if (this.password == '' || this.password2 == '') {
uni.showToast({
title: 'Password is empty',
icon: 'none',
duration: 1500
})
return;
}
if(this.password!=this.password2){
uni.showToast({
title: 'The two passwords are inconsistent',
icon: 'none',
duration: 1500
})
return;
}
uni.request({
url: '/start/api/home/register',
data: {
"mobile":this.mobile,
'password': md5(this.password),
'inviteCode': this.inviteCode,
'code': this.infoCode,
},
header: {
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8' //自定义请求头信息
},
method:'POST',//请求方式 或GET,必须为大写
success: (res) => {
uni.showToast({
title: res.data.errMsg,
icon: 'none',
duration: 1500
})
setTimeout(function(){
uni.reLaunch({
url:'../login/index'
})
},1500)
},
fail:(res)=>{
uni.showToast({
title: res.data.errMsg,
icon: 'none',
duration: 1500
})
}
});
},
goLogin(){
uni.reLaunch({
url:'../login/index',
})
}
},
}
</script>
<style>
@import './index.css';
</style>