Browse Source

freevip

master
gsd 1 month ago
parent
commit
8a611f03a2
  1. 12
      src/app/pages/main-page/main-page.component.html
  2. 8
      src/app/pages/main-page/main-page.component.scss
  3. 6
      src/app/pages/vip-page/VipBuyDialog.ts
  4. 55
      src/app/pages/vip-page/VipFreeDialog.ts
  5. 4
      src/app/services/vip.service.ts

12
src/app/pages/main-page/main-page.component.html

@ -4,13 +4,21 @@
<div class="img-in-header"><img style="height: 250px; padding-top: 20px" src="assets/images/Engineertaunt1.png"></div>
<div class="main-content-in-header">
<!--кнопочки страниц-->
<mat-toolbar style="background: unset !important; margin-bottom: 2%">
<!--<mat-toolbar style="background: unset !important; margin-bottom: 2%">
<button *ngFor="let b of go2urls" mat-icon-button style="color: #fbf1d7; margin: 0 1%;" class="spacer" (click)="go2url(b.url)">
<mat-icon>{{b.ico}}</mat-icon>
<br>
<p style="margin: 0 0; line-height: 10px">{{b.name}}</p>
</button>
</mat-toolbar>
</mat-toolbar>-->
<div style="display: flex; justify-content: space-between;background: unset !important; margin-bottom: 3%; margin-top: 1%" >
<button *ngFor="let b of go2urls" mat-icon-button style="color: #fbf1d7; display: flex;justify-content: center;align-items: center;flex-wrap: wrap;" (click)="go2url(b.url)">
<mat-icon>{{b.ico}}</mat-icon>
<br>
<p style="margin: 0 0; line-height: 10px">{{b.name}}</p>
</button>
</div>
<div style="padding-bottom: 1%" >
<div class="stats-container">
<div class="stats-container-element">

8
src/app/pages/main-page/main-page.component.scss

@ -1,11 +1,3 @@
//.card-annonces-container {
// display: flex; flex-wrap: wrap; justify-content: space-between
//}
.container {
padding: 24px;
}
.responsive-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));

6
src/app/pages/vip-page/VipBuyDialog.ts

@ -1,5 +1,5 @@
import {Component, Inject} from "@angular/core";
import {MAT_DIALOG_DATA} from "@angular/material/dialog";
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
import {VipBuy} from "../../entities/VipBuy";
import {ActionService} from "../../services/action.service";
import {AuthService} from "../../services/auth.service";
@ -56,6 +56,7 @@ import {AuthService} from "../../services/auth.service";
</mat-accordion>
</div>
<p>Выбери способ по душе</p>
<button (click)="dialogRef.close()" mat-button mat-raised-button style="width: 100%">Пожалуй откажусь</button>
</mat-dialog-content>
`
})
@ -63,7 +64,8 @@ export class VipBuyDialog {
acceptRules: boolean = false;
constructor(@Inject(MAT_DIALOG_DATA) public vip:VipBuy,
private actionService: ActionService,
private authService: AuthService) {}
private authService: AuthService,
public dialogRef: MatDialogRef<any>) {}
goToTrade(buy_type: 'QIWI' | 'DONATIONALERTS'| 'STEAM', cost:number) {
let url = `api/profile/current/buyvip?steam64=${this.authService.steamIds?.steam64==null?'':this.authService.steamIds?.steam64}&buy_type=${buy_type}&cost=${cost}`;

55
src/app/pages/vip-page/VipFreeDialog.ts

@ -1,18 +1,63 @@
import {Component, Inject} from "@angular/core";
import {MAT_DIALOG_DATA} from "@angular/material/dialog";
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
import {VipBuy} from "../../entities/VipBuy";
import {AuthService} from "../../services/auth.service";
import {VipService} from "../../services/vip.service";
@Component({
selector: "app-vip-buy-dialog",
template:`
<h1 mat-dialog-title style="color: black">Получение бесплатно</h1>
<mat-dialog-content>
<app-need-auth-to-continue *ngIf="authService.isAuth()"></app-need-auth-to-continue>
<div *ngIf="!authService.isAuth()">
<p>Бесплатная випка отличный способ проверить ее перед "покупкой", но стоит знать что для ее получения стоит отыграть некоторое время на наших серверах. Бесплатную випку можно получать неограниченное количество раз, но с перерывами!</p>
<p *ngIf="text.length>0" [style]="{'color': text_color}">{{text}}</p>
<button *ngIf="text.length==0" mat-button mat-raised-button style="width: 100%" (click)="getFreeVip()">Получить випку бесплатно</button>
<button (click)="dialogRef.close()" mat-button mat-raised-button style="width: 100%">Закрыть</button>
</div>
</mat-dialog-content>
<mat-dialog-actions>
</mat-dialog-actions>
`
})
export class VipFreeDialog {
constructor(@Inject(MAT_DIALOG_DATA) public vip:VipBuy) {}
constructor(@Inject(MAT_DIALOG_DATA) public vip:VipBuy,
public authService: AuthService,
private vipService: VipService,
public dialogRef: MatDialogRef<any>) {}
text: string = '';
text_color: string = 'black';
getFreeVip() {
this.vipService.getFreeVip().subscribe(
(res) => {
switch (res) {
case 0: {
this.text = 'У тебя уже есть VIP права на сервере, приходи когда кончатся';
this.text_color = '#DDD78D';
//права уже есть
break;
}
case 1: {
this.text = 'Иди развлекайся браток, бесплатная випка твоя';
this.text_color = '#3A7D44';
//права выданы
break;
}
default: {
if (res > 1) {
//стоит подождать пока можно получить новые
this.text = `Чел, ты недавно уже забрал свою випку, подожди до ${new Date(new Date().getTime() + res*1000).toLocaleString()}`;
this.text_color = '#2B4570';
} else {
this.text = `Ты недостаточно наиграл у нас на серверах, наиграй еще ${res/60*-1} минут`;
this.text_color = '#7180AC';
}
}
}
}, (err) => {
this.text = 'Произошла ошибка, попробуй чуть позже'
this.text_color = 'red';
}
)
}
}

4
src/app/services/vip.service.ts

@ -13,4 +13,8 @@ export class VipService {
getVipPrices(): Observable<any> {
return this.http.get(`api/external/vip`);
}
getFreeVip(): Observable<any> {
return this.http.get(`api/profile/current/freevip`);
}
}

Loading…
Cancel
Save