Browse Source

profile view 2

master
gsd 1 year ago
parent
commit
8e84a0024c
  1. 5
      src/api/PlayerApi.js
  2. 13
      src/components/Others/CustomSvg/SteamSvg.vue
  3. 6
      src/components/Others/ProfileViewer.vue
  4. 13
      src/components/TabsMenuElements/ProfileView/Components/ProfileContainer.vue
  5. 7
      src/components/TabsMenuElements/ServersView/Components/ServerCard.vue
  6. 18
      src/components/TabsMenuElements/ServersView/ServersView.vue

5
src/api/PlayerApi.js

@ -7,7 +7,8 @@ export default class PlayerApi {
ban: null,
steamids: null,
gametime: {},
lastplay: {}
lastplay: {},
play_on: null
}
discord = null;
@ -50,7 +51,7 @@ export default class PlayerApi {
let t = [];
for (const srv in player.lastplay) {
for (const map_name in player.lastplay[srv]) {
t.push([map_name.replace("workshop/", "").split(".ugc")[0], new Date(player.lastplay[srv][map_name] * 1000).toLocaleDateString()]);
t.push([map_name.replace("workshop/", "").split(".ugc")[0], new Date(player.lastplay[srv][map_name] * 1000).toLocaleDateString(), srv]);
}
}

13
src/components/Others/CustomSvg/SteamSvg.vue

@ -1,6 +1,6 @@
<template>
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
:width="w" :height="h" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
<svg class="clickable" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
:width="w" :height="h" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve" v-on:click="openUrl()">
<g>
<path fill="currentColor" d="M151.961,418.005c13.572,0,26.893-6.567,34.986-18.708c12.867-19.301,7.651-45.377-11.649-58.244l-33.037-22.022
c5.654-1.54,11.597-2.38,17.739-2.38c37.196,0,67.348,30.152,67.348,67.351s-30.153,67.349-67.349,67.349
@ -57,6 +57,15 @@ export default {
h: {
type: String,
default: "60%"
},
url: {
type:String,
default: null
}
},
methods: {
openUrl(){
if (this.url !== null) window.open(this.url, '_blank');
}
}
}

6
src/components/Others/ProfileViewer.vue

@ -1,7 +1,7 @@
<template>
<md-dialog :md-active.sync="showProfileDialog">
<div class="md-layout md-alignment-bottom-center">
<div class="md-layout-item md-size-50 md-small-size-100 md-alignment-bottom-center rounded-only">
<div class="md-layout-item md-size-100 md-small-size-100 md-alignment-bottom-center rounded-only">
<ProfileContainer :player="player"/>
<h1 v-if="loading">Загрузка</h1>
</div>
@ -31,9 +31,11 @@ export default {
axios.get("/api/profile?steam64=" + this.steam64).then(response => {
if (response.status === 200) this.player = response.data;
else console.log("not permition");
}).catch(() => {
}).catch((err) => {
if (err.response.status === 429) console.log("не гони брат");
console.log("not permition");
this.showProfileDialog = false;
}).finally(() => {
this.loading = false;
})
}

13
src/components/TabsMenuElements/ProfileView/Components/ProfileContainer.vue

@ -38,15 +38,15 @@
</md-menu>
</div>
<div :class="`md-layout-item md-size-${f_size} md-small-size-100`">
<div style="justify-content: right; display: flex">
<div style="justify-content: right; display: flex; padding: 10% 0%">
<img :src="getAvatar()" style="border-radius: 15px;">
</div>
<p class="profile-text" style="text-align: right">Убийств : 20</p>
<p class="profile-text" style="text-align: right">Смертей : 543</p>
<p class="profile-text" style="text-align: right" v-if="this.player['play_on'] !== null">Убийств : 20</p>
<p class="profile-text" style="text-align: right" v-if="this.player['play_on'] !== null">Смертей : {{'похуй'}}</p>
<p class="profile-text" style="text-align: right">Наиграно : {{getTotalPlaytime()}}</p>
<div style="justify-content: right; display: flex">
<DiscordSvg :h="'10%'" :w="'40'" style="margin-left: 5%"/>
<SteamSvg :h="'10%'" :w="'40'" style="margin-left: 5%"/>
<SteamSvg :h="'10%'" :w="'40'" style="margin-left: 5%" :url="this.player['steamids']['community_url']"/>
</div>
</div>
<br>
@ -103,4 +103,9 @@ export default {
color: #131213;
font-size: 1.5em;
}
.md-menu-content {
z-index: 111;
max-width: unset;
}
</style>

7
src/components/TabsMenuElements/ServersView/Components/ServerCard.vue

@ -9,7 +9,8 @@
<md-card-header>
<span class="md-title sc-title" style="text-align: left; font-family: tf2build; font-size: 2.5em">{{serverName}}</span>
<br class="sc-br">
<span class="md-subhead sc-subhead" style="text-align: left; font-family: tf2secondary; font-size: 3em">{{serverCurrentPlayer}}/{{serverMaxPlayer}}</span>
<span class="md-subhead sc-subhead" style="text-align: left; font-family: tf2secondary; font-size: 3em">{{serverCurrentPlayer}}/{{serverMaxPlayer}}{{last_play===null?'':` | Играл: ${last_play}`}}</span>
</md-card-header>
</md-card-area>
</md-card-media-cover>
@ -32,6 +33,10 @@ export default {
serverData: {
type: Object,
default: null
},
last_play: {
type: String,
default: null
}
},
data: () => ({

18
src/components/TabsMenuElements/ServersView/ServersView.vue

@ -13,11 +13,11 @@
<h4 style="text-align: center">Для подключения к серверу нажми на него</h4>
<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"/>
<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'])"/>
<h5 style="text-align: center" v-if="this.$API.stats.servers['e'].length>0">где сейчас никого нет</h5>
<ServerCard v-for="srv in this.$API.stats.servers['e']" :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"/>
<ServerCard v-for="srv in this.$API.stats.servers['e']" :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'])"/>
<h5 style="text-align: center" v-if="this.$API.stats.servers['n'].length>0">где сейчас играют карлики</h5>
<ServerCard v-for="srv in this.$API.stats.servers['n']" :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"/>
<ServerCard v-for="srv in this.$API.stats.servers['n']" :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'])"/>
</div>
</div>
<SnackLoader ref="s_loader" s_text="Обновление списка серверов"/>
@ -32,7 +32,8 @@ export default {
name: 'ServersView',
components: {SnackLoader, ServerCard, CharacterImage},
data:() => ({
servers: {'w':[], 'n':[], 'e':[]}
servers: {'w':[], 'n':[], 'e':[]},
lp_cache: null
}),
methods: {
updateServers() {
@ -41,6 +42,15 @@ export default {
this.servers = this.$API.stats.servers;
this.$refs.s_loader.setLoading(false);
})
},
getLastPlay(srv) {
if (this.$API.player.store !== null) {
if (this.lp_cache == null) this.lp_cache = this.$API.player.getLastplayList(this.$API.player.store);
for (const lp in this.lp_cache) {
if (this.lp_cache[lp][2] === srv) return this.lp_cache[lp][1];
}
}
return null;
}
}
}

Loading…
Cancel
Save