|
|
@@ -15,6 +15,34 @@
|
|
|
ref="form"
|
|
|
:rules="rules"
|
|
|
>
|
|
|
+ <el-form-item
|
|
|
+ prop="phone"
|
|
|
+ label="手机号"
|
|
|
+ :rules="{
|
|
|
+ pattern: /^1[3-9]\d{9}$/,
|
|
|
+ message: '请输入正确的手机号',
|
|
|
+ trigger: 'blur'
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ style="width: 300px"
|
|
|
+ :disabled="true"
|
|
|
+ v-model="ruleForm.phone"
|
|
|
+ placeholder="请输入手机号"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="code" label="验证码">
|
|
|
+ <el-form-item prop="code" :rules="{ required: true, message: '请输入', trigger: 'blur' }">
|
|
|
+ <el-input style="width: 300px" v-model="ruleForm.code" placeholder="请输入短信验证码">
|
|
|
+ <span
|
|
|
+ @click="send"
|
|
|
+ style="color: #ff4f50; cursor: pointer; font-size: 13px"
|
|
|
+ slot="suffix"
|
|
|
+ >{{ time === 0 ? '发送验证码' : `重新发送${time}s` }}</span
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="原密码" prop="password">
|
|
|
<el-input
|
|
|
style="width: 300px"
|
|
|
@@ -53,14 +81,19 @@
|
|
|
|
|
|
<script>
|
|
|
import eventBus from '../../eventBus';
|
|
|
+import phone from '../../mixins/phone';
|
|
|
+import { mapState } from 'vuex';
|
|
|
export default {
|
|
|
+ mixins: [phone],
|
|
|
data() {
|
|
|
return {
|
|
|
labelPosition: 'right',
|
|
|
ruleForm: {
|
|
|
pass: '',
|
|
|
- password: ''
|
|
|
+ password: '',
|
|
|
+ phone: ''
|
|
|
},
|
|
|
+ time: 0,
|
|
|
rules: {
|
|
|
checkPass: [
|
|
|
{
|
|
|
@@ -78,7 +111,17 @@ export default {
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ ...mapState(['userInfo'])
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.ruleForm.phone = this.userInfo.phone;
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ // 验证码
|
|
|
+ send() {
|
|
|
+ this.sendMsg(this.form.phone);
|
|
|
+ },
|
|
|
codeSend() {
|
|
|
this.$refs.form.validate(valid => {
|
|
|
this.$http
|
|
|
@@ -94,25 +137,6 @@ export default {
|
|
|
this.$toast(e.error);
|
|
|
}
|
|
|
});
|
|
|
- // if (valid) {
|
|
|
- // this.$http
|
|
|
- // .post('/user/changePw', {
|
|
|
- // newPassword: this.ruleForm.pass,
|
|
|
- // password: this.ruleForm.password
|
|
|
- // })
|
|
|
- // .then(() => {
|
|
|
- // this.$message.warning('修改成功,请重新登录');
|
|
|
- // localStorage.removeItem('webToken');
|
|
|
- // this.$store.commit('updateUserInfo', null);
|
|
|
- // })
|
|
|
- // .then(() => {
|
|
|
- // this.$router.push('/');
|
|
|
- // eventBus.$emit('login');
|
|
|
- // })
|
|
|
- // .catch(e => {
|
|
|
- // this.$message.error(e.error);
|
|
|
- // });
|
|
|
- // }
|
|
|
});
|
|
|
}
|
|
|
}
|