parent
3989ff9f31
commit
a4b6335583
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* @Author: your name
|
||||
* @Date: 2021-10-23 17:19:09
|
||||
* @LastEditTime: 2021-10-23 17:26:38
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @Description: In User Settings Edit
|
||||
* @FilePath: /data-show/src/api/mySelf/index.js
|
||||
*/
|
||||
import httpService from "@/request"
|
||||
// 获取当前的数据
|
||||
export function getMyFileInfoExcel(params) {
|
||||
let obj = Object.assign({action: 'getFileInfoExcel', sType: 'User'}, params)
|
||||
return httpService({
|
||||
url: `/api/v6.ashx`,
|
||||
method: 'get',
|
||||
params: obj
|
||||
})
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
<!--
|
||||
* @Author: your name
|
||||
* @Date: 2021-10-23 15:58:58
|
||||
* @LastEditTime: 2021-10-23 17:13:21
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @Description: In User Settings Edit
|
||||
* @FilePath: /data-show/src/views/Myself/modifyForm/index.vue
|
||||
-->
|
||||
<template>
|
||||
<a-form-model layout="horizontal" :model="form" :rules="rules" :label-col="labelCol" :wrapper-col="wrapperCol" ref="resetForm">
|
||||
<a-form-model-item label="设置密码" prop="pwd1">
|
||||
<a-input type="password" v-model="form.pwd1" placeholder="请输入新密码" autocomplete="off"/>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="再次输入" prop="pwd2">
|
||||
<a-input type="password" v-model="form.pwd2" placeholder="请再次输入新密码" autocomplete="off"/>
|
||||
</a-form-model-item>
|
||||
</a-form-model>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {updPhonePwd} from "@/api/login"
|
||||
export default {
|
||||
name: "modifyForm",
|
||||
props: {
|
||||
forgetForm: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
const validatePass = (rule, value, callback) => {
|
||||
if (value === "") {
|
||||
callback(new Error("请输入密码"));
|
||||
} else {
|
||||
let reg =
|
||||
/^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?!([^(0-9a-zA-Z)])+$).{6,}$/;
|
||||
if (!reg.test(value)) {
|
||||
callback(new Error("密码由大小写字母、数字和特殊字符组成"));
|
||||
} else if (value.length < 8 || value.length > 16) {
|
||||
callback(new Error("密码8~16位"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
};
|
||||
const validatePass2 = (rule, value, callback) => {
|
||||
if (value === "") {
|
||||
callback(new Error("请输入密码"));
|
||||
} else {
|
||||
let reg =
|
||||
/^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?!([^(0-9a-zA-Z)])+$).{6,}$/;
|
||||
if (!reg.test(value)) {
|
||||
callback(new Error("密码由大小写字母、数字和特殊字符组成"));
|
||||
} else if (value.length < 8 || value.length > 16) {
|
||||
callback(new Error("密码8~16位"));
|
||||
} else if (value != this.form.pwd1) {
|
||||
callback(new Error("两次密码不一致"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
};
|
||||
return {
|
||||
form: {
|
||||
pwd1: "",
|
||||
pwd2: "",
|
||||
},
|
||||
labelCol: { span: 4 },
|
||||
wrapperCol: { span: 20 },
|
||||
rules: {
|
||||
pwd1: [{ validator: validatePass, trigger: "change" }],
|
||||
pwd2: [{ validator: validatePass2, trigger: "change" }],
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 完成
|
||||
onSuccess() {
|
||||
this.$refs.resetForm.validate((valid) => {
|
||||
if (valid) {
|
||||
let obj = {...this.forgetForm};
|
||||
obj.sPwd = this.form.pwd2;
|
||||
updPhonePwd(obj).then(() => {
|
||||
this.$emit('success')
|
||||
})
|
||||
} else {
|
||||
console.log("error submit!!");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
</style>
|
@ -0,0 +1,115 @@
|
||||
<!--
|
||||
* @Author: your name
|
||||
* @Date: 2021-10-23 15:34:18
|
||||
* @LastEditTime: 2021-10-23 17:13:16
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @Description: In User Settings Edit
|
||||
* @FilePath: /data-show/src/views/Myself/phoneForm/index.vue
|
||||
-->
|
||||
<template>
|
||||
<a-form-model layout="horizontal" :model="form" :rules="rules" ref="phoneForm" :label-col="labelCol" :wrapper-col="wrapperCol">
|
||||
<a-form-model-item label="手机号码" prop="sPhone">
|
||||
<a-input v-model="form.sPhone" placeholder="手机号码" autocomplete="off" />
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="验证码" prop="iCode">
|
||||
<a-input v-model="form.iCode" placeholder="验证码" autocomplete="off">
|
||||
<span class="fp-s1" slot="suffix" v-if="showCode" @click="getCode">发送验证码</span>
|
||||
<span class="fp-s1" slot="suffix" v-else>{{count}}</span>
|
||||
</a-input>
|
||||
</a-form-model-item>
|
||||
</a-form-model>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getVERCode, checkVERCode } from "@/api/login";
|
||||
export default {
|
||||
name: "phoneForm",
|
||||
data() {
|
||||
const validatePhone = (rule, value, callback) => {
|
||||
if (value === "") {
|
||||
callback(new Error("请输入手机号"));
|
||||
} else {
|
||||
let reg = /^1\d{10}$/;
|
||||
if (!reg.test(value)) {
|
||||
callback(new Error("请输入正确的手机号"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
};
|
||||
const validateCode = (rule, value, callback) => {
|
||||
if (value === "") {
|
||||
callback(new Error("请输入验证码"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
return {
|
||||
timer: null,
|
||||
count: 0,
|
||||
showCode: true,
|
||||
labelCol: { span: 4 },
|
||||
wrapperCol: { span: 20 },
|
||||
form: {
|
||||
sPhone: "",
|
||||
iCode: "",
|
||||
},
|
||||
rules: {
|
||||
sPhone: [{ validator: validatePhone, trigger: "change" }],
|
||||
iCode: [{ validator: validateCode, trigger: "change" }],
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
// 获取手机的验证码
|
||||
getCode() {
|
||||
this.$refs.phoneForm.validateField("sPhone", (errMsg) => {
|
||||
if (!errMsg) {
|
||||
getVERCode({ sPhone: this.form.sPhone }).then(() => {
|
||||
this.countdown();
|
||||
});
|
||||
} else {
|
||||
console.log("验证失败");
|
||||
}
|
||||
});
|
||||
},
|
||||
// 倒计时
|
||||
countdown() {
|
||||
const TIME_COUNT = 60;
|
||||
if (!this.timer) {
|
||||
this.count = TIME_COUNT;
|
||||
this.showCode = false;
|
||||
this.timer = setInterval(() => {
|
||||
if (this.count > 0 && this.count <= TIME_COUNT) {
|
||||
this.count--;
|
||||
} else {
|
||||
this.showCode = true;
|
||||
clearInterval(this.timer);
|
||||
this.timer = null;
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
},
|
||||
// 下一步
|
||||
onNext() {
|
||||
this.$refs.phoneForm.validate((valid) => {
|
||||
if (valid) {
|
||||
checkVERCode(this.form).then(() => {
|
||||
this.$emit("nextStep", this.form);
|
||||
});
|
||||
} else {
|
||||
console.log("error submit!!");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.fp-s1 {
|
||||
cursor: pointer;
|
||||
color: #698198;
|
||||
}
|
||||
</style>
|
Loading…
Reference in new issue