5 changed files with 139 additions and 5 deletions
@ -0,0 +1,91 @@ |
|||
<template> |
|||
<div> |
|||
<md-dialog :md-active.sync="show" @close="show=false" v-on:keyup.esc="show=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-table v-if="top.mdData.length>0" v-model="top.mdData" md-card style="max-height: 666px; overflow-y: auto;"> |
|||
<md-table-row slot="md-table-row" slot-scope="{ item }" v-on:click="$refs.kdt_fp.showFPD(item.name)" class="clickable"> |
|||
<md-table-cell md-label="Никнейм">{{ item.name }}</md-table-cell> |
|||
<md-table-cell md-label="Оружие">{{ item.count }}</md-table-cell> |
|||
</md-table-row> |
|||
</md-table> |
|||
<h4 v-else style="text-align: center">Пусто</h4> |
|||
<div style="padding-right: 2.5%; padding-left: 2.5%"> |
|||
<md-field style="margin: 0% 0%;" v-if="this.srv_setted === false"> |
|||
<label style="font-family: tf2secondary">Выбрать сервер</label> |
|||
<md-select v-model="srv" :mdClass="'ssm'"> |
|||
<md-option :value="''">Выбрать все</md-option> |
|||
<md-option v-for="srv in $API.getServers4Selector()" :key="srv['srv']" :value="srv['srv']">{{srv['name']}}</md-option> |
|||
</md-select> |
|||
</md-field> |
|||
</div> |
|||
<md-button style="float: left" class="btn-hand" v-on:click="update(1, rowsPerPage)">Искать</md-button> |
|||
<md-button style="float: right" class="btn-colored" v-on:click="showMe(false)">Закрыть</md-button> |
|||
</div> |
|||
</div> |
|||
</md-dialog> |
|||
<md-dialog :md-active.sync="loading"> |
|||
<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"> |
|||
<h3 class="tf2rainbow" style="text-align: center; padding: 2% 5%">Загрузка</h3> |
|||
</div> |
|||
</div> |
|||
</md-dialog> |
|||
<FindPlayer_KDT ref="kdt_fp"/> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import axios from "axios"; |
|||
import Random from "@/api/Random"; |
|||
|
|||
export default { |
|||
name: "KillDeadTop", |
|||
components: {FindPlayer_KDT: () => import("@/components/ActionDialogs/FindPlayer.vue")}, |
|||
data: () => ({ |
|||
show: false, |
|||
loading: false, |
|||
rowsPerPage: 10, |
|||
srv: '', |
|||
srv_setted: false, |
|||
top: { |
|||
mdCount: 1, |
|||
mdPage: 1, |
|||
mdData: [] |
|||
}, |
|||
type: 0 |
|||
}), |
|||
methods: { |
|||
showMe(b, type, srv) { |
|||
if (srv !== undefined) { |
|||
this.srv_setted = true; |
|||
this.srv = srv; |
|||
} |
|||
if (type !== undefined) { |
|||
this.type = type; |
|||
} |
|||
if (b===true) this.update(1, this.rowsPerPage) |
|||
else this.show = b; |
|||
}, |
|||
update(page, limit) { |
|||
if (this.loading === true) return; |
|||
console.log(page, limit, this.rowsPerPage); |
|||
const method = this.type===1?'get':'delete'; |
|||
this.loading = true; |
|||
axios[method](`api/profile/killfeed/top?${this.srv===null?'':`srv=${this.srv}`}` + Random.getRndWebAppend()).then( |
|||
(response) => { |
|||
if (response.status === 200) { |
|||
this.top.mdData = response.data; |
|||
this.top.mdCount = -1; |
|||
this.top.mdPage = page; |
|||
} else { |
|||
console.log("cannot get top list"); |
|||
} |
|||
this.show = true; |
|||
} |
|||
).catch((e) => {console.log(e)}).finally(() => this.loading = false) |
|||
} |
|||
} |
|||
|
|||
} |
|||
</script> |
Loading…
Reference in new issue