правки по реферальной системе и версии приложения
This commit is contained in:
gofnnp 2022-09-29 21:46:49 +04:00
parent 55486de524
commit 25a5db7337
6 changed files with 89 additions and 72 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "fashion-logica", "name": "fashion-logica",
"version": "0.0.1", "version": "0.0.2",
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"start": "ng serve --host 192.168.0.179", "start": "ng serve --host 192.168.0.179",

View File

@ -1,14 +1,11 @@
<div class="woocommerce"> <div [ngClass]="{
<div woocommerce: true,
*ngIf="currentPage.code !== PageCode.Auth" 'auth-page': currentPage.code === PageCode.Auth
class="top-left-attribute" }">
></div> <div *ngIf="currentPage.code !== PageCode.Auth" class="top-left-attribute"></div>
<div [ngSwitch]="currentPage.code" class=""> <div [ngSwitch]="currentPage.code" class="">
<ng-container *ngSwitchCase="PageCode.Auth"> <ng-container *ngSwitchCase="PageCode.Auth">
<app-auth <app-auth [handleHttpError]="handleHttpErrorFunc" (phoneConfirmed)="phoneConfirmed()"></app-auth>
[handleHttpError]="handleHttpErrorFunc"
(phoneConfirmed)="phoneConfirmed()"
></app-auth>
</ng-container> </ng-container>
<ng-container *ngSwitchCase="PageCode.Orders"> <ng-container *ngSwitchCase="PageCode.Orders">
<app-orders></app-orders> <app-orders></app-orders>
@ -23,26 +20,15 @@
<app-ref-system></app-ref-system> <app-ref-system></app-ref-system>
</ng-container> </ng-container>
</div> </div>
<nav <nav *ngIf="currentPage.code !== PageCode.Auth" class="woocommerce-MyAccount-navigation">
*ngIf="currentPage.code !== PageCode.Auth"
class="woocommerce-MyAccount-navigation"
>
<ul> <ul>
<ng-container *ngFor="let page of pageList; let index = index"> <ng-container *ngFor="let page of pageList; let index = index">
<li <li *ngIf="page.onSideBar" class="woocommerce-MyAccount-navigation-link" [ngClass]="{
*ngIf="page.onSideBar"
class="woocommerce-MyAccount-navigation-link"
[ngClass]="{
'is-active': page === currentPage, 'is-active': page === currentPage,
first: index === 1 first: index === 1
}" }" (click)="changePage($event, page)">
(click)="changePage($event, page)"
>
<div class="container"> <div class="container">
<img <img src="{{ './assets/menu-icons/' + page.resName + '.png' }}" alt="Иконка меню" />
src="{{ './assets/menu-icons/' + page.resName + '.png' }}"
alt="Иконка меню"
/>
<div class="menu-item-info"> <div class="menu-item-info">
<a href="#">{{ page.name }}</a> <a href="#">{{ page.name }}</a>
<p>{{ page.description }}</p> <p>{{ page.description }}</p>
@ -50,10 +36,7 @@
</div> </div>
</li> </li>
</ng-container> </ng-container>
<li <li class="woocommerce-MyAccount-navigation-link" (click)="logout($event)">
class="woocommerce-MyAccount-navigation-link"
(click)="logout($event)"
>
<div class="container"> <div class="container">
<img src="./assets/menu-icons/exit.png" alt="Иконка меню" /> <img src="./assets/menu-icons/exit.png" alt="Иконка меню" />
<div class="menu-item-info"> <div class="menu-item-info">
@ -63,13 +46,9 @@
</li> </li>
</ul> </ul>
</nav> </nav>
<span <span class="version" [ngClass]="{
class="version" version: true
[ngClass]="{ }">
version: true,
bottom: currentPage.code === PageCode.Auth
}"
>
v{{ version }} v{{ version }}
</span> </span>
</div> </div>

View File

@ -2,11 +2,19 @@
.woocommerce { .woocommerce {
min-height: calc(100vh - 39px); min-height: calc(100vh - 39px);
padding: 20px 18px; padding: 20px 18px;
&.auth-page {
display: flex;
flex-direction: column;
justify-content: space-between;
}
nav { nav {
margin-bottom: 24px; margin-bottom: 24px;
margin-top: 26px; margin-top: 26px;
display: flex; display: flex;
justify-content: center; justify-content: center;
ul { ul {
max-width: 400px; max-width: 400px;
width: 100%; width: 100%;
@ -14,6 +22,7 @@
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
flex-direction: column; flex-direction: column;
li { li {
padding: 12px; padding: 12px;
width: 100%; width: 100%;
@ -25,20 +34,25 @@
box-shadow: 0px 0px 5px rgb(0 0 0 / 15%); box-shadow: 0px 0px 5px rgb(0 0 0 / 15%);
color: #000; color: #000;
border-radius: 15px; border-radius: 15px;
&.is-active { &.is-active {
border: solid #09467f 1px; border: solid #09467f 1px;
// display: none; // display: none;
} }
&.first { &.first {
// border-radius: 7px 0 0 7px; // border-radius: 7px 0 0 7px;
} }
.container { .container {
display: flex; display: flex;
align-items: center; align-items: center;
height: 100%; height: 100%;
.menu-item-info { .menu-item-info {
margin-left: 16px; margin-left: 16px;
& > a {
&>a {
font-style: normal; font-style: normal;
font-weight: 700; font-weight: 700;
font-size: 18px; font-size: 18px;
@ -48,7 +62,8 @@
display: block; display: block;
text-align-last: left; text-align-last: left;
} }
& > p {
&>p {
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
font-size: 12px; font-size: 12px;
@ -58,11 +73,13 @@
} }
} }
} }
li:nth-child(odd) { li:nth-child(odd) {
background-color: #ebebeb; background-color: #ebebeb;
} }
} }
} }
.top-left-attribute { .top-left-attribute {
width: 10px; width: 10px;
height: 5px; height: 5px;
@ -71,12 +88,9 @@
position: absolute; position: absolute;
top: 69px; top: 69px;
} }
.version { .version {
opacity: 0.5; opacity: 0.5;
&.bottom {
position: absolute;
bottom: 8px;
}
} }
} }
} }

View File

@ -9,6 +9,7 @@ import { ExitComponent } from '../../components/exit/exit.component';
import { DialogService, DynamicDialogRef } from 'primeng/dynamicdialog'; import { DialogService, DynamicDialogRef } from 'primeng/dynamicdialog';
import { JsonrpcService, RpcService } from 'src/app/services/jsonrpc.service'; import { JsonrpcService, RpcService } from 'src/app/services/jsonrpc.service';
import { MessageService } from 'primeng/api'; import { MessageService } from 'primeng/api';
import { lastValueFrom } from 'rxjs';
@Component({ @Component({
selector: 'app-account', selector: 'app-account',
@ -70,10 +71,25 @@ export class AccountComponent implements OnInit {
this.currentPage = this.pageList[1]; this.currentPage = this.pageList[1];
} }
refSystem() { async refSystem() {
const additionalInfo = (await lastValueFrom(
this.jsonRpcService.rpc({
method: 'getAdditionalInfo',
params: []
}, RpcService.authService, true)
)).data
if (additionalInfo.refSystem?.code.length) {
this.messageService.add({
severity: 'custom',
summary:
'Вы уже зарегестрированы в реферальной программе!',
});
return;
}
this.route.queryParams.subscribe((params) => { this.route.queryParams.subscribe((params) => {
if (params['refCardNumber']) { console.log('####: ', params)
this.refSystemId = params['refCardNumber']; if (params['refUserId']) {
this.refSystemId = params['refUserId'];
this.jsonRpcService this.jsonRpcService
.rpc( .rpc(
{ {
@ -93,7 +109,7 @@ export class AccountComponent implements OnInit {
next: () => { next: () => {
this.router.navigate([], { this.router.navigate([], {
queryParams: { queryParams: {
refCardNumber: null, refUserId: null,
}, },
queryParamsHandling: 'merge', queryParamsHandling: 'merge',
}); });

View File

@ -13,6 +13,7 @@
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
cursor: pointer;
img { img {
height: 26px; height: 26px;
} }
@ -25,6 +26,7 @@
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
cursor: pointer;
} }
} }
} }

View File

@ -11,7 +11,7 @@ import { environment } from 'src/environments/environment';
styleUrls: ['./ref-system.component.scss'] styleUrls: ['./ref-system.component.scss']
}) })
export class RefSystemComponent implements OnInit { export class RefSystemComponent implements OnInit {
public refUrl: string = `${environment.defaultUrl}/?refCardNumber=` public refUrl: string = `${environment.defaultUrl}/?refUserId=`
public loading: boolean = true; public loading: boolean = true;
constructor( constructor(
@ -21,13 +21,19 @@ export class RefSystemComponent implements OnInit {
async ngOnInit() { async ngOnInit() {
const accountData = (await lastValueFrom( const accountData = (await lastValueFrom(
this.jsonrpc.rpc({ this.jsonrpc
method: 'GetAccounts', .rpc(
params: [] {
}, method: 'getTokenData',
RpcService.bonusService params: [],
)))['Cards'][0] },
this.refUrl += accountData.CardNumber RpcService.authService,
true
)
)).data
console.log(accountData);
this.refUrl += accountData.user_id
this.loading = false this.loading = false
} }
@ -35,30 +41,30 @@ export class RefSystemComponent implements OnInit {
if (navigator.share) { if (navigator.share) {
navigator.share({ navigator.share({
title: document.title, title: document.title,
text: "Fashion Logica", text: "Fashionlogica",
url: this.refUrl url: this.refUrl
}) })
.then(() => console.log('Successful share')) .then(() => console.log('Successful share'))
.catch((error) => { .catch((error) => {
console.log('Error sharing:', error) console.log('Error sharing:', error)
}); });
} }
} }
copyUrl() { copyUrl() {
navigator.clipboard.writeText(this.refUrl) navigator.clipboard.writeText(this.refUrl)
.then(() => { .then(() => {
this.messageService.add({ this.messageService.add({
severity: 'custom', severity: 'custom',
summary: 'Ссылка скопирована!', summary: 'Ссылка скопирована!',
});
})
.catch(err => {
this.messageService.add({
severity: 'error',
summary: 'Произошла ошибка!',
});
}); });
})
.catch(err => {
this.messageService.add({
severity: 'error',
summary: 'Произошла ошибка!',
});
});
} }
} }