|
@@ -1,10 +1,10 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div>
|
|
<div>
|
|
|
<basic-container>
|
|
<basic-container>
|
|
|
- <avue-tabs :option="option"
|
|
|
|
|
|
|
+ <avue-form :option="option"
|
|
|
v-model="form"
|
|
v-model="form"
|
|
|
- @change="handleChange"
|
|
|
|
|
- @submit="handleSubmit"></avue-tabs>
|
|
|
|
|
|
|
+ @tab-click="handleTabClick"
|
|
|
|
|
+ @submit="handleSubmit"></avue-form>
|
|
|
</basic-container>
|
|
</basic-container>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
@@ -13,12 +13,13 @@
|
|
|
import option from "@/const/user/info";
|
|
import option from "@/const/user/info";
|
|
|
import {getUserInfo, updateInfo, updatePassword} from "@/api/system/user";
|
|
import {getUserInfo, updateInfo, updatePassword} from "@/api/system/user";
|
|
|
import md5 from 'js-md5';
|
|
import md5 from 'js-md5';
|
|
|
|
|
+ import func from "@/util/func";
|
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
- type: "info",
|
|
|
|
|
|
|
+ index: 0,
|
|
|
option: option,
|
|
option: option,
|
|
|
form: {}
|
|
form: {}
|
|
|
};
|
|
};
|
|
@@ -27,9 +28,9 @@
|
|
|
this.handleWitch();
|
|
this.handleWitch();
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
- handleSubmit() {
|
|
|
|
|
- if (this.type === "info") {
|
|
|
|
|
- updateInfo(this.form).then(res => {
|
|
|
|
|
|
|
+ handleSubmit(form, done) {
|
|
|
|
|
+ if (this.index === 0) {
|
|
|
|
|
+ updateInfo(form).then(res => {
|
|
|
if (res.data.success) {
|
|
if (res.data.success) {
|
|
|
this.$message({
|
|
this.$message({
|
|
|
type: "success",
|
|
type: "success",
|
|
@@ -41,9 +42,13 @@
|
|
|
message: res.data.msg
|
|
message: res.data.msg
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+ done();
|
|
|
|
|
+ }, error => {
|
|
|
|
|
+ window.console.log(error);
|
|
|
|
|
+ done();
|
|
|
})
|
|
})
|
|
|
} else {
|
|
} else {
|
|
|
- updatePassword(md5(this.form.oldPassword), md5(this.form.newPassword), md5(this.form.newPassword1)).then(res => {
|
|
|
|
|
|
|
+ updatePassword(md5(form.oldPassword), md5(form.newPassword), md5(form.newPassword1)).then(res => {
|
|
|
if (res.data.success) {
|
|
if (res.data.success) {
|
|
|
this.$message({
|
|
this.$message({
|
|
|
type: "success",
|
|
type: "success",
|
|
@@ -55,11 +60,15 @@
|
|
|
message: res.data.msg
|
|
message: res.data.msg
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+ done();
|
|
|
|
|
+ }, error => {
|
|
|
|
|
+ window.console.log(error);
|
|
|
|
|
+ done();
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
handleWitch() {
|
|
handleWitch() {
|
|
|
- if (this.type === "info") {
|
|
|
|
|
|
|
+ if (this.index === 0) {
|
|
|
getUserInfo().then(res => {
|
|
getUserInfo().then(res => {
|
|
|
const user = res.data.data;
|
|
const user = res.data.data;
|
|
|
this.form = {
|
|
this.form = {
|
|
@@ -73,8 +82,8 @@
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- handleChange(item) {
|
|
|
|
|
- this.type = item.prop;
|
|
|
|
|
|
|
+ handleTabClick(tabs) {
|
|
|
|
|
+ this.index = func.toInt(tabs.index);
|
|
|
this.handleWitch();
|
|
this.handleWitch();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|