Browse Source

add free vip

master
gsd 1 year ago
parent
commit
33d27bf59a
  1. 10
      src/api/GlobalApi.js
  2. 39
      src/components/TabsMenuElements/VipView/Components/FreeVipDialog.vue
  3. 24
      src/components/TabsMenuElements/VipView/Components/VipBuyDialog.vue

10
src/api/GlobalApi.js

@ -20,7 +20,12 @@ export default class GlobalApi {
}, },
'uniq': null, 'uniq': null,
'builddate':0, 'builddate':0,
'ban_count':0 'ban_count':0,
"donate":{
"day":{"statistic":{}},
"month":{"statistic":{}},
"year":{"statistic":{}}
}
} }
loading = false; loading = false;
failed = false; failed = false;
@ -54,7 +59,7 @@ export default class GlobalApi {
return await axios.get(`/api/stats?filter=${value}`) return await axios.get(`/api/stats?filter=${value}`)
.then(response => response.data) .then(response => response.data)
.then(response => { .then(response => {
this.stats[value] = response[value]; this.stats = Object.assign(this.stats, response);
}) })
.catch(err => { .catch(err => {
console.log(`[API] cannot request ${value}, err: ${err}`); console.log(`[API] cannot request ${value}, err: ${err}`);
@ -117,6 +122,7 @@ export default class GlobalApi {
await Promise.all( await Promise.all(
[this.fillThis('statistic'), [this.fillThis('statistic'),
this.fillThis('uniq'), this.fillThis('uniq'),
this.fillThis('donate'),
this.fillServers(), this.fillServers(),
this.admin.load(this.load_stages), this.admin.load(this.load_stages),
this.player.load(this.load_stages), this.player.load(this.load_stages),

39
src/components/TabsMenuElements/VipView/Components/FreeVipDialog.vue

@ -0,0 +1,39 @@
<template>
<md-dialog :md-active.sync="showFreeVipDialog" @close="showFreeVipDialog=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">
<h1 v-if="loading">Загрузка</h1>
<h5 v-else style="padding: 0% 5%; text-align: center">{{result}}</h5>
<md-button style="color: #fdfde1; font-family: tf2build; background: #000000;float: right" v-if="result.length>0" v-on:click="openFVD(false)">ОК</md-button>
</div>
</div>
</md-dialog>
</template>
<script>
import axios from "axios";
export default {
name: 'FreeVipDialog',
data: () => ({
showFreeVipDialog: false,
loading: false,
result: ""
}),
methods: {
openFVD(s) {this.showFreeVipDialog = s;},
getFreeVIP() {
axios.post("api/profile/current/freevip").then(
(response) => {
if (response.data === 0) this.result="У тебя уже есть VIP, жать второй раз незачем";
else if (response.data === 1) this.result="Бесплатный вип выдан, балдей...";
else if (response.data > 1) this.result=`Ты не можешь получить вип бесплатно, вернись через ${this.$API.UNIX2FACTI_TIME(response)}`;
else if (response.data < 0) this.result=`Ты недостаточно наиграл у нас на серверах! Наиграй еще ${this.$API.UNIX2FACTI_TIME(response * -1)}`;
else this.result=`Сегодня не твой день...`;
this.openFVD(true);
}
).catch(() => {this.result="Тебя обоссал морген...";})
.finally(() => {this.loading = false;})
}
}
}
</script>

24
src/components/TabsMenuElements/VipView/Components/VipBuyDialog.vue

@ -23,21 +23,22 @@
</div> </div>
</div> </div>
<hr> <hr>
<div style="justify-content: center; display: flex; margin-top: 2.5%" v-if="$API.player.auth('steam')"> <div style="justify-content: center; display: flex; margin: 2.5% 0%" v-if="$API.player.auth('steam')">
<div style="max-width: 40%; float: left;" class="clickable" v-if="price.period !=='free'" v-on:click="buyWithQiwi(price.money_price)"> <div style="max-width: 40%; float: left;" class="clickable" v-if="price.period !=='free'" v-on:click="buyWithQiwi(price.money_price)">
<QiwiSvg class="img-vipextra"/> <QiwiSvg class="img-vipextra"/>
<p class="p-vipbuy" style="margin-bottom: -5%">{{price.money_price}} рублей</p> <p class="p-vipbuy" style="margin-bottom: -5%">{{price.money_price}} рублей</p>
<p class="p-vipbuy-extra"></p> <p class="p-vipbuy-extra">В этом году купили {{getStat4('qiwi', price.period)}} раз</p>
</div> </div>
<div style="max-width: 40%; float: left;" class="clickable" v-if="price.period !=='free'" v-on:click="buyWithSteam()"> <div style="max-width: 40%; float: left;" class="clickable" v-if="price.period !=='free'" v-on:click="buyWithSteam()">
<SteamSvg class="img-vipextra"/> <SteamSvg class="img-vipextra"/>
<p class="p-vipbuy" style="margin-bottom: -5%">{{price.item_price}}</p> <p class="p-vipbuy" style="margin-bottom: -5%">{{price.item_price}}</p>
<p class="p-vipbuy-extra"></p> <p class="p-vipbuy-extra">В этом году купили {{getStat4('steam', price.period)}} раз</p>
</div> </div>
<div style="max-width: 40%; float: left;" class="clickable" v-if="price.period ==='free'" v-on:click="buyWithFree()"> <div style="max-width: 40%; float: left;" class="clickable" v-if="price.period ==='free'" v-on:click="buyWithFree()">
<FreeSvg class="img-vipextra"/> <FreeSvg class="img-vipextra"/>
<p class="p-vipbuy" style="margin-bottom: -5%">{{price.item_price}}</p> <p class="p-vipbuy" style="margin-bottom: -5%">{{price.item_price}}</p>
<p class="p-vipbuy-extra"></p> <p class="p-vipbuy-extra">схватили {{getStat4('free', 'day')}} раз</p>
<FreeVipDialog ref="vfd"/>
</div> </div>
</div> </div>
<div v-if="$API.player.auth('steam')"> <div v-if="$API.player.auth('steam')">
@ -58,10 +59,11 @@ import QiwiSvg from "@/components/Others/CustomSvg/QiwiSvg.vue";
import SteamSvg from "@/components/Others/CustomSvg/SteamSvg.vue"; import SteamSvg from "@/components/Others/CustomSvg/SteamSvg.vue";
import FreeSvg from "@/components/Others/CustomSvg/FreeSvg.vue"; import FreeSvg from "@/components/Others/CustomSvg/FreeSvg.vue";
import AuthWindow from "@/components/Others/Auth/AuthWindow.vue"; import AuthWindow from "@/components/Others/Auth/AuthWindow.vue";
import FreeVipDialog from "@/components/TabsMenuElements/VipView/Components/FreeVipDialog.vue";
export default { export default {
name: 'VipBuyDialog', name: 'VipBuyDialog',
components: {AuthWindow, FreeSvg, SteamSvg, QiwiSvg}, components: {FreeVipDialog, AuthWindow, FreeSvg, SteamSvg, QiwiSvg},
data: () => ({ data: () => ({
showBuyDialog: false showBuyDialog: false
}), }),
@ -76,17 +78,21 @@ export default {
this.showBuyDialog = false; this.showBuyDialog = false;
}, },
buyWithSteam() { buyWithSteam() {
window.open("https://tf2.pblr-nyk.pro/api/profile/current/buyvip?buy_type=steam", "_blank"); window.open("api/profile/current/buyvip?buy_type=steam", "_blank");
}, },
buyWithQiwi(cost) { buyWithQiwi(cost) {
console.log(this.$API.player.store); window.open(`api/profile/current/buyvip?buy_type=qiwi&steam64=${this.$API.player.store.steamids.steam64}&cost=${cost}`, "_blank")
window.open(`https://tf2.pblr-nyk.pro/api/profile/current/buyvip?buy_type=qiwi&steam64=${this.$API.player.store.steamids.steam64}&cost=${cost}`, "_blank")
}, },
buyWithFree() { buyWithFree() {
this.$refs.vfd.getFreeVIP();
}, },
openAW() { openAW() {
this.$refs.aw.openAW(); this.$refs.aw.openAW();
},
getStat4(service, period) {
try {
return this.$API.stats['donate']['year']['statistic'][service][period];
} catch (e) {return 0;}
} }
} }
} }

Loading…
Cancel
Save