Browse Source

new tops

master
gsd 1 year ago
parent
commit
10b22074a6
  1. 2
      src/App.vue
  2. 91
      src/components/ActionDialogs/Tables/KillDeadTop.vue
  3. 27
      src/components/ActionDialogs/Tables/MessagesDialog.vue
  4. 12
      src/components/TabsMenuElements/ServersView/Components/ServerFullInfo.vue
  5. 12
      src/components/TabsMenuElements/ServersView/ServersView.vue

2
src/App.vue

@ -29,6 +29,7 @@ import MdContent from "vue-material/dist/components/MdContent";
import MdRipple from "vue-material/dist/components/MdRipple";
import MdSwitch from "vue-material/dist/components/MdSwitch";
import MdTooltip from "vue-material/dist/components/MdTooltip";
import MdCheckbox from "vue-material/dist/components/MdCheckbox";
Vue.use(MdTabs);
Vue.use(MdIcon);
@ -47,6 +48,7 @@ Vue.use(MdContent);
Vue.use(MdRipple);
Vue.use(MdSwitch);
Vue.use(MdTooltip);
Vue.use(MdCheckbox);
import "@/css/buttons.css";
import "@/css/rounded.css";

91
src/components/ActionDialogs/Tables/KillDeadTop.vue

@ -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>

27
src/components/ActionDialogs/Tables/MessagesDialog.vue

@ -35,6 +35,7 @@
</md-field>
</div>
<md-button style="float: left" class="btn-hand" v-on:click="update(1, rowsPerPage)">Искать</md-button>
<md-checkbox style="border: 1px solid black; font-family: tf2secondary" v-model="autoUpdate" value="true" v-on:change="updater(!autoUpdate)">Автообновление</md-checkbox>
<md-button style="float: right" class="btn-colored" v-on:click="showMe(false)">Закрыть</md-button>
</div>
</div>
@ -70,6 +71,7 @@ export default {
mdPage: 1,
mdData: []
},
autoUpdate: false
}),
methods: {
showMe(b, steam64, srv) {
@ -100,7 +102,30 @@ export default {
this.$refs.md_p.updatePage();
}
).catch((e) => {console.log(e)}).finally(() => this.loading = false)
},
async updater() {
const sleep = function sleep (howLong) {
return new Promise(function (resolve) {
setTimeout(() => {resolve()}, howLong)
})
}
console.log(this.autoUpdate);
while (this.show && this.autoUpdate) {
console.log("[MessagesDialog] updater get...");
await sleep(3000).then(
() => {
if (this.show && this.autoUpdate) this.update(1, 10)
else this.autoUpdate = false;
}
)
}
}
}
}
</script>
</script>
<style>
.md-checked {
background-color: #fd8846;
}
</style>

12
src/components/TabsMenuElements/ServersView/Components/ServerFullInfo.vue

