4 changed files with 64 additions and 4 deletions
@ -0,0 +1,54 @@ |
|||
<template> |
|||
<md-dialog :md-active.sync="showReportDialog" @close="showReportDialog=false"> |
|||
<div class="md-layout md-alignment-bottom-center"> |
|||
<div class="md-layout-item md-size-100 md-small-size-100 md-alignment-bottom-center rounded-only"> |
|||
<md-field style="padding-left: 5%; padding-right: 5%;" :class="hasFeedback"> |
|||
<label style="padding-left: 5%; padding-right: 5%">{{'Причина тряски?'}}</label> |
|||
<md-input v-model="reason" minlength="32"></md-input> |
|||
<span class="md-error" style="padding-left: 5%; padding-right: 5%">{{feedback}}</span> |
|||
</md-field> |
|||
<md-button class="md-raised" style="color: #131213; font-family: tf2build; background: brown" v-on:click="sendReport()">Пожаловаться</md-button> |
|||
<md-button class="md-raised" style="color: #131213; font-family: tf2build; background: #a1a52a" v-on:click="showReportDialog=false">Передумал</md-button> |
|||
</div> |
|||
</div> |
|||
</md-dialog> |
|||
</template> |
|||
|
|||
<script> |
|||
import axios from "axios"; |
|||
export default { |
|||
name: "ReportView", |
|||
props: { |
|||
steam64:String |
|||
}, |
|||
data: () => ({ |
|||
showReportDialog: false, |
|||
loading: false, |
|||
reason: "", |
|||
feedback: "" |
|||
}), |
|||
methods: { |
|||
sendReport() { |
|||
this.loading = true; |
|||
this.rsp = "Загрузка..."; |
|||
axios.post(`api/profile/current/report?steam64=${this.steam64}&text=${this.reason}`).then( |
|||
(response => { |
|||
if (response.data > 0) this.showRV(false); |
|||
else if (response.data < 0) this.feedback = `Не так быстро, подожди ${response.data*-1} секунд`; |
|||
else this.feedback = "Увы, данный игрок уже ливнул с сервера"; |
|||
})).catch(() => this.feedback = "Ошибка отправки") |
|||
.finally(()=>this.loading = false) |
|||
}, |
|||
showRV(b) { |
|||
this.showReportDialog = b; |
|||
} |
|||
}, |
|||
computed: { |
|||
hasFeedback () { |
|||
return { |
|||
'md-invalid': this.feedback.length > 0 |
|||
} |
|||
} |
|||
}, |
|||
} |
|||
</script> |
Loading…
Reference in new issue