Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-05-06 17:37:55 +04:00
parent 1d19ddd47c
commit 98423be0c3
4 changed files with 38 additions and 10 deletions

View File

@@ -145,13 +145,13 @@
<h2 class="modal__title">{{ 'fastcheck.modal_title' | translate }}</h2> <h2 class="modal__title">{{ 'fastcheck.modal_title' | translate }}</h2>
<p class="modal__sub">{{ 'fastcheck.modal_sub' | translate }}</p> <p class="modal__sub">{{ 'fastcheck.modal_sub' | translate }}</p>
<div class="qr"> @if (popupLoading() && !webSessionId()) {
@if (popupLoading() && !webSessionId()) { <div class="qr__placeholder">{{ 'fastcheck.modal_loading' | translate }}</div>
<div class="qr__placeholder">{{ 'fastcheck.modal_loading' | translate }}</div> }
} @else if (webSessionId()) {
<img [src]="qrUrl()" width="240" height="240" alt="QR Telegram" /> @if (webSessionId() && !isMobile) {
} <img [src]="qrUrl()" width="240" height="240" alt="QR Telegram" style="border-radius:12px;display:block;margin:0 auto 12px;" />
</div> }
@if (webSessionId()) { @if (webSessionId()) {
<a class="tg-link" [href]="telegramLink()" target="_blank" rel="noopener"> <a class="tg-link" [href]="telegramLink()" target="_blank" rel="noopener">

View File

@@ -78,6 +78,10 @@ export class FastcheckPage {
return `https://api.qrserver.com/v1/create-qr-code/?size=240x240&margin=8&data=${encodeURIComponent(link)}`; return `https://api.qrserver.com/v1/create-qr-code/?size=240x240&margin=8&data=${encodeURIComponent(link)}`;
}); });
get isMobile(): boolean {
return typeof window !== 'undefined' && window.innerWidth < 768;
}
constructor() { constructor() {
// Pull autofill data: prefer router navigation state, fall back to service. // Pull autofill data: prefer router navigation state, fall back to service.
const navState = typeof window !== 'undefined' ? (window.history?.state ?? {}) : {}; const navState = typeof window !== 'undefined' ? (window.history?.state ?? {}) : {};
@@ -122,7 +126,11 @@ export class FastcheckPage {
next: (res) => { next: (res) => {
this.popupLoading.set(false); this.popupLoading.set(false);
this.webSessionId.set(res.sessionId); this.webSessionId.set(res.sessionId);
this.startPolling(res.sessionId); if (this.isMobile) {
window.location.href = `https://t.me/${this.telegramBot}?start=${encodeURIComponent(res.sessionId)}`;
} else {
this.startPolling(res.sessionId);
}
}, },
error: () => { error: () => {
this.popupLoading.set(false); this.popupLoading.set(false);

View File

@@ -53,7 +53,18 @@
></textarea> ></textarea>
</div> </div>
<button class="pay-btn" type="button" (click)="pay()" [disabled]="loading()"> @if (nspkUrl()) {
<div class="qr-pay">
<img
[src]="'https://api.qrserver.com/v1/create-qr-code/?size=240x240&margin=8&data=' + nspkUrl()"
width="240" height="240"
alt="SBP QR"
/>
<p class="qr-pay__hint">Отсканируйте QR-код в приложении вашего банка</p>
</div>
}
<button class="pay-btn" type="button" (click)="pay()" [disabled]="loading() || !!nspkUrl()">
<span class="pay-btn__icon"> <span class="pay-btn__icon">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"> stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">

View File

@@ -38,6 +38,11 @@ export class LegacyPayPage {
note = signal<string>(''); note = signal<string>('');
error = signal<string>(''); error = signal<string>('');
loading = signal<boolean>(false); loading = signal<boolean>(false);
nspkUrl = signal<string>('');
get isMobile(): boolean {
return window.innerWidth < 768;
}
paymentId = signal<string>(''); paymentId = signal<string>('');
@@ -84,7 +89,11 @@ export class LegacyPayPage {
next: (res) => { next: (res) => {
this.loading.set(false); this.loading.set(false);
if (res?.nspkurl) { if (res?.nspkurl) {
window.location.href = res.nspkurl; if (this.isMobile) {
window.location.href = res.nspkurl;
} else {
this.nspkUrl.set(res.nspkurl);
}
} else { } else {
this.error.set(this.t('errors.payment_failed')); this.error.set(this.t('errors.payment_failed'));
} }