@ -15,7 +15,13 @@
<img :src="serverData['preview']" style="width: 100%; height:12em;object-fit: cover;border-top-left-radius: 15px; border-top-right-radius: 15px">
<div>
<p class="p-server">{{serverData['description']}}</p>
<p class="p-server clickable" v-if="this.$API.player.auth('steam') === true" v-on:click="$refs.sfi_md.showMe(true, undefined, serverData['key'])">Чат сервера</p>
<div v-if="this.$API.player.auth('steam') === true" style="text-align: center; font-size: 0.5em !important;">
<p class="p-server clickable" style="display: inline" v-on:click="$refs.sfi_md.showMe(true, undefined, serverData['key'])">Чат сервера</p>
<p class="p-server" style="display: inline"> | </p>
<p class="p-server clickable" style="display: inline" v-on:click="$refs.sfi_kdt.showMe(true, 1, serverData['key'])">Топ убийств</p>
<p class="p-server" style="display: inline"> | </p>
<p class="p-server clickable" style="display: inline" v-on:click="$refs.sfi_kdt.showMe(true, 2, serverData['key'])">Топ смертей</p>
</div>
<hr width="30%">
</div>
<div style="justify-content: center; display: flex; margin-top: 2.5%">
@ -54,6 +60,7 @@
</div>
</md-dialog>
<MessagesDialog ref="sfi_md"/>
<KillDeadTop ref="sfi_kdt"/>
</div>
</template>
@ -62,10 +69,11 @@ import SteamSvg from "@/components/Others/CustomSvg/SteamSvg.vue";
import TerminalSvg from "@/components/Others/CustomSvg/TerminalSvg.vue";
import PlayerExtendedInfo from "@/components/TabsMenuElements/ServersView/Components/PlayerExtendedInfo.vue";
import MessagesDialog from "@/components/ActionDialogs/Tables/MessagesDialog.vue";
import KillDeadTop from "@/components/ActionDialogs/Tables/KillDeadTop.vue";
export default {
name: "ServerFullInfo",
components: {MessagesDialog, PlayerExtendedInfo, TerminalSvg, SteamSvg},
components: {KillDeadTop, MessagesDialog, PlayerExtendedInfo, TerminalSvg, SteamSvg},
props: {
serverData: Object,
},

12
src/components/TabsMenuElements/ServersView/ServersView.vue

@ -13,7 +13,13 @@
<div class="md-layout md-alignment-bottom-center" style="margin-top: -1.5%">
<div class="md-layout-item md-size-50 md-small-size-100 md-alignment-bottom-center rounded-only">
<h4 style="text-align: center; margin-top: 5%; margin-bottom: 0%">Для подключения к серверу нажми на него</h4>
<p class="p-server clickable" v-if="this.$API.player.auth('steam') === true" v-on:click="$refs.sv_md.showMe(true)">Чаты серверов</p>
<div v-if="this.$API.player.auth('steam') === true" style="text-align: center; font-size: 0.5em !important;">
<p class="p-server clickable" style="display: inline" v-on:click="$refs.sv_md.showMe(true)">Чаты серверов</p>
<p class="p-server" style="display: inline"> | </p>
<p class="p-server clickable" style="display: inline" v-on:click="$refs.sv_kdt.showMe(true, 1)">Топ убийств</p>
<p class="p-server" style="display: inline"> | </p>
<p class="p-server clickable" style="display: inline" v-on:click="$refs.sv_kdt.showMe(true, 2)">Топ смертей</p>
</div>
<hr>
<h5 style="text-align: center" v-if="this.$API.stats.servers['w'].length>0">где сейчас играют карлики</h5>
<ServerCard v-for="srv in this.$API.stats.servers['w']" :key="srv['name']" :server-name="srv['name']" :server-image="srv['preview']" :server-current-player="srv['player_count']" :server-max-player="srv['max_players']" :server-data="srv" :last_play="getLastPlay(srv['key'])"/>
@ -25,6 +31,7 @@
</div>
<SnackLoader ref="s_loader" s_text="Обновление списка серверов"/>
<MessagesDialog ref="sv_md"/>
<KillDeadTop ref="sv_kdt"/>
</md-tab>
</template>
@ -33,9 +40,10 @@ import CharacterImage from "@/components/Others/Images/CharacterImage.vue";
import ServerCard from "@/components/TabsMenuElements/ServersView/Components/ServerCard.vue";
import SnackLoader from "@/components/Others/Loader/SnackLoader.vue";
import MessagesDialog from "@/components/ActionDialogs/Tables/MessagesDialog.vue";
import KillDeadTop from "@/components/ActionDialogs/Tables/KillDeadTop.vue";
export default {
name: 'ServersView',
components: {MessagesDialog, SnackLoader, ServerCard, CharacterImage},
components: {KillDeadTop, MessagesDialog, SnackLoader, ServerCard, CharacterImage},
data:() => ({
servers: {'w':[], 'n':[], 'e':[]},
lp_cache: null

Loading…
Cancel
Save