11 changed files with 248 additions and 18 deletions
@ -0,0 +1,123 @@ |
|||
<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="mykills.mdData.length>0" v-model="mykills.mdData" md-card class="api-table" style="max-height: 666px; overflow-y: auto;"> |
|||
<md-table-row slot="md-table-row" slot-scope="{ item }" :class="steam64 === null?'':'clickable'" v-on:click="$refs.mkd_fp.showFPD(type===0?item.victim_name:type===1?item.attacker_name:item.victim_name)"> |
|||
<md-table-cell md-label="Время">{{ new Date(item.utime*1000).toLocaleString() }}</md-table-cell> |
|||
<md-table-cell v-if="type!==1" md-label="Жертва">{{ item.victim_name }}</md-table-cell> |
|||
<md-table-cell v-if="type!==0" md-label="Убийца">{{ item.attacker_name }}</md-table-cell> |
|||
<md-table-cell v-if="type!==2" md-label="Помог">{{ item.assister_name }}</md-table-cell> |
|||
<md-table-cell md-label="Оружие">{{ prepareWeaponName(item.weapon_name) }}</md-table-cell> |
|||
<md-table-cell md-label="Сервер">{{ $API.getHumanServerName(item.server_id) }}</md-table-cell> |
|||
</md-table-row> |
|||
|
|||
<md-table-pagination ref="md_p" |
|||
:md-page-size="rowsPerPage" |
|||
:md-page-options="[5, 10, 15]" |
|||
:md-update="update" |
|||
:md-data.sync="mykills" |
|||
:md-label="type===0?'Твои убийства':type===1?'Твои смерти':'Твоя помощь другим'" |
|||
:md-separator="'из'" |
|||
style="font-family: tf2build"/> |
|||
</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="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:left;" class="btn-unusual" v-if="type===0" v-on:click="$refs.mkd_lw.showMe(true, steam64, srv)">Любимые оружия</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_MKD ref="mkd_fp"/> |
|||
<LoveWeapons ref="mkd_lw"/> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import axios from "axios"; |
|||
import Random from "@/api/Random"; |
|||
import LoveWeapons from "@/components/ActionDialogs/Tables/LoveWeapons.vue"; |
|||
|
|||
export default { |
|||
name: "MyKillsDialog", |
|||
components: {LoveWeapons, FindPlayer_MKD: () => import("@/components/ActionDialogs/FindPlayer.vue")}, |
|||
data: () => ({ |
|||
show: false, |
|||
loading: false, |
|||
rowsPerPage: 5, |
|||
filter: "", |
|||
steam64: null, |
|||
srv: null, |
|||
srv_setted: false, |
|||
type: 0, |
|||
mykills: { |
|||
mdCount: 1, |
|||
mdPage: 1, |
|||
mdData: [] |
|||
}, |
|||
}), |
|||
methods: { |
|||
showMe(b, steam64, srv, type) { |
|||
if (steam64 !== undefined) this.steam64 = steam64; |
|||
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 offset = Math.abs((page - 1) * limit); |
|||
this.loading = true; |
|||
let method; |
|||
switch (this.type) { |
|||
case 0: {method = "get";break;} |
|||
case 1: {method = "delete"; break;} |
|||
case 2: {method = "put"; break;} |
|||
} |
|||
axios[method](`api/profile/killfeed?${this.steam64 === null?'':`steam64=${this.steam64}&`}${this.srv===null?'':`srv=${this.srv}&`}limit=${Math.abs(limit)}&offset=${offset}` + Random.getRndWebAppend()).then( |
|||
(response) => { |
|||
if (response.status === 200) { |
|||
this.mykills.mdData = response.data['result']; |
|||
this.mykills.mdCount = response.data['count']; |
|||
this.mykills.mdPage = page; |
|||
} else { |
|||
console.log("cannot get mykills list, method: " + method); |
|||
} |
|||
this.show = true; |
|||
if (this.$refs.md_p !== undefined) |
|||
this.$refs.md_p.updatePage(); |
|||
} |
|||
).catch((e) => {console.log(e)}).finally(() => this.loading = false) |
|||
}, |
|||
prepareWeaponName(wp_name) { |
|||
//text-transform: capitalize; |
|||
if (wp_name.indexOf("TF_WEAPON_") !== -1) { |
|||
const string = wp_name.replace("TF_WEAPON_", "").toLowerCase(); |
|||
return string[0].toUpperCase() + string.slice(1); |
|||
} |
|||
return wp_name; |
|||
} |
|||
} |
|||
} |
|||
</script> |
@ -0,0 +1,96 @@ |
|||
<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="loveweapons.mdData.length>0" v-model="loveweapons.mdData" md-card class="" style="max-height: 666px; overflow-y: auto;"> |
|||
<md-table-row slot="md-table-row" slot-scope="{ item }"> |
|||
<md-table-cell md-label="Убито">{{ item.count }}</md-table-cell> |
|||
<md-table-cell md-label="Оружие">{{ prepareWeaponName(item.name) }}</md-table-cell> |
|||
<!--<md-table-cell md-label="Сервер">{{ $API.getHumanServerName(item.server_id) }}</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%;"> |
|||
<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> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import axios from "axios"; |
|||
import Random from "@/api/Random"; |
|||
|
|||
export default { |
|||
name: "LoveWeapons", |
|||
data: () => ({ |
|||
show: false, |
|||
loading: false, |
|||
rowsPerPage: 10, |
|||
filter: "", |
|||
steam64: null, |
|||
srv: '', |
|||
//srv_setted: false, |
|||
loveweapons: { |
|||
mdCount: 1, |
|||
mdPage: 1, |
|||
mdData: [] |
|||
}, |
|||
}), |
|||
methods: { |
|||
showMe(b, steam64, srv) { |
|||
if (steam64 !== undefined) this.steam64 = steam64; |
|||
if (srv !== undefined) { |
|||
//this.srv_setted = true; |
|||
this.srv = srv; |
|||
} |
|||
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 offset = Math.abs((page - 1) * limit); |
|||
this.loading = true; |
|||
axios.get(`api/profile/killfeed/weapons?${this.steam64 === null?'':`steam64=${this.steam64}&`}${this.srv===null?'':`srv=${this.srv}&`}limit=${Math.abs(limit)}&offset=${offset}` + Random.getRndWebAppend()).then( |
|||
(response) => { |
|||
if (response.status === 200) { |
|||
this.loveweapons.mdData = response.data['result']; |
|||
this.loveweapons.mdCount = response.data['count']; |
|||
this.loveweapons.mdPage = page; |
|||
} else { |
|||
console.log("cannot get weapons list"); |
|||
} |
|||
this.show = true; |
|||
} |
|||
).catch((e) => {console.log(e)}).finally(() => this.loading = false) |
|||
}, |
|||
prepareWeaponName(wp_name) { |
|||
//text-transform: capitalize; |
|||
if (wp_name.indexOf("TF_WEAPON_") !== -1) { |
|||
const string = wp_name.replace("TF_WEAPON_", "").toLowerCase().replace("_"," "); |
|||
return string[0].toUpperCase() + string.slice(1); |
|||
} |
|||
return wp_name; |
|||
} |
|||
} |
|||
} |
|||
</script> |
Loading…
Reference in new issue