From 25a5db733735ed376da7937e0ffe0bcf94a9b9fb Mon Sep 17 00:00:00 2001 From: gofnnp Date: Thu, 29 Sep 2022 21:46:49 +0400 Subject: [PATCH 1/3] =?UTF-8?q?dev=20#12401=20=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BA=D0=B8=20=D0=BF=D0=BE=20=D1=80=D0=B5=D1=84=D0=B5=D1=80?= =?UTF-8?q?=D0=B0=D0=BB=D1=8C=D0=BD=D0=BE=D0=B9=20=D1=81=D0=B8=D1=81=D1=82?= =?UTF-8?q?=D0=B5=D0=BC=D0=B5=20=D0=B8=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8?= =?UTF-8?q?=D0=B8=20=D0=BF=D1=80=D0=B8=D0=BB=D0=BE=D0=B6=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=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: 'Произошла ошибка!', - }); - }); } } From 4414480d6ee31f7bc23c1efc362823859776024c Mon Sep 17 00:00:00 2001 From: gofnnp Date: Fri, 30 Sep 2022 13:02:57 +0400 Subject: [PATCH 2/3] =?UTF-8?q?dev=20#12425=20=D0=9F=D0=BE=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=B8=D0=BB=20=D1=81=D0=BE=D1=85=D1=80=D0=B0=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=82=D0=BE=D0=BA=D0=B5=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=20=D0=B4=D0=BB=D1=8F=20=D0=BF=D1=83=D1=88=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/services/messaging.service.ts | 20 +++++++++++++++++--- src/firebase-messaging-sw.js | 4 ++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/app/services/messaging.service.ts b/src/app/services/messaging.service.ts index 6c5edea..bd6f9b9 100644 --- a/src/app/services/messaging.service.ts +++ b/src/app/services/messaging.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { AngularFireMessaging } from '@angular/fire/compat/messaging'; import { MessageService } from 'primeng/api'; -import { BehaviorSubject } from 'rxjs'; +import { BehaviorSubject, lastValueFrom } from 'rxjs'; import { JsonrpcService, RpcService } from './jsonrpc.service'; @Injectable() @@ -19,15 +19,29 @@ export class MessagingService { }); } - updateToken(token: string | null) { + async updateToken(token: string | null) { if (!token) return; + const additionalInfo = (await lastValueFrom( + this.jsonRpcService.rpc({ + method: 'getAdditionalInfo', + params: [] + }, RpcService.authService, true) + )).data + let tokens: string[] = [] + if (typeof additionalInfo['fmc-token'] === 'string') { + tokens.push(additionalInfo['fmc-token'], token) + } else if (typeof additionalInfo['fmc-token'] === 'object') { + tokens = [...additionalInfo['fmc-token'], token] + } else { + tokens = [token] + } this.jsonRpcService .rpc( { method: 'updateAdditionalInfo', params: [ { - 'fmc-token': token, + 'fmc-token': tokens, }, ], }, diff --git a/src/firebase-messaging-sw.js b/src/firebase-messaging-sw.js index 29cfaf4..3468516 100644 --- a/src/firebase-messaging-sw.js +++ b/src/firebase-messaging-sw.js @@ -1,5 +1,5 @@ -importScripts('https://www.gstatic.com/firebasejs/7.4.1/firebase-app.js'); -importScripts('https://www.gstatic.com/firebasejs/7.4.1/firebase-messaging.js'); +importScripts('https://www.gstatic.com/firebasejs/3.6.9/firebase-app.js'); +importScripts('https://www.gstatic.com/firebasejs/3.6.9/firebase-messaging.js'); firebase.initializeApp({ apiKey: "AIzaSyCnKvln5itnrBj62POCPHxshAN_Vmd0zds", From 1ee13ab73ddae4d5babc24adce106c994338caa2 Mon Sep 17 00:00:00 2001 From: gofnnp Date: Fri, 30 Sep 2022 13:07:02 +0400 Subject: [PATCH 3/3] =?UTF-8?q?dev=20#12618=20=D0=BF=D0=BE=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=B8=D0=BB=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80?= =?UTF-8?q?=D0=BA=D1=83=20=D0=BD=D0=B0=20=D1=81=D1=83=D1=89=D0=B5=D1=81?= =?UTF-8?q?=D1=82=D0=B2=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=B2=20?= =?UTF-8?q?=D1=80=D0=B5=D1=84=D0=B5=D1=80=D0=B0=D0=BB=D1=8C=D0=BD=D0=BE?= =?UTF-8?q?=D0=B9=20=D1=81=D0=B8=D1=81=D1=82=D0=B5=D0=BC=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/pages/account/account.component.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/app/pages/account/account.component.ts b/src/app/pages/account/account.component.ts index 125c88d..bdd91b9 100644 --- a/src/app/pages/account/account.component.ts +++ b/src/app/pages/account/account.component.ts @@ -78,17 +78,17 @@ export class AccountComponent implements OnInit { params: [] }, RpcService.authService, true) )).data - if (additionalInfo.refSystem?.code.length) { - this.messageService.add({ - severity: 'custom', - summary: - 'Вы уже зарегестрированы в реферальной программе!', - }); - return; - } this.route.queryParams.subscribe((params) => { console.log('####: ', params) if (params['refUserId']) { + if (additionalInfo.refSystem?.code.length) { + this.messageService.add({ + severity: 'custom', + summary: + 'Вы уже зарегестрированы в реферальной программе!', + }); + return; + } this.refSystemId = params['refUserId']; this.jsonRpcService .rpc(