From 25a5db733735ed376da7937e0ffe0bcf94a9b9fb Mon Sep 17 00:00:00 2001 From: gofnnp Date: Thu, 29 Sep 2022 21:46:49 +0400 Subject: [PATCH] =?UTF-8?q?dev=20#12401=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=BF=D0=BE=20=D1=80=D0=B5=D1=84=D0=B5=D1=80=D0=B0?= =?UTF-8?q?=D0=BB=D1=8C=D0=BD=D0=BE=D0=B9=20=D1=81=D0=B8=D1=81=D1=82=D0=B5?= =?UTF-8?q?=D0=BC=D0=B5=20=D0=B8=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D0=B8=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B8=D0=BB=D0=BE=D0=B6=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/app/pages/account/account.component.html | 51 ++++++------------ src/app/pages/account/account.component.scss | 28 +++++++--- src/app/pages/account/account.component.ts | 24 +++++++-- .../ref-system/ref-system.component.scss | 2 + .../ref-system/ref-system.component.ts | 54 ++++++++++--------- 6 files changed, 89 insertions(+), 72 deletions(-) diff --git a/package.json b/package.json index 3b47502..4fbf5e4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fashion-logica", - "version": "0.0.1", + "version": "0.0.2", "scripts": { "ng": "ng", "start": "ng serve --host 192.168.0.179", diff --git a/src/app/pages/account/account.component.html b/src/app/pages/account/account.component.html index 95c6158..41806ec 100644 --- a/src/app/pages/account/account.component.html +++ b/src/app/pages/account/account.component.html @@ -1,14 +1,11 @@ -
-
+
+
- + @@ -23,26 +20,15 @@
-
+
\ No newline at end of file diff --git a/src/app/pages/account/account.component.scss b/src/app/pages/account/account.component.scss index f4dceee..e9ffa76 100644 --- a/src/app/pages/account/account.component.scss +++ b/src/app/pages/account/account.component.scss @@ -2,11 +2,19 @@ .woocommerce { min-height: calc(100vh - 39px); padding: 20px 18px; + + &.auth-page { + display: flex; + flex-direction: column; + justify-content: space-between; + } + nav { margin-bottom: 24px; margin-top: 26px; display: flex; justify-content: center; + ul { max-width: 400px; width: 100%; @@ -14,6 +22,7 @@ display: flex; justify-content: space-between; flex-direction: column; + li { padding: 12px; width: 100%; @@ -25,20 +34,25 @@ box-shadow: 0px 0px 5px rgb(0 0 0 / 15%); color: #000; border-radius: 15px; + &.is-active { border: solid #09467f 1px; // display: none; } + &.first { // border-radius: 7px 0 0 7px; } + .container { display: flex; align-items: center; height: 100%; + .menu-item-info { margin-left: 16px; - & > a { + + &>a { font-style: normal; font-weight: 700; font-size: 18px; @@ -48,7 +62,8 @@ display: block; text-align-last: left; } - & > p { + + &>p { font-style: normal; font-weight: 400; font-size: 12px; @@ -58,11 +73,13 @@ } } } + li:nth-child(odd) { background-color: #ebebeb; } } } + .top-left-attribute { width: 10px; height: 5px; @@ -71,12 +88,9 @@ position: absolute; top: 69px; } + .version { opacity: 0.5; - &.bottom { - position: absolute; - bottom: 8px; - } } } -} +} \ No newline at end of file diff --git a/src/app/pages/account/account.component.ts b/src/app/pages/account/account.component.ts index 49d39f0..125c88d 100644 --- a/src/app/pages/account/account.component.ts +++ b/src/app/pages/account/account.component.ts @@ -9,6 +9,7 @@ import { ExitComponent } from '../../components/exit/exit.component'; import { DialogService, DynamicDialogRef } from 'primeng/dynamicdialog'; import { JsonrpcService, RpcService } from 'src/app/services/jsonrpc.service'; import { MessageService } from 'primeng/api'; +import { lastValueFrom } from 'rxjs'; @Component({ selector: 'app-account', @@ -70,10 +71,25 @@ export class AccountComponent implements OnInit { 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) => { - if (params['refCardNumber']) { - this.refSystemId = params['refCardNumber']; + console.log('####: ', params) + if (params['refUserId']) { + this.refSystemId = params['refUserId']; this.jsonRpcService .rpc( { @@ -93,7 +109,7 @@ export class AccountComponent implements OnInit { next: () => { this.router.navigate([], { queryParams: { - refCardNumber: null, + refUserId: null, }, queryParamsHandling: 'merge', }); diff --git a/src/app/pages/account/ref-system/ref-system.component.scss b/src/app/pages/account/ref-system/ref-system.component.scss index 59f7d79..e955a14 100644 --- a/src/app/pages/account/ref-system/ref-system.component.scss +++ b/src/app/pages/account/ref-system/ref-system.component.scss @@ -13,6 +13,7 @@ display: flex; justify-content: center; align-items: center; + cursor: pointer; img { height: 26px; } @@ -25,6 +26,7 @@ display: flex; justify-content: center; align-items: center; + cursor: pointer; } } } diff --git a/src/app/pages/account/ref-system/ref-system.component.ts b/src/app/pages/account/ref-system/ref-system.component.ts index 9ac9d31..f18e144 100644 --- a/src/app/pages/account/ref-system/ref-system.component.ts +++ b/src/app/pages/account/ref-system/ref-system.component.ts @@ -11,7 +11,7 @@ import { environment } from 'src/environments/environment'; styleUrls: ['./ref-system.component.scss'] }) export class RefSystemComponent implements OnInit { - public refUrl: string = `${environment.defaultUrl}/?refCardNumber=` + public refUrl: string = `${environment.defaultUrl}/?refUserId=` public loading: boolean = true; constructor( @@ -21,13 +21,19 @@ export class RefSystemComponent implements OnInit { async ngOnInit() { const accountData = (await lastValueFrom( - this.jsonrpc.rpc({ - method: 'GetAccounts', - params: [] - }, - RpcService.bonusService - )))['Cards'][0] - this.refUrl += accountData.CardNumber + this.jsonrpc + .rpc( + { + method: 'getTokenData', + params: [], + }, + RpcService.authService, + true + ) + )).data + console.log(accountData); + + this.refUrl += accountData.user_id this.loading = false } @@ -35,30 +41,30 @@ export class RefSystemComponent implements OnInit { if (navigator.share) { navigator.share({ title: document.title, - text: "Fashion Logica", + text: "Fashionlogica", url: this.refUrl }) - .then(() => console.log('Successful share')) - .catch((error) => { - console.log('Error sharing:', error) - }); + .then(() => console.log('Successful share')) + .catch((error) => { + console.log('Error sharing:', error) + }); } } copyUrl() { navigator.clipboard.writeText(this.refUrl) - .then(() => { - this.messageService.add({ - severity: 'custom', - summary: 'Ссылка скопирована!', + .then(() => { + this.messageService.add({ + severity: 'custom', + summary: 'Ссылка скопирована!', + }); + }) + .catch(err => { + this.messageService.add({ + severity: 'error', + summary: 'Произошла ошибка!', + }); }); - }) - .catch(err => { - this.messageService.add({ - severity: 'error', - summary: 'Произошла ошибка!', - }); - }); } }