菜单栏
This commit is contained in:
@@ -1,183 +0,0 @@
|
||||
<template>
|
||||
<div class="main">
|
||||
|
||||
<a-form style="max-width: 500px; margin: 40px auto 0;" :form="form" @keyup.enter.native="nextStep">
|
||||
<a-form-item>
|
||||
<a-input
|
||||
v-decorator="['username',validatorRules.username]"
|
||||
size="large"
|
||||
type="text"
|
||||
autocomplete="false"
|
||||
placeholder="请输入用户账号或手机号">
|
||||
<a-icon slot="prefix" type="lock" :style="{ color: 'rgba(0,0,0,.25)' }"/>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
<a-row :gutter="0">
|
||||
<a-col :span="14">
|
||||
<a-form-item>
|
||||
<a-input
|
||||
v-decorator="['inputCode',validatorRules.inputCode]"
|
||||
size="large"
|
||||
type="text"
|
||||
@change="inputCodeChange"
|
||||
placeholder="请输入验证码">
|
||||
<a-icon slot="prefix" v-if=" inputCodeContent==verifiedCode " type="smile"
|
||||
:style="{ color: 'rgba(0,0,0,.25)' }"/>
|
||||
<a-icon slot="prefix" v-else type="frown" :style="{ color: 'rgba(0,0,0,.25)' }"/>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="10" style="text-align: right">
|
||||
<img v-if="requestCodeSuccess" style="margin-top: 2px;" :src="randCodeImage" @click="handleChangeCheckCode"/>
|
||||
<img v-else style="margin-top: 2px;" src="../../../assets/checkcode.png" @click="handleChangeCheckCode"/>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-form-item :wrapperCol="{span: 19, offset: 5}">
|
||||
<router-link style="float: left;line-height: 40px;" :to="{ name: 'login' }">使用已有账户登录</router-link>
|
||||
<a-button type="primary" @click="nextStep">下一步</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getAction,postAction } from '@/api/manage'
|
||||
import { checkOnlyUser } from '@/api/api'
|
||||
|
||||
export default {
|
||||
name: "Step1",
|
||||
data() {
|
||||
return {
|
||||
form: this.$form.createForm(this),
|
||||
inputCodeContent: "",
|
||||
inputCodeNull: true,
|
||||
verifiedCode: "",
|
||||
validatorRules: {
|
||||
username: {rules: [{required: false}, {validator: this.validateInputUsername}]},
|
||||
inputCode: {rules: [{required: true, message: '请输入验证码!'}]},
|
||||
},
|
||||
randCodeImage:'',
|
||||
requestCodeSuccess:true,
|
||||
currdatetime:''
|
||||
|
||||
}
|
||||
},
|
||||
created(){
|
||||
this.handleChangeCheckCode();
|
||||
},
|
||||
methods: {
|
||||
handleChangeCheckCode(){
|
||||
this.currdatetime = new Date().getTime();
|
||||
getAction(`/sys/randomImage/${this.currdatetime}`).then(res=>{
|
||||
if(res.success){
|
||||
this.randCodeImage = res.result
|
||||
this.requestCodeSuccess=true
|
||||
}else{
|
||||
this.$message.error(res.message)
|
||||
this.requestCodeSuccess=false
|
||||
}
|
||||
}).catch(()=>{
|
||||
this.requestCodeSuccess=false
|
||||
})
|
||||
},
|
||||
nextStep() {
|
||||
let that = this
|
||||
this.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
let isPhone = false;
|
||||
var params = {}
|
||||
var reg = /^[1-9]\d*$|^0$/;
|
||||
var username = values.username;
|
||||
if (reg.test(username) == true) {
|
||||
params.phone = username;
|
||||
isPhone = true
|
||||
} else {
|
||||
params.username = username;
|
||||
}
|
||||
that.validateInputCode().then(()=>{
|
||||
getAction("/sys/user/querySysUser", params).then((res) => {
|
||||
if (res.success) {
|
||||
var userList = {
|
||||
username: res.result.username,
|
||||
phone: res.result.phone,
|
||||
isPhone: isPhone
|
||||
};
|
||||
setTimeout(function () {
|
||||
that.$emit('nextStep', userList)
|
||||
})
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
validateInputCode() {
|
||||
return new Promise((resolve,reject)=>{
|
||||
postAction("/sys/checkCaptcha",{
|
||||
captcha:this.inputCodeContent,
|
||||
checkKey:this.currdatetime
|
||||
}).then(res=>{
|
||||
if(res.success){
|
||||
resolve();
|
||||
}else{
|
||||
this.$message.error(res.message)
|
||||
reject();
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
inputCodeChange(e) {
|
||||
this.inputCodeContent = e.target.value;
|
||||
console.log(this.inputCodeContent)
|
||||
if (!e.target.value || 0 == e.target.value) {
|
||||
this.inputCodeNull = true
|
||||
} else {
|
||||
this.inputCodeContent = this.inputCodeContent.toLowerCase()
|
||||
this.inputCodeNull = false
|
||||
}
|
||||
},
|
||||
generateCode(value) {
|
||||
this.verifiedCode = value.toLowerCase();
|
||||
console.log(this.verifiedCode);
|
||||
},
|
||||
validateInputUsername(rule, value, callback) {
|
||||
console.log(value);
|
||||
var reg = /^[0-9]+.?[0-9]*/;
|
||||
if (!value) {
|
||||
callback("请输入用户名和手机号!");
|
||||
}
|
||||
|
||||
//判断用户输入账号还是手机号码
|
||||
if (reg.test(value)) {
|
||||
var params = {
|
||||
phone: value,
|
||||
};
|
||||
checkOnlyUser(params).then((res) => {
|
||||
if (res.success) {
|
||||
callback("用户名不存在!")
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
var params = {
|
||||
username: value,
|
||||
};
|
||||
checkOnlyUser(params).then((res) => {
|
||||
if (res.success) {
|
||||
callback("用户名不存在!")
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -1,204 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<a-form :form="form" style="max-width: 500px; margin: 40px auto 0;" @keyup.enter.native="nextStep">
|
||||
<a-form-item
|
||||
label="手机"
|
||||
:labelCol="{span: 5}"
|
||||
:wrapperCol="{span: 16}"
|
||||
style="text-align: left"
|
||||
>
|
||||
<a-input
|
||||
type="text"
|
||||
autocomplete="false"
|
||||
v-decorator="['phone',{ rules: validatorRules.phone.rule}]"
|
||||
placeholder="请输入手机号">
|
||||
<a-icon slot="prefix" type="phone" :style="{ color: 'rgba(0,0,0,.25)'}"/>
|
||||
</a-input>
|
||||
<a-col :span="3"></a-col>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
label="验证码"
|
||||
:labelCol="{span: 5}"
|
||||
:wrapperCol="{span: 19}"
|
||||
v-if="show">
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="13">
|
||||
<a-input
|
||||
v-decorator="['captcha',validatorRules.captcha]"
|
||||
type="text"
|
||||
placeholder="手机短信验证码">
|
||||
</a-input>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-button
|
||||
tabindex="-1"
|
||||
size="default"
|
||||
:disabled="state.smsSendBtn"
|
||||
@click.stop.prevent="getCaptcha"
|
||||
v-text="!state.smsSendBtn && '获取验证码' || (state.time+' s')"></a-button>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form-item>
|
||||
<a-form-item :wrapperCol="{span: 19, offset: 5}">
|
||||
<router-link style="float: left;line-height: 40px;" :to="{ name: 'login' }">使用已有账户登录</router-link>
|
||||
<a-button type="primary" @click="nextStep" style="margin-left: 20px">下一步</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {postAction} from '@/api/manage'
|
||||
|
||||
export default {
|
||||
name: "Step2",
|
||||
props: ['userList'],
|
||||
data() {
|
||||
return {
|
||||
form: this.$form.createForm(this),
|
||||
loading: false,
|
||||
// accountName: this.userList.username,
|
||||
dropList: "0",
|
||||
captcha: "",
|
||||
show: true,
|
||||
state: {
|
||||
time: 60,
|
||||
smsSendBtn: false,
|
||||
},
|
||||
formLogin: {
|
||||
captcha: "",
|
||||
mobile: "",
|
||||
},
|
||||
validatorRules: {
|
||||
captcha: {rule: [{required: true, message: '请输入短信验证码!'}, {validator: this.validateCaptcha}]},
|
||||
phone: {rule: [{required: true, message: '请输入手机号码!'}, {validator: this.validatePhone}]},
|
||||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
methods: {
|
||||
nextStep() {
|
||||
let that = this
|
||||
that.loading = true
|
||||
this.form.validateFields((err, values) => {
|
||||
console.log(values);
|
||||
if (!err) {
|
||||
if (that.dropList == "0") {
|
||||
if (values.captcha == undefined) {
|
||||
this.cmsFailed("请输入短信验证码!");
|
||||
} else {
|
||||
var params = {}
|
||||
params.phone = values.phone;
|
||||
params.smscode = values.captcha;
|
||||
postAction("/sys/user/phoneVerification", params).then((res) => {
|
||||
if (res.success) {
|
||||
console.log(res);
|
||||
var userList = {
|
||||
username: res.result.username,
|
||||
phone: values.phone,
|
||||
smscode: res.result.smscode
|
||||
};
|
||||
setTimeout(function () {
|
||||
that.$emit('nextStep', userList)
|
||||
}, 0)
|
||||
} else {
|
||||
this.cmsFailed(res.message);
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
getCaptcha(e) {
|
||||
e.preventDefault();
|
||||
let that = this;
|
||||
let phone=that.form.getFieldValue("phone")
|
||||
if(!phone){
|
||||
this.cmsFailed("手机号不能为空!");
|
||||
return;
|
||||
}
|
||||
this.state.smsSendBtn = true;
|
||||
let interval = window.setInterval(() => {
|
||||
if (that.state.time-- <= 0) {
|
||||
that.state.time = 60;
|
||||
that.state.smsSendBtn = false;
|
||||
window.clearInterval(interval);
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
const hide = this.$message.loading('验证码发送中..', 0);
|
||||
let smsParams = {
|
||||
mobile: phone,
|
||||
smsmode: "2"
|
||||
};
|
||||
postAction("/sys/sms", smsParams).then(res => {
|
||||
if (!res.success) {
|
||||
setTimeout(hide, 1);
|
||||
this.cmsFailed(res.message);
|
||||
}
|
||||
setTimeout(hide, 500);
|
||||
})
|
||||
},
|
||||
cmsFailed(err) {
|
||||
this.$notification['error']({
|
||||
message: "验证错误",
|
||||
description: err,
|
||||
duration: 4,
|
||||
});
|
||||
},
|
||||
handleChangeSelect(value) {
|
||||
var that = this;
|
||||
console.log(value);
|
||||
if (value == 0) {
|
||||
that.dropList = "0";
|
||||
that.show = true;
|
||||
} else {
|
||||
that.dropList = "1";
|
||||
that.show = false;
|
||||
}
|
||||
},
|
||||
validatePhone(rule,value,callback){
|
||||
if(value){
|
||||
var myreg=/^[1][3,4,5,7,8][0-9]{9}$/;
|
||||
if(!myreg.test(value)){
|
||||
callback("请输入正确的手机号")
|
||||
}else{
|
||||
callback();
|
||||
}
|
||||
}else{
|
||||
callback()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.stepFormText {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
.ant-row{
|
||||
margin-left: 0 !important;
|
||||
margin-right: 0 !important;
|
||||
}
|
||||
.ant-col{
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.ant-form-item-label,
|
||||
.ant-form-item-control {
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
.getCaptcha {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,132 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<a-form :form="form" style="max-width: 500px; margin: 40px auto 0;">
|
||||
<a-form-item
|
||||
label="账号名"
|
||||
:labelCol="{span: 5}"
|
||||
:wrapperCol="{span: 19}"
|
||||
>
|
||||
<a-input
|
||||
type="text"
|
||||
autocomplete="false" :value="accountName" disabled>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
label="新密码"
|
||||
:labelCol="{span: 5}"
|
||||
:wrapperCol="{span: 19}"
|
||||
class="stepFormText">
|
||||
<a-input
|
||||
v-decorator="['password',validatorRules.password]"
|
||||
type="password"
|
||||
autocomplete="false">
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
label="确认密码"
|
||||
:labelCol="{span: 5}"
|
||||
:wrapperCol="{span: 19}"
|
||||
class="stepFormText">
|
||||
<a-input
|
||||
v-decorator="['confirmPassword',validatorRules.confirmPassword]"
|
||||
type="password"
|
||||
autocomplete="false">
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
<a-form-item :wrapperCol="{span: 19, offset: 5}">
|
||||
<a-button style="margin-left: 8px" @click="prevStep">上一步</a-button>
|
||||
<a-button :loading="loading" type="primary" @click="nextStep" style="margin-left:20px">提交</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { putAction,getAction } from '@/api/manage'
|
||||
export default {
|
||||
name: "Step3",
|
||||
// components: {
|
||||
// Result
|
||||
// },
|
||||
props: ['userList'],
|
||||
data () {
|
||||
return {
|
||||
loading: false,
|
||||
form: this.$form.createForm(this),
|
||||
accountName: this.userList.username,
|
||||
validatorRules: {
|
||||
username: {rules: [{required: true, message: '用户名不能为空!'}]},
|
||||
password: {
|
||||
rules: [{
|
||||
required: true,
|
||||
pattern: /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,.\/]).{8,}$/,
|
||||
message: '密码由8位数字、大小写字母和特殊符号组成!!'
|
||||
}, {validator: this.handlePasswordLevel}]
|
||||
},
|
||||
confirmPassword: {rules: [{required: true, message: '密码不能为空!'}, {validator: this.handlePasswordCheck}]},
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
nextStep () {
|
||||
let that = this
|
||||
that.loading = true
|
||||
this.form.validateFields((err, values) => {
|
||||
if ( !err ){
|
||||
var params={}
|
||||
params.username=this.userList.username;
|
||||
params.password=values.password;
|
||||
params.smscode=this.userList.smscode;
|
||||
params.phone= this.userList.phone;
|
||||
getAction("/sys/user/passwordChange", params).then((res) => {
|
||||
if(res.success){
|
||||
var userList = {
|
||||
username: this.userList.username
|
||||
}
|
||||
console.log(userList);
|
||||
setTimeout(function () {
|
||||
that.$emit('nextStep', userList)
|
||||
}, 1500)
|
||||
}else{
|
||||
this.passwordFailed(res.message);
|
||||
that.loading = false
|
||||
}
|
||||
})
|
||||
} else{
|
||||
that.loading = false
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
prevStep () {
|
||||
this.$emit('prevStep', this.userList)
|
||||
},
|
||||
|
||||
handlePasswordCheck (rule, value, callback) {
|
||||
let password = this.form.getFieldValue('password')
|
||||
if (value && password && value.trim() !== password.trim()) {
|
||||
callback(new Error('两次密码不一致'))
|
||||
}
|
||||
callback()
|
||||
},
|
||||
passwordFailed(err){
|
||||
this.$notification[ 'error' ]({
|
||||
message: "更改密码失败",
|
||||
description:err,
|
||||
duration: 4,
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.stepFormText {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.ant-form-item-label,
|
||||
.ant-form-item-control {
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -1,55 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<a-form style="margin: 40px auto 0;">
|
||||
<result title="更改密码成功" :is-success="true">
|
||||
<div class="toLogin">
|
||||
<h3>将在<span>{{time}}</span>秒后返回登录页面.</h3>
|
||||
</div>
|
||||
</result>
|
||||
|
||||
</a-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Result from '@/views/result/Result'
|
||||
export default {
|
||||
name: "Step4",
|
||||
props:['userList'],
|
||||
components: {
|
||||
Result
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
loading: false,
|
||||
time: 0,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
countDown(){
|
||||
let that = this;
|
||||
that.time--;
|
||||
}
|
||||
},
|
||||
mounted(){
|
||||
let that = this;
|
||||
that.time = 5;
|
||||
setInterval(that.countDown, 1000);
|
||||
},
|
||||
watch: {
|
||||
time: function (newVal,oldVal) {
|
||||
if (newVal == 0) {
|
||||
var params = {
|
||||
username: this.userList.username
|
||||
};
|
||||
this.$router.push({name: 'login', params})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.toLogin{
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user