Skip to content
This repository has been archived by the owner on Nov 15, 2018. It is now read-only.

Commit

Permalink
fix(user): (#548) 如果个人信息未变更,则完成按钮不可点
Browse files Browse the repository at this point in the history
  • Loading branch information
mutoe committed Oct 22, 2018
1 parent ef2eeef commit 98f3113
Showing 1 changed file with 7 additions and 30 deletions.
37 changes: 7 additions & 30 deletions src/page/UserInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ export default {
computed: {
...mapState(["CURRENTUSER"]),
disabled() {
return !["sex", "bio", "location", "name", this.change].some(
if (!this.bio || !this.name) return true;
if (this.location.label !== this.CURRENTUSER.location) return false;
return !["sex", "bio", "name", this.change].some(
key =>
typeof key === "string"
? this.$data[key] !== this.CURRENTUSER[key]
Expand Down Expand Up @@ -160,17 +162,7 @@ export default {
if (this.loading) return;
this.change = false;
this.loading = true;
// PATCH /user
if (this.bio.length === 0) {
this.$Message.error("简介不能为空");
this.loading = false;
return false;
}
if (this.bio.length > 50) {
this.$Message.error("简介不能超过50字");
this.loading = false;
return false;
}
const param = {
name: this.name,
bio: this.bio,
Expand Down Expand Up @@ -221,24 +213,9 @@ export default {
},
switchSex() {
const options = [
{
text: "",
method: () => {
this.sex = 1;
}
},
{
text: "",
method: () => {
this.sex = 2;
}
},
{
text: "保密",
method: () => {
this.sex = 0;
}
}
{ text: "", method: () => (this.sex = 1) },
{ text: "", method: () => (this.sex = 2) },
{ text: "保密", method: () => (this.sex = 0) }
];
this.$bus.$emit("actionSheet", options, "取消");
}
Expand Down

0 comments on commit 98f3113

Please sign in to comment.