From 33d27bf59a0533340d022b0729c31f470e9ef328 Mon Sep 17 00:00:00 2001 From: gsd Date: Sun, 22 Oct 2023 14:54:07 +0300 Subject: [PATCH] add free vip --- src/api/GlobalApi.js | 10 ++++- .../VipView/Components/FreeVipDialog.vue | 39 +++++++++++++++++++ .../VipView/Components/VipBuyDialog.vue | 24 +++++++----- 3 files changed, 62 insertions(+), 11 deletions(-) create mode 100644 src/components/TabsMenuElements/VipView/Components/FreeVipDialog.vue diff --git a/src/api/GlobalApi.js b/src/api/GlobalApi.js index 65b9fe3..7221caa 100644 --- a/src/api/GlobalApi.js +++ b/src/api/GlobalApi.js @@ -20,7 +20,12 @@ export default class GlobalApi { }, 'uniq': null, 'builddate':0, - 'ban_count':0 + 'ban_count':0, + "donate":{ + "day":{"statistic":{}}, + "month":{"statistic":{}}, + "year":{"statistic":{}} + } } loading = false; failed = false; @@ -54,7 +59,7 @@ export default class GlobalApi { return await axios.get(`/api/stats?filter=${value}`) .then(response => response.data) .then(response => { - this.stats[value] = response[value]; + this.stats = Object.assign(this.stats, response); }) .catch(err => { console.log(`[API] cannot request ${value}, err: ${err}`); @@ -117,6 +122,7 @@ export default class GlobalApi { await Promise.all( [this.fillThis('statistic'), this.fillThis('uniq'), + this.fillThis('donate'), this.fillServers(), this.admin.load(this.load_stages), this.player.load(this.load_stages), diff --git a/src/components/TabsMenuElements/VipView/Components/FreeVipDialog.vue b/src/components/TabsMenuElements/VipView/Components/FreeVipDialog.vue new file mode 100644 index 0000000..51402f6 --- /dev/null +++ b/src/components/TabsMenuElements/VipView/Components/FreeVipDialog.vue @@ -0,0 +1,39 @@ + + + \ No newline at end of file diff --git a/src/components/TabsMenuElements/VipView/Components/VipBuyDialog.vue b/src/components/TabsMenuElements/VipView/Components/VipBuyDialog.vue index 47b8153..0db57b9 100644 --- a/src/components/TabsMenuElements/VipView/Components/VipBuyDialog.vue +++ b/src/components/TabsMenuElements/VipView/Components/VipBuyDialog.vue @@ -23,21 +23,22 @@
-
+

{{price.money_price}} рублей

-

+

В этом году купили {{getStat4('qiwi', price.period)}} раз

{{price.item_price}}

-

+

В этом году купили {{getStat4('steam', price.period)}} раз

{{price.item_price}}

-

+

схватили {{getStat4('free', 'day')}} раз

+
@@ -58,10 +59,11 @@ import QiwiSvg from "@/components/Others/CustomSvg/QiwiSvg.vue"; import SteamSvg from "@/components/Others/CustomSvg/SteamSvg.vue"; import FreeSvg from "@/components/Others/CustomSvg/FreeSvg.vue"; import AuthWindow from "@/components/Others/Auth/AuthWindow.vue"; +import FreeVipDialog from "@/components/TabsMenuElements/VipView/Components/FreeVipDialog.vue"; export default { name: 'VipBuyDialog', - components: {AuthWindow, FreeSvg, SteamSvg, QiwiSvg}, + components: {FreeVipDialog, AuthWindow, FreeSvg, SteamSvg, QiwiSvg}, data: () => ({ showBuyDialog: false }), @@ -76,17 +78,21 @@ export default { this.showBuyDialog = false; }, 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) { - console.log(this.$API.player.store); - window.open(`https://tf2.pblr-nyk.pro/api/profile/current/buyvip?buy_type=qiwi&steam64=${this.$API.player.store.steamids.steam64}&cost=${cost}`, "_blank") + window.open(`api/profile/current/buyvip?buy_type=qiwi&steam64=${this.$API.player.store.steamids.steam64}&cost=${cost}`, "_blank") }, buyWithFree() { - + this.$refs.vfd.getFreeVIP(); }, openAW() { this.$refs.aw.openAW(); + }, + getStat4(service, period) { + try { + return this.$API.stats['donate']['year']['statistic'][service][period]; + } catch (e) {return 0;} } } }