Skip to content

Commit 0825618

Browse files
committed
add button loading
Signed-off-by: zhangtianli2006 <zhangtianli2006@163.com>
1 parent 579937a commit 0825618

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/components/problem/edit.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ export default {
9090
enabled: this.enabled
9191
})
9292
.then(() => {
93-
this.$SegmentMessage.success(this, 'Your change has been submited');
94-
this.$router.push('/problem/'+this.$route.params.id);
93+
this.buttonLoading = false;
94+
this.$SegmentMessage.success(this, 'Your changes have been submitted');
9595
})
9696
.catch(err => {
9797
if(err.request.status === 404) {

src/components/user/edit.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
<el-avatar shape="square" :size="400"><img src="./../../assets/icon/SOJ-thick-white-background.png" /></el-avatar>
66
</el-card>
77
<el-card class="item">
8-
<div slot="header" class="clearfix"><i class="el-icon-setting" /> Tool Bar</div>
9-
<el-button v-if="isMine || this.$store.state.user.isStaff || this.$store.state.user.isRoot" type="primary" @click="submit()">Submit</el-button>
8+
<el-button v-if="isMine || this.$store.state.user.isStaff || this.$store.state.user.isRoot" type="primary" @click="submit()" :loading="buttonLoading">Submit</el-button>
109
<el-button @click="$router.go(-1);">Back</el-button>
1110
</el-card>
1211
</div>
@@ -46,7 +45,8 @@ export default {
4645
isActive: true,
4746
isRootMe: false,
4847
isStaffMe: false,
49-
isActiveMe: true
48+
isActiveMe: true,
49+
buttonLoading: false,
5050
};
5151
},
5252
methods: {
@@ -71,6 +71,7 @@ export default {
7171
});
7272
},
7373
submit() {
74+
this.buttonLoading = true;
7475
this.$axios
7576
.patch(apiurl('/account/' + this.$route.params.id), {
7677
username: this.username,
@@ -80,7 +81,8 @@ export default {
8081
is_active: this.isActive
8182
})
8283
.then(() => {
83-
this.$SegmentMessage.success(this, 'Submitted');
84+
this.buttonLoading = false;
85+
this.$SegmentMessage.success(this, 'Your changes have been submitted');
8486
if (this.isMine) {
8587
this.$store.commit('userStaffChange', {
8688
isStaff: this.isStaff,

0 commit comments

Comments
 (0)