|
@@ -82,8 +82,7 @@
|
|
|
type="primary"
|
|
|
style="width: 100%; margin-top: 10px"
|
|
|
@click.native.prevent="handleLoginX"
|
|
|
- >下一步</el-button
|
|
|
- >
|
|
|
+ >下一步</el-button>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
<div v-else-if="step === 1">
|
|
@@ -127,15 +126,13 @@
|
|
|
:disabled="loading"
|
|
|
icon="el-icon-arrow-left"
|
|
|
@click.native.prevent="step = 0"
|
|
|
- >上一步</el-button
|
|
|
- >
|
|
|
+ >上一步</el-button>
|
|
|
<el-button
|
|
|
type="primary"
|
|
|
:loading="loading"
|
|
|
style="width: 140px"
|
|
|
@click.native.prevent="handleLoginY"
|
|
|
- >下一步<i class="el-icon-arrow-right el-icon--right"></i
|
|
|
- ></el-button>
|
|
|
+ >下一步<i class="el-icon-arrow-right el-icon--right" /></el-button>
|
|
|
</el-button-group>
|
|
|
</el-form>
|
|
|
</div>
|
|
@@ -145,8 +142,7 @@
|
|
|
</div>
|
|
|
<div class="teps-title">恭喜你,新密码设置成功!</div>
|
|
|
<div class="teps-time">
|
|
|
- <span>{{ num }}</span
|
|
|
- >秒后自动返回
|
|
|
+ <span>{{ num }}</span>秒后自动返回
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -159,123 +155,123 @@ import {
|
|
|
isMobile,
|
|
|
isnumber,
|
|
|
isAlphanumeric,
|
|
|
- validAlphabets,
|
|
|
-} from "@/utils/validate";
|
|
|
-import asyncRequest from "@/apis/service/user/index";
|
|
|
-import resToken from "@/mixins/resToken";
|
|
|
+ validAlphabets
|
|
|
+} from '@/utils/validate'
|
|
|
+import asyncRequest from '@/apis/service/user/index'
|
|
|
+import resToken from '@/mixins/resToken'
|
|
|
export default {
|
|
|
- name: "Login",
|
|
|
+ name: 'Login',
|
|
|
mixins: [resToken],
|
|
|
data() {
|
|
|
const validateUsername = (rule, value, callback) => {
|
|
|
- if (value === "") {
|
|
|
- callback(new Error("请输入账号"));
|
|
|
+ if (value === '') {
|
|
|
+ callback(new Error('请输入账号'))
|
|
|
} else {
|
|
|
- callback();
|
|
|
+ callback()
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
const validatemobile = (rule, value, callback) => {
|
|
|
- if (value === "") {
|
|
|
- callback(new Error("手机号不能为空!"));
|
|
|
+ if (value === '') {
|
|
|
+ callback(new Error('手机号不能为空!'))
|
|
|
} else {
|
|
|
if (!isMobile(value)) {
|
|
|
- callback(new Error("手机号不正确!"));
|
|
|
+ callback(new Error('手机号不正确!'))
|
|
|
} else {
|
|
|
- callback();
|
|
|
+ callback()
|
|
|
}
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
const validatecode = (rule, value, callback) => {
|
|
|
- if (value === "") {
|
|
|
- callback(new Error("验证码不能为空!"));
|
|
|
+ if (value === '') {
|
|
|
+ callback(new Error('验证码不能为空!'))
|
|
|
} else {
|
|
|
if (!isnumber(value)) {
|
|
|
- callback(new Error("验证码应为6位数字!"));
|
|
|
+ callback(new Error('验证码应为6位数字!'))
|
|
|
} else if (value.length !== 6) {
|
|
|
- callback(new Error("验证码应为6位数字!"));
|
|
|
+ callback(new Error('验证码应为6位数字!'))
|
|
|
} else {
|
|
|
- callback();
|
|
|
+ callback()
|
|
|
}
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
const validatePassword = (rule, value, callback) => {
|
|
|
- if (value === "") {
|
|
|
- callback(new Error("新密码不能为空!"));
|
|
|
+ if (value === '') {
|
|
|
+ callback(new Error('新密码不能为空!'))
|
|
|
} else {
|
|
|
if (!isAlphanumeric(value)) {
|
|
|
- callback(new Error("新密码为6-16位数字字母组合!"));
|
|
|
+ callback(new Error('新密码为6-16位数字字母组合!'))
|
|
|
} else if (value.length < 6 || value.length > 16) {
|
|
|
- callback(new Error("新密码为6-16位数字字母组合!"));
|
|
|
+ callback(new Error('新密码为6-16位数字字母组合!'))
|
|
|
} else if (isnumber(value)) {
|
|
|
- callback(new Error("新密码不能为纯数字!"));
|
|
|
+ callback(new Error('新密码不能为纯数字!'))
|
|
|
} else if (validAlphabets(value)) {
|
|
|
- callback(new Error("新密码不能为纯字母!"));
|
|
|
+ callback(new Error('新密码不能为纯字母!'))
|
|
|
} else {
|
|
|
- callback();
|
|
|
+ callback()
|
|
|
}
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
const validateConfirmPassword = (rule, value, callback) => {
|
|
|
- if (value === "") {
|
|
|
- callback(new Error("确认密码不能为空!"));
|
|
|
+ if (value === '') {
|
|
|
+ callback(new Error('确认密码不能为空!'))
|
|
|
} else {
|
|
|
if (this.loginFormY.newPassword !== value) {
|
|
|
- callback(new Error("确认密码与新密码不一致!"));
|
|
|
+ callback(new Error('确认密码与新密码不一致!'))
|
|
|
} else {
|
|
|
- callback();
|
|
|
+ callback()
|
|
|
}
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
return {
|
|
|
- stepList: ["验证身份", "重设密码", "设置成功"],
|
|
|
+ stepList: ['验证身份', '重设密码', '设置成功'],
|
|
|
timer: null,
|
|
|
num: 3,
|
|
|
step: 0,
|
|
|
loginFormX: {
|
|
|
- username: "",
|
|
|
- mobile: "",
|
|
|
- code: "",
|
|
|
+ username: '',
|
|
|
+ mobile: '',
|
|
|
+ code: ''
|
|
|
},
|
|
|
loginRulesX: {
|
|
|
username: [
|
|
|
- { required: true, trigger: "blur", validator: validateUsername },
|
|
|
+ { required: true, trigger: 'blur', validator: validateUsername }
|
|
|
],
|
|
|
mobile: [
|
|
|
- { required: true, trigger: "blur", validator: validatemobile },
|
|
|
+ { required: true, trigger: 'blur', validator: validatemobile }
|
|
|
],
|
|
|
- code: [{ required: true, trigger: "blur", validator: validatecode }],
|
|
|
+ code: [{ required: true, trigger: 'blur', validator: validatecode }]
|
|
|
},
|
|
|
loginFormY: {
|
|
|
- newPassword: "",
|
|
|
- confirmPassword: "",
|
|
|
+ newPassword: '',
|
|
|
+ confirmPassword: ''
|
|
|
},
|
|
|
loginRulesY: {
|
|
|
newPassword: [
|
|
|
- { required: true, trigger: "blur", validator: validatePassword },
|
|
|
+ { required: true, trigger: 'blur', validator: validatePassword }
|
|
|
],
|
|
|
confirmPassword: [
|
|
|
{
|
|
|
required: true,
|
|
|
- trigger: "blur",
|
|
|
- validator: validateConfirmPassword,
|
|
|
- },
|
|
|
- ],
|
|
|
+ trigger: 'blur',
|
|
|
+ validator: validateConfirmPassword
|
|
|
+ }
|
|
|
+ ]
|
|
|
},
|
|
|
- codeType: "code",
|
|
|
+ codeType: 'code',
|
|
|
capsTooltip: false,
|
|
|
loading: false,
|
|
|
showDialog: false,
|
|
|
redirect: undefined,
|
|
|
- otherQuery: {},
|
|
|
- };
|
|
|
+ otherQuery: {}
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
mounted() {
|
|
|
- if (this.loginFormX.mobile === "") {
|
|
|
- this.$refs.mobile.focus();
|
|
|
+ if (this.loginFormX.mobile === '') {
|
|
|
+ this.$refs.mobile.focus()
|
|
|
}
|
|
|
- if (this.loginFormX.code === "") {
|
|
|
- this.$refs.code.focus();
|
|
|
+ if (this.loginFormX.code === '') {
|
|
|
+ this.$refs.code.focus()
|
|
|
}
|
|
|
},
|
|
|
destroyed() {
|
|
@@ -283,78 +279,78 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
modifyPostLevel(val) {
|
|
|
- this.step = val;
|
|
|
+ this.step = val
|
|
|
},
|
|
|
phoneErr(e) {
|
|
|
if (!e) {
|
|
|
- this.$refs.loginFormX.validateField("mobile");
|
|
|
+ this.$refs.loginFormX.validateField('mobile')
|
|
|
}
|
|
|
},
|
|
|
checkCapslock(e) {
|
|
|
- const { key } = e;
|
|
|
- this.capsTooltip = key && key.length === 1 && key >= "A" && key <= "Z";
|
|
|
+ const { key } = e
|
|
|
+ this.capsTooltip = key && key.length === 1 && key >= 'A' && key <= 'Z'
|
|
|
},
|
|
|
|
|
|
handleLoginX() {
|
|
|
this.$refs.loginFormX.validate((valid) => {
|
|
|
if (valid) {
|
|
|
- this.step++;
|
|
|
+ this.step++
|
|
|
} else {
|
|
|
- return false;
|
|
|
+ return false
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
},
|
|
|
handleLoginY() {
|
|
|
this.$refs.loginFormY.validate((valid) => {
|
|
|
if (valid) {
|
|
|
if (!this.loading) {
|
|
|
- this.loading = true;
|
|
|
+ this.loading = true
|
|
|
const model = {
|
|
|
username: this.loginFormX.username,
|
|
|
mobile: this.loginFormX.mobile,
|
|
|
code: this.loginFormX.code,
|
|
|
- password: this.loginFormY.newPassword,
|
|
|
- };
|
|
|
- asyncRequest.resetpwd(model).then(async (res) => {
|
|
|
+ password: this.loginFormY.newPassword
|
|
|
+ }
|
|
|
+ asyncRequest.resetpwd(model).then(async(res) => {
|
|
|
if (res && res.code === 0) {
|
|
|
- this.loading = false;
|
|
|
- this.step++;
|
|
|
- this.setTime();
|
|
|
+ this.loading = false
|
|
|
+ this.step++
|
|
|
+ this.setTime()
|
|
|
} else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
- await this.logout();
|
|
|
+ await this.logout()
|
|
|
} else {
|
|
|
- this.$message.warning(res.message);
|
|
|
- this.loading = false;
|
|
|
+ this.$message.warning(res.message)
|
|
|
+ this.loading = false
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
}
|
|
|
} else {
|
|
|
- return false;
|
|
|
+ return false
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
},
|
|
|
setTime() {
|
|
|
this.timer = setInterval(() => {
|
|
|
if (this.num !== 0) {
|
|
|
- this.num--;
|
|
|
+ this.num--
|
|
|
} else {
|
|
|
if (this.timer) {
|
|
|
- clearInterval(this.timer);
|
|
|
- this.num = 3;
|
|
|
- this.gotoLogin();
|
|
|
+ clearInterval(this.timer)
|
|
|
+ this.num = 3
|
|
|
+ this.gotoLogin()
|
|
|
}
|
|
|
}
|
|
|
- }, 1000);
|
|
|
+ }, 1000)
|
|
|
},
|
|
|
|
|
|
gotoLogin() {
|
|
|
// this.$router.
|
|
|
// push(`/login`);
|
|
|
- window.vm.$router.replace(`/login`);
|
|
|
+ window.vm.$router.replace(`/login`)
|
|
|
// push("/login ");
|
|
|
- },
|
|
|
- },
|
|
|
-};
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|