|
|
@ -1,5 +1,5 @@ |
|
|
|
<template> |
|
|
|
<md-dialog :md-active.sync="active" @close="active=false" v-if="steam64!==null"> |
|
|
|
<md-dialog :md-active.sync="active" @close="active=false" v-if="s64!==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> |
|
|
@ -25,7 +25,7 @@ |
|
|
|
</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;" class="btn-collect">Забанить</md-button> |
|
|
|
<md-button v-on:click="toBan(s64)" style="float: left;" class="btn-collect">Забанить</md-button> |
|
|
|
<md-button v-on:click="payload.ban_length = 0" style="float: left;" class="btn-unusual">Навсегда</md-button> |
|
|
|
<md-button v-on:click="showMe(false)" style="float: right;" class="btn-colored">Закрыть</md-button> |
|
|
|
</md-card-content> |
|
|
@ -37,7 +37,7 @@ |
|
|
|
</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;" class="btn-hand">Разбанить</md-button> |
|
|
|
<md-button v-on:click="toUnBan(s64)" style="float: left;" class="btn-hand">Разбанить</md-button> |
|
|
|
<md-button v-on:click="showMe(false)" style="float: right;" class="btn-colored">Закрыть</md-button> |
|
|
|
</md-card-content> |
|
|
|
</md-card> |
|
|
@ -57,7 +57,7 @@ |
|
|
|
</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" class="btn-high">Кикнуть</md-button> |
|
|
|
<md-button v-on:click="toKick(s64)" style="float: left" class="btn-high">Кикнуть</md-button> |
|
|
|
<md-button v-on:click="showMe(false)" style="float: right;" class="btn-colored">Закрыть</md-button> |
|
|
|
</md-card-content> |
|
|
|
</md-card> |
|
|
@ -72,8 +72,13 @@ export default { |
|
|
|
name: "AdminDialog", |
|
|
|
props: { |
|
|
|
steam64: String, |
|
|
|
any: { |
|
|
|
type: String, |
|
|
|
default: null |
|
|
|
} |
|
|
|
}, |
|
|
|
data: () => ({ |
|
|
|
s64: null, |
|
|
|
active: false, |
|
|
|
payload: { |
|
|
|
ban_length:0, |
|
|
@ -84,11 +89,19 @@ export default { |
|
|
|
current_mode: 0 |
|
|
|
}), |
|
|
|
methods: { |
|
|
|
showMe(b, m) {this.response="";this.active = b;this.current_mode =m}, |
|
|
|
toBan() { |
|
|
|
showMe(b, m) { |
|
|
|
if (b===true) { |
|
|
|
this.s64 = this.steam64; |
|
|
|
this.foundOfAny(); |
|
|
|
} |
|
|
|
this.response=""; |
|
|
|
this.active = b; |
|
|
|
this.current_mode =m; |
|
|
|
}, |
|
|
|
toBan(steam64) { |
|
|
|
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}` + Random.getRndWebAppend()) |
|
|
|
axios.post(`/api/admin/ban?steam64=${steam64}&ban_length=${this.payload.ban_length}&ban_reason=${this.payload.ban_reason}` + Random.getRndWebAppend()) |
|
|
|
.then((response) => { |
|
|
|
switch (response.status) { |
|
|
|
case 201: {this.response=`Успешно забанен, ид #${response.data}`;break;} |
|
|
@ -99,10 +112,10 @@ export default { |
|
|
|
}).catch(()=>{}) |
|
|
|
.finally(()=>{this.sending = false;}) |
|
|
|
}, |
|
|
|
toUnBan(){ |
|
|
|
toUnBan(steam64){ |
|
|
|
this.sending = true; |
|
|
|
this.response = "Отправляем..."; |
|
|
|
axios.post(`/api/admin/unban?steam64=${this.steam64}` + Random.getRndWebAppend()) |
|
|
|
axios.delete(`/api/admin/ban?steam64=${steam64}` + Random.getRndWebAppend()) |
|
|
|
.then((response) => { |
|
|
|
switch (response.status) { |
|
|
|
case 200: {this.response=`Игрок разбанен!`;break;} |
|
|
@ -113,10 +126,10 @@ export default { |
|
|
|
}).catch(()=>{}) |
|
|
|
.finally(()=>{this.sending = false;}) |
|
|
|
}, |
|
|
|
toKick(){ |
|
|
|
toKick(steam64){ |
|
|
|
this.sending = true; |
|
|
|
this.response = "Отправляем..."; |
|
|
|
axios.post(`/api/admin/kick?steam64=${this.steam64}&reason=${this.payload.ban_reason}` + Random.getRndWebAppend()) |
|
|
|
axios.post(`/api/admin/kick?steam64=${steam64}&reason=${this.payload.ban_reason}` + Random.getRndWebAppend()) |
|
|
|
.then((response) => { |
|
|
|
switch (response.status) { |
|
|
|
case 200: {this.response=`Игрок был кикнут!`;break;} |
|
|
@ -125,6 +138,15 @@ export default { |
|
|
|
} |
|
|
|
}).catch(()=>{}) |
|
|
|
.finally(()=>{this.sending = false;}) |
|
|
|
}, |
|
|
|
foundOfAny() { |
|
|
|
if (this.s64 !== null) return null; |
|
|
|
axios.post("/api/profile/steam/web" + Random.getRndWebNew(), {"any":this.any}) |
|
|
|
.then(response => { |
|
|
|
if (response.status === 200 && response.data && 'steam64' in response.data) { |
|
|
|
this.s64 = response.data['steam64']; |
|
|
|
} |
|
|
|
}).catch(()=>{}) |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|