From 544b30c830124e3516e68075c68777c63c840911 Mon Sep 17 00:00:00 2001 From: Pig Fang Date: Fri, 7 Sep 2018 22:26:34 +0800 Subject: [PATCH] Fix for dropdown menu in admin panel --- .../assets/src/components/admin/Players.vue | 121 ++++++++++++------ .../assets/src/components/admin/Users.vue | 41 +++++- resources/assets/src/stylus/admin.styl | 5 + .../tests/components/admin/Players.test.js | 16 +-- .../tests/components/admin/Users.test.js | 14 +- resources/lang/en/front-end.yml | 1 + resources/lang/zh_CN/front-end.yml | 1 + 7 files changed, 140 insertions(+), 59 deletions(-) diff --git a/resources/assets/src/components/admin/Players.vue b/resources/assets/src/components/admin/Players.vue index 7e81c87d..8272e2c7 100644 --- a/resources/assets/src/components/admin/Players.vue +++ b/resources/assets/src/components/admin/Players.vue @@ -14,13 +14,28 @@ styleClass="vgt-table striped" > + + @@ -131,6 +176,11 @@ export default { ofLabel: this.$t('vendor.datatable.of') } }, + textureChanges: { + originalIndex: -1, + model: 'steve', + tid: '', + } }; }, beforeMount() { @@ -162,23 +212,18 @@ export default { this.serverParams.search = params.searchTerm; this.fetchData(); }, - async changeTexture(player, model) { - const { dismiss, value } = await swal({ - text: this.$t('admin.pidNotice'), - input: 'number', - inputValue: player[`tid_${model}`] - }); - if (dismiss) { - return; - } + async changeTexture() { + const player = this.players[this.textureChanges.originalIndex]; + const { model, tid } = this.textureChanges; const { errno, msg } = await this.$http.post( '/admin/players?action=texture', - { pid: player.pid, model, tid: value } + { pid: player.pid, model, tid } ); if (errno === 0) { - player[`tid_${model}`] = value; + player[`tid_${model}`] = tid; toastr.success(msg); + $('.modal').modal('hide'); } else { toastr.warning(msg); } diff --git a/resources/assets/src/components/admin/Users.vue b/resources/assets/src/components/admin/Users.vue index 2071f6a5..718b6772 100644 --- a/resources/assets/src/components/admin/Users.vue +++ b/resources/assets/src/components/admin/Users.vue @@ -14,7 +14,25 @@ styleClass="vgt-table striped" >