9 changed files with 151 additions and 16 deletions
@ -0,0 +1,130 @@ |
|||
<template> |
|||
<md-dialog :md-active.sync="active" @close="active=false" v-if="steam64!==null"> |
|||
<div class="md-layout md-alignment-bottom-center rounded-only"> |
|||
<md-card class="md-layout-item md-small-size-100" v-if="current_mode===1"> |
|||
<md-card-header> |
|||
<div class="md-title" style="display: inline;">Забанить игрока</div> |
|||
</md-card-header> |
|||
<md-card-content> |
|||
<div class="md-layout md-gutter"> |
|||
<div class="md-layout-item md-small-size-100"> |
|||
<md-field> |
|||
<label for="ban_reason">Причина</label> |
|||
<md-input name="ban_reason" v-model="payload.ban_reason" :disabled="sending" /> |
|||
<span class="md-error" v-if="payload.ban_reason<3">Нужна объективная причина</span> |
|||
</md-field> |
|||
</div> |
|||
</div> |
|||
<div class="md-layout md-gutter"> |
|||
<div class="md-layout-item md-small-size-100"> |
|||
<md-field> |
|||
<label for="ban_reason">Длина бана в минутах</label> |
|||
<md-input type="number" name="ban_reason" v-model="payload.ban_length" :disabled="sending" /> |
|||
<span class="md-error" v-if="payload.ban_length<0">Ты не можешь забанить в отрицалово</span> |
|||
</md-field> |
|||
</div> |
|||
</div> |
|||
<p v-if="response.length>0" style="font-family: tf2secondary; color: black">Ответ: {{response}}</p> |
|||
<md-button v-on:click="toBan()" style="float: left;background-color: #bd2200; color: black; font-family: tf2build">Забанить</md-button> |
|||
<md-button v-on:click="payload.ban_length = 0" style="float: left;background-color: #fd8846; color: black; font-family: tf2build">Навсегда</md-button> |
|||
<md-button v-on:click="showMe(false)" style="float: right;background-color: #46fd4f; color: black; font-family: tf2build">Закрыть</md-button> |
|||
</md-card-content> |
|||
</md-card> |
|||
<!----> |
|||
<md-card class="md-layout-item md-small-size-100" v-if="current_mode===2"> |
|||
<md-card-header> |
|||
<div class="md-title" style="display: inline;">Разбанить игрока</div> |
|||
</md-card-header> |
|||
<md-card-content> |
|||
<p v-if="response.length>0" style="font-family: tf2secondary; color: black">Ответ: {{response}}</p> |
|||
<md-button v-on:click="toUnBan()" style="float: left;background-color: #bd2200; color: black; font-family: tf2build">Разбанить</md-button> |
|||
<md-button v-on:click="showMe(false)" style="float: right;background-color: #46fd4f; color: black; font-family: tf2build">Закрыть</md-button> |
|||
</md-card-content> |
|||
</md-card> |
|||
<!----> |
|||
<md-card class="md-layout-item md-small-size-100" v-if="current_mode===3"> |
|||
<md-card-header> |
|||
<div class="md-title" style="display: inline;">Кикнуть игрока</div> |
|||
</md-card-header> |
|||
<md-card-content> |
|||
<div class="md-layout md-gutter"> |
|||
<div class="md-layout-item md-small-size-100"> |
|||
<md-field> |
|||
<label for="ban_reason">Причина</label> |
|||
<md-input name="ban_reason" v-model="payload.ban_reason" :disabled="sending" /> |
|||
<span class="md-error" v-if="payload.ban_reason<3">Нужна объективная причина</span> |
|||
</md-field> |
|||
</div> |
|||
</div> |
|||
<p v-if="response.length>0" style="font-family: tf2secondary; color: black">Ответ: {{response}}</p> |
|||
<md-button v-on:click="toKick()" style="float: left;background-color: #579af1; color: black; font-family: tf2build">Кикнуть</md-button> |
|||
<md-button v-on:click="showMe(false)" style="float: right;background-color: #46fd4f; color: black; font-family: tf2build">Закрыть</md-button> |
|||
</md-card-content> |
|||
</md-card> |
|||
</div> |
|||
</md-dialog> |
|||
</template> |
|||
|
|||
<script> |
|||
import axios from "axios"; |
|||
export default { |
|||
name: "AdminDialog", |
|||
props: { |
|||
steam64: String, |
|||
}, |
|||
data: () => ({ |
|||
active: false, |
|||
payload: { |
|||
ban_length:0, |
|||
ban_reason:"без причины" |
|||
}, |
|||
sending: false, |
|||
response: "", |
|||
current_mode: 0 |
|||
}), |
|||
methods: { |
|||
showMe(b, m) {this.response="";this.active = b;this.current_mode =m}, |
|||
toBan() { |
|||
this.sending = true; |
|||
this.response = "Отправляем..."; |
|||
axios.post(`/api/admin/ban?steam64=${this.steam64}&ban_length=${this.payload.ban_length}&ban_reason=${this.payload.ban_reason}`) |
|||
.then((response) => { |
|||
switch (response.status) { |
|||
case 201: {this.response=`Успешно забанен, ид #${response.data}`;break;} |
|||
case 202: {this.response=`Уже в бане, ид #${response.data}`;break;} |
|||
case 406: {this.response="Тот кого ты пытаешься забанить, круче тебя";break;} |
|||
default: {this.response="Куда ты лезишь мудоеб, не для тебя это";break;} |
|||
} |
|||
}).catch(()=>{}) |
|||
.finally(()=>{this.sending = false;}) |
|||
}, |
|||
toUnBan(){ |
|||
this.sending = true; |
|||
this.response = "Отправляем..."; |
|||
axios.post(`/api/admin/unban?steam64=${this.steam64}`) |
|||
.then((response) => { |
|||
switch (response.status) { |
|||
case 200: {this.response=`Игрок разбанен!`;break;} |
|||
case 404: {this.response=`Этот игрок не в бане!!!`;break;} |
|||
case 406: {this.response="Этого игрока забанил админ который круче тебя!";break;} |
|||
default: {this.response="Куда ты лезишь мудоеб, не для тебя это";break;} |
|||
} |
|||
}).catch(()=>{}) |
|||
.finally(()=>{this.sending = false;}) |
|||
}, |
|||
toKick(){ |
|||
this.sending = true; |
|||
this.response = "Отправляем..."; |
|||
axios.post(`/api/admin/kick?steam64=${this.steam64}&reason=${this.payload.ban_reason}`) |
|||
.then((response) => { |
|||
switch (response.status) { |
|||
case 200: {this.response=`Игрок был кикнут!`;break;} |
|||
case 404: {this.response=`Такого игрока нет на серверах!`;break;} |
|||
default: {this.response="Куда ты лезишь мудоеб, не для тебя это";break;} |
|||
} |
|||
}).catch(()=>{}) |
|||
.finally(()=>{this.sending = false;}) |
|||
} |
|||
}, |
|||
} |
|||
</script> |
Loading…
Reference in new issue