mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-10-02 02:06:38 +08:00
revert Leungs coding
This commit is contained in:
parent
66d7a0556b
commit
1ab577799d
@ -1,161 +1,147 @@
|
||||
// <!-- -->
|
||||
<template>
|
||||
<div class="container rc-full-width">
|
||||
<Myheader></Myheader>
|
||||
<div class="rc-top"></div>
|
||||
|
||||
<div class="container rc-full-width">
|
||||
<Myheader></Myheader>
|
||||
<div class="content ts-max-width--460">
|
||||
<h2 class="rc-beta rc-text--center">账号注册</h2>
|
||||
|
||||
<div class="content ts-max-width--460">
|
||||
<h2 class="rc-beta rc-text--center">账号注册</h2>
|
||||
|
||||
<div class="rc-layout-container rc-one-column">
|
||||
<div class="rc-column">
|
||||
<input
|
||||
class="ts-standard-input"
|
||||
v-model="tel"
|
||||
placeholder="请输入手机号"
|
||||
:error-message="usertel"
|
||||
v-if="!ifpassword"
|
||||
clearable
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <van-field
|
||||
v-model="password"
|
||||
type="password"
|
||||
placeholder="请输入密码"
|
||||
:error-message="pass"
|
||||
|
||||
clearable
|
||||
/> -->
|
||||
<div class="rc-layout-container rc-two-column">
|
||||
<div class="rc-column">
|
||||
<input
|
||||
v-if="!ifpassword"
|
||||
v-model="sms"
|
||||
class="ts-standard-input ts-standard-input--two center"
|
||||
center
|
||||
clearable
|
||||
placeholder="请输入验证码"
|
||||
|
||||
>
|
||||
</div>
|
||||
<div class="rc-column">
|
||||
<button
|
||||
:disabled="flag"
|
||||
slot="button"
|
||||
size="small"
|
||||
@click="sendCode"
|
||||
class="rc-use ts-standard-btn ts-standard-btn--two"
|
||||
>{{ buttonmsg }}</button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="rc-layout-container rc-one-column">
|
||||
<div class="usecheck rc-column rc-text--left">
|
||||
<label>
|
||||
<input
|
||||
type="checkbox"
|
||||
@click="checkBox()"
|
||||
style="width: 24px; height: 24px"
|
||||
v-model="inRank"
|
||||
/>我已阅读同意隐私声明和账号使用协议
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rc-layout-container rc-two-column rc-button">
|
||||
<div class="rc-column rc-text--left">
|
||||
<a href="#" class="rc-styled-link"><span>隐私政策</span></a>
|
||||
</div>
|
||||
<div class="rc-column rc-text--right">
|
||||
<nuxt-link :to="`/userlogin/login/`" class="rc-styled-link">
|
||||
<span>返回登录</span>
|
||||
</nuxt-link>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rc-layout-container rc-one-column">
|
||||
<div class="rc-column">
|
||||
<input
|
||||
class="ts-standard-input"
|
||||
v-model="tel"
|
||||
placeholder="请输入手机号"
|
||||
:error-message="usertel"
|
||||
v-if="!ifpassword"
|
||||
clearable
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <van-field
|
||||
v-model="password"
|
||||
type="password"
|
||||
placeholder="请输入密码"
|
||||
:error-message="pass"
|
||||
|
||||
<div class="rc-layout-container rc-one-column">
|
||||
<div class="rc-column">
|
||||
<input
|
||||
type="primary"
|
||||
:loading="loading"
|
||||
loading-text="注册中..."
|
||||
size="large"
|
||||
:disabled="zhud"
|
||||
@click="register()"
|
||||
class="ts-standard-btn ts-standard-btn--max-width"
|
||||
value="注册"
|
||||
></input
|
||||
>
|
||||
<!-- <van-divider @click="toLogin">注册账户</van-divider> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
clearable
|
||||
/> -->
|
||||
<div class="rc-layout-container rc-two-column">
|
||||
<div class="rc-column">
|
||||
<input
|
||||
v-if="!ifpassword"
|
||||
v-model="sms"
|
||||
class="ts-standard-input ts-standard-input--two center"
|
||||
center
|
||||
clearable
|
||||
placeholder="请输入验证码"
|
||||
|
||||
>
|
||||
</div>
|
||||
<div class="rc-column">
|
||||
<button
|
||||
:disabled="flag"
|
||||
slot="button"
|
||||
size="small"
|
||||
@click="sendCode"
|
||||
class="rc-use ts-standard-btn ts-standard-btn--two"
|
||||
>{{ buttonmsg }}</button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="rc-layout-container rc-one-column">
|
||||
<div class="usecheck rc-column rc-text--left">
|
||||
<label>
|
||||
<input
|
||||
type="checkbox"
|
||||
@click="checkBox()"
|
||||
style="width: 24px; height: 24px"
|
||||
v-model="inRank"
|
||||
/>我已阅读同意隐私声明和账号使用协议
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rc-layout-container rc-two-column rc-button">
|
||||
<div class="rc-column rc-text--left">
|
||||
<a href="#" class="rc-styled-link"><span>隐私政策</span></a>
|
||||
</div>
|
||||
<div class="rc-column rc-text--right">
|
||||
<nuxt-link :to="`/userlogin/login/`" class="rc-styled-link">
|
||||
<span>返回登录</span>
|
||||
</nuxt-link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="rc-layout-container rc-one-column">
|
||||
<div class="rc-column">
|
||||
<input
|
||||
type="primary"
|
||||
:loading="loading"
|
||||
loading-text="注册中..."
|
||||
size="large"
|
||||
:disabled="zhud"
|
||||
@click="register()"
|
||||
class="ts-standard-btn ts-standard-btn--max-width"
|
||||
value="注册"
|
||||
></input
|
||||
>
|
||||
<!-- <van-divider @click="toLogin">注册账户</van-divider> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
import {useredit,inserdiscount,sendMsg,vadatnmsg } from '../../ajax/getData'
|
||||
import {useredit,inserdiscount,sendMsg,vadatnmsg } from '../../ajax/getData'
|
||||
import Myheader from '~/components/header.vue' //引用头部公共组件
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
phone:'',
|
||||
layerMSg:'手机格式不对',
|
||||
tel:'',
|
||||
password:'',
|
||||
captchadata:'',
|
||||
tamp:'',
|
||||
hash:'',
|
||||
sms:'',
|
||||
buttonmsg:'获取验证码',
|
||||
flag:false,
|
||||
adminCode:'',
|
||||
zhud:false,
|
||||
usercheckbox:false,
|
||||
loading:false,
|
||||
usertitle:true,
|
||||
gender: '',
|
||||
inRank:false
|
||||
|
||||
tel:'',
|
||||
password:'',
|
||||
captchadata:'',
|
||||
tamp:'',
|
||||
hash:'',
|
||||
sms:'',
|
||||
buttonmsg:'获取验证码',
|
||||
flag:false,
|
||||
adminCode:'',
|
||||
zhud:false,
|
||||
usercheckbox:false,
|
||||
loading:false,
|
||||
usertitle:true,
|
||||
gender: '',
|
||||
inRank:false,
|
||||
ifpassword:false
|
||||
};
|
||||
},
|
||||
components: {
|
||||
// Myheader,
|
||||
Myheader,
|
||||
},
|
||||
computed: {
|
||||
usertel () {
|
||||
if (this.tel === ""){
|
||||
return ''
|
||||
}else if(!/^[1][3,4,5,7,8][0-9]{9}$/.test(this.tel)){
|
||||
return '手机号格式错误'
|
||||
}else {
|
||||
return ''
|
||||
}
|
||||
},
|
||||
pass () {
|
||||
if (this.password === ""){
|
||||
return ''
|
||||
}else if(this.password.length<6){
|
||||
return '密码不可小于6位'
|
||||
}else {
|
||||
return ''
|
||||
}
|
||||
},
|
||||
// test () {
|
||||
// if (this.sms === ""){
|
||||
// return ''
|
||||
// }else if(this.sms.length !== 5){
|
||||
// return '验证码格式错误'
|
||||
// }else {
|
||||
// return ''
|
||||
// }
|
||||
// }
|
||||
computed: {
|
||||
usertel () {
|
||||
if (this.tel === ""){
|
||||
return ''
|
||||
}else if(!/^[1][3,4,5,7,8][0-9]{9}$/.test(this.tel)){
|
||||
return '手机号格式错误'
|
||||
}else {
|
||||
return ''
|
||||
}
|
||||
},
|
||||
pass () {
|
||||
if (this.password === ""){
|
||||
return ''
|
||||
}else if(this.password.length<6){
|
||||
return '密码不可小于6位'
|
||||
}else {
|
||||
return ''
|
||||
}
|
||||
},
|
||||
|
||||
components: {
|
||||
|
||||
},
|
||||
mounted(){
|
||||
},
|
||||
@ -163,165 +149,160 @@ export default {
|
||||
methods: {
|
||||
|
||||
|
||||
//获取验证码
|
||||
async usermsg() {
|
||||
console.log("-----");
|
||||
//获取验证码
|
||||
async usermsg() {
|
||||
//console.log("-----");
|
||||
let data = await sendMsg(this.tel);
|
||||
if(data){
|
||||
console.log(data);
|
||||
this.captchadata=data.msgNum;
|
||||
this.tamp=data.tamp;
|
||||
this.hash=data.hash;
|
||||
//console.log(data);
|
||||
//this.captchadata=data.msgNum;
|
||||
this.tamp=data.tamp;
|
||||
this.hash=data.hash;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
//发送验证码数据
|
||||
async vadmsg() {
|
||||
console.log("-----");
|
||||
let data = await vadatnmsg(this.captchadata,this.hash,this.tamp);
|
||||
async vadmsg() {
|
||||
//console.log("-----");
|
||||
let data = await vadatnmsg(this.sms,this.hash,this.tamp);
|
||||
if(data){
|
||||
console.log(data);
|
||||
if(!data.code==1){
|
||||
return false
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
},
|
||||
checkBox(){
|
||||
console.log(event.target.checked)
|
||||
this.usercheckbox=event.target.checked
|
||||
|
||||
checkBox(){
|
||||
//console.log(event.target.checked)
|
||||
this.usercheckbox=event.target.checked
|
||||
|
||||
},
|
||||
|
||||
//添加优惠券
|
||||
async serdiscount (mobile,couponId) {
|
||||
//添加优惠券
|
||||
async serdiscount (mobile,couponId) {
|
||||
let data = await inserdiscount(mobile,couponId);
|
||||
if(data){
|
||||
console.log(data);
|
||||
console.log(data);
|
||||
}
|
||||
console.log(data);
|
||||
//console.log(data);
|
||||
},
|
||||
//注册账户
|
||||
sendCode () {
|
||||
this.getCode()
|
||||
},
|
||||
//注册账户
|
||||
sendCode () {
|
||||
this.getCode()
|
||||
},
|
||||
getCode() {
|
||||
if (!/^[1][3,4,5,7,8][0-9]{9}$/.test(this.tel) || this.tel === "") {
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '手机号码输入有误'
|
||||
});
|
||||
return
|
||||
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '手机号码输入有误'
|
||||
});
|
||||
return
|
||||
|
||||
} else{
|
||||
let time = 60;
|
||||
let timer;
|
||||
|
||||
timer = setInterval(() => {
|
||||
time--;
|
||||
if (time === 0) {
|
||||
clearInterval(timer);
|
||||
this.flag = false;
|
||||
this.buttonmsg = "点击发送验证码";
|
||||
return;
|
||||
}
|
||||
this.flag = true;
|
||||
this.buttonmsg = time + "秒后重新发送";
|
||||
}, 1000);
|
||||
this.usermsg();
|
||||
let time = 60;
|
||||
let timer;
|
||||
|
||||
timer = setInterval(() => {
|
||||
time--;
|
||||
if (time === 0) {
|
||||
clearInterval(timer);
|
||||
this.flag = false;
|
||||
this.buttonmsg = "点击发送验证码";
|
||||
return;
|
||||
}
|
||||
this.flag = true;
|
||||
this.buttonmsg = time + "秒后重新发送";
|
||||
}, 1000);
|
||||
this.usermsg();
|
||||
}
|
||||
},
|
||||
async register () {
|
||||
if (!/^[1][3,4,5,7,8][0-9]{9}$/.test(this.tel) || this.tel === "") {
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '手机号码输入有误'
|
||||
});
|
||||
return
|
||||
|
||||
async register () {
|
||||
if (!/^[1][3,4,5,7,8][0-9]{9}$/.test(this.tel) || this.tel === "") {
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '手机号码输入有误'
|
||||
});
|
||||
return
|
||||
|
||||
}
|
||||
if(this.sms!==this.captchadata){
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '验证码输入有误请重新输入'
|
||||
});
|
||||
return
|
||||
}
|
||||
if(this.sms==''){
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '请输入验证码'
|
||||
});
|
||||
return
|
||||
// if(this.sms!==this.captchadata){
|
||||
// this.$message({
|
||||
// type: 'warning',
|
||||
// message: '验证码输入有误请重新输入'
|
||||
// });
|
||||
// return
|
||||
// }
|
||||
if(this.sms==''){
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '请输入验证码'
|
||||
});
|
||||
return
|
||||
}
|
||||
console.log(this.usercheckbox);
|
||||
if(this.usercheckbox==false){
|
||||
console.log('----');
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '请先同意隐私声明和账号使用协议'
|
||||
});
|
||||
if (!/^[1][3,4,5,7,8][0-9]{9}$/.test(this.tel) || this.tel === "") {
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '请先勾选'
|
||||
});
|
||||
if (!/^[1][3,4,5,7,8][0-9]{9}$/.test(this.tel) || this.tel === "") {
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '手机号码输入有误'
|
||||
});
|
||||
return
|
||||
|
||||
}
|
||||
}
|
||||
else{
|
||||
type: 'warning',
|
||||
message: '手机号码输入有误'
|
||||
});
|
||||
return
|
||||
|
||||
|
||||
let user= JSON.parse(localStorage.getItem("userInfo"));
|
||||
console.log(this.tel);
|
||||
let data=await useredit(this.tel);
|
||||
this.vadmsg();
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: data.msg
|
||||
});
|
||||
if(data){
|
||||
let couponId='0000000123';
|
||||
this.serdiscount(user.data.mobile,couponId);
|
||||
setTimeout(() => {
|
||||
this.serdiscount(user.data.mobile,"0000000140");
|
||||
}, 100);
|
||||
setTimeout(() => {
|
||||
this.serdiscount(user.data.mobile,"0000000122");
|
||||
}, 500);
|
||||
|
||||
}
|
||||
|
||||
return
|
||||
|
||||
}
|
||||
}
|
||||
else{
|
||||
//let user= JSON.parse(localStorage.getItem("userInfo"));
|
||||
let data = await this.vadmsg();
|
||||
if(data.code=="1")
|
||||
{
|
||||
data=await useredit(this.tel);
|
||||
if(data.code=='1'){
|
||||
let couponId='0000000123';
|
||||
this.serdiscount(this.tel,couponId);
|
||||
setTimeout(() => {
|
||||
this.serdiscount(this.tel,"0000000140");
|
||||
}, 100);
|
||||
setTimeout(() => {
|
||||
this.serdiscount(this.tel,"0000000122");
|
||||
}, 500);
|
||||
this.$router.push({
|
||||
path: "/",
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: data.msg
|
||||
});
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
},
|
||||
|
||||
// reallR () {
|
||||
// this.zhud=true
|
||||
// this.loading=true
|
||||
// axios.post('https://www.daxunxun.com/users/register', {
|
||||
// username: this.tel,
|
||||
// password: this.password
|
||||
// }).then(res=>{
|
||||
// this.zhud=false
|
||||
// this.loading=false
|
||||
// if (res.data === 2) {
|
||||
// Toast('用户名已注册,请直接登录')
|
||||
// } else if (res.data === 0) {
|
||||
// Toast('注册失败')
|
||||
// } else {
|
||||
// Toast('注册成功')
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
|
||||
},
|
||||
|
||||
// reallR () {
|
||||
// this.zhud=true
|
||||
// this.loading=true
|
||||
// axios.post('https://www.daxunxun.com/users/register', {
|
||||
// username: this.tel,
|
||||
// password: this.password
|
||||
// }).then(res=>{
|
||||
// this.zhud=false
|
||||
// this.loading=false
|
||||
// if (res.data === 2) {
|
||||
// Toast('用户名已注册,请直接登录')
|
||||
// } else if (res.data === 0) {
|
||||
// Toast('注册失败')
|
||||
// } else {
|
||||
// Toast('注册成功')
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,39 +1,38 @@
|
||||
<template>
|
||||
<div class="container rc-full-width">
|
||||
<Myheader></Myheader>
|
||||
|
||||
<div class="rc-top"></div>
|
||||
<div class="content ts-max-width--460">
|
||||
<h2 class="rc-beta rc-text--center">{{ usertitle ? "账号登录" : "" }}</h2>
|
||||
<!-- Deprecated : No tab switching as no password
|
||||
<div class="rc-header">
|
||||
<span
|
||||
v-for="(item, index) in swiperData"
|
||||
:key="index"
|
||||
@click="selectGoods(item, index)"
|
||||
:class="activeIndex == index ? 'active' : 'unactive'"
|
||||
>{{ item.title }}</span
|
||||
>
|
||||
</div>
|
||||
-->
|
||||
|
||||
<div class="rc-layout-container rc-one-column">
|
||||
<div class="rc-column">
|
||||
<input
|
||||
class="ts-standard-input"
|
||||
v-model="tel"
|
||||
placeholder="请输入手机号"
|
||||
:error-message="usertel"
|
||||
v-if="!ifpassword"
|
||||
clearable
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Deprecated : No tab switching as no password
|
||||
<h2 class="rc-beta rc-text--center">{{ usertitle ? "账号登录" : "" }}</h2>
|
||||
<!-- Deprecated : No tab switching as no password
|
||||
<div class="rc-header">
|
||||
<span
|
||||
v-for="(item, index) in swiperData"
|
||||
:key="index"
|
||||
@click="selectGoods(item, index)"
|
||||
:class="activeIndex == index ? 'active' : 'unactive'"
|
||||
>{{ item.title }}</span
|
||||
>
|
||||
</div>
|
||||
-->
|
||||
<div class="rc-layout-container rc-one-column">
|
||||
<div class="rc-column">
|
||||
<input
|
||||
class="ts-standard-input"
|
||||
v-model="tel"
|
||||
placeholder="请输入手机号"
|
||||
:error-message="usertel"
|
||||
v-if="!ifpassword"
|
||||
clearable
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Deprecated : No tab switching as no password
|
||||
<input
|
||||
v-model="text"
|
||||
class="ts-standard-input ts-standard-input--two"
|
||||
placeholder="请输入账号"
|
||||
|
||||
|
||||
v-if="ifpassword"
|
||||
clearable
|
||||
/>
|
||||
@ -42,76 +41,76 @@
|
||||
v-model="password"
|
||||
type="password"
|
||||
placeholder="请输入密码"
|
||||
|
||||
|
||||
v-if="ifpassword"
|
||||
clearable
|
||||
/>
|
||||
-->
|
||||
<div class="rc-layout-container rc-two-column">
|
||||
<div class="rc-column">
|
||||
<input
|
||||
v-if="!ifpassword"
|
||||
v-model="sms"
|
||||
class="ts-standard-input ts-standard-input--two center"
|
||||
center
|
||||
clearable
|
||||
placeholder="请输入验证码"
|
||||
|
||||
>
|
||||
</div>
|
||||
<div class="rc-column">
|
||||
<button
|
||||
:disabled="flag"
|
||||
slot="button"
|
||||
size="small"
|
||||
@click="sendCode"
|
||||
class="rc-use ts-standard-btn ts-standard-btn--two"
|
||||
>{{ buttonmsg }}</button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="rc-layout-container rc-one-column">
|
||||
<div class="usecheck rc-column rc-text--left">
|
||||
<label>
|
||||
<input
|
||||
type="checkbox"
|
||||
@click="checkBox()"
|
||||
style="width: 24px; height: 24px"
|
||||
v-model="inRank"
|
||||
/>我已阅读同意隐私声明和账号使用协议
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rc-layout-container rc-two-column rc-button">
|
||||
<div class="rc-column rc-text--left">
|
||||
<a href="#" class="rc-styled-link"><span>隐私政策</span></a>
|
||||
</div>
|
||||
<div class="rc-column rc-text--right">
|
||||
<nuxt-link :to="`/userlogin/edit/`" class="rc-styled-link">
|
||||
<span>注册账户</span>
|
||||
</nuxt-link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="rc-layout-container rc-one-column">
|
||||
<div class="rc-column">
|
||||
<input
|
||||
type="primary"
|
||||
:loading="loading"
|
||||
loading-text="登录..."
|
||||
size="large"
|
||||
:disabled="zhud"
|
||||
@click="register()"
|
||||
class="ts-standard-btn ts-standard-btn--max-width"
|
||||
value="登录"
|
||||
></input
|
||||
>
|
||||
<!-- <van-divider @click="toLogin">注册账户</van-divider> -->
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
<div class="rc-layout-container rc-two-column">
|
||||
<div class="rc-column">
|
||||
<input
|
||||
v-if="!ifpassword"
|
||||
v-model="sms"
|
||||
class="ts-standard-input ts-standard-input--two center"
|
||||
center
|
||||
clearable
|
||||
placeholder="请输入验证码"
|
||||
|
||||
>
|
||||
</div>
|
||||
<div class="rc-column">
|
||||
<button
|
||||
:disabled="flag"
|
||||
slot="button"
|
||||
size="small"
|
||||
@click="sendCode"
|
||||
class="rc-use ts-standard-btn ts-standard-btn--two"
|
||||
>{{ buttonmsg }}</button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="rc-layout-container rc-one-column">
|
||||
<div class="usecheck rc-column rc-text--left">
|
||||
<label>
|
||||
<input
|
||||
type="checkbox"
|
||||
@click="checkBox()"
|
||||
style="width: 24px; height: 24px"
|
||||
v-model="inRank"
|
||||
/>我已阅读同意隐私声明和账号使用协议
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rc-layout-container rc-two-column rc-button">
|
||||
<div class="rc-column rc-text--left">
|
||||
<a href="#" class="rc-styled-link"><span>隐私政策</span></a>
|
||||
</div>
|
||||
<div class="rc-column rc-text--right">
|
||||
<nuxt-link :to="`/userlogin/edit/`" class="rc-styled-link">
|
||||
<span>注册账户</span>
|
||||
</nuxt-link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="rc-layout-container rc-one-column">
|
||||
<div class="rc-column">
|
||||
<input
|
||||
type="primary"
|
||||
:loading="loading"
|
||||
loading-text="登录..."
|
||||
size="large"
|
||||
:disabled="zhud"
|
||||
@click="register()"
|
||||
class="ts-standard-btn ts-standard-btn--max-width"
|
||||
value="登录"
|
||||
></input
|
||||
>
|
||||
<!-- <van-divider @click="toLogin">注册账户</van-divider> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@ -146,11 +145,11 @@ export default {
|
||||
swiperData: [
|
||||
// { index: 1 ,title:'短信验证码登录'},
|
||||
// { index: 2 ,title:'密码登录'},
|
||||
],
|
||||
]
|
||||
};
|
||||
},
|
||||
components: {
|
||||
Myheader
|
||||
Myheader
|
||||
},
|
||||
computed: {
|
||||
usertel() {
|
||||
@ -181,48 +180,40 @@ export default {
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
components: {},
|
||||
mounted() {
|
||||
console.log(this.$route.params);
|
||||
//console.log(this.$route.params);
|
||||
},
|
||||
// watch: function () {
|
||||
// console.log(this.inRank);
|
||||
// },
|
||||
methods: {
|
||||
|
||||
...mapMutations(["changeClod"]),
|
||||
...mapMutations(["changeClod"]),
|
||||
checkBox(){
|
||||
console.log(event.target.checked)
|
||||
this.usercheckbox=event.target.checked
|
||||
|
||||
console.log(event.target.checked)
|
||||
this.usercheckbox=event.target.checked
|
||||
},
|
||||
|
||||
//获取验证码
|
||||
async usermsg() {
|
||||
console.log("-----");
|
||||
async usermsg() {
|
||||
//console.log("-----");
|
||||
let data = await sendMsg(this.tel);
|
||||
if(data){
|
||||
console.log(data);
|
||||
this.captchadata=data.msgNum;
|
||||
this.tamp=data.tamp;
|
||||
this.hash=data.hash;
|
||||
console.log(data);
|
||||
//this.captchadata=data.msgNum;
|
||||
this.tamp=data.tamp;
|
||||
this.hash=data.hash;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
//发送验证码数据
|
||||
async vadmsg() {
|
||||
console.log("-----");
|
||||
let data = await vadatnmsg(this.captchadata,this.hash,this.tamp);
|
||||
//发送验证码数据
|
||||
async vadmsg() {
|
||||
//console.log("-----");
|
||||
let data = await vadatnmsg(this.sms,this.hash,this.tamp);
|
||||
if(data){
|
||||
console.log(data.code);
|
||||
if(!data.code==1){
|
||||
return false
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
},
|
||||
onClickHander(e) {
|
||||
console.log(e);
|
||||
@ -239,7 +230,7 @@ export default {
|
||||
},
|
||||
//注册账户
|
||||
useredd() {
|
||||
console.log("---注册账户");
|
||||
//console.log("---注册账户");
|
||||
this.usertitle = false;
|
||||
},
|
||||
|
||||
@ -248,134 +239,96 @@ export default {
|
||||
},
|
||||
sendCode() {
|
||||
|
||||
this.getCode();
|
||||
this.getCode();
|
||||
|
||||
|
||||
|
||||
},
|
||||
getCode() {
|
||||
if (!/^[1][3,4,5,7,8][0-9]{9}$/.test(this.tel) || this.tel === "") {
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '手机号码输入有误'
|
||||
});
|
||||
return
|
||||
|
||||
} else{
|
||||
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '手机号码输入有误'
|
||||
});
|
||||
return
|
||||
|
||||
let time = 60;
|
||||
let timer;
|
||||
|
||||
timer = setInterval(() => {
|
||||
time--;
|
||||
if (time === 0) {
|
||||
clearInterval(timer);
|
||||
this.flag = false;
|
||||
this.buttonmsg = "点击发送验证码";
|
||||
return;
|
||||
}
|
||||
this.flag = true;
|
||||
this.buttonmsg = time + "秒后重新发送";
|
||||
}, 1000);
|
||||
this.usermsg();
|
||||
} else{
|
||||
|
||||
|
||||
let time = 60;
|
||||
let timer;
|
||||
|
||||
timer = setInterval(() => {
|
||||
time--;
|
||||
if (time === 0) {
|
||||
clearInterval(timer);
|
||||
this.flag = false;
|
||||
this.buttonmsg = "点击发送验证码";
|
||||
return;
|
||||
}
|
||||
this.flag = true;
|
||||
this.buttonmsg = time + "秒后重新发送";
|
||||
}, 1000);
|
||||
this.usermsg();
|
||||
}
|
||||
},
|
||||
async register() {
|
||||
if (!/^[1][3,4,5,7,8][0-9]{9}$/.test(this.tel) || this.tel === "") {
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '手机号码输入有误'
|
||||
});
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
if(this.sms!==this.captchadata){
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '验证码输入有误请重新输入'
|
||||
});
|
||||
return
|
||||
if (!/^[1][3,4,5,7,8][0-9]{9}$/.test(this.tel) || this.tel === "") {
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '手机号码输入有误'
|
||||
});
|
||||
return
|
||||
}
|
||||
if(this.sms==''){
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '请输入验证码'
|
||||
});
|
||||
return
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '请输入验证码'
|
||||
});
|
||||
return
|
||||
}
|
||||
console.log(this.usercheckbox);
|
||||
if(this.usercheckbox==false){
|
||||
console.log('----');
|
||||
//console.log('----');
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '请先同意隐私声明和账号使用协议'
|
||||
});
|
||||
if (!/^[1][3,4,5,7,8][0-9]{9}$/.test(this.tel) || this.tel === "") {
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '请先勾选'
|
||||
});
|
||||
if (!/^[1][3,4,5,7,8][0-9]{9}$/.test(this.tel) || this.tel === "") {
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '手机号码输入有误'
|
||||
});
|
||||
return
|
||||
|
||||
}
|
||||
}
|
||||
else{
|
||||
console.log(this.tel);
|
||||
let data = await userLongin(this.tel);
|
||||
console.log(data);
|
||||
this.vadmsg();
|
||||
|
||||
type: 'warning',
|
||||
message: '手机号码输入有误'
|
||||
});
|
||||
return
|
||||
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '登录成功'
|
||||
});
|
||||
if(data.msg=='SUCCESS'){
|
||||
this.$router.push({
|
||||
path: "/",
|
||||
|
||||
});
|
||||
let token=JSON.stringify(data);
|
||||
this.changeClod({ cloud: token });
|
||||
}else{
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: data.msg
|
||||
});
|
||||
}
|
||||
|
||||
return
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
else{
|
||||
let data=await this.vadmsg();
|
||||
if(data.code=="1")
|
||||
{
|
||||
data = await userLongin(this.tel);
|
||||
if(data.msg=='SUCCESS'){
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '登录成功'
|
||||
});
|
||||
this.$router.push({
|
||||
path: "/",
|
||||
});
|
||||
let token=JSON.stringify(data);
|
||||
this.changeClod({ cloud: token });
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: data.msg
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
|
||||
// reallR () {
|
||||
// this.zhud=true
|
||||
// this.loading=true
|
||||
// axios.post('https://www.daxunxun.com/users/register', {
|
||||
// username: this.tel,
|
||||
// password: this.password
|
||||
// }).then(res=>{
|
||||
// this.zhud=false
|
||||
// this.loading=false
|
||||
// if (res.data === 2) {
|
||||
// Toast('用户名已注册,请直接登录')
|
||||
// } else if (res.data === 0) {
|
||||
// Toast('注册失败')
|
||||
// } else {
|
||||
// Toast('注册成功')
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
return
|
||||
}},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
@import url("../../assets/css/global.less");
|
||||
@import url("../../assets/css/login.less");
|
||||
</style>
|
Loading…
Reference in New Issue
Block a user