Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21472823b4 | ||
|
|
7e6f1603a2 | ||
|
|
2296d36eed | ||
|
|
b03808c442 | ||
|
|
cec78883a2 | ||
|
|
76bd8c0666 | ||
|
|
744065cd12 | ||
|
|
d6a2caffe0 | ||
|
|
2977b479dd | ||
|
|
036184c68b | ||
|
|
cabce85e11 | ||
|
|
3036324509 | ||
|
|
187fda391f | ||
|
|
0547b9ebaa | ||
|
|
0f50ec315c | ||
|
|
ae01f6c8d6 | ||
|
|
5596fc75d0 | ||
|
|
c21738950d | ||
|
|
47d4fb44df | ||
|
|
a19f3072f0 | ||
|
|
5d3d7c4ed7 | ||
|
|
24a98b5448 | ||
|
|
e08af043e0 | ||
|
|
0fba52f3e7 | ||
|
|
f6fdce4c20 | ||
|
|
0de5b0dcb7 | ||
|
|
adaf0a087b | ||
|
|
2f64c26251 | ||
|
|
20c871e66c | ||
|
|
819e007e60 | ||
|
|
2048680d7a | ||
|
|
7626453def | ||
|
|
5e181fdae9 | ||
|
|
9487490981 | ||
|
|
cf8a46ec9c | ||
|
|
ab22c4dd63 | ||
|
|
282c0fe09a | ||
|
|
0a3a5d7c82 | ||
|
|
5920866a95 | ||
|
|
9356a2ab5e | ||
|
|
e9012e26fb | ||
|
|
b1cf0639f5 | ||
|
|
42aef88064 | ||
|
|
be896fe247 | ||
|
|
e6dea15752 | ||
|
|
4fd12277e7 | ||
|
|
21345318ba | ||
|
|
149f82edd4 | ||
|
|
da66e6fef5 |
@@ -0,0 +1,177 @@
|
||||
---
|
||||
description: دستورالعمل اجباری AI — پروژه ابشوده/خانگی (توکن کم، پچ محدود)
|
||||
alwaysApply: true
|
||||
---
|
||||
# دستورالعمل اجباری برای هوش مصنوعی — پروژه ابشوده / خانگی
|
||||
|
||||
این فایل را کامل به AI بده (Project Rules / Custom Instructions / System prompt).
|
||||
هدف: **توکن کمتر، یادگیری پایدار، حل سریع اصل کار، بدون تغییر الکی.**
|
||||
|
||||
---
|
||||
|
||||
## ۱) با هر پرامپت کاربر — همین ترتیب
|
||||
|
||||
1. اصل قضیه را **یک خط** مشخص کن (یک باگ / یک UI / یک فیچر).
|
||||
2. مسیر را از **نقشه و یادداشت** بگیر — کل ریپو را سرچ نکن.
|
||||
3. فقط **۱ تا ۳ فایل** مربوط را باز/پچ کن.
|
||||
4. تمام کن؛ جواب کوتاه بده.
|
||||
5. یک خط **یادداشت بخش** بنویس (پایین ببین) تا دفعهٔ بعد فراموش نشود.
|
||||
|
||||
```
|
||||
پرامپت → اصل کار → نقشه/یادداشت → Grep فقط همان پوشه → پچ محدود → یادداشت → تمام
|
||||
```
|
||||
|
||||
### ممنوع (سوخت توکن)
|
||||
|
||||
- دوباره پیدا کردن فایلی که در نقشه/یادداشت هست
|
||||
- explore / گشت سراسری برای «X کجاست؟»
|
||||
- خواندن کل فایل بلند وقتی چند ده خط کافی است
|
||||
- refactor یا «درست کردن» فایلهای همجوار بدون درخواست
|
||||
- کپی پچ به سیستم/اپ دیگر «برای کامل بودن»
|
||||
|
||||
---
|
||||
|
||||
## ۲) محدودهٔ تغییر — حساس
|
||||
|
||||
- **فقط** همان چیزی که کاربر گفته؛ جای بیربط را دست نزن.
|
||||
- مبهم بود (هدف، اپ، برنچ، سیستم حسابداری) → **بپرس**؛ حدس نزن.
|
||||
- روی **برنچ فعلی** بمان؛ checkout/merge به برنچ دیگر بدون اجازه ممنوع.
|
||||
- هر زیرپروژه git جدا دارد؛ فقط همان ریپوی مربوط را عوض کن.
|
||||
|
||||
| کار | فقط این ریپو |
|
||||
|-----|----------------|
|
||||
| ادمین | `khaneghi_admin` |
|
||||
| API / SQL | `khaneghi_server` |
|
||||
| اپ کاربر | `khaneghi_user` + تم + `ghatreh_user` (هر سه اگر رفتاری است) |
|
||||
| سوپرادمین | `controlpanel_server` / `controlpanel_user` |
|
||||
| بورس مس | فقط با درخواست صریح |
|
||||
|
||||
---
|
||||
|
||||
## ۳) حسابداری — قانون سخت
|
||||
|
||||
سیستمها **جدا** هستند: زرین (`zarin`) / تهحساب (`tahesab`) / پرگار (`pargar`).
|
||||
|
||||
1. اگر گفت حسابداری/سند/سینک مشتری و **نام نبرد** → اول بپرس کدام؟
|
||||
2. تا جواب ندادی کد نزن و فایل سیستم دیگر را باز نکن.
|
||||
3. پچ یک سیستم را به بقیه کپی نکن مگر در همان پیام صریح بگوید.
|
||||
|
||||
---
|
||||
|
||||
## ۴) یادگیری قوی — یادداشت بخشها
|
||||
|
||||
هر کار تمامشده را در دفتر پروژه ثبت کن (اگر در این ریپو هست:
|
||||
`.cursor/skills/abshode-domain-lookup/learned-notes.md`):
|
||||
|
||||
```
|
||||
- YYYY-MM-DD | موضوع | مسیر فایل(ها) | نکتهٔ ۱ خطی
|
||||
```
|
||||
|
||||
قبل از هر Grep سراسری: **یادداشتها را بخوان.**
|
||||
اگر مسیر آنجا بود، دوباره سرچ نکن.
|
||||
|
||||
---
|
||||
|
||||
## ۵) نقشهٔ سریع مسیرها
|
||||
|
||||
| موضوع | کجا |
|
||||
|-------|-----|
|
||||
| تنظیمات ادمین | `khaneghi_admin/src/pages/menuPages/configuration/` |
|
||||
| فلگ منو از settings | `khaneghi_admin/src/utils/config.ts` |
|
||||
| مشتریان | `khaneghi_admin/src/pages/menuPages/customers/` |
|
||||
| همگام تهحساب | `…/accounting/components/TahesabCustomerSync.vue`, `TahesabWalletBulkSync.vue` |
|
||||
| کد حساب همکار | `…/colleagueOrders/components/ColleagueAccountingAccounts.vue` |
|
||||
| API تهحساب (فرانت) | `khaneghi_admin/src/api/tahesab.ts` |
|
||||
| تنظیمات سرور / overlay سوپرادمین | `SuperAdminProgramSettingsOverlay`, `SettingsController` |
|
||||
| deploy settings | `khaneghi_server/database/sql/deploy_settings_const.sql` — **value موجود را UPDATE نکن** |
|
||||
| قیمت ویژه مشتری | `customer_special_pricing` + منوی `customers/special-price` |
|
||||
|
||||
نقشهٔ کاملتر (اگر موجود): `.cursor/skills/abshode-domain-lookup/project-map.md`
|
||||
|
||||
---
|
||||
|
||||
## ۶) فرانت — زیاد از Ant + UnoCSS + lodash استفاده کن
|
||||
|
||||
اولویت:
|
||||
|
||||
1. **BasicPacks** پروژه (دکمه/آیکون/اینپوت/مدال) اگر هست
|
||||
2. **Ant Design Vue** (`a-button`, `a-input`, `a-table`, `a-spin`, `a-form`, …)
|
||||
3. **UnoCSS** برای layout و فاصله (`flex`, `grid`, `gap-*`, `w-full`, `min-w-0`, `sm:`)
|
||||
4. **lodash** برای داده (`get`, `debounce`, `cloneDeep`, `isEmpty`, …) — helper تکراری ننویس
|
||||
5. CSS/`<style>` فقط وقتی utility کافی نیست (توکن تم، انیمیشن خاص)
|
||||
|
||||
```text
|
||||
❌ button خام + CSS بزرگ برای layout
|
||||
✅ Ant/Basic + کلاسهای Uno روی تمپلیت + lodash برای منطق داده
|
||||
```
|
||||
|
||||
- `BasicButton` را با `:deep` برای عوض کردن layout داخلی خراب نکن.
|
||||
- رنگ: توکن تم؛ از `bg-primary/10` روی CSS variable پرهیز کن (اغلب میشکند).
|
||||
|
||||
---
|
||||
|
||||
## ۷) UI حرفهای — عینک گرافیککار
|
||||
|
||||
- هر بلوک جدید: **عنوان + یک خط راهنما** (این کار چیست / دکمه کی زده شود).
|
||||
- **باکسبندی خوب است؛ فضای مرده بد است** — کارت عریض با محتوا فقط در یک گوشه ممنوع.
|
||||
- یا `sm:grid-cols-2` / `flex` تا پر شود، یا عرض باکس را محدود کن.
|
||||
- موبایل: اکشن **زیر** توضیح (`flex-col`).
|
||||
- دسکتاپ: کنار یا ستون دوم پر (`sm:flex-row` / `sm:grid`).
|
||||
- **نسبت سرچ و دکمه:**
|
||||
- موبایل: سرچ `w-full`؛ بعد دکمهها با عرض مساوی (`grid` / `1fr`).
|
||||
- اینپوت باریک کنار دکمهٔ پهن در یک ردیف wrap = زشت → ممنوع.
|
||||
- بنر گرادیان جیغ و دکمهٔ `block` تمامعرض الکی ممنوع مگر اکشن اصلی صفحه باشد.
|
||||
- فشرده باش: `p-2.5` / `gap-2`؛ عدد و padding غولپیکر نگذار.
|
||||
|
||||
---
|
||||
|
||||
## ۸) مهندسی بکاند / فرانت — بدون باگ الکی
|
||||
|
||||
- یک مسئولیت در هر کامپوننت / متد / سرویس؛ خدا-فایل نساز.
|
||||
- UI نازک؛ منطق سنگین در composable یا Service.
|
||||
- Controller نازک → Service؛ SQL و business را قاطی نکن.
|
||||
- خطا، خالی، timeout، دوبار کلیک / race را طراحی کن (`running` قفل، early return).
|
||||
- الگوی همان پوشه را کپی کن؛ اختراع ساختار جدید نکن مگر لازم باشد.
|
||||
- نامگذاری گویا؛ قرارداد API فرانت و بک یکی باشد.
|
||||
|
||||
---
|
||||
|
||||
## ۹) سوپرادمین / تنظیمات دسترسی
|
||||
|
||||
- کلیدهای دسترسی مشتری (`customer_special_pricing`, `has_page_*`, …) مال سوپرادمیناند؛ در پنل خانگی معمولاً فقطخواندنی.
|
||||
- منوی وابسته به فلگ باید از `get_settings` / overlay زنده بیاید؛ کش کهنه برای این کلیدها مطلوب نیست.
|
||||
- دکمهٔ بروزرسانی تنظیمات پیشرفته باید همگام زنده از سوپرادمین را هم بزند اگر فلگ منو میخواهد عوض شود.
|
||||
|
||||
---
|
||||
|
||||
## ۱۰) چک قبل از اتمام
|
||||
|
||||
- [ ] diff فقط به درخواست مربوط است؟
|
||||
- [ ] سیستم حسابداری / اپ / برنچ اشتباه درگیر نشده؟
|
||||
- [ ] اگر مبهم بود سؤال شد؟
|
||||
- [ ] یادداشت یکخطی نوشته شد؟
|
||||
- [ ] UI: راهنما + بدون فضای مرده + نسبت سرچ/دکمه درست؟
|
||||
- [ ] Ant / Uno / lodash بهجای reinvent؟
|
||||
- [ ] جواب کوتاه است؛ توضیح اضافه نداری؟
|
||||
|
||||
---
|
||||
|
||||
## ۱۱) نمونهٔ رفتار درست / غلط
|
||||
|
||||
```text
|
||||
❌ «همگامسازی مشتری خراب» → هر سه زرین/تهحساب/پرگار را عوض کند
|
||||
✅ بپرسد کدام؟ بعد فقط همان
|
||||
|
||||
❌ UI یک کارت → کل صفحه accounting را redesign کند
|
||||
✅ فقط همان کارت / همان فایل
|
||||
|
||||
❌ هر بار از صفر Grep مونوریپو
|
||||
✅ learned-notes + project-map → مستقیم فایل
|
||||
|
||||
❌ CSS سفارشی ۵۰ خط برای flex ساده
|
||||
✅ class="flex flex-col gap-2 sm:grid sm:grid-cols-2"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**پایان.** این سند را بهروز نگه دار؛ نکات جدید حساس را همینجا یا در `learned-notes.md` اضافه کن.
|
||||
@@ -0,0 +1,82 @@
|
||||
# یادداشتهای یادگیری — abshode-domain-lookup
|
||||
|
||||
- 2026-11-10 | مدال احراز کاربر جدید | `RequiredKycModal.vue` | شرط نمایش اشتباهی همیشه false بود؛ برای is_legal=0 دوباره باز میشود، قفل مسیر در setupRouter نیست
|
||||
- 2026-11-10 | قفل منو بعد از احراز | `setupRouter.ts` + `RequiredKycModal.vue` | گارد فقط home/user و مدال سراسری برداشته شد؛ احراز روی معامله/واریز/هدیه ماند
|
||||
- 2026-11-10 | مدال موفقیت ثبتنام خالی | `DialogVantOneButton.vue` | تم لاگین `color:#fff`؛ بدون teleport متن سفید روی دیالوگ سفید — مثل `DialogVant` با teleport+رنگ تیره
|
||||
- 2026-11-10 | خانه خالی بدون KYC | `RequiredKycModal` + `HomeLayoutRenderer` | v-model:open روی computed فقطخواندنی؛ تشخیص احراز با `isCustomerIdentityVerified`؛ skeleton هنگام lazy layout
|
||||
|
||||
فرمت هر خط:
|
||||
- YYYY-MM-DD | موضوع | مسیر فایل(ها) | نکتهٔ ۱ خطی
|
||||
|
||||
- 2026-11-09 | FAB ثبت کارت هدیه | `App.vue` `#gift-card-button` | مثل پشتیبانی؛ `has_page_gift_card` + لاگین؛ کلیک → `giftCard`؛ موقعیت پیشفرض بالای دکمه پشتیبانی
|
||||
- 2026-11-09 | ترتیب منوی کاربر | `useUserPage.ts` `menuActions` | موبایل+دسکتاپ یکسان؛ اول giftCard… بعد password؛ خروج جدا؛ هشدار قیمت دیگر فقط موبایل نیست
|
||||
- 2026-11-09 | وضعیت تاریخچه واریز کیف پول | `wallet/components/Item.vue` + `resolveTransactionStatusLabel` | قبلاً فقط `transaction[0]` → ناموفق؛ واریز pending باید «در انتظار تایید» مثل تب تراکنشها
|
||||
|
||||
- 2026-10-25 | انتخاب روش واریز | `WalletDepositMethodModal.vue` بعد از دکمهٔ واحد واریز | آنی = `INSTANT_DEPOSIT_PAYMENT_URL`؛ حساب = مودال کارت/شبا
|
||||
- 2026-10-22 | addon اینپوت | `assets/css/main.less` | پسزمینه addon = secondary تم، نه primary (سبز tenant)
|
||||
- 2026-10-21 | نمودار خانه = لندینگ | `LandingLiveChartMain.vue` + `useLandingLiveChart` + `zaarboxPriceHistory`؛ جایگزین `PriceChart` در PriceChartSection/DesktopChart* | همان `dlanding-live__main` SVG؛ داده از zaarbox + `/api/price/last`
|
||||
- 2026-10-20 | ظاهر خرید اقساطی | `views/base/installment/InstallmentPanel.vue` | دسکتاپ کلاسهای `dgift` مثل کارت هدیه؛ موبایل کارت `rounded-xl` و توضیح بالای فرم
|
||||
- 2026-10-20 | خرید اقساطی دیجیپی | سرور `DigipayInstallmentService` + تنظیمات `enable_digipay_installment`/`digipay_*`؛ اپ `views/base/installment`؛ ادمین `customers/digipayInstallment` | لینک احراز در تنظیمات؛ مانده اعتبار را ادمین با موبایل مینویسد؛ خرید مس را به کیف gold مینشاند
|
||||
- 2026-10-20 | پاپآپ احراز عملیات | واریز/برداشت `useWalletPage.ensureIdentity`؛ هدیه `useGiftCardPage`؛ خرید/فروش دیالوگ `noCompleteVisible` در gold / copper&silver / DealProduct روی mount اگر is_legal=0 | همه هست؛ معامله با ورود صفحه نه با کلیک ثبت
|
||||
- 2026-10-20 | هشدار قیمت موبایل | `useUserPage.ts` منوی `notifyTrigger` | فقط موبایل و با فلگ `has_page_price_trigger`؛ دسکتاپ همان سایدبار
|
||||
- 2026-10-20 | آیکون درباره ما | `assets/img/boursecu-about-icon.png` + `getBoursecuActionIconSrc('about')` در `navigation.ts` و `useUserPage.ts` | آدمک حباب گفتار جایگزین info-circle در سایدبار و منوی امکانات بیشتر
|
||||
- 2026-10-19 | قفل احراز واریز/هدیه | `useWalletPage` + `useGiftCardPage` + `assertCustomerIdentityVerified` روی withdraw و giftcard/use | is_legal=0 دیالوگ میدهد و API هم رد میکند
|
||||
- 2026-10-19 | آیکون پشتیبانی/هشدار/قوانین | `assets/img/boursecu-support-icon.png` + `price-trigger` + `rules` و `navigation.ts` / `useUserPage.ts` | آدمک=پشتیبانی، زنگ دلار=هشدار قیمت سایدبار، برگه=قوانین
|
||||
- 2026-09-08 | لیست کارت هدیه کاربر | `views/base/giftCard/` + `api/giftCard.ts` + سرور `GiftCardController::mine` / `GET customer/giftcard/mine` | زیر فرم: available (اختصاصی + عمومی use_once=0 تککد) و history؛ تخفیف فقط نمایش/سبد نه giftcard/use
|
||||
- 2026-09-08 | تب کارت هدیه/تخفیف در تراکنشها | `transactions/config/boursecuTabs.ts` + `useTransactionsPageData.ts` + `Item.vue` | fetchMode giftcard/discount از historyِ mine؛ واحد تخفیف٪/طلا در Item
|
||||
- 2026-09-08 | گیر کردن در لاگین بعد رفرش | `app/authBoot.ts` + `setupRouter.ts` | finger unlock در sessionStorage؛ بعد ۳دقیقه fingerprintChecked ریست؛ لاگین بدون userInfo نرود home
|
||||
- 2026-09-08 | حذف دکمه قلک از خانه | `BoursecuQuickActionsSection.vue` + دسکتاپ quick actions + `useHomePage.ts` | دیگر با enable_product_funds به گرید اضافه نمیشود
|
||||
- 2026-09-08 | پشتیبانی در تنظیمات → چت | `user/composables/useUserPage.ts` | دکمه پشتیبانی مستقیم `router.push({ name: 'support' })` نه منوی پیامرسان
|
||||
- 2026-09-08 | چت دسکتاپ کنار منو | `views/support/index.vue` + `desktop-layout.less` | از ۷۶۸px شل دسکتاپ؛ کارت چت inset با radius ۲۸ کنار سایدبار
|
||||
- 2026-09-08 | چت+سایدبار اجباری | `support/index.vue` + router `hideMenu` | سایدبار داخل صفحه چت وقتی isDesktop؛ شل بیرونی سایدبار ندارد تا دوبل نشود
|
||||
- 2026-09-08 | دسکتاپ از ۶۰۰px | `layouts/constants.ts` + shell/frame + `support/index.vue` | آستانه ۷۶۸→۶۰۰؛ سایدبار چت همیشه در DOM و با @media نمایش
|
||||
- 2026-09-09 | آستانه دسکتاپ ۷۶۸ | `layouts/constants.ts` + shell/frame + `support/index.vue` | از عرض >۷۶۷ (min-width: 768) سایدبار دسکتاپ
|
||||
- 2026-09-09 | لوگوی هدر پشتیبانی | `SupportChatHeader.vue` | بهجای config.avatar از `getProjectSplashLogo()` (لوگوی محلی اپ)
|
||||
- 2026-09-09 | هدر دسکتاپ اعلانها | `DesktopAppNotificationsView.vue` | قبلاً topbar نداشت؛ `DesktopPageTopbar` مثل کیفپول/تراکنشها
|
||||
- 2026-09-09 | جزئیات اعلان دسکتاپ | `appNotifications/index.vue` | دسکتاپ `BasicModal`؛ موبایل `BasicActionSheet`
|
||||
- 2026-09-09 | بازگشت چت پشتیبانی | `SupportChatHeader.vue` | تایماوت ۸۰ms با beforeEach تداخل داشت؛ `push(back)` یا `replace(user)`
|
||||
- 2026-09-09 | دکمه ارسال چت | `SupportChatComposer.vue` + `support/index.vue` | BasicButton فقط `disabledB`؛ متن فقط بعد موفقیت پاک شود + toast خطا
|
||||
- 2026-09-09 | عرض چت موبایل/دسکتاپ | `support/index.vue` + `App.vue` | زیر ۷۶۸ fullbleed؛ دسکتاپ با کلاس isDesktop سایدبار؛ بدون float credit روی پشتیبانی
|
||||
- 2026-09-09 | چت زیر آستانه | `support/index.vue` | max-width 767 منو مخفی + w-full؛ از ۷۶۸ flex width:0 برای پر کردن باقیمانده
|
||||
- 2026-09-09 | دکمه ریپلای چت | `SupportChatMessages.vue` | native button + همیشه pointer-events؛ فوکوس composer بعد از reply
|
||||
- 2026-09-09 | قلک دسکتاپ | `piggy/` desktop+mobile + `usePiggyPage` | مثل fund/wallet: topbar + خلاصه + لیست گروهها
|
||||
- 2026-09-09 | زیرصفحات قلک دسکتاپ | `piggy/new` + `piggy/info` + create/info composable | ساخت/ویرایش و جزئیات با DesktopPageTopbar و گرید دوستونه
|
||||
- 2026-09-09 | عرض قلک دسکتاپ | `desktop-piggy-create.less` | کانتینر ساخت هم max-width ۱۱۸۰ مثل لیست/جزئیات/کیفپول
|
||||
- 2026-09-09 | نام منوی کاربر | `navigation.ts` + `MobileBottomNav.vue` | «تنظیمات» → «امکانات بیشتر» (دسکتاپ+موبایل)
|
||||
- 2026-09-12 | دکمه داراییها خانه | `boursecuQuickActions` + `useHomePage.openAssetsSheet` | قبلاً `fund` میرفت و با خاموش بودن قلک گارد بیصدا برمیگرداند؛ حالا شیت BalanceSheet
|
||||
- 2026-09-09 | ماشین حساب | `useUserPage.ts` + `GoldDayCalculatorModal.vue` | «قیمت روز طلا» → «ماشین حساب»؛ برچسب فلز/واحد از settingsStore (metalTypeLabel + tradeWeightUnit) نه هاردکد طلا/گرم
|
||||
- 2026-10-05 | ????? ????? ??????? | desktop/components/DesktopAuthShell.vue + desktop/styles/desktop-auth.less | ????? stretch? ??? ???????? bleed? tagline ? form-links ?? margin-top:auto ???????? support ??? ???? ?? __top
|
||||
- 2026-10-05 | نمای کلی پروژه | `boursecu/BOURSECU.md` | چهار ریپو: user:3100، admin:3600، server:8000، landing:3200؛ فلز مس از settings
|
||||
- 2026-10-17 | کلیک کارت محصول دسکتاپ | `products/index.vue` + `DesktopProductCard.vue` + `useProductsPage.ts` | کاتد مس: `isMeltedTradeGroup` → indexGold در مدال؛ رویداد `select`؛ بسته بودن معامله با `shouldBlockStoreTrading`
|
||||
- 2026-10-05 | ???? ????? ????? | DesktopAuthShell.vue + desktop-auth.less | status ???? form-column__foot ??? ???????? body/top ?? margin-top:auto ???????? tagline ??????? foot
|
||||
- 2026-10-05 | ??? ????? ?????? | home/components/AppHeader.vue + guestHome.ts | ???? ????? ???? ?????login? ????????? ????? ?????/??/???? ?? guest ????
|
||||
- 2026-10-05 | FAB ???????? ????? ?????? | DesktopAuthShell.vue + useDraggableFloatingButton | ??????: ????? ???? ????????? ??????: ???? inline ??? ????
|
||||
- 2026-10-05 | ?????? ?? ??? ????? | boutUs/components/AboutUsContentPanel.vue | ??? ?????? ???? ??? ???? ?? ????? ???? ?? ??? ??
|
||||
- 2026-10-06 | بیلد آموزش ENOENT 1.png | EducateContentPanel.vue + assets/img/1.png,2.png,4.png + banner1/2 | فایلها در گیت بودند و از دیسک پاک شده بودند؛ git restore
|
||||
- 2026-10-17 | باز/بسته خرید فروش محصول | `utils/productTradeOpen.ts` + `gold/index.vue` | `open_buy`/`open_sell`؛ بدون ProductItem هر دو باز
|
||||
- 2026-10-17 | نمودار مهمان ۴۰۱ | `usePriceChart.ts` + `api/home.ts` + سرور `routes/api.php` `POST /api/price/all` | مهمان product/list نمیزند؛ تاریخچه نمودار از `/api/price/all` (همان priceData)
|
||||
- 2026-10-17 | قیمت زنده مهمان | `bootstrap.ts` + `priceSocket.ts` + سرور `/api/price/stream` بدون auth | SSE بدون توکن؛ polling پشتیبان product/list فقط با توکن
|
||||
- 2026-10-21 | نمودار خانه = کارت لندینگ | `home/components/LandingLiveChartMain.vue` + `useLandingLiveChart.ts` + `styles/landing-live-chart-main.less` | موبایل PriceChartSection و دسکتاپ DesktopChartSection/Panel همین کارت؛ استایل از main.less
|
||||
- 2026-10-21 | چیدمان کارت نمودار خانه | همان دو فایل vue/less | هدر: نام+وضعیت راست، تب محصول چپ؛ قیمت راست و تغییر چپ؛ تب بازه کنار عنوان نمودار
|
||||
- 2026-10-21 | تب نمودار = محصول فعال | `useLandingLiveChart.ts` + `LandingLiveChartMain.vue` | تب از کاتالوگ `active && show`؛ داده با `price_offset_percent` همان محصول
|
||||
- 2026-11-01 | درخواست تبدیل سیم | `convert/CopperConvertCalculator.vue` + `useCopperConvertPage.ts` + سرور `CopperConvertRequestService` + ادمین `hesabKetab.ts` فرزند `copperConvertMain` | حلقه صحیح؛ منوی ادمین زیر حساب کتاب نه منوی اصلی
|
||||
- 2026-11-01 | ۵۰۰ لیست تبدیل | `2026_11_01_000001_create_copper_convert_requests_table.php` | git pull کافی نیست؛ بدون `php artisan migrate` جدول نیست و GET ادمین ۵۰۰ میدهد
|
||||
- 2026-11-01 | جدول درخواست تبدیل | ادمین `copperConvert/components/table.vue` | دسکتاپ BaseTable؛ موبایل `CopperConvertMobileCardList` مثل بقیه صفحات
|
||||
- 2026-11-01 | ترتیب ۱.۵ و mm² | `convert/components/CopperConvertCalculator.vue` | صفحه rtl است؛ نشان و برچسب سیم با `dir="ltr"` تا اول مقطع بیاید بعد mm²
|
||||
- 2026-11-01 | جای واحد و عدد در تبدیل | `CopperConvertCalculator.vue` + `useCopperConvertPage.ts` | ریال/کیلو/عدد با `bdi` داخل `measure` قبل از عدد؛ باکس مقدار `dir=ltr`
|
||||
- 2026-11-01 | ماشینحساب اجرت/سود/مالیات | `components/GoldDayCalculatorModal.vue` | اجرت ساخت مفتول؛ سود مورد انتظار جدا؛ مالیات ارزش افزوده روی (هزینه+اجرت+سود)
|
||||
- 2026-11-01 | پلیسهولدر هشدار قیمت | user `priceTrigger/components/PriceTriggerForm.vue` + admin `priceTriggers/components/PriceTriggerEditorFormBody.vue` | «آبشده، سکه، نقره و ...» → «کاتد مس، مفتول مس و...»
|
||||
- 2026-11-02 | هشدار کاتد→طلا | user `priceTrigger/` + `BasicSelect.vue` + server `Customer/PriceTriggerController.php` | شناسه عددی محصول ارسال شود؛ fallback عنوان «طلا» نباشد. محصول پیشفرض const برابر id=1 است
|
||||
- 2026-11-02 | زبانه تبدیل کشیدنی | `convert/components/CopperConvertCalculator.vue` | `dragHandleOnly` در capture؛ لمس ریل مقدار را جابهجا نمیکند، فقط کشیدن دستگیره
|
||||
- 2026-11-02 | سه زبانه تبدیل از اول | همان `CopperConvertCalculator.vue` | زبانه ۱.۵ و ۲.۵ دیگر پشت `remainderAmount > 0` نیستند؛ زیر زبانه مقدار، قبل از نتیجه
|
||||
- 2026-11-02 | زبانه سیم مکمل | `useCopperConvertPage.ts` | بودجه = ارزش مقدار انتخابشده؛ نصف به ۱.۵ و بقیه به ۲.۵؛ جابهجایی یکی دیگری را پر میکند
|
||||
- 2026-11-01 | تاریخچه برداشت کیف پول | `wallet/mobile/MobileWalletView.vue` + `desktop/DesktopWalletView.vue` + `useWalletPageData.ts` | `walletWithdrawItems` از قبل لود میشد؛ زیر راهنمای برداشت و زیر حسابهای دسکتاپ نشان داده میشود
|
||||
- 2026-11-03 | تاریخچه تبدیل کاربر | `convert/components/CopperConvertHistory.vue` + `useCopperConvertPage.ts` + سرور `Customer/CopperConvertRequestController@index` | GET `/customer/copper-convert-request` فقط ردیفهای همان مشتری؛ زیر فرم موبایل و دسکتاپ
|
||||
- 2026-11-03 | ویرایش/حذف تبدیل در انتظار | همان تاریخچه + `CopperConvertRequestService::update/remove` | فقط status=pending؛ ویرایش فرم را با همان حلقهها پر میکند و PUT میزند
|
||||
- 2026-11-03 | چیدمان دسکتاپ تبدیل | `convert/desktop/DesktopConvertView.vue` | مثل کیف پول: `dwallet-grid`؛ فرم راست، تاریخچه چپ با `variant=side`
|
||||
- 2026-11-03 | مداد ویرایش تبدیل | `convert/components/CopperConvertHistory.vue` | فقط pending؛ آیکون `vuesax-linear:edit` کنار وضعیت، همان `beginEdit`
|
||||
- 2026-11-03 | چهار قیمت هیرو خانه | `home/desktop/components/DesktopLivePrice.vue` + سرور `ZaarboxPriceService::copperDollarReferences` | مس جهانی=کلید `basemetal_london_copper`، دلار آزاد=`tgju_usd`؛ تن=ضرب، کیلو=تقسیم بر ۱۰۰۰
|
||||
- 2026-11-03 | چهار قیمت موبایل خانه | `home/components/CurrentPrice.vue` + `composables/useHomeQuoteRows.ts` | همان چهار ردیف دسکتاپ؛ منطق مشترک در useHomeQuoteRows
|
||||
- 2026-11-03 | هاور نمودار دارایی | `assets/index.vue` + `useAssetsPortfolioChart.ts` + `chartAreaPaths.ts` | نزدیکترین نقطهٔ رسمشده؛ مقدار همان نمونهٔ دارایی، نه قیمت مس
|
||||
- 2026-11-04 | لینک دعوتنامه | `utils/referralShare.ts` + لندینگ `pages/login.vue` | `%لینک` = `/login?register=true&id=`؛ لندینگ با `id` به ثبتنام اپ ریدایرکت میکند
|
||||
- 2026-11-04 | دکمه ثبتنام آیفون | `login/desktop/styles/desktop-auth.less` + `login/index.vue` | موبایل height:auto و اسکرول؛ بنر نصب پایین تا روی دکمه ننشیند
|
||||
@@ -0,0 +1,15 @@
|
||||
# کپی به `.env.production` / `.env.development`
|
||||
|
||||
# لوکال (پیشنهادی): پروکسی Vite → بدون CORS
|
||||
# VITE_SUPERADMIN_URL=/__sa
|
||||
# VITE_TENANT_DOMAIN=k.montzar.ir
|
||||
|
||||
# لوکال با API سوپرادمین روی سیستم خودت:
|
||||
# VITE_SUPERADMIN_URL=http://localhost:3001
|
||||
|
||||
# پروداکشن:
|
||||
# VITE_SUPERADMIN_URL=https://adm.montzar.ir
|
||||
# failover: adm.montzar.ir → adm.montech.ir → adm.montest.ir
|
||||
|
||||
# URL لندینگ داخل اپ
|
||||
VITE_LANDING_APP_URL=/landing/
|
||||
@@ -14,6 +14,11 @@ dist-ssr
|
||||
coverage
|
||||
*.local
|
||||
|
||||
# Local env
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
|
||||
/cypress/videos/
|
||||
/cypress/screenshots/
|
||||
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
# دستورالعمل اجباری برای هوش مصنوعی — پروژه ابشوده / خانگی
|
||||
|
||||
این فایل را کامل به AI بده (Project Rules / Custom Instructions / System prompt).
|
||||
هدف: **توکن کمتر، یادگیری پایدار، حل سریع اصل کار، بدون تغییر الکی.**
|
||||
|
||||
---
|
||||
|
||||
## ۱) با هر پرامپت کاربر — همین ترتیب
|
||||
|
||||
1. اصل قضیه را **یک خط** مشخص کن (یک باگ / یک UI / یک فیچر).
|
||||
2. مسیر را از **نقشه و یادداشت** بگیر — کل ریپو را سرچ نکن.
|
||||
3. فقط **۱ تا ۳ فایل** مربوط را باز/پچ کن.
|
||||
4. تمام کن؛ جواب کوتاه بده.
|
||||
5. یک خط **یادداشت بخش** بنویس (پایین ببین) تا دفعهٔ بعد فراموش نشود.
|
||||
|
||||
```
|
||||
پرامپت → اصل کار → نقشه/یادداشت → Grep فقط همان پوشه → پچ محدود → یادداشت → تمام
|
||||
```
|
||||
|
||||
### ممنوع (سوخت توکن)
|
||||
|
||||
- دوباره پیدا کردن فایلی که در نقشه/یادداشت هست
|
||||
- explore / گشت سراسری برای «X کجاست؟»
|
||||
- خواندن کل فایل بلند وقتی چند ده خط کافی است
|
||||
- refactor یا «درست کردن» فایلهای همجوار بدون درخواست
|
||||
- کپی پچ به سیستم/اپ دیگر «برای کامل بودن»
|
||||
|
||||
---
|
||||
|
||||
## ۲) محدودهٔ تغییر — حساس
|
||||
|
||||
- **فقط** همان چیزی که کاربر گفته؛ جای بیربط را دست نزن.
|
||||
- مبهم بود (هدف، اپ، برنچ، سیستم حسابداری) → **بپرس**؛ حدس نزن.
|
||||
- روی **برنچ فعلی** بمان؛ checkout/merge به برنچ دیگر بدون اجازه ممنوع.
|
||||
- هر زیرپروژه git جدا دارد؛ فقط همان ریپوی مربوط را عوض کن.
|
||||
|
||||
| کار | فقط این ریپو |
|
||||
|-----|----------------|
|
||||
| ادمین | `khaneghi_admin` |
|
||||
| API / SQL | `khaneghi_server` |
|
||||
| اپ کاربر | `khaneghi_user` + تم + `ghatreh_user` (هر سه اگر رفتاری است) |
|
||||
| سوپرادمین | `controlpanel_server` / `controlpanel_user` |
|
||||
| بورس مس | فقط با درخواست صریح |
|
||||
|
||||
---
|
||||
|
||||
## ۳) حسابداری — قانون سخت
|
||||
|
||||
سیستمها **جدا** هستند: زرین (`zarin`) / تهحساب (`tahesab`) / پرگار (`pargar`).
|
||||
|
||||
1. اگر گفت حسابداری/سند/سینک مشتری و **نام نبرد** → اول بپرس کدام؟
|
||||
2. تا جواب ندادی کد نزن و فایل سیستم دیگر را باز نکن.
|
||||
3. پچ یک سیستم را به بقیه کپی نکن مگر در همان پیام صریح بگوید.
|
||||
|
||||
---
|
||||
|
||||
## ۴) یادگیری قوی — یادداشت بخشها
|
||||
|
||||
هر کار تمامشده را در دفتر پروژه ثبت کن (اگر در این ریپو هست:
|
||||
`.cursor/skills/abshode-domain-lookup/learned-notes.md`):
|
||||
|
||||
```
|
||||
- YYYY-MM-DD | موضوع | مسیر فایل(ها) | نکتهٔ ۱ خطی
|
||||
```
|
||||
|
||||
قبل از هر Grep سراسری: **یادداشتها را بخوان.**
|
||||
اگر مسیر آنجا بود، دوباره سرچ نکن.
|
||||
|
||||
---
|
||||
|
||||
## ۵) نقشهٔ سریع مسیرها
|
||||
|
||||
| موضوع | کجا |
|
||||
|-------|-----|
|
||||
| تنظیمات ادمین | `khaneghi_admin/src/pages/menuPages/configuration/` |
|
||||
| فلگ منو از settings | `khaneghi_admin/src/utils/config.ts` |
|
||||
| مشتریان | `khaneghi_admin/src/pages/menuPages/customers/` |
|
||||
| همگام تهحساب | `…/accounting/components/TahesabCustomerSync.vue`, `TahesabWalletBulkSync.vue` |
|
||||
| کد حساب همکار | `…/colleagueOrders/components/ColleagueAccountingAccounts.vue` |
|
||||
| API تهحساب (فرانت) | `khaneghi_admin/src/api/tahesab.ts` |
|
||||
| تنظیمات سرور / overlay سوپرادمین | `SuperAdminProgramSettingsOverlay`, `SettingsController` |
|
||||
| deploy settings | `khaneghi_server/database/sql/deploy_settings_const.sql` — **value موجود را UPDATE نکن** |
|
||||
| قیمت ویژه مشتری | `customer_special_pricing` + منوی `customers/special-price` |
|
||||
|
||||
نقشهٔ کاملتر (اگر موجود): `.cursor/skills/abshode-domain-lookup/project-map.md`
|
||||
|
||||
---
|
||||
|
||||
## ۶) فرانت — زیاد از Ant + UnoCSS + lodash استفاده کن
|
||||
|
||||
اولویت:
|
||||
|
||||
1. **BasicPacks** پروژه (دکمه/آیکون/اینپوت/مدال) اگر هست
|
||||
2. **Ant Design Vue** (`a-button`, `a-input`, `a-table`, `a-spin`, `a-form`, …)
|
||||
3. **UnoCSS** برای layout و فاصله (`flex`, `grid`, `gap-*`, `w-full`, `min-w-0`, `sm:`)
|
||||
4. **lodash** برای داده (`get`, `debounce`, `cloneDeep`, `isEmpty`, …) — helper تکراری ننویس
|
||||
5. CSS/`<style>` فقط وقتی utility کافی نیست (توکن تم، انیمیشن خاص)
|
||||
|
||||
```text
|
||||
❌ button خام + CSS بزرگ برای layout
|
||||
✅ Ant/Basic + کلاسهای Uno روی تمپلیت + lodash برای منطق داده
|
||||
```
|
||||
|
||||
- `BasicButton` را با `:deep` برای عوض کردن layout داخلی خراب نکن.
|
||||
- رنگ: توکن تم؛ از `bg-primary/10` روی CSS variable پرهیز کن (اغلب میشکند).
|
||||
|
||||
---
|
||||
|
||||
## ۷) UI حرفهای — عینک گرافیککار
|
||||
|
||||
- هر بلوک جدید: **عنوان + یک خط راهنما** (این کار چیست / دکمه کی زده شود).
|
||||
- **باکسبندی خوب است؛ فضای مرده بد است** — کارت عریض با محتوا فقط در یک گوشه ممنوع.
|
||||
- یا `sm:grid-cols-2` / `flex` تا پر شود، یا عرض باکس را محدود کن.
|
||||
- موبایل: اکشن **زیر** توضیح (`flex-col`).
|
||||
- دسکتاپ: کنار یا ستون دوم پر (`sm:flex-row` / `sm:grid`).
|
||||
- **نسبت سرچ و دکمه:**
|
||||
- موبایل: سرچ `w-full`؛ بعد دکمهها با عرض مساوی (`grid` / `1fr`).
|
||||
- اینپوت باریک کنار دکمهٔ پهن در یک ردیف wrap = زشت → ممنوع.
|
||||
- بنر گرادیان جیغ و دکمهٔ `block` تمامعرض الکی ممنوع مگر اکشن اصلی صفحه باشد.
|
||||
- فشرده باش: `p-2.5` / `gap-2`؛ عدد و padding غولپیکر نگذار.
|
||||
|
||||
---
|
||||
|
||||
## ۸) مهندسی بکاند / فرانت — بدون باگ الکی
|
||||
|
||||
- یک مسئولیت در هر کامپوننت / متد / سرویس؛ خدا-فایل نساز.
|
||||
- UI نازک؛ منطق سنگین در composable یا Service.
|
||||
- Controller نازک → Service؛ SQL و business را قاطی نکن.
|
||||
- خطا، خالی، timeout، دوبار کلیک / race را طراحی کن (`running` قفل، early return).
|
||||
- الگوی همان پوشه را کپی کن؛ اختراع ساختار جدید نکن مگر لازم باشد.
|
||||
- نامگذاری گویا؛ قرارداد API فرانت و بک یکی باشد.
|
||||
|
||||
---
|
||||
|
||||
## ۹) سوپرادمین / تنظیمات دسترسی
|
||||
|
||||
- کلیدهای دسترسی مشتری (`customer_special_pricing`, `has_page_*`, …) مال سوپرادمیناند؛ در پنل خانگی معمولاً فقطخواندنی.
|
||||
- منوی وابسته به فلگ باید از `get_settings` / overlay زنده بیاید؛ کش کهنه برای این کلیدها مطلوب نیست.
|
||||
- دکمهٔ بروزرسانی تنظیمات پیشرفته باید همگام زنده از سوپرادمین را هم بزند اگر فلگ منو میخواهد عوض شود.
|
||||
|
||||
---
|
||||
|
||||
## ۱۰) چک قبل از اتمام
|
||||
|
||||
- [ ] diff فقط به درخواست مربوط است؟
|
||||
- [ ] سیستم حسابداری / اپ / برنچ اشتباه درگیر نشده؟
|
||||
- [ ] اگر مبهم بود سؤال شد؟
|
||||
- [ ] یادداشت یکخطی نوشته شد؟
|
||||
- [ ] UI: راهنما + بدون فضای مرده + نسبت سرچ/دکمه درست؟
|
||||
- [ ] Ant / Uno / lodash بهجای reinvent؟
|
||||
- [ ] جواب کوتاه است؛ توضیح اضافه نداری؟
|
||||
|
||||
---
|
||||
|
||||
## ۱۱) نمونهٔ رفتار درست / غلط
|
||||
|
||||
```text
|
||||
❌ «همگامسازی مشتری خراب» → هر سه زرین/تهحساب/پرگار را عوض کند
|
||||
✅ بپرسد کدام؟ بعد فقط همان
|
||||
|
||||
❌ UI یک کارت → کل صفحه accounting را redesign کند
|
||||
✅ فقط همان کارت / همان فایل
|
||||
|
||||
❌ هر بار از صفر Grep مونوریپو
|
||||
✅ learned-notes + project-map → مستقیم فایل
|
||||
|
||||
❌ CSS سفارشی ۵۰ خط برای flex ساده
|
||||
✅ class="flex flex-col gap-2 sm:grid sm:grid-cols-2"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**پایان.** این سند را بهروز نگه دار؛ نکات جدید حساس را همینجا یا در `learned-notes.md` اضافه کن.
|
||||
@@ -7,10 +7,12 @@ export {}
|
||||
|
||||
declare module 'vue' {
|
||||
export interface GlobalComponents {
|
||||
ABadge: typeof import('ant-design-vue/es')['Badge']
|
||||
AButton: typeof import('ant-design-vue/es')['Button']
|
||||
ADivider: typeof import('ant-design-vue/es')['Divider']
|
||||
AForm: typeof import('ant-design-vue/es')['Form']
|
||||
AFormItem: typeof import('ant-design-vue/es')['FormItem']
|
||||
AImage: typeof import('ant-design-vue/es')['Image']
|
||||
AInput: typeof import('ant-design-vue/es')['Input']
|
||||
AInputPassword: typeof import('ant-design-vue/es')['InputPassword']
|
||||
AModal: typeof import('ant-design-vue/es')['Modal']
|
||||
@@ -42,6 +44,7 @@ declare module 'vue' {
|
||||
BasicToggleTwoItem: typeof import('./src/components/BasicPacks/BasicToggleTwoItem.vue')['default']
|
||||
Bg_main: typeof import('./src/components/bg_main.vue')['default']
|
||||
Bordered: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/bordered.vue')['default']
|
||||
CopperConvertModal: typeof import('./src/components/CopperConvertModal.vue')['default']
|
||||
DateRender: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/date-render.vue')['default']
|
||||
Demo: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/index.vue')['default']
|
||||
DialogVant: typeof import('./src/components/DialogVant.vue')['default']
|
||||
@@ -49,14 +52,23 @@ declare module 'vue' {
|
||||
Disabled: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/disabled.vue')['default']
|
||||
DisabledDate: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/disabled-date.vue')['default']
|
||||
Empty: typeof import('./src/components/empty.vue')['default']
|
||||
EnamadBadge: typeof import('./src/components/EnamadBadge.vue')['default']
|
||||
ExtraFooter: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/extra-footer.vue')['default']
|
||||
Format: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/format.vue')['default']
|
||||
GoldDayCalculatorModal: typeof import('./src/components/GoldDayCalculatorModal.vue')['default']
|
||||
GoldLoading: typeof import('./src/components/GoldLoading.vue')['default']
|
||||
IdentityRequiredDialog: typeof import('./src/components/IdentityRequiredDialog.vue')['default']
|
||||
InstallButton: typeof import('./src/components/InstallButton.vue')['default']
|
||||
ListAnim: typeof import('./src/components/ListAnim.vue')['default']
|
||||
Mode: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/mode.vue')['default']
|
||||
PresettedRanges: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/presetted-ranges.vue')['default']
|
||||
ProductImage: typeof import('./src/components/ProductImage.vue')['default']
|
||||
ProfileAvatarUpload: typeof import('./src/components/ProfileAvatarUpload.vue')['default']
|
||||
PwaInstallBanner: typeof import('./src/components/pwa/PwaInstallBanner.vue')['default']
|
||||
PwaInstallGuideModal: typeof import('./src/components/pwa/PwaInstallGuideModal.vue')['default']
|
||||
PwaInstallStepIllustration: typeof import('./src/components/pwa/PwaInstallStepIllustration.vue')['default']
|
||||
RangePicker: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/range-picker.vue')['default']
|
||||
RequiredKycModal: typeof import('./src/components/RequiredKycModal.vue')['default']
|
||||
RouterLink: typeof import('vue-router')['RouterLink']
|
||||
RouterView: typeof import('vue-router')['RouterView']
|
||||
SelectInRange: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/select-in-range.vue')['default']
|
||||
@@ -65,9 +77,12 @@ declare module 'vue' {
|
||||
StartEnd: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/start-end.vue')['default']
|
||||
Suffix: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/suffix.vue')['default']
|
||||
SupportContactBar: typeof import('./src/components/SupportContactBar.vue')['default']
|
||||
SupportMessengerBrandIcon: typeof import('./src/components/SupportMessengerBrandIcon.vue')['default']
|
||||
SupportMessengerPicker: typeof import('./src/components/SupportMessengerPicker.vue')['default']
|
||||
Switchable: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/switchable.vue')['default']
|
||||
Text: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/text.vue')['default']
|
||||
Time: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/time.vue')['default']
|
||||
TradeFeeConfirmSummary: typeof import('./src/components/TradeFeeConfirmSummary.vue')['default']
|
||||
TransactionSkeleton: typeof import('./src/components/TransactionSkeleton.vue')['default']
|
||||
VanActionSheet: typeof import('vant/es')['ActionSheet']
|
||||
VanDialog: typeof import('vant/es')['Dialog']
|
||||
|
||||
@@ -1 +1 @@
|
||||
if('serviceWorker' in navigator) navigator.serviceWorker.register('/dev-sw.js?dev-sw', { scope: '/', type: 'classic' })
|
||||
if('serviceWorker' in navigator) navigator.serviceWorker.register('/dev-sw.js?dev-sw', { scope: '/', type: 'module' })
|
||||
@@ -2,6 +2,65 @@
|
||||
<html lang="fa" dir="rtl">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<script>
|
||||
(function () {
|
||||
try {
|
||||
var icon = ''
|
||||
try {
|
||||
icon = localStorage.getItem('PWA_INSTALL_ICON_URL') || ''
|
||||
} catch (e) {}
|
||||
var title = ''
|
||||
try {
|
||||
var raw = localStorage.getItem('PWA_MANIFEST_CACHE_V5')
|
||||
if (raw) {
|
||||
var payload = JSON.parse(raw)
|
||||
var manifest = payload && payload.manifest
|
||||
if (manifest) {
|
||||
title = manifest.short_name || manifest.name || ''
|
||||
if (!icon && manifest.icons && manifest.icons.length) {
|
||||
var icons = manifest.icons
|
||||
var pick = function (size) {
|
||||
var target = size + 'x' + size
|
||||
for (var i = 0; i < icons.length; i++) {
|
||||
if (String(icons[i].sizes || '').indexOf(target) !== -1 && icons[i].src) {
|
||||
return icons[i].src
|
||||
}
|
||||
}
|
||||
return ''
|
||||
}
|
||||
icon = pick(180) || pick(192) || pick(512) || (icons[0] && icons[0].src) || ''
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {}
|
||||
if (title) {
|
||||
document.title = title
|
||||
var appleTitle = document.createElement('meta')
|
||||
appleTitle.name = 'apple-mobile-web-app-title'
|
||||
appleTitle.content = title
|
||||
document.head.appendChild(appleTitle)
|
||||
}
|
||||
if (icon) {
|
||||
var sized = document.createElement('link')
|
||||
sized.rel = 'apple-touch-icon'
|
||||
sized.setAttribute('data-dynamic-pwa', 'true')
|
||||
sized.setAttribute('data-pwa-icon-src', icon)
|
||||
sized.setAttribute('sizes', '180x180')
|
||||
sized.href = icon
|
||||
document.head.appendChild(sized)
|
||||
var primary = document.createElement('link')
|
||||
primary.rel = 'apple-touch-icon'
|
||||
primary.setAttribute('data-dynamic-pwa', 'true')
|
||||
primary.setAttribute('data-pwa-icon-src', icon)
|
||||
primary.href = icon
|
||||
document.head.appendChild(primary)
|
||||
var img = new Image()
|
||||
img.decoding = 'async'
|
||||
img.src = icon
|
||||
}
|
||||
} catch (e) {}
|
||||
})()
|
||||
</script>
|
||||
<meta name="enamad" content="44889195" />
|
||||
|
||||
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
|
||||
@@ -12,6 +71,8 @@
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1.0, viewport-fit=cover, interactive-widget=resizes-content"
|
||||
/>
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||
|
||||
<title>در حال بارگذاری...</title>
|
||||
<!---->
|
||||
@@ -33,15 +94,19 @@
|
||||
body {
|
||||
margin: 0;
|
||||
min-height: 100%;
|
||||
width: 100%;
|
||||
background: var(--boot-bg);
|
||||
}
|
||||
|
||||
#app {
|
||||
min-height: 100vh;
|
||||
width: 100%;
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
.boot-loader {
|
||||
min-height: 100vh;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@@ -85,13 +150,22 @@
|
||||
display: block !important;
|
||||
}
|
||||
}
|
||||
#app,
|
||||
.boot-loader {
|
||||
width: 100% !important;
|
||||
max-width: none !important;
|
||||
}
|
||||
.app-splash-screen {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
position: fixed !important;
|
||||
inset: 0 !important;
|
||||
width: 100vw !important;
|
||||
min-width: 100vw !important;
|
||||
max-width: none !important;
|
||||
min-height: 100vh !important;
|
||||
left: 0 !important;
|
||||
right: 0 !important;
|
||||
margin: 0 !important;
|
||||
transform: none !important;
|
||||
z-index: 2147483646;
|
||||
}
|
||||
</style>
|
||||
@@ -328,30 +402,49 @@
|
||||
return window.location.protocol === 'https:' ? 'https:' : 'http:'
|
||||
}
|
||||
|
||||
function getVersionUrls() {
|
||||
var protocol = getProtocol()
|
||||
function resolveTenantDomain() {
|
||||
var host = String(window.location.hostname || '').trim()
|
||||
if (!host || host === 'localhost' || host === '127.0.0.1') {
|
||||
return 'k.montzar.ir'
|
||||
}
|
||||
return host
|
||||
}
|
||||
|
||||
function getSuperAdminBases() {
|
||||
return [
|
||||
'https://nerkh.gold/get_version',
|
||||
'https://tablo.talasevin.ir/get_version',
|
||||
'https://abshode-service.montgit.ir/server/get_version',
|
||||
protocol + '//212.23.201.173:8381/get_version',
|
||||
protocol + '//91.212.174.137:4040/server/get_version'
|
||||
'https://adm.montzar.ir',
|
||||
'https://adm.montech.ir',
|
||||
'https://adm.montest.ir'
|
||||
]
|
||||
}
|
||||
|
||||
function getVersionUrls() {
|
||||
var domain = encodeURIComponent(resolveTenantDomain())
|
||||
return getSuperAdminBases().map(function (base) {
|
||||
return base + '/get_version?domain=' + domain
|
||||
})
|
||||
}
|
||||
|
||||
function getConfigUrls() {
|
||||
var protocol = getProtocol()
|
||||
|
||||
return [
|
||||
protocol + '//nerkh.gold/get_user',
|
||||
protocol + '//tablo.talasevin.ir/get_user',
|
||||
protocol + '//abshode-service.montgit.ir/server/get_user',
|
||||
protocol + '//212.23.201.173:8381/get_user',
|
||||
protocol + '//91.212.174.137:4040/server/get_user'
|
||||
]
|
||||
var domain = encodeURIComponent(resolveTenantDomain())
|
||||
return getSuperAdminBases().map(function (base) {
|
||||
return base + '/get_user?domain=' + domain
|
||||
})
|
||||
}
|
||||
|
||||
// پاککردن URL موفقیت قدیمی رجیستری (مثل nerkh.gold)
|
||||
;(function clearLegacyConfigSuccess() {
|
||||
var last = localStorage.getItem(CONFIG_SUCCESS_URL_KEY)
|
||||
if (!last) return
|
||||
var ok = getSuperAdminBases().some(function (base) {
|
||||
return last.indexOf(base) === 0
|
||||
})
|
||||
if (!ok) {
|
||||
localStorage.removeItem(CONFIG_SUCCESS_URL_KEY)
|
||||
document.cookie = CONFIG_COOKIE_NAME + '=; Path=/; Max-Age=0; SameSite=Lax'
|
||||
}
|
||||
})()
|
||||
|
||||
function sortVersionUrls(urls) {
|
||||
var lastSuccessUrl = localStorage.getItem(VERSION_SUCCESS_URL_KEY)
|
||||
|
||||
@@ -367,6 +460,11 @@
|
||||
function sortByLastSuccess(urls) {
|
||||
var lastSuccessUrl = localStorage.getItem(CONFIG_SUCCESS_URL_KEY)
|
||||
|
||||
if (lastSuccessUrl && urls.indexOf(lastSuccessUrl) === -1) {
|
||||
localStorage.removeItem(CONFIG_SUCCESS_URL_KEY)
|
||||
lastSuccessUrl = null
|
||||
}
|
||||
|
||||
return urls.slice().sort(function (a, b) {
|
||||
if (a === lastSuccessUrl) return -1
|
||||
if (b === lastSuccessUrl) return 1
|
||||
@@ -650,10 +748,10 @@
|
||||
'<div style="font-size: 42px; margin-bottom: 12px;">⚠️</div>' +
|
||||
'<h2 style="margin: 0 0 12px; font-size: 20px;">خطا در بارگذاری برنامه</h2>' +
|
||||
'<p style="margin: 0 0 20px; color: var(--boot-muted); line-height: 2; font-size: 14px;">' +
|
||||
'ارتباط با سرور برقرار نشد یا فایلهای برنامه بهدرستی دریافت نشدند.' +
|
||||
'برقراری ارتباط با سرور امکانپذیر نیست. لطفاً اتصال اینترنت خود را بررسی کرده و صفحه را تازهسازی نمایید.' +
|
||||
'</p>' +
|
||||
'<button onclick="window.__APP_BOOT_SIMPLE_RETRY__()" style="padding: 11px 22px; border: 0; border-radius: 12px; background: var(--boot-accent); color: white; cursor: pointer; font-weight: 700;">' +
|
||||
'تلاش مجدد' +
|
||||
'تازهسازی صفحه' +
|
||||
'</button>' +
|
||||
'<button onclick="window.__APP_BOOT_CLEAN_RELOAD__()" style="margin-right: 8px; padding: 11px 18px; border: 1px solid var(--boot-border); border-radius: 12px; background: transparent; color: var(--boot-text); cursor: pointer; font-weight: 700;">' +
|
||||
'پاکسازی و تلاش مجدد' +
|
||||
@@ -665,8 +763,8 @@
|
||||
async function cleanFetchAndReload() {
|
||||
renderRecovering('در حال دریافت تنظیمات جدید برنامه...')
|
||||
|
||||
var version = await loadRemoteVersion(5)
|
||||
var freshConfigResult = await fetchFreshConfig(5)
|
||||
var version = await loadRemoteVersion(3)
|
||||
var freshConfigResult = await fetchFreshConfig(3)
|
||||
|
||||
clearReadableCookies()
|
||||
// clearLocalStorageExceptToken()
|
||||
|
||||
@@ -35,7 +35,8 @@
|
||||
"vue3-apexcharts": "^1.4.4",
|
||||
"vue3-lazyload": "^0.3.8",
|
||||
"vue3-odometer": "^0.1.3",
|
||||
"vue3-otp-input": "^0.4.1"
|
||||
"vue3-otp-input": "^0.4.1",
|
||||
"wavesurfer.js": "^7.12.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rushstack/eslint-patch": "^1.3.2",
|
||||
@@ -9121,6 +9122,12 @@
|
||||
"loose-envify": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/wavesurfer.js": {
|
||||
"version": "7.12.11",
|
||||
"resolved": "https://registry.npmjs.org/wavesurfer.js/-/wavesurfer.js-7.12.11.tgz",
|
||||
"integrity": "sha512-Sx0yZIz7jRJ9J9p7UL+pl9y0UQBB6UN/XNo+R7Gy4tCR5xZI9jMyA0dnt1R8TMVSQ4LZ10SeB2HJYQ+dV2dPSA==",
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/webidl-conversions": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz",
|
||||
|
||||
@@ -39,7 +39,8 @@
|
||||
"vue3-apexcharts": "^1.4.4",
|
||||
"vue3-lazyload": "^0.3.8",
|
||||
"vue3-odometer": "^0.1.3",
|
||||
"vue3-otp-input": "^0.4.1"
|
||||
"vue3-otp-input": "^0.4.1",
|
||||
"wavesurfer.js": "^7.12.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rushstack/eslint-patch": "^1.3.2",
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{"nm":"Pre-comp 1","ddd":0,"h":1200,"w":1200,"meta":{"g":"LottieFiles AE 0.1.21"},"layers":[{"ty":4,"nm":"arrow down Outlines","sr":1,"st":0,"op":1020,"ip":0,"hd":false,"ddd":0,"bm":0,"hasMask":false,"ao":0,"ks":{"a":{"a":0,"k":[256,256,0],"ix":1},"s":{"a":0,"k":[46.875,46.875,100],"ix":6},"sk":{"a":0,"k":0},"p":{"a":1,"k":[{"o":{"x":0.333,"y":0},"i":{"x":0.667,"y":1},"s":[600,528,0],"t":0,"ti":[0,0,0],"to":[0,-15.333,0]},{"o":{"x":0.333,"y":0},"i":{"x":0.667,"y":1},"s":[600,436,0],"t":13,"ti":[0,-15.333,0],"to":[0,0,0]},{"s":[600,528,0],"t":27}],"ix":2,"x":"var $bm_rt;\n$bm_rt = loopOut('cycle');"},"r":{"a":0,"k":0,"ix":10},"sa":{"a":0,"k":0},"o":{"a":0,"k":100,"ix":11}},"ef":[],"shapes":[{"ty":"gr","bm":0,"hd":false,"mn":"ADBE Vector Group","nm":"Group 1","ix":1,"cix":2,"np":4,"it":[{"ty":"sh","bm":0,"hd":false,"mn":"ADBE Vector Shape - Group","nm":"Path 1","ix":1,"d":1,"ks":{"a":0,"k":{"c":true,"i":[[7.831,7.793],[7.792,-7.828],[0,0],[0,0],[11.045,0],[0,-11.046],[0,0],[0,0],[7.829,-7.792],[-7.791,-7.829],[0,0],[-0.005,-0.006],[-7.819,7.833],[-0.005,0.006],[0,0]],"o":[[-7.829,-7.792],[0,0],[0,0],[0,-11.046],[-11.046,0],[0,0],[0,0],[-7.792,-7.828],[-7.83,7.793],[0,0],[0.006,0.007],[7.792,7.809],[0.006,-0.007],[0,0],[7.79,-7.828]],"v":[[118.109,117.328],[89.825,117.394],[20.001,187.557],[20.001,-236],[0.001,-256],[-19.999,-236],[-19.999,187.557],[-89.824,117.393],[-118.107,117.327],[-118.175,145.612],[-14.175,250.116],[-14.157,250.134],[14.158,250.135],[14.176,250.117],[118.176,145.613]]},"ix":2}},{"ty":"fl","bm":0,"hd":false,"mn":"ADBE Vector Graphic - Fill","nm":"Fill 1","c":{"a":0,"k":[0.1608,0.1608,0.3843],"ix":4},"r":1,"o":{"a":0,"k":100,"ix":5}},{"ty":"tr","a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"sk":{"a":0,"k":0,"ix":4},"p":{"a":0,"k":[255.999,256],"ix":2},"r":{"a":0,"k":0,"ix":6},"sa":{"a":0,"k":0,"ix":5},"o":{"a":0,"k":100,"ix":7}}]}],"ind":1},{"ty":4,"nm":"Shape Layer 1","sr":1,"st":0,"op":1020,"ip":0,"hd":false,"ddd":0,"bm":0,"hasMask":false,"ao":0,"ks":{"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[141,141,100],"ix":6},"sk":{"a":0,"k":0},"p":{"a":1,"k":[{"o":{"x":0.333,"y":0},"i":{"x":0.667,"y":1},"s":[622.56,380.04,0],"t":0,"ti":[0,0,0],"to":[0,-15.333,0]},{"o":{"x":0.333,"y":0},"i":{"x":0.667,"y":1},"s":[622.56,288.04,0],"t":13,"ti":[0,-15.333,0],"to":[0,0,0]},{"s":[622.56,380.04,0],"t":27}],"ix":2,"x":"var $bm_rt;\n$bm_rt = loopOut('cycle');"},"r":{"a":0,"k":0,"ix":10},"sa":{"a":0,"k":0},"o":{"a":0,"k":100,"ix":11}},"ef":[],"shapes":[{"ty":"gr","bm":0,"hd":false,"mn":"ADBE Vector Group","nm":"Ellipse 1","ix":1,"cix":2,"np":3,"it":[{"ty":"el","bm":0,"hd":false,"mn":"ADBE Vector Shape - Ellipse","nm":"Ellipse Path 1","d":1,"p":{"a":0,"k":[0,0],"ix":3},"s":{"a":0,"k":[144,144],"ix":2}},{"ty":"fl","bm":0,"hd":false,"mn":"ADBE Vector Graphic - Fill","nm":"Fill 1","c":{"a":0,"k":[1,1,1],"ix":4},"r":1,"o":{"a":0,"k":100,"ix":5}},{"ty":"tr","a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"sk":{"a":0,"k":0,"ix":4},"p":{"a":0,"k":[-16,156],"ix":2},"r":{"a":0,"k":0,"ix":6},"sa":{"a":0,"k":0,"ix":5},"o":{"a":0,"k":100,"ix":7}}]}],"ind":2}],"v":"5.5.7","fr":30,"op":1020,"ip":0,"assets":[]}
|
||||
@@ -1,4 +1,19 @@
|
||||
<template>
|
||||
<!-- Splash outside .desktopConfig so the 426px mobile frame cannot clip it -->
|
||||
<div
|
||||
v-if="showSplash"
|
||||
class="app-splash-screen flex justify-center"
|
||||
:style="{ backgroundColor: getProjectSplashBackground() }"
|
||||
>
|
||||
<div class="self-center splash_appear_fade_in">
|
||||
<img
|
||||
:src="getProjectSplashLogo(config?.config?.avatar)"
|
||||
class="w-[min(72vw,280px)] h-auto object-contain"
|
||||
alt=""
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="desktopConfig w-full right-0 left-0">
|
||||
<div v-if="popVisible" class="top-0 bottom-0 wrap-fix bg-primary z-100 opacity-60">
|
||||
<div class="absolute right-0 left-0 bottom-10vh flex flex-col items-center">
|
||||
@@ -10,27 +25,47 @@
|
||||
</div>
|
||||
</div>
|
||||
<AConfigProvider :theme="antTheme ?? undefined" direction="rtl">
|
||||
<div v-if="showSplash" class="app-splash-screen flex justify-center" :style="{ backgroundColor: getProjectSplashBackground() }">
|
||||
<div class="self-center splash_appear_fade_in">
|
||||
<img
|
||||
:src="getProjectSplashLogo(config?.config?.avatar)"
|
||||
class="w-[min(72vw,280px)] h-auto object-contain"
|
||||
alt=""
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-else class="app-main">
|
||||
<div v-if="!showSplash" class="app-main">
|
||||
<router-view v-slot="{ Component, route }">
|
||||
<component :is="Component" :key="route.fullPath" />
|
||||
</router-view>
|
||||
</div>
|
||||
<RequiredKycModal v-if="!showSplash && !isTvBoardRoute && !isLoginRoute" />
|
||||
</AConfigProvider>
|
||||
<div
|
||||
v-if="showSupportButton && !showSplash"
|
||||
v-if="showGiftCardButton"
|
||||
id="gift-card-button"
|
||||
class="fixed z-[5095] cursor-grab select-none rounded-full"
|
||||
:class="{ 'cursor-grabbing': giftCardDragging }"
|
||||
:style="giftCardButtonStyle"
|
||||
title="ثبت کارت هدیه"
|
||||
@pointerdown="onGiftCardPointerDown"
|
||||
@pointermove="onGiftCardPointerMove"
|
||||
@pointerup="handleGiftCardPointerUp"
|
||||
@pointercancel="onGiftCardPointerCancel"
|
||||
>
|
||||
<div
|
||||
class="relative inline-flex items-center gap-2 rounded-full bg-white border border-solid border-gray-200 shadow-[0_6px_20px_rgba(15,23,42,0.14)] px-3.5 py-[9px] text-slate-800 text-[13px] font-600 leading-none transition-all duration-200"
|
||||
:class="{ 'shadow-[0_10px_28px_rgba(15,23,42,0.22)]': giftCardDragging }"
|
||||
>
|
||||
<BasicIcon
|
||||
icon="vuesax-linear:gift"
|
||||
size="18"
|
||||
:color="giftCardFabAccent"
|
||||
class="shrink-0"
|
||||
/>
|
||||
<span class="whitespace-nowrap">ثبت کارت هدیه</span>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="showSupportButton && !showSplash && route.name !== 'support' && route.name !== 'login' && !isTvBoardRoute && !isKycRequired"
|
||||
id="support-button"
|
||||
class="draggable-support-button"
|
||||
:class="{ 'is-dragging': supportDragging }"
|
||||
ref="supportButtonEl"
|
||||
class="fixed z-[5100] cursor-grab select-none rounded-full"
|
||||
:class="{
|
||||
'cursor-grabbing': supportDragging,
|
||||
'z-[var(--app-z-support-fab-open,5615)]': supportPickerOpen,
|
||||
}"
|
||||
:style="supportButtonStyle"
|
||||
title="پشتیبانی"
|
||||
@pointerdown="onSupportPointerDown"
|
||||
@@ -38,26 +73,69 @@
|
||||
@pointerup="handleSupportPointerUp"
|
||||
@pointercancel="onSupportPointerCancel"
|
||||
>
|
||||
<div class="support-button-inner" :style="{ '--support-accent': supportAccentColor }">
|
||||
<BasicIcon :icon="supportIcon" size="18" class="support-button-icon" />
|
||||
<span class="support-button-label">پشتیبانی</span>
|
||||
<div
|
||||
class="relative inline-flex items-center gap-2 rounded-full bg-white border border-solid border-gray-200 shadow-[0_6px_20px_rgba(15,23,42,0.14)] px-3.5 py-[9px] text-slate-800 text-[13px] font-600 leading-none transition-all duration-200"
|
||||
:class="{
|
||||
'shadow-[0_10px_28px_rgba(15,23,42,0.22)]': supportDragging,
|
||||
'scale-[0.94] shadow-[0_4px_14px_rgba(15,23,42,0.12)]': supportPickerOpen && !supportDragging,
|
||||
}"
|
||||
>
|
||||
<BasicIcon
|
||||
:icon="supportIcon"
|
||||
size="18"
|
||||
:color="supportAccentColor"
|
||||
class="shrink-0"
|
||||
/>
|
||||
<span class="whitespace-nowrap">پشتیبانی</span>
|
||||
<span
|
||||
v-if="supportChatUnreadCount > 0"
|
||||
class="support-fab-badge"
|
||||
>
|
||||
{{ supportChatUnreadCount > 99 ? '99+' : supportChatUnreadCount }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="!showSplash && !isDesktop"
|
||||
v-if="!showSplash && !isDesktop && !isTvBoardRoute && !isLoginRoute"
|
||||
class="app-credit-footer app-credit-footer--mobile"
|
||||
:class="{ 'app-credit-footer--login': showLoginCreditExtras }"
|
||||
>
|
||||
<EnamadBadge v-if="showLoginCreditExtras" size="sm" />
|
||||
<AppCreditLink variant="mobile" />
|
||||
</div>
|
||||
<div
|
||||
v-if="!showSplash && showDesktopFloatingCredit"
|
||||
v-if="!showSplash && showDesktopFloatingCredit && !isTvBoardRoute"
|
||||
class="app-credit-footer app-credit-footer--desktop-float"
|
||||
:class="{ 'app-credit-footer--login': showLoginCreditExtras }"
|
||||
>
|
||||
<EnamadBadge v-if="showLoginCreditExtras" size="sm" />
|
||||
<AppCreditLink variant="float" />
|
||||
</div>
|
||||
|
||||
<SupportMessengerPicker
|
||||
v-model:open="supportPickerOpen"
|
||||
:entries="supportMessengerEntries"
|
||||
:anchor-el="pickerAnchorEl"
|
||||
@select="openMessengerEntry"
|
||||
/>
|
||||
|
||||
<VersionUpdateModal />
|
||||
|
||||
<PwaInstallBanner
|
||||
v-if="!showSplash && !isTvBoardRoute"
|
||||
:visible="bannerVisible && !guideOpen"
|
||||
@install="openGuide()"
|
||||
@dismiss="dismissBanner()"
|
||||
/>
|
||||
|
||||
<PwaInstallGuideModal
|
||||
v-model:open="guideOpen"
|
||||
:platform="platform"
|
||||
@complete="completeGuide()"
|
||||
/>
|
||||
|
||||
<GoldDayCalculatorModal />
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
@@ -68,15 +146,32 @@ import {getProjectFontFamily, getProjectSplashBackground, getProjectSplashLogo,
|
||||
import {ConfigProvider as AConfigProvider} from 'ant-design-vue'
|
||||
import BasicIcon from "@/components/BasicPacks/BasicIcon.vue";
|
||||
import { useApplyDesktopLayoutClass, useDesktopBreakpoint } from '@/layouts/composables/useAppLayout'
|
||||
import {
|
||||
buildSupportMessengerUrl,
|
||||
loadSupportMessengerFromSettings,
|
||||
supportMessengerSettings,
|
||||
} from '@/utils/supportMessenger'
|
||||
import { useSupportMessenger } from '@/composables/useSupportMessenger'
|
||||
import { loadSupportMessengerFromSettings } from '@/utils/supportMessenger'
|
||||
import { useDraggableFloatingButton } from '@/utils/useDraggableFloatingButton'
|
||||
import AppCreditLink from '@/components/AppCreditLink.vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import EnamadBadge from '@/components/EnamadBadge.vue'
|
||||
import SupportMessengerPicker from '@/components/SupportMessengerPicker.vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { recoverMobileViewportAfterAuth } from '@/layouts/composables/useMobileScrollReset'
|
||||
import { usePwaInstall } from '@/composables/usePwaInstall'
|
||||
import PwaInstallBanner from '@/components/pwa/PwaInstallBanner.vue'
|
||||
import PwaInstallGuideModal from '@/components/pwa/PwaInstallGuideModal.vue'
|
||||
import GoldDayCalculatorModal from '@/components/GoldDayCalculatorModal.vue'
|
||||
import RequiredKycModal from '@/components/RequiredKycModal.vue'
|
||||
import { useUserStore } from '@/store/userStore'
|
||||
import { useSettingsStore } from '@/store/settingsStore'
|
||||
import {
|
||||
connectChatIfExists,
|
||||
disconnectChat,
|
||||
isSettingFlagOn,
|
||||
unreadSupportCount,
|
||||
useChatService,
|
||||
} from '@/utils/chat'
|
||||
import { getToken } from '@/utils'
|
||||
import { isCustomerIdentityVerified } from '@/utils/customerIdentity'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { showBrowserNotification } from '@/utils/browserNotification'
|
||||
|
||||
const VersionUpdateModal = defineAsyncComponent(
|
||||
() => import('@/modules/version/VersionUpdateModal.vue')
|
||||
@@ -86,56 +181,63 @@ useApplyDesktopLayoutClass()
|
||||
|
||||
const isDesktop = useDesktopBreakpoint()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const showDesktopFloatingCredit = computed(() => {
|
||||
if (!isDesktop.value) return false
|
||||
return route.name === 'login' || !!route.meta.hideMenu
|
||||
// پشتیبانی خودش سایدبار دارد؛ float روی دکمه ارسال میافتد
|
||||
if (route.name === 'support') return false
|
||||
if (route.name === 'login') return false
|
||||
return !!route.meta.hideMenu
|
||||
})
|
||||
const isLoginRoute = computed(() => route.name === 'login')
|
||||
|
||||
const config = useConfigStore()
|
||||
const showSplash = ref(true)
|
||||
|
||||
function isTvBoardPath() {
|
||||
const path = window.location.pathname.replace(/\/+$/, '')
|
||||
return path.endsWith('/tv') || path.endsWith('/monitor')
|
||||
}
|
||||
|
||||
const showSplash = ref(!isTvBoardPath())
|
||||
const isTvBoardRoute = computed(
|
||||
() => route.name === 'tvMonitor' || route.meta.hideChrome === true || isTvBoardPath(),
|
||||
)
|
||||
const popVisible = ref(false)
|
||||
|
||||
const supportLink = computed(() => {
|
||||
return buildSupportMessengerUrl(
|
||||
supportMessengerSettings.value.messenger,
|
||||
supportMessengerSettings.value.messengerId
|
||||
)
|
||||
})
|
||||
const {
|
||||
guideOpen,
|
||||
bannerVisible,
|
||||
platform,
|
||||
openGuide,
|
||||
dismissBanner,
|
||||
completeGuide,
|
||||
showBanner,
|
||||
} = usePwaInstall()
|
||||
|
||||
const showSupportButton = computed(() => !!supportLink.value)
|
||||
const {
|
||||
supportPickerOpen,
|
||||
supportPickerAnchor,
|
||||
supportMessengerEntries,
|
||||
messengerMeta,
|
||||
isChatEnabled,
|
||||
hasMessengerLink: showSupportButton,
|
||||
openMessengerEntry,
|
||||
openSupportMessenger,
|
||||
} = useSupportMessenger()
|
||||
|
||||
const supportIcon = computed(() => {
|
||||
const messenger = (supportMessengerSettings.value.messenger ?? '').toLowerCase()
|
||||
switch (messenger) {
|
||||
case 'whatsapp':
|
||||
return 'vuesax-linear:whatsapp'
|
||||
case 'telegram':
|
||||
return 'vuesax-linear:send-2'
|
||||
case 'bale':
|
||||
return 'vuesax-linear:messages-2'
|
||||
default:
|
||||
return 'vuesax-linear:messages-2'
|
||||
}
|
||||
})
|
||||
const supportButtonEl = ref<HTMLElement | null>(null)
|
||||
const pickerAnchorEl = computed(() => supportPickerAnchor.value ?? supportButtonEl.value)
|
||||
|
||||
const supportChatUnreadCount = computed(() =>
|
||||
isChatEnabled.value ? Number(unreadSupportCount.value) || 0 : 0,
|
||||
)
|
||||
|
||||
const supportIcon = computed(() => messengerMeta.value.icon)
|
||||
|
||||
const supportAccentColor = computed(() => {
|
||||
const messenger = (supportMessengerSettings.value.messenger ?? '').toLowerCase()
|
||||
switch (messenger) {
|
||||
case 'whatsapp':
|
||||
return '#22c55e'
|
||||
case 'telegram':
|
||||
return '#0ea5e9'
|
||||
case 'bale':
|
||||
return '#16a34a'
|
||||
case 'rubika':
|
||||
return '#7c3aed'
|
||||
case 'eitaa':
|
||||
return '#f59e0b'
|
||||
case 'soroush':
|
||||
return '#2563eb'
|
||||
default:
|
||||
return config.config?.color || '#334155'
|
||||
}
|
||||
const accent = messengerMeta.value.accent
|
||||
if (accent !== '#334155') return accent
|
||||
return config.config?.color || accent
|
||||
})
|
||||
|
||||
const {
|
||||
@@ -153,14 +255,14 @@ const {
|
||||
})
|
||||
|
||||
function openSupportLink() {
|
||||
if (!supportLink.value) return
|
||||
window.open(supportLink.value, '_blank', 'noopener,noreferrer')
|
||||
void openSupportMessenger(supportButtonEl.value)
|
||||
}
|
||||
|
||||
function handleSupportPointerUp(event: PointerEvent) {
|
||||
if (supportPointerUp(event)) {
|
||||
openSupportLink()
|
||||
}
|
||||
const clicked = supportPointerUp(event)
|
||||
if (!clicked) return
|
||||
event.stopPropagation()
|
||||
openSupportLink()
|
||||
}
|
||||
|
||||
const antTheme = computed(() => {
|
||||
@@ -196,11 +298,23 @@ onMounted(async () => {
|
||||
}, 2000)
|
||||
})
|
||||
|
||||
watch(showSplash, (visible) => {
|
||||
if (!visible) {
|
||||
watch(
|
||||
showSplash,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
const splashBg = getProjectSplashBackground()
|
||||
document.documentElement.style.backgroundColor = splashBg
|
||||
document.body.style.backgroundColor = splashBg
|
||||
return
|
||||
}
|
||||
resetAppSurfaceBackground()
|
||||
}
|
||||
})
|
||||
void import('@/utils/safeAreaInsets').then(({ syncSafeAreaInsets }) => {
|
||||
syncSafeAreaInsets()
|
||||
})
|
||||
showBanner()
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
watch(
|
||||
() => route.name,
|
||||
@@ -213,13 +327,122 @@ watch(
|
||||
{ flush: 'post' },
|
||||
)
|
||||
|
||||
const userStore = useUserStore()
|
||||
const settingsStore = useSettingsStore()
|
||||
const isKycRequired = computed(
|
||||
() =>
|
||||
Boolean(getToken()) &&
|
||||
Boolean(userStore.userInfo) &&
|
||||
!isCustomerIdentityVerified(userStore.userInfo?.is_legal),
|
||||
)
|
||||
|
||||
const giftCardFabAccent = computed(
|
||||
() => config.config?.color || getProjectPrimaryColor() || '#334155',
|
||||
)
|
||||
|
||||
const showGiftCardButton = computed(() => {
|
||||
if (showSplash.value) return false
|
||||
if (isTvBoardRoute.value || isLoginRoute.value || isKycRequired.value) return false
|
||||
if (route.name === 'giftCard') return false
|
||||
if (!getToken()) return false
|
||||
return settingsStore.isSettingTruthy('has_page_gift_card')
|
||||
})
|
||||
|
||||
const {
|
||||
dragging: giftCardDragging,
|
||||
fabStyle: giftCardButtonStyle,
|
||||
handlePointerDown: onGiftCardPointerDown,
|
||||
handlePointerMove: onGiftCardPointerMove,
|
||||
handlePointerUp: giftCardPointerUp,
|
||||
handlePointerCancel: onGiftCardPointerCancel,
|
||||
} = useDraggableFloatingButton('boursecu_gift_card_button_position_v1', {
|
||||
width: 148,
|
||||
height: 42,
|
||||
defaultBottomGap: 62,
|
||||
defaultRightOffset: 16,
|
||||
})
|
||||
|
||||
function handleGiftCardPointerUp(event: PointerEvent) {
|
||||
const clicked = giftCardPointerUp(event)
|
||||
if (!clicked) return
|
||||
event.stopPropagation()
|
||||
void router.push({ name: 'giftCard' })
|
||||
}
|
||||
|
||||
const showLoginCreditExtras = computed(() => {
|
||||
if (!isLoginRoute.value) return false
|
||||
const href = String(settingsStore.getSettingByKey('enamad_url') ?? '').trim()
|
||||
const src = String(settingsStore.getSettingByKey('enamad_logo') ?? '').trim()
|
||||
return Boolean(href && src)
|
||||
})
|
||||
const { latestIncomingNotification } = useChatService()
|
||||
let lastConnectedChatSessionKey = ''
|
||||
let lastSupportToastAt = 0
|
||||
|
||||
watch(
|
||||
() => [
|
||||
userStore.userInfo?.chat_room_id,
|
||||
userStore.userInfo?.chat_user_id,
|
||||
settingsStore.getSettingByKey('chat_api_key'),
|
||||
settingsStore.getSettingByKey('show_to_users_chat'),
|
||||
settingsStore.getSettingByKey('has_chat'),
|
||||
getToken(),
|
||||
],
|
||||
async ([roomId, chatUserId, chatApiKey, chatAdminFlag, chatCustomerFlag, token]) => {
|
||||
const chatOn =
|
||||
isSettingFlagOn(chatAdminFlag) && isSettingFlagOn(chatCustomerFlag)
|
||||
if (!token || !chatOn || !chatApiKey || !roomId || !chatUserId) {
|
||||
lastConnectedChatSessionKey = ''
|
||||
disconnectChat()
|
||||
return
|
||||
}
|
||||
|
||||
const sessionKey = `${roomId}:${chatUserId}:${chatApiKey}`
|
||||
if (lastConnectedChatSessionKey === sessionKey) return
|
||||
|
||||
try {
|
||||
await connectChatIfExists()
|
||||
lastConnectedChatSessionKey = sessionKey
|
||||
} catch (error) {
|
||||
lastConnectedChatSessionKey = ''
|
||||
console.error('connectChatIfExists failed:', error)
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
watch(latestIncomingNotification, (payload) => {
|
||||
if (!payload) return
|
||||
if (payload.at === lastSupportToastAt) return
|
||||
lastSupportToastAt = payload.at
|
||||
|
||||
if (typeof document === 'undefined' || document.visibilityState === 'visible') {
|
||||
message.info({
|
||||
content: `پیام جدید پشتیبانی: ${payload.body}`,
|
||||
duration: 3,
|
||||
})
|
||||
}
|
||||
|
||||
void showBrowserNotification({
|
||||
title: payload.title || 'پشتیبانی',
|
||||
body: payload.body || 'پیام جدید',
|
||||
tag: 'support-chat-message',
|
||||
url: '/support',
|
||||
})
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
/* ارتفاع نوار اعتبار + safe-area؛ منوی پایین با bottom: var(--app-credit-footer-offset) بالاتر از این نوار مینشیند */
|
||||
:root {
|
||||
--app-credit-bar-inner: 28px;
|
||||
/* constant برای iOS قدیمی؛ env باید مستقیم هم در مصرفکنندهها تکرار شود */
|
||||
--app-safe-top: 0px;
|
||||
--app-safe-top: constant(safe-area-inset-top);
|
||||
--app-safe-top: env(safe-area-inset-top, 0px);
|
||||
--app-safe-bottom: 0px;
|
||||
--app-safe-bottom: constant(safe-area-inset-bottom);
|
||||
--app-safe-bottom: env(safe-area-inset-bottom, 0px);
|
||||
--app-home-header-offset: calc(4.25rem + var(--app-safe-top));
|
||||
--app-credit-footer-offset: calc(var(--app-credit-bar-inner) + var(--app-safe-bottom));
|
||||
@@ -230,12 +453,20 @@ watch(
|
||||
/* بخشی از کارت کیفپول زیر نوار «افزودن کارت جدید» دیده میشود */
|
||||
--wallet-card-dock-overlap: 52px;
|
||||
--app-z-nav: 5000;
|
||||
--app-z-toast: 5050;
|
||||
--app-z-wallet-dock: 4490;
|
||||
--app-z-wallet-add-bar: 4510;
|
||||
--app-z-action-sheet: 5200;
|
||||
--app-z-dialog: 5300;
|
||||
/* زیر لایه دراپداون اینت (99999) تا تقویم/سلکت داخل مدال روی آن باز شود */
|
||||
--app-z-modal: 5500;
|
||||
--app-z-support-picker: 5600;
|
||||
--app-z-support-fab-open: 5615;
|
||||
}
|
||||
|
||||
/* نوار اعلان Ant — پیشفرض z-index:1010 زیر هدر fixed میرود */
|
||||
.ant-notification {
|
||||
z-index: var(--app-z-toast, 5050) !important;
|
||||
}
|
||||
|
||||
.app-main {
|
||||
@@ -257,18 +488,36 @@ watch(
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
/* toast اعلانهای اپ باید بالای نوار اعتبار باشد */
|
||||
.ant-notification .app-notif-toast,
|
||||
.app-notif-toast {
|
||||
z-index: 1000001 !important;
|
||||
}
|
||||
|
||||
.app-credit-footer--mobile {
|
||||
width: 100%;
|
||||
max-width: 426px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
min-height: var(--app-credit-bar-inner);
|
||||
padding-bottom: var(--app-safe-bottom);
|
||||
padding: 4px 0 var(--app-safe-bottom);
|
||||
background: #fff;
|
||||
box-shadow: 0 -2px 4px -2px #0000001a;
|
||||
box-shadow: 0 3.75px 16px 0 rgba(0, 0, 0, 0.43);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
font-size: 9px;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.app-credit-footer--login.app-credit-footer--mobile {
|
||||
min-height: 72px;
|
||||
}
|
||||
|
||||
:root:has(.app-credit-footer--login) {
|
||||
--app-credit-bar-inner: 72px;
|
||||
}
|
||||
|
||||
.app-credit-footer--desktop-float {
|
||||
@@ -276,6 +525,10 @@ watch(
|
||||
right: 20px;
|
||||
bottom: 16px;
|
||||
width: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.app-credit-link {
|
||||
@@ -287,6 +540,7 @@ watch(
|
||||
|
||||
&:hover {
|
||||
opacity: 0.85;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
&__text {
|
||||
@@ -296,13 +550,19 @@ watch(
|
||||
|
||||
&__logo {
|
||||
width: auto;
|
||||
height: 12px;
|
||||
object-fit: contain;
|
||||
display: block;
|
||||
}
|
||||
|
||||
&--mobile {
|
||||
gap: 4px;
|
||||
padding: 4px 0;
|
||||
color: inherit;
|
||||
color: #000;
|
||||
|
||||
.app-credit-link__text {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.app-credit-link__logo {
|
||||
height: 12px;
|
||||
@@ -310,15 +570,30 @@ watch(
|
||||
}
|
||||
|
||||
&--sidebar {
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
padding: 4px;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
padding: 4px 4px;
|
||||
color: #9ca3af;
|
||||
font-size: 10px;
|
||||
font-size: 11px;
|
||||
line-height: 1.35;
|
||||
text-align: center;
|
||||
box-sizing: border-box;
|
||||
|
||||
.app-credit-link__text {
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.app-credit-link__logo {
|
||||
height: 15px;
|
||||
opacity: 0.85;
|
||||
max-width: 68px;
|
||||
flex-shrink: 0;
|
||||
opacity: 0.9;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -340,11 +615,15 @@ watch(
|
||||
|
||||
html.project-boursecu {
|
||||
.app-credit-link--sidebar {
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
color: rgba(255, 255, 255, 0.55);
|
||||
|
||||
.app-credit-link__logo {
|
||||
filter: brightness(1.15);
|
||||
opacity: 0.75;
|
||||
filter: brightness(1.2);
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
color: rgba(255, 255, 255, 0.85);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,61 +641,37 @@ html.project-boursecu {
|
||||
}
|
||||
|
||||
#support-button {
|
||||
position: fixed;
|
||||
z-index: 5100;
|
||||
cursor: grab;
|
||||
user-select: none;
|
||||
border-radius: 9999px;
|
||||
|
||||
&.is-dragging {
|
||||
cursor: grabbing;
|
||||
}
|
||||
/* جای draggable از fabStyle میآید */
|
||||
}
|
||||
|
||||
.support-button-inner {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 9px 14px 9px 12px;
|
||||
background: #ffffff;
|
||||
border: 1px solid rgba(15, 23, 42, 0.08);
|
||||
border-radius: 9999px;
|
||||
box-shadow: 0 6px 20px rgba(15, 23, 42, 0.14);
|
||||
color: #1e293b;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
line-height: 1;
|
||||
direction: rtl;
|
||||
transition: box-shadow 0.2s ease, transform 0.2s ease;
|
||||
|
||||
.support-button-icon {
|
||||
color: var(--support-accent, #334155);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.support-button-label {
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
#support-button:not(.is-dragging):hover .support-button-inner {
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
|
||||
}
|
||||
|
||||
#support-button.is-dragging .support-button-inner {
|
||||
box-shadow: 0 10px 28px rgba(15, 23, 42, 0.22);
|
||||
.support-fab-badge {
|
||||
position: absolute;
|
||||
top: -6px;
|
||||
left: -4px;
|
||||
z-index: 2;
|
||||
min-width: 18px;
|
||||
height: 18px;
|
||||
padding: 0 5px;
|
||||
border-radius: 999px;
|
||||
background: #dc2626;
|
||||
color: #fff;
|
||||
font-size: 10px;
|
||||
font-weight: 700;
|
||||
line-height: 18px;
|
||||
text-align: center;
|
||||
box-shadow: 0 0 0 2px #fff;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 426px) and (max-width: 767.98px) {
|
||||
.desktopConfig {
|
||||
html:not(.app-layout--desktop) .desktopConfig {
|
||||
width: 426px;
|
||||
position: relative !important;
|
||||
}
|
||||
}
|
||||
|
||||
html.app-layout--desktop {
|
||||
#support-button {
|
||||
#support-button,
|
||||
#gift-card-button {
|
||||
bottom: 12px;
|
||||
right: calc(var(--app-desktop-sidebar-width, 260px) + 20px);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import useAxios from '@/utils/useAxios'
|
||||
|
||||
export type AppNotificationSeverity = 'info' | 'success' | 'warning' | 'danger'
|
||||
|
||||
export interface CustomerAppNotification {
|
||||
id: number
|
||||
title: string
|
||||
body: string
|
||||
severity: AppNotificationSeverity
|
||||
created_at?: string
|
||||
is_read: boolean
|
||||
}
|
||||
|
||||
export const getAppNotifications = async () =>
|
||||
await useAxios.get<CustomerAppNotification[]>(`/customer/app_notifications`)
|
||||
|
||||
export const getAppNotificationsUnreadCount = async () =>
|
||||
await useAxios.get<{ unread_count: number }>(`/customer/app_notifications/unread-count`)
|
||||
|
||||
export const markAppNotificationRead = async (id: number) =>
|
||||
await useAxios.post(`/customer/app_notifications/${id}/read`)
|
||||
|
||||
export const markAllAppNotificationsRead = async () =>
|
||||
await useAxios.post(`/customer/app_notifications/read-all`)
|
||||
@@ -0,0 +1,6 @@
|
||||
import useAxios from '@/utils/useAxios'
|
||||
import type { User } from '@/models/login'
|
||||
|
||||
export const startChat = async (): Promise<{ message: string; user: User }> => {
|
||||
return await useAxios.get<{ message: string; user: User }>(`/customer/start-chat`)
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
import useAxios from "@/utils/useAxios";
|
||||
import useAxios from '@/utils/useAxios'
|
||||
import { getSuperAdminBase, resolveTenantDomain } from '@/config/superadmin'
|
||||
|
||||
export async function getConfig() {
|
||||
return await useAxios.get(`https://nerkh.gold/get_user`)
|
||||
const base = getSuperAdminBase() || 'https://adm.montzar.ir'
|
||||
const domain = encodeURIComponent(resolveTenantDomain())
|
||||
return await useAxios.get(`${base}/get_user?domain=${domain}`)
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import useAxios from '@/utils/useAxios'
|
||||
import type { CopperConvertSource } from '@/utils/copperWireConvert'
|
||||
|
||||
export interface CopperConvertHistoryRow {
|
||||
id: number
|
||||
status: string
|
||||
source: string
|
||||
asset_unit: string
|
||||
consumed_amount: number
|
||||
leftover_amount: number
|
||||
wire15_rings: number
|
||||
wire25_rings: number
|
||||
created_at?: string
|
||||
}
|
||||
|
||||
export function createCopperConvertRequest(payload: {
|
||||
source: CopperConvertSource
|
||||
rings15: number
|
||||
rings25: number
|
||||
}) {
|
||||
return useAxios.post('/customer/copper-convert-request', payload)
|
||||
}
|
||||
|
||||
export function getCopperConvertRequests() {
|
||||
return useAxios.get<CopperConvertHistoryRow[]>('/customer/copper-convert-request')
|
||||
}
|
||||
|
||||
export function updateCopperConvertRequest(
|
||||
id: number,
|
||||
payload: {
|
||||
source: CopperConvertSource
|
||||
rings15: number
|
||||
rings25: number
|
||||
},
|
||||
) {
|
||||
return useAxios.put(`/customer/copper-convert-request/${id}`, payload)
|
||||
}
|
||||
|
||||
export function deleteCopperConvertRequest(id: number) {
|
||||
return useAxios.delete(`/customer/copper-convert-request/${id}`)
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import useAxios from '@/utils/useAxios'
|
||||
|
||||
export interface DigipayInstallmentStatus {
|
||||
enabled: boolean
|
||||
status: 'none' | 'pending' | 'active' | string
|
||||
plan4_remaining_toman: number
|
||||
plan12_remaining_toman: number
|
||||
gram_price_rial: number
|
||||
config: {
|
||||
onboarding_url: string
|
||||
fee_shop_percent: number
|
||||
fee_gateway_percent: number
|
||||
fee_extra_percent: number
|
||||
plan4_cap_toman: number
|
||||
plan12_cap_toman: number
|
||||
}
|
||||
}
|
||||
|
||||
export const fetchDigipayInstallment = () =>
|
||||
useAxios.get<DigipayInstallmentStatus>('/customer/digipay_installment')
|
||||
|
||||
export const startDigipayInstallment = () =>
|
||||
useAxios.post<DigipayInstallmentStatus>('/customer/digipay_installment/start')
|
||||
|
||||
export const buyDigipayInstallment = (plan: 4 | 12, amountToman: number) =>
|
||||
useAxios.post('/customer/digipay_installment/buy', { plan, amount_toman: amountToman })
|
||||
@@ -1,5 +1,27 @@
|
||||
import useAxios from "@/utils/useAxios";
|
||||
|
||||
export interface CustomerGiftCardItem {
|
||||
id: number
|
||||
giftcard_id: number
|
||||
code: string
|
||||
name: string | null
|
||||
description: string | null
|
||||
amount: number | string | null
|
||||
unit: number
|
||||
kind: 'gift' | 'discount'
|
||||
scope: 'personal' | 'public'
|
||||
sts: number
|
||||
expiry_date: string | null
|
||||
used_at: string | null
|
||||
}
|
||||
|
||||
//customer
|
||||
export const registerCodeGiftCard = async (code: string) => await useAxios.post(`/customer/giftcard/use`, {code:code})
|
||||
export interface CustomerGiftCardMineResponse {
|
||||
available: CustomerGiftCardItem[]
|
||||
history: CustomerGiftCardItem[]
|
||||
}
|
||||
|
||||
export const registerCodeGiftCard = async (code: string) =>
|
||||
await useAxios.post(`/customer/giftcard/use`, { code })
|
||||
|
||||
export const fetchMyGiftCards = async () =>
|
||||
await useAxios.get<CustomerGiftCardMineResponse>(`/customer/giftcard/mine`)
|
||||
|
||||
@@ -9,3 +9,6 @@ export const getPrice = async () => await useAxios.get<Price>(`/api/price/up`)
|
||||
export const getLastPrice = async () => await useAxios.get<Price>(`/api/price/last`)
|
||||
|
||||
export const getAllPrices = async () => await useAxios.post('/customer/prices/all')
|
||||
|
||||
/** نمودار مهمان — همان بدنهٔ prices/all، بدون توکن مشتری */
|
||||
export const getPublicChartPrices = async () => await useAxios.post('/api/price/all')
|
||||
@@ -5,12 +5,14 @@ import type {Ref, UnwrapRef} from "vue";
|
||||
import type {Transaction} from "@/models/transaction";
|
||||
import {useUserStore} from "@/store/userStore";
|
||||
|
||||
const userStore = useUserStore()
|
||||
function customerOrderBase() {
|
||||
return `/customer${useUserStore().isSingle ? '/single' : ''}/order`
|
||||
}
|
||||
|
||||
export const createOrder = async (obj: Order): Promise<any> => {
|
||||
return await useAxios.post<Order>(`/customer${!userStore.isSingle ? '' : '/single'}/order`, obj)
|
||||
return await useAxios.post<Order>(customerOrderBase(), obj)
|
||||
}
|
||||
|
||||
export const getOrders = async (tbl: Ref<UnwrapRef<TableInput>>): Promise<TableOutput<Transaction>> => {
|
||||
return await useAxios.post<TableOutput<Order>>(`/customer${!userStore.isSingle ? '' : '/single'}/order/table`, tbl)
|
||||
return await useAxios.post<TableOutput<Order>>(`${customerOrderBase()}/table`, tbl)
|
||||
}
|
||||
|
||||
@@ -6,6 +6,10 @@ import type { PWallet, Wallet } from '@/models/wallet'
|
||||
export const getProducts = async (): Promise<any> => {
|
||||
return await useAxios.get<Product[]>(`/customer/product/list`)
|
||||
}
|
||||
export const getTvProducts = async (): Promise<Product[]> => {
|
||||
const response = await useAxios.get<unknown>(`/customer/tv/products`)
|
||||
return Array.isArray(response) ? (response as Product[]) : []
|
||||
}
|
||||
export const getProductInventory = async (): Promise<any> => {
|
||||
return await useAxios.post<PInventory[]>(`/customer/wallet/product/table`)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import {
|
||||
fetchSuperAdminJson,
|
||||
resolveTenantDomain,
|
||||
SA_PROGRAM_SETTINGS_PATH,
|
||||
} from '@/config/superadmin'
|
||||
|
||||
export type SuperAdminSettingRow = {
|
||||
id?: number
|
||||
key?: string
|
||||
value?: string | number
|
||||
title_fa?: string
|
||||
description?: string
|
||||
is_active?: boolean | number | string
|
||||
type?: string
|
||||
can_edit?: number | boolean | string
|
||||
}
|
||||
|
||||
function parseSettingsPayload(data: unknown): SuperAdminSettingRow[] {
|
||||
if (Array.isArray(data)) return data as SuperAdminSettingRow[]
|
||||
if (data && typeof data === 'object') {
|
||||
const obj = data as Record<string, unknown>
|
||||
if (Array.isArray(obj.settings)) return obj.settings as SuperAdminSettingRow[]
|
||||
if (Array.isArray(obj.items)) return obj.items as SuperAdminSettingRow[]
|
||||
if (Array.isArray(obj.data)) return obj.data as SuperAdminSettingRow[]
|
||||
}
|
||||
return []
|
||||
}
|
||||
|
||||
/** کلید قفلشده در get_settings محلی — باید از سوپرادمین بیاید */
|
||||
export function isLockedCanEdit(canEdit: unknown): boolean {
|
||||
return canEdit === 0 || canEdit === false || canEdit === '0'
|
||||
}
|
||||
|
||||
/** تنظیمات پیشرفته نسخه از سوپرادمین — فقط GET /api/public/program-settings?domain= */
|
||||
export async function fetchSuperAdminProgramSettings(): Promise<SuperAdminSettingRow[]> {
|
||||
const domain = encodeURIComponent(resolveTenantDomain())
|
||||
const data = await fetchSuperAdminJson(
|
||||
(base) => `${base}${SA_PROGRAM_SETTINGS_PATH}?domain=${domain}`,
|
||||
)
|
||||
return parseSettingsPayload(data)
|
||||
}
|
||||
@@ -16,6 +16,10 @@ export const deposit = async (obj: Transaction): Promise<any> => {
|
||||
return await useAxios.post<Transaction>(`/customer/charge_account`, obj)
|
||||
}
|
||||
|
||||
export const submitDepositRequest = async (formData: FormData): Promise<any> => {
|
||||
return await useAxios.postForm(`/customer/wallet/deposit_request`, formData)
|
||||
}
|
||||
|
||||
export const createCard = async (obj: Card): Promise<any> => {
|
||||
return await useAxios.post<Transaction>(`/customer/account`, obj)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/** تاریخچه قیمت عمومی بورس کالا (بدون توکن) — کاتد مس */
|
||||
|
||||
export const ZAANBOX_COPPER_CTHD_ID = '8c19e06a-446e-3d56-9cc0-750f7c6cd767'
|
||||
|
||||
export const ZAANBOX_HISTORY_URL = `https://price.zaarbox.ir/api/history/${ZAANBOX_COPPER_CTHD_ID}`
|
||||
|
||||
export type ZaanboxHistoryPoint = {
|
||||
time: string
|
||||
price: number
|
||||
}
|
||||
|
||||
export type ZaanboxHistoryResponse = {
|
||||
history?: ZaanboxHistoryPoint[]
|
||||
data?: { history?: ZaanboxHistoryPoint[] }
|
||||
}
|
||||
|
||||
export type LandingHistoryRange = 'DAILY' | 'WEEKLY' | 'MONTHLY'
|
||||
|
||||
export type LandingHistorySample = {
|
||||
timeMs: number
|
||||
price: number
|
||||
}
|
||||
|
||||
const RANGE_MS: Record<LandingHistoryRange, number> = {
|
||||
DAILY: 1 * 24 * 60 * 60 * 1000,
|
||||
WEEKLY: 7 * 24 * 60 * 60 * 1000,
|
||||
MONTHLY: 30 * 24 * 60 * 60 * 1000,
|
||||
}
|
||||
|
||||
const HISTORY_LIMIT = 1_000_000_000
|
||||
|
||||
function resolveHistoryRows(payload: unknown): ZaanboxHistoryPoint[] {
|
||||
if (!payload || typeof payload !== 'object') return []
|
||||
const body = payload as ZaanboxHistoryResponse
|
||||
if (Array.isArray(body.history)) return body.history
|
||||
if (Array.isArray(body.data?.history)) return body.data!.history!
|
||||
return []
|
||||
}
|
||||
|
||||
export async function fetchZaanboxPriceHistory(
|
||||
range: LandingHistoryRange,
|
||||
now = new Date(),
|
||||
): Promise<LandingHistorySample[]> {
|
||||
const end = now
|
||||
const start = new Date(end.getTime() - RANGE_MS[range])
|
||||
const url = new URL(ZAANBOX_HISTORY_URL)
|
||||
url.searchParams.set('start', start.toISOString())
|
||||
url.searchParams.set('end', end.toISOString())
|
||||
url.searchParams.set('limit', String(HISTORY_LIMIT))
|
||||
|
||||
const response = await fetch(url.toString(), {
|
||||
method: 'GET',
|
||||
headers: { Accept: 'application/json' },
|
||||
})
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Zaanbox history HTTP ${response.status}`)
|
||||
}
|
||||
|
||||
const payload = (await response.json()) as unknown
|
||||
const rows = resolveHistoryRows(payload)
|
||||
|
||||
return rows
|
||||
.map((row) => {
|
||||
const timeMs = Date.parse(String(row.time ?? ''))
|
||||
const price = Number(row.price)
|
||||
return { timeMs, price }
|
||||
})
|
||||
.filter((point) => Number.isFinite(point.timeMs) && Number.isFinite(point.price) && point.price > 0)
|
||||
.sort((a, b) => a.timeMs - b.timeMs)
|
||||
}
|
||||
@@ -1,17 +1,49 @@
|
||||
const FINGER_SESSION_KEY = 'boursecu_finger_session_ok'
|
||||
|
||||
let fingerPosition = false
|
||||
|
||||
function readPersistedFingerSession(): boolean {
|
||||
try {
|
||||
return sessionStorage.getItem(FINGER_SESSION_KEY) === '1'
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
function writePersistedFingerSession(value: boolean) {
|
||||
try {
|
||||
if (value) {
|
||||
sessionStorage.setItem(FINGER_SESSION_KEY, '1')
|
||||
} else {
|
||||
sessionStorage.removeItem(FINGER_SESSION_KEY)
|
||||
}
|
||||
} catch {
|
||||
// ignore quota / private mode
|
||||
}
|
||||
}
|
||||
|
||||
export function setTruth() {
|
||||
fingerPosition = true
|
||||
writePersistedFingerSession(true)
|
||||
}
|
||||
|
||||
export function setEnableAuthenticate() {
|
||||
fingerPosition = false
|
||||
writePersistedFingerSession(false)
|
||||
}
|
||||
|
||||
export function getFingerPosition() {
|
||||
return fingerPosition
|
||||
if (fingerPosition) {
|
||||
return true
|
||||
}
|
||||
if (readPersistedFingerSession()) {
|
||||
fingerPosition = true
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
export function setFingerPosition(value: boolean) {
|
||||
fingerPosition = value
|
||||
writePersistedFingerSession(value)
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@ import { getToken } from '@/utils'
|
||||
import '@/utils/useDateTime'
|
||||
import { initPriceRealtimeChannel } from '@/utils/priceSocket'
|
||||
import { initMobileScrollRestoration } from '@/layouts/composables/useMobileScrollReset'
|
||||
import { initMobileInputKeyboardScroll } from '@/utils/mobileInputKeyboardScroll'
|
||||
import { isServerUnavailableError } from '@/utils/serverUnavailable'
|
||||
import { isGuestHomeQuery } from '@/utils/guestHome'
|
||||
|
||||
type BootWindow = Window & {
|
||||
__BOOT_TIMEOUT__?: number
|
||||
@@ -53,13 +56,13 @@ function showBootstrapError(error: unknown) {
|
||||
<div style="font-size: 42px; margin-bottom: 12px;">⚠️</div>
|
||||
<h2 style="margin: 0 0 12px; font-size: 20px;">خطا در راهاندازی برنامه</h2>
|
||||
<p style="margin: 0 0 20px; color: var(--boot-muted, rgba(15,23,42,0.62)); line-height: 2; font-size: 14px;">
|
||||
لطفاً اتصال اینترنت خود را بررسی کنید و دوباره تلاش کنید.
|
||||
برقراری ارتباط با سرور امکانپذیر نیست. لطفاً اتصال اینترنت خود را بررسی کرده و صفحه را تازهسازی نمایید.
|
||||
</p>
|
||||
<button
|
||||
onclick="location.reload()"
|
||||
style="padding: 11px 22px; border: 0; border-radius: 12px; background: var(--boot-accent, #2563eb); color: white; cursor: pointer; font-weight: 700;"
|
||||
>
|
||||
تلاش مجدد
|
||||
تازهسازی صفحه
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -114,9 +117,7 @@ export async function bootstrapApp() {
|
||||
|
||||
await withTimeout(settingsStore.fetchSettings(), 45000, 'Settings loading timeout')
|
||||
|
||||
if (getToken()) {
|
||||
initPriceRealtimeChannel((key) => settingsStore.getSettingByKey(key))
|
||||
}
|
||||
initPriceRealtimeChannel((key) => settingsStore.getSettingByKey(key))
|
||||
|
||||
if (getToken()) {
|
||||
await withTimeout(userStore.getMyInfo(), 45000, 'User session loading timeout')
|
||||
@@ -124,12 +125,21 @@ export async function bootstrapApp() {
|
||||
|
||||
setupRouterGuards()
|
||||
initMobileScrollRestoration()
|
||||
initMobileInputKeyboardScroll()
|
||||
|
||||
app.mount('#app')
|
||||
|
||||
await router.isReady()
|
||||
|
||||
if (!getToken() && router.currentRoute.value.name !== 'login') {
|
||||
const bootRoute = router.currentRoute.value
|
||||
const guestHomeBoot = bootRoute.name === 'home' && isGuestHomeQuery(bootRoute.query)
|
||||
if (
|
||||
!getToken()
|
||||
&& bootRoute.name !== 'login'
|
||||
&& bootRoute.name !== 'tvMonitor'
|
||||
&& bootRoute.name !== 'aboutSoftware'
|
||||
&& !guestHomeBoot
|
||||
) {
|
||||
await router.replace({ name: 'login' })
|
||||
}
|
||||
|
||||
@@ -138,6 +148,10 @@ export async function bootstrapApp() {
|
||||
sessionStorage.removeItem('__APP_BOOT_RECOVERY_DONE__')
|
||||
sessionStorage.removeItem('__APP_BOOT_RETRY_CLICKED__')
|
||||
} catch (error) {
|
||||
if (isServerUnavailableError(error)) {
|
||||
clearBootTimeout()
|
||||
return
|
||||
}
|
||||
showBootstrapError(error)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,17 @@ import { useFundUserStore } from '@/store/fundStore'
|
||||
import type { NavigationGuardNext } from 'vue-router'
|
||||
import { useAuthStore } from '@/store/useAuthStore'
|
||||
import { recoverMobileViewportAfterAuth } from '@/layouts/composables/useMobileScrollReset'
|
||||
import { getFingerPosition, setFingerPosition } from '@/app/authBoot'
|
||||
import { isGuestHomeQuery } from '@/utils/guestHome'
|
||||
import type { RouteLocationNormalized } from 'vue-router'
|
||||
|
||||
const PUBLIC_ROUTE_NAMES = ['login', '404', 'educate', 'aboutUs'] as const
|
||||
const PUBLIC_ROUTE_NAMES = ['login', '404', 'educate', 'aboutUs', 'aboutSoftware', 'tvMonitor'] as const
|
||||
|
||||
function isPublicRoute(name: string | symbol | null | undefined) {
|
||||
return PUBLIC_ROUTE_NAMES.includes(name as (typeof PUBLIC_ROUTE_NAMES)[number])
|
||||
function isPublicRoute(to: RouteLocationNormalized) {
|
||||
if (to.name === 'home' && isGuestHomeQuery(to.query)) {
|
||||
return true
|
||||
}
|
||||
return PUBLIC_ROUTE_NAMES.includes(to.name as (typeof PUBLIC_ROUTE_NAMES)[number])
|
||||
}
|
||||
|
||||
function goToLogin(next: NavigationGuardNext) {
|
||||
@@ -70,12 +76,83 @@ export function setupRouterGuards() {
|
||||
const authenticated = await resolveSession()
|
||||
|
||||
if (!authenticated) {
|
||||
if (isPublicRoute(to.name)) {
|
||||
if (isPublicRoute(to)) {
|
||||
return next()
|
||||
}
|
||||
return goToLogin(next)
|
||||
}
|
||||
|
||||
if (to.name === 'notifyTrigger') {
|
||||
const { useSettingsStore } = await import('@/store/settingsStore')
|
||||
const settingsStore = useSettingsStore()
|
||||
if (!settingsStore.loaded) {
|
||||
await settingsStore.fetchSettings()
|
||||
}
|
||||
if (!settingsStore.isSettingTruthy('has_page_price_trigger')) {
|
||||
return next({ name: (from.name as string) || 'user' })
|
||||
}
|
||||
}
|
||||
|
||||
if (to.name === 'installment') {
|
||||
const { useSettingsStore } = await import('@/store/settingsStore')
|
||||
const settingsStore = useSettingsStore()
|
||||
if (!settingsStore.loaded) {
|
||||
await settingsStore.fetchSettings()
|
||||
}
|
||||
if (!settingsStore.isSettingTruthy('enable_digipay_installment')) {
|
||||
return next({ name: (from.name as string) || 'user' })
|
||||
}
|
||||
}
|
||||
|
||||
if (to.name === 'giftCard') {
|
||||
const { useSettingsStore } = await import('@/store/settingsStore')
|
||||
const settingsStore = useSettingsStore()
|
||||
if (!settingsStore.loaded) {
|
||||
await settingsStore.fetchSettings()
|
||||
}
|
||||
if (!settingsStore.isSettingTruthy('has_page_gift_card')) {
|
||||
return next({ name: (from.name as string) || 'user' })
|
||||
}
|
||||
}
|
||||
|
||||
if (to.name === 'appNotifications') {
|
||||
const { useSettingsStore } = await import('@/store/settingsStore')
|
||||
const settingsStore = useSettingsStore()
|
||||
if (!settingsStore.loaded) {
|
||||
await settingsStore.fetchSettings()
|
||||
}
|
||||
if (!settingsStore.isSettingTruthy('has_page_notification')) {
|
||||
return next({ name: (from.name as string) || 'home' })
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
to.name === 'piggy' ||
|
||||
to.name === 'fund' ||
|
||||
to.name === 'fund_info' ||
|
||||
to.name === 'fund_add'
|
||||
) {
|
||||
const { useSettingsStore } = await import('@/store/settingsStore')
|
||||
const settingsStore = useSettingsStore()
|
||||
if (!settingsStore.loaded) {
|
||||
await settingsStore.fetchSettings()
|
||||
}
|
||||
if (!settingsStore.isSettingTruthy('enable_product_funds')) {
|
||||
return next({ name: (from.name as string) || 'home' })
|
||||
}
|
||||
}
|
||||
|
||||
if (to.name === 'earnMoney') {
|
||||
const { useSettingsStore } = await import('@/store/settingsStore')
|
||||
const settingsStore = useSettingsStore()
|
||||
if (!settingsStore.loaded) {
|
||||
await settingsStore.fetchSettings()
|
||||
}
|
||||
if (!settingsStore.isSettingTruthy('has_page_earn_money')) {
|
||||
return next({ name: (from.name as string) || 'user' })
|
||||
}
|
||||
}
|
||||
|
||||
hasFingerPrint = !!userStore.userInfo?.finger_print
|
||||
|
||||
if (isApple && userStore.userInfo?.finger_print) {
|
||||
@@ -86,7 +163,10 @@ export function setupRouterGuards() {
|
||||
if (!isApple && userStore.userInfo?.finger_print) {
|
||||
if (!fingerprintChecked) {
|
||||
fingerprintChecked = true
|
||||
setFingerPosition(await authenticateWithFingerprint())
|
||||
// اگر همین الان با پسورد/OTP وارد شده (setTruth)، دوباره WebAuthn نخواه
|
||||
if (!getFingerPosition()) {
|
||||
setFingerPosition(await authenticateWithFingerprint())
|
||||
}
|
||||
}
|
||||
|
||||
if (!getFingerPosition()) {
|
||||
@@ -96,6 +176,8 @@ export function setupRouterGuards() {
|
||||
timeoutId = setTimeout(() => {
|
||||
if (hasFingerPrint) {
|
||||
setFingerPosition(false)
|
||||
// بعد از انقضا دوباره WebAuthn بخواهد؛ مستقیم لاگین اجباری نکند
|
||||
fingerprintChecked = false
|
||||
}
|
||||
}, 180000)
|
||||
}
|
||||
@@ -126,7 +208,11 @@ export async function ensureAuthenticatedRoute() {
|
||||
|
||||
if (!token) {
|
||||
userStore.userInfo = undefined
|
||||
if (router.currentRoute.value.name !== 'login') {
|
||||
const current = router.currentRoute.value
|
||||
if (current.name === 'home' && isGuestHomeQuery(current.query)) {
|
||||
return false
|
||||
}
|
||||
if (current.name !== 'login') {
|
||||
await router.replace({ name: 'login' })
|
||||
}
|
||||
return false
|
||||
|
||||
@@ -240,9 +240,9 @@
|
||||
}
|
||||
|
||||
.ant-spin-dot-item {
|
||||
background-color: @App-primary-color !important;
|
||||
background-color: var(--color-primary, var(--App-secondary-color)) !important;
|
||||
}
|
||||
|
||||
.ant-spin-dot i {
|
||||
background-color: @App-primary-color !important;
|
||||
background-color: var(--color-primary, var(--App-secondary-color)) !important;
|
||||
}
|
||||
@@ -13,8 +13,8 @@ html.project-boursecu {
|
||||
}
|
||||
|
||||
.ant-input-group-addon {
|
||||
background-color: @secondary-color !important;
|
||||
color: @App-primary-color !important;
|
||||
background-color: #e0be7f !important;
|
||||
color: #0a1b37 !important;
|
||||
}
|
||||
|
||||
.text-red,
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
@import (less) '../../views/base/rules/desktop/styles/desktop-rules.less';
|
||||
@import (less) '../../views/base/rules/permissions/desktop/styles/desktop-permissions.less';
|
||||
@import (less) '../../views/base/giftCard/desktop/styles/desktop-gift-card.less';
|
||||
@import (less) '../../views/base/home/styles/landing-live-chart-main.less';
|
||||
@import (less) '../../views/base/address/desktop/styles/desktop-address.less';
|
||||
@import (less) '../../views/base/educate/desktop/styles/desktop-educate.less';
|
||||
@import (less) '../../views/base/aboutUs/desktop/styles/desktop-about-us.less';
|
||||
@@ -23,6 +24,8 @@
|
||||
@import (less) '../../views/base/physicalReceive/desktop/styles/desktop-physical-receive.less';
|
||||
@import (less) '../../views/base/fund/desktop/styles/desktop-fund.less';
|
||||
@import (less) '../../views/base/gold/desktop/styles/desktop-gold.less';
|
||||
@import (less) './mobile-keyboard-scroll.less';
|
||||
@import (less) '../../styles/app-premium-modal.less';
|
||||
|
||||
html {
|
||||
scroll-behavior: smooth;
|
||||
@@ -448,8 +451,8 @@ body:has(.ant-modal-root .ant-modal-wrap:not([style*='display: none'])) {
|
||||
color:@App-primary-color !important;
|
||||
}
|
||||
.ant-input-group-addon{
|
||||
background-color: @App-primary-color !important;
|
||||
color: @secondary-color !important;
|
||||
background-color: #e0be7f !important;
|
||||
color: #0a1b37 !important;
|
||||
}
|
||||
.ant-slider-track{
|
||||
background-color:@App-primary-color !important;
|
||||
@@ -466,3 +469,14 @@ body:has(.ant-modal-root .ant-modal-wrap:not([style*='display: none'])) {
|
||||
.ant-radio-group-solid .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):hover{
|
||||
color: white !important;
|
||||
}
|
||||
|
||||
/* لودینگ محتوای صفحه — وسط ناحیه محتوا (موبایل و دسکتاپ یکسان) */
|
||||
.app-page-content-loading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
min-height: min(52vh, 22rem);
|
||||
padding: 2rem 1rem;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
:root {
|
||||
--app-keyboard-inset: 0px;
|
||||
--app-visual-viewport-height: 100dvh;
|
||||
--app-visual-viewport-offset-top: 0px;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 767.98px) {
|
||||
input,
|
||||
textarea,
|
||||
select,
|
||||
.ant-input,
|
||||
.ant-input-affix-wrapper,
|
||||
.ant-select-selection-search-input {
|
||||
scroll-margin-bottom: calc(var(--app-keyboard-inset) + 16px);
|
||||
}
|
||||
|
||||
html[data-keyboard-open='true'] {
|
||||
.main-with-bottom-chrome,
|
||||
.login-vip-page__body,
|
||||
.login-page,
|
||||
.login-page-root,
|
||||
.ant-modal-body,
|
||||
.ant-drawer-body,
|
||||
.van-action-sheet__content,
|
||||
.basic-action-sheet__body {
|
||||
scroll-padding-bottom: calc(var(--app-keyboard-inset) + 16px);
|
||||
}
|
||||
|
||||
.main-with-bottom-chrome,
|
||||
.login-vip-page__body,
|
||||
.login-page {
|
||||
padding-bottom: var(--app-keyboard-inset);
|
||||
}
|
||||
|
||||
.login-mobile {
|
||||
height: var(--app-visual-viewport-height, 100dvh);
|
||||
max-height: var(--app-visual-viewport-height, 100dvh);
|
||||
}
|
||||
|
||||
.login-page.flex {
|
||||
height: var(--app-visual-viewport-height, 92vh) !important;
|
||||
max-height: var(--app-visual-viewport-height, 92vh) !important;
|
||||
overflow-y: auto;
|
||||
overscroll-behavior: contain;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
align-items: flex-start !important;
|
||||
justify-content: flex-start !important;
|
||||
padding-top: 0.75rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
Before Width: | Height: | Size: 176 KiB |
|
Before Width: | Height: | Size: 830 KiB |
|
Before Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 912 KiB |
|
Before Width: | Height: | Size: 929 KiB |
|
Before Width: | Height: | Size: 2.4 MiB |
|
Before Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 40 KiB |
@@ -0,0 +1,10 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256">
|
||||
<circle cx="128" cy="128" r="124" fill="#12B76A"/>
|
||||
<!-- Bootstrap Icons telephone-fill — گوشی کامل -->
|
||||
<g transform="translate(48 48) scale(10)">
|
||||
<path
|
||||
fill="#fff"
|
||||
d="M1.885.511a1.745 1.745 0 0 1 2.612.163L6.29 2.98c.329.423.445.967.315 1.49l-.547 2.19a.678.678 0 0 0 .178.643l2.457 2.457a.678.678 0 0 0 .644.178l2.189-.547a1.745 1.745 0 0 1 1.49.315l2.306 1.794c.829.645.905 1.87.163 2.611l-1.034 1.034c-.74.74-1.846 1.065-2.877.702a18.634 18.634 0 0 1-7.01-4.42 18.634 18.634 0 0 1-4.42-7.009c-.362-1.03-.038-2.137.703-2.877L1.885.511z"
|
||||
/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 680 B |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
@@ -0,0 +1,7 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256" fill="none">
|
||||
<circle cx="128" cy="128" r="128" fill="#3B82F6"/>
|
||||
<path
|
||||
fill="#fff"
|
||||
d="M78 76h100c11 0 20 9 20 20v64c0 11-9 20-20 20h-52l-30 26v-26H78c-11 0-20-9-20-20V96c0-11 9-20 20-20zm16 40h68v14H94v-14zm0 28h48v14H94v-14z"
|
||||
/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 337 B |
@@ -0,0 +1,7 @@
|
||||
<svg viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="48" height="48" rx="12" fill="#1CA0E2"/>
|
||||
<g transform="translate(12 12)">
|
||||
<path d="M14.4501 0.922337C14.4249 0.922337 14.3996 0.922337 14.3749 0.922337C13.9177 0.865759 13.4564 0.848106 12.9962 0.869568C12.3937 0.891042 11.7968 0.992415 11.2211 1.17103C10.5799 1.36599 9.98324 1.6851 9.46511 2.11021C9.27918 2.26684 9.10383 2.43563 8.94023 2.61545C8.62473 2.95789 8.39401 3.35478 8.19696 3.77245C8.09086 3.997 7.99543 4.22773 7.8955 4.45565C7.88203 4.48764 7.8708 4.5202 7.86014 4.55333C7.82589 4.66167 7.79558 4.77114 7.75853 4.87836C7.65492 5.2025 7.5737 5.53337 7.51545 5.86863C7.45552 6.17826 7.41539 6.4914 7.39532 6.80613C7.37904 7.03574 7.36669 7.2659 7.36613 7.49607C7.36593 7.89339 7.3888 8.29039 7.43461 8.68506C7.49075 9.19592 7.58787 9.70059 7.69341 10.2036C7.81298 10.7756 7.99094 11.3303 8.1644 11.8877C8.33787 12.4452 8.5394 12.9847 8.73757 13.5297C8.89756 13.9716 9.04576 14.4167 9.16702 14.8709C9.24027 15.1385 9.29245 15.4114 9.32309 15.6871C9.37053 16.0792 9.35422 16.4763 9.27481 16.8632C9.26358 16.9126 9.25179 16.9614 9.23719 17.0097C9.17854 17.206 9.10843 17.3987 9.02724 17.5868C8.97171 17.7142 8.90383 17.8359 8.82458 17.95C8.54294 18.3624 8.19617 18.7262 7.79782 19.0273C7.33066 19.3746 6.78803 19.6066 6.21418 19.7043C5.97198 19.7479 5.72653 19.7708 5.48046 19.7728C4.65255 19.785 3.84735 19.5021 3.20913 18.9745C3.06738 18.8636 2.93586 18.7402 2.81616 18.6057C2.79988 18.5866 2.78024 18.5704 2.76003 18.553C2.73982 18.5355 2.73701 18.5479 2.72578 18.553C2.70445 18.5423 2.69715 18.5198 2.68536 18.5019C2.53435 18.2655 2.37492 18.0348 2.23289 17.7923C2.02466 17.4393 1.83484 17.0758 1.66422 16.7032C1.4634 16.2612 1.29071 15.8068 1.14719 15.343C1.028 14.9577 0.929988 14.5662 0.853591 14.1703C0.802506 13.9081 0.760402 13.6437 0.730649 13.3776C0.707633 13.171 0.686862 12.9644 0.674512 12.7567C0.663846 12.6024 0.663846 12.448 0.655425 12.2942C0.647566 12.1645 0.644197 12.0354 0.647004 11.9062C0.650934 11.7204 0.654302 11.5341 0.666091 11.3488C0.679564 11.1349 0.696405 10.921 0.722229 10.7088C0.800805 10.0199 0.942301 9.33971 1.14495 8.67664C1.27499 8.25508 1.42887 7.84124 1.60584 7.43712C1.89207 6.78413 2.23982 6.15987 2.64438 5.57279C3.12563 4.87288 3.68354 4.22892 4.30774 3.65288C5.11591 2.9082 6.02747 2.28423 7.01414 1.80033C7.73201 1.44668 8.48602 1.17169 9.26302 0.980159C9.59984 0.898198 9.93667 0.829149 10.2814 0.776941C10.4554 0.750369 10.6303 0.728288 10.8062 0.710698C10.9943 0.691611 11.1829 0.681506 11.371 0.663542C11.4367 0.657367 11.5035 0.65849 11.5697 0.657367C11.9065 0.649508 12.2383 0.649508 12.5723 0.661297C12.7015 0.665788 12.83 0.681506 12.9586 0.69105C13.0338 0.696664 13.109 0.703962 13.1831 0.711259C13.4533 0.737083 13.7213 0.774508 13.987 0.823535C14.1229 0.848797 14.2587 0.875743 14.3951 0.901566C14.4154 0.901603 14.4349 0.908983 14.4501 0.922337Z" fill="#ffffff"/>
|
||||
<path d="M5.25874 21.1173C5.27981 21.122 5.29921 21.1323 5.31488 21.1471C5.63283 21.3639 5.96476 21.5595 6.30852 21.7326C6.92863 22.0651 7.58142 22.3326 8.2565 22.5309C8.68006 22.6535 9.11143 22.7472 9.54766 22.8116C10.1444 22.8977 10.748 22.9264 11.3502 22.8974C11.7252 22.8804 12.0987 22.8397 12.4685 22.7756C12.6768 22.7403 12.8834 22.6976 13.0894 22.6516C13.6547 22.5202 14.2077 22.3411 14.7426 22.116C15.2004 21.927 15.6441 21.7057 16.0703 21.4536C16.5961 21.1443 17.0675 20.7507 17.4659 20.2887C17.8669 19.8343 18.2251 19.3438 18.5359 18.8235C19.0119 18.0108 19.35 17.1247 19.5362 16.2013C19.5979 15.8984 19.6419 15.5921 19.6682 15.2841C19.6987 14.9384 19.7084 14.5912 19.6974 14.2444C19.6623 13.1958 19.4489 12.1608 19.0664 11.1838C18.9917 10.9929 18.9131 10.8037 18.8351 10.614C18.8194 10.5763 18.8008 10.5399 18.7818 10.5017C18.4002 9.77858 17.9286 9.1067 17.3783 8.50205C17.0213 8.10516 16.6334 7.7397 16.2449 7.37481C15.9642 7.1132 15.6661 6.87687 15.3658 6.64109C15.1553 6.47267 14.938 6.31829 14.7365 6.1409C14.6708 6.07719 14.6006 6.01828 14.5265 5.96463C14.5033 5.94836 14.482 5.92953 14.4631 5.90849C14.3716 5.81306 14.2778 5.71931 14.1897 5.62106C13.9048 5.30938 13.7133 4.9238 13.6373 4.50841C13.5599 4.04993 13.605 3.57914 13.7681 3.14371C14.0347 2.46051 14.5209 2.00355 15.2063 1.7571C15.6623 1.58876 16.1576 1.55753 16.6311 1.66728C16.6586 1.67346 16.6873 1.67683 16.7148 1.68132C16.716 1.68322 16.7176 1.68484 16.7195 1.68607C16.7214 1.68729 16.7235 1.68809 16.7258 1.68841C16.728 1.68873 16.7303 1.68856 16.7325 1.68792C16.7346 1.68728 16.7366 1.68617 16.7383 1.68469C16.8039 1.70602 16.8668 1.73484 16.9258 1.77058C17.6094 2.10085 18.2582 2.4986 18.8626 2.95789C19.1186 3.1525 19.366 3.35834 19.6047 3.57541C19.8577 3.8037 20.1001 4.04303 20.3317 4.29341C21.5814 5.64007 22.4838 7.27123 22.9606 9.04547C23.0482 9.37163 23.1201 9.70059 23.1801 10.0324C23.2149 10.2277 23.2434 10.424 23.2655 10.6213C23.2885 10.8312 23.3087 11.0412 23.3216 11.2517C23.3312 11.3836 23.3345 11.5161 23.339 11.6486C23.3424 11.7608 23.3508 11.8686 23.3491 11.9792C23.3463 12.1998 23.3441 12.421 23.33 12.6411C23.3147 12.8858 23.2926 13.1304 23.2638 13.3748C23.0982 14.7647 22.6752 16.1116 22.0164 17.3466C21.8345 17.6892 21.6334 18.0213 21.4141 18.3413C21.3957 18.3665 21.3825 18.3952 21.3754 18.4255C21.3682 18.4559 21.3673 18.4874 21.3725 18.5181C21.3966 18.677 21.4185 18.8359 21.4404 18.9953C21.4623 19.1547 21.4837 19.3198 21.505 19.482C21.528 19.6566 21.551 19.8318 21.5735 20.0064C21.5886 20.1287 21.6016 20.2506 21.6167 20.3724C21.633 20.5071 21.6509 20.6413 21.6672 20.7754C21.6835 20.9096 21.6975 21.032 21.7127 21.16C21.7279 21.288 21.7413 21.4042 21.7565 21.526C21.7722 21.6574 21.789 21.7887 21.8053 21.919C21.8233 22.0627 21.8407 22.207 21.8581 22.3507C21.8733 22.4759 21.8873 22.6005 21.9019 22.7257C21.9097 22.7913 21.9182 22.857 21.926 22.9227C21.9339 22.9884 21.9182 23.0064 21.8463 22.9884C21.7851 22.9732 21.7245 22.9558 21.6639 22.9396L20.2486 22.5612C19.7995 22.4416 19.3538 22.3232 18.9069 22.2025C18.5662 22.111 18.226 22.0166 17.8858 21.9218C17.8224 21.9044 17.7578 21.8881 17.6949 21.8656C17.6773 21.8594 17.6585 21.8573 17.6399 21.8594C17.6213 21.8616 17.6035 21.8679 17.5877 21.878C17.3474 22.0172 17.0993 22.1424 16.8489 22.262C16.493 22.4309 16.1283 22.5808 15.7565 22.7111C15.361 22.8498 14.958 22.9664 14.5495 23.0602C14.3008 23.1164 14.051 23.1686 13.7984 23.204C13.6395 23.2264 13.4812 23.255 13.3218 23.2724C13.1467 23.291 12.9709 23.3073 12.7947 23.319C12.4674 23.3404 12.1395 23.3544 11.8117 23.3482C11.6444 23.3449 11.4775 23.3385 11.3109 23.3291C11.1599 23.3202 11.0089 23.3089 10.8585 23.2921C10.6429 23.2674 10.4273 23.241 10.2129 23.2068C9.96701 23.1675 9.72281 23.122 9.4831 23.067C8.84985 22.9227 8.23008 22.7246 7.63056 22.4747C7.28999 22.3321 6.9571 22.1735 6.63187 21.9987C6.17367 21.752 5.73289 21.4742 5.31264 21.1673C5.28962 21.1555 5.26492 21.1448 5.25874 21.1173Z" fill="#ffffff"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 6.7 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 256 256"><defs><linearGradient id="SVG6DaOZcwt" x1="50%" x2="50%" y1="0%" y2="100%"><stop offset="0%" stop-color="#2aabee"/><stop offset="100%" stop-color="#229ed9"/></linearGradient></defs><path fill="url(#SVG6DaOZcwt)" d="M128 0C94.06 0 61.48 13.494 37.5 37.49A128.04 128.04 0 0 0 0 128c0 33.934 13.5 66.514 37.5 90.51C61.48 242.506 94.06 256 128 256s66.52-13.494 90.5-37.49c24-23.996 37.5-56.576 37.5-90.51s-13.5-66.514-37.5-90.51C194.52 13.494 161.94 0 128 0"/><path fill="#fff" d="M57.94 126.648q55.98-24.384 74.64-32.152c35.56-14.786 42.94-17.354 47.76-17.441c1.06-.017 3.42.245 4.96 1.49c1.28 1.05 1.64 2.47 1.82 3.467c.16.996.38 3.266.2 5.038c-1.92 20.24-10.26 69.356-14.5 92.026c-1.78 9.592-5.32 12.808-8.74 13.122c-7.44.684-13.08-4.912-20.28-9.63c-11.26-7.386-17.62-11.982-28.56-19.188c-12.64-8.328-4.44-12.906 2.76-20.386c1.88-1.958 34.64-31.748 35.26-34.45c.08-.338.16-1.598-.6-2.262c-.74-.666-1.84-.438-2.64-.258c-1.14.256-19.12 12.152-54 35.686c-5.1 3.508-9.72 5.218-13.88 5.128c-4.56-.098-13.36-2.584-19.9-4.708c-8-2.606-14.38-3.984-13.82-8.41c.28-2.304 3.46-4.662 9.52-7.072"/></svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 256 258"><defs><linearGradient id="SVGK3KZq49U" x1="50%" x2="50%" y1="100%" y2="0%"><stop offset="0%" stop-color="#1faf38"/><stop offset="100%" stop-color="#60d669"/></linearGradient><linearGradient id="SVGefMkoEOd" x1="50%" x2="50%" y1="100%" y2="0%"><stop offset="0%" stop-color="#f9f9f9"/><stop offset="100%" stop-color="#fff"/></linearGradient></defs><path fill="url(#SVGK3KZq49U)" d="M5.463 127.456c-.006 21.677 5.658 42.843 16.428 61.499L4.433 252.697l65.232-17.104a123 123 0 0 0 58.8 14.97h.054c67.815 0 123.018-55.183 123.047-123.01c.013-32.867-12.775-63.773-36.009-87.025c-23.23-23.25-54.125-36.061-87.043-36.076c-67.823 0-123.022 55.18-123.05 123.004"/><path fill="url(#SVGefMkoEOd)" d="M1.07 127.416c-.007 22.457 5.86 44.38 17.014 63.704L0 257.147l67.571-17.717c18.618 10.151 39.58 15.503 60.91 15.511h.055c70.248 0 127.434-57.168 127.464-127.423c.012-34.048-13.236-66.065-37.3-90.15C194.633 13.286 162.633.014 128.536 0C58.276 0 1.099 57.16 1.071 127.416m40.24 60.376l-2.523-4.005c-10.606-16.864-16.204-36.352-16.196-56.363C22.614 69.029 70.138 21.52 128.576 21.52c28.3.012 54.896 11.044 74.9 31.06c20.003 20.018 31.01 46.628 31.003 74.93c-.026 58.395-47.551 105.91-105.943 105.91h-.042c-19.013-.01-37.66-5.116-53.922-14.765l-3.87-2.295l-40.098 10.513z"/><path fill="#fff" d="M96.678 74.148c-2.386-5.303-4.897-5.41-7.166-5.503c-1.858-.08-3.982-.074-6.104-.074c-2.124 0-5.575.799-8.492 3.984c-2.92 3.188-11.148 10.892-11.148 26.561s11.413 30.813 13.004 32.94c1.593 2.123 22.033 35.307 54.405 48.073c26.904 10.609 32.379 8.499 38.218 7.967c5.84-.53 18.844-7.702 21.497-15.139c2.655-7.436 2.655-13.81 1.859-15.142c-.796-1.327-2.92-2.124-6.105-3.716s-18.844-9.298-21.763-10.361c-2.92-1.062-5.043-1.592-7.167 1.597c-2.124 3.184-8.223 10.356-10.082 12.48c-1.857 2.129-3.716 2.394-6.9.801c-3.187-1.598-13.444-4.957-25.613-15.806c-9.468-8.442-15.86-18.867-17.718-22.056c-1.858-3.184-.199-4.91 1.398-6.497c1.431-1.427 3.186-3.719 4.78-5.578c1.588-1.86 2.118-3.187 3.18-5.311c1.063-2.126.531-3.986-.264-5.579c-.798-1.593-6.987-17.343-9.819-23.64"/></svg>
|
||||
|
After Width: | Height: | Size: 2.1 KiB |
@@ -7,14 +7,19 @@
|
||||
:class="`app-credit-link--${variant}`"
|
||||
>
|
||||
<span class="app-credit-link__text">توسعه و طراحی توسط</span>
|
||||
<img src="/logo-montzar.png" alt="montzar" class="app-credit-link__logo" />
|
||||
<img :src="logoSrc" alt="montzar" class="app-credit-link__logo" />
|
||||
</a>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
const logoSrc = `${import.meta.env.BASE_URL || '/'}logo-montzar.png`.replace(
|
||||
/([^:]\/)\/+/g,
|
||||
'$1',
|
||||
)
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
variant?: 'mobile' | 'sidebar' | 'float'
|
||||
variant?: 'mobile' | 'sidebar' | 'float' | 'tv'
|
||||
}>(),
|
||||
{ variant: 'mobile' },
|
||||
)
|
||||
|
||||
@@ -16,7 +16,14 @@
|
||||
|
||||
</style>-->
|
||||
<template>
|
||||
<VanActionSheet v-model:show="show" teleport="body" :z-index="zIndex">
|
||||
<VanActionSheet
|
||||
v-model:show="show"
|
||||
teleport="body"
|
||||
overlay
|
||||
lock-scroll
|
||||
close-on-click-overlay
|
||||
:z-index="zIndex"
|
||||
>
|
||||
<div class="justify-center cursor-pointer flex mt-1" @click="show = false">
|
||||
<span class="rounded-sm w-12 border-t-2 border-t-solid border-t-gray-500 mt-2"></span>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
<template>
|
||||
<AButton :disabled="props.disabledB" :type="props.type" :size="props.size" :class="[prefixCls, _class]" :loading="props.loading">
|
||||
<AButton
|
||||
:disabled="props.disabledB"
|
||||
:type="props.type"
|
||||
:size="props.size"
|
||||
:class="[prefixCls, _class]"
|
||||
:loading="props.loading"
|
||||
:html-type="props.htmlType"
|
||||
@click="onClick"
|
||||
>
|
||||
<!-- py-1 px-2-->
|
||||
<div
|
||||
class="flex items-center gap-1 justify-center flex-row-reverse gap-2 py-1 px-2"
|
||||
@@ -28,7 +36,7 @@ interface Props {
|
||||
size?: string
|
||||
loading?: boolean
|
||||
disabledB?:boolean
|
||||
|
||||
htmlType?: 'button' | 'submit' | 'reset'
|
||||
// prefixIcon?: string
|
||||
}
|
||||
|
||||
@@ -51,8 +59,17 @@ const { prefixCls } = usePrefix('base-button')
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
iconSize: baseButtonIconSize,
|
||||
// iconLeft: false,
|
||||
iconClass: ''
|
||||
iconClass: '',
|
||||
htmlType: 'submit',
|
||||
})
|
||||
|
||||
const emit = defineEmits<{
|
||||
click: [event: MouseEvent]
|
||||
}>()
|
||||
|
||||
function onClick(event: MouseEvent) {
|
||||
emit('click', event)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
|
||||
@@ -33,10 +33,12 @@ const color = computed(() => {
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
if (props.size) {
|
||||
const svg: SVGElement = refIcon.value?.children[0] as SVGElement
|
||||
svg.setAttribute('width', props.size as string)
|
||||
svg.setAttribute('height', props.size as string)
|
||||
if (props.size && refIcon.value) {
|
||||
const svg = refIcon.value.children?.[0] as SVGElement | undefined
|
||||
if (svg && typeof svg.setAttribute === 'function') {
|
||||
svg.setAttribute('width', String(props.size))
|
||||
svg.setAttribute('height', String(props.size))
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -38,7 +38,11 @@
|
||||
import {usePrefix} from "@/utils/usePrefix";
|
||||
import {computed} from "vue";
|
||||
import {usePrice} from "@/utils/usePrice";
|
||||
import {persianToEnglishDigits, shouldNormalizeInputDigits} from '@/utils/persianDigits';
|
||||
import {
|
||||
normalizeDecimalInput,
|
||||
persianToEnglishDigits,
|
||||
shouldNormalizeDecimalSeparators,
|
||||
} from '@/utils/persianDigits';
|
||||
|
||||
//Props
|
||||
interface Prop {
|
||||
@@ -57,8 +61,6 @@ interface Prop {
|
||||
placeHolder?: String
|
||||
}
|
||||
|
||||
const addonBgColor = computed(() => props.addonBgColor)
|
||||
const addonTextColor = computed(() => props.addonTextColor)
|
||||
//emits
|
||||
const localValue = computed({
|
||||
set(value) {
|
||||
@@ -81,19 +83,23 @@ function normalizeValue(value: unknown) {
|
||||
return value
|
||||
}
|
||||
|
||||
let normalized = String(value)
|
||||
if (shouldNormalizeInputDigits(props)) {
|
||||
normalized = persianToEnglishDigits(normalized)
|
||||
if (shouldNormalizeDecimalSeparators(props)) {
|
||||
const isPrice = String(props.type ?? '').trim().toLowerCase() === 'price'
|
||||
return normalizeDecimalInput(value as string | number, {
|
||||
commaAsThousand: isPrice,
|
||||
})
|
||||
}
|
||||
if (props.type === 'price') {
|
||||
normalized = normalized.replaceAll(',', '')
|
||||
}
|
||||
return normalized
|
||||
|
||||
return persianToEnglishDigits(String(value))
|
||||
}
|
||||
|
||||
const handlerChange = (e: Event | string) => {
|
||||
const raw = typeof e === 'string' ? e : (e.target as HTMLInputElement | null)?.value
|
||||
const target = typeof e === 'string' ? null : (e.target as HTMLInputElement | null)
|
||||
const raw = typeof e === 'string' ? e : target?.value
|
||||
const normalized = normalizeValue(raw)
|
||||
if (target && typeof normalized === 'string' && target.value !== normalized) {
|
||||
target.value = normalized
|
||||
}
|
||||
emits('update:value', normalized)
|
||||
emits('onchange', normalized)
|
||||
}
|
||||
@@ -124,8 +130,8 @@ const {prefixCls} = usePrefix('input')
|
||||
}
|
||||
|
||||
.ant-input-group-addon {
|
||||
background-color: v-bind(addonBgColor);
|
||||
color: v-bind(addonTextColor);
|
||||
background-color: #e0be7f !important;
|
||||
color: #0a1b37 !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -13,10 +13,13 @@
|
||||
:width="props.width"
|
||||
:ok-text="props.okText"
|
||||
:cancel-text="props.cancelText"
|
||||
:wrapClassName="props.wrapClassName"
|
||||
:wrapClassName="mergedWrapClassName"
|
||||
:closable="props.closable"
|
||||
:destroy-on-close="props.destroyOnClose"
|
||||
>
|
||||
<template v-if="$slots.title" #title>
|
||||
<slot name="title" />
|
||||
</template>
|
||||
<template v-if="props.customFooter" #footer> <slot name="footer" /></template>
|
||||
<a-spin :spinning="props.loading">
|
||||
<div class="overflow-y-auto py-2 px-1 relative max-h-[83vh]" id="body">
|
||||
@@ -60,6 +63,11 @@ const props = withDefaults(defineProps<Prop>(), {
|
||||
zIndex: APP_Z_MODAL,
|
||||
})
|
||||
|
||||
const mergedWrapClassName = computed(() => {
|
||||
const extra = (props.wrapClassName ?? '').trim()
|
||||
return extra ? `app-premium-modal ${extra}` : 'app-premium-modal'
|
||||
})
|
||||
|
||||
const localValue = computed({
|
||||
get() {
|
||||
return props.visible
|
||||
@@ -67,13 +75,6 @@ const localValue = computed({
|
||||
|
||||
set(value) {
|
||||
emits('update:visible', value)
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.ant-modal-content {
|
||||
border-radius: 0.6rem;
|
||||
padding-top: 0.5rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
import {usePrice} from '@/utils/usePrice'
|
||||
import {computed} from "vue";
|
||||
import BasicInput from "../../BasicInput.vue";
|
||||
import {persianToEnglishDigits} from '@/utils/persianDigits'
|
||||
import {normalizeDecimalInput} from '@/utils/persianDigits'
|
||||
|
||||
interface Props {
|
||||
value?: string | number
|
||||
@@ -24,7 +24,7 @@ const props = withDefaults(defineProps<Props>(), {})
|
||||
|
||||
const _val = computed({
|
||||
set(val: string) {
|
||||
emit('update:value', persianToEnglishDigits(val).replaceAll(',', ''))
|
||||
emit('update:value', normalizeDecimalInput(val))
|
||||
},
|
||||
get() {
|
||||
return props.value ? usePrice(props.value as number, true, '').trim() : ''
|
||||
|
||||
@@ -23,8 +23,9 @@
|
||||
<div class="w-full text-center font-bold">{{ noData }}</div>
|
||||
</template>
|
||||
<a-select-option
|
||||
:label="val[props.valueName]"
|
||||
v-for="val in props.items"
|
||||
:key="val[props.keyName]"
|
||||
:label="val[props.valueName]"
|
||||
:value="val[props.keyName]"
|
||||
>
|
||||
<a-tooltip v-if="props.hasTooltip" placement="left" class="cursor-pointer">
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<template>
|
||||
<BasicModal
|
||||
v-model:visible="visible"
|
||||
width="460px"
|
||||
destroy-on-close
|
||||
custom-footer
|
||||
title="تبدیل محصول"
|
||||
wrap-class-name="app-premium-modal--scroll-tall"
|
||||
@close="closeCopperConvert"
|
||||
>
|
||||
<CopperConvertCalculator />
|
||||
|
||||
<template #footer>
|
||||
<BasicButton
|
||||
type="primary"
|
||||
class="app-premium-modal__btn-primary !w-full"
|
||||
size="middle"
|
||||
@click="closeCopperConvert"
|
||||
>
|
||||
بستن
|
||||
</BasicButton>
|
||||
</template>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { watch } from 'vue'
|
||||
import BasicModal from '@/components/BasicPacks/BasicModal.vue'
|
||||
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||
import CopperConvertCalculator from '@/views/base/convert/components/CopperConvertCalculator.vue'
|
||||
import {
|
||||
closeCopperConvert,
|
||||
copperConvertModalVisible,
|
||||
} from '@/composables/useCopperConvertModal'
|
||||
import { useCopperConvertPage } from '@/views/base/convert/composables/useCopperConvertPage'
|
||||
|
||||
const visible = copperConvertModalVisible
|
||||
const { refreshLivePrices, stopLivePrices } = useCopperConvertPage()
|
||||
|
||||
watch(visible, async (open) => {
|
||||
if (open) {
|
||||
await refreshLivePrices()
|
||||
} else {
|
||||
stopLivePrices()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
@@ -1,61 +1,71 @@
|
||||
<template>
|
||||
<!-- <div v-if="modelValue">-->
|
||||
<van-dialog class="oneButtonDialog">
|
||||
<div class="my-4">
|
||||
<van-dialog
|
||||
v-model:show="show"
|
||||
class="oneButtonDialog"
|
||||
teleport="body"
|
||||
:close-on-click-overlay="closeOnClickOverlay"
|
||||
:z-index="zIndex"
|
||||
v-bind="$attrs"
|
||||
>
|
||||
<div class="oneButtonDialog__body my-4 text-slate-800">
|
||||
<div class="w-full flex justify-center">
|
||||
<slot name="img">{{ text2 }}</slot>
|
||||
|
||||
</div>
|
||||
<div class="w-full flex justify-center text-[18px] font-semibold">
|
||||
<div class="w-full flex justify-center text-[18px] font-semibold text-slate-800">
|
||||
<slot name="title">{{ text1 }}</slot>
|
||||
</div>
|
||||
<div class=" border-t border-solid border-[#E5E7EB] pt-4 mx-2 mt-6 font-semibold text-[15px]">
|
||||
<div
|
||||
class="border-t border-solid border-[#E5E7EB] pt-4 mx-2 mt-6 font-semibold text-[15px] text-slate-800"
|
||||
>
|
||||
<slot name="button">{{ text3 }}</slot>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</van-dialog>
|
||||
<!-- <van-dialog style="background-color: #2b3f6e" show-cancel-button cancelButtonText="بیخیال" confirmButtonText="بله" cancelButtonColor="">-->
|
||||
<!-- <div class="w-full mt-6 text-white ">-->
|
||||
<!-- <div class="w-full flex mb-[10px] ">-->
|
||||
<!-- <Icon icon="vuesax-linear:info-circle" class="mx-4" size="25"/>-->
|
||||
<!-- <span class="text-lg flex-1">-->
|
||||
<!-- <slot name="title">{{text1}}</slot>-->
|
||||
<!-- </span>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="flex justify-start mb-6 mt-8" style="font-weight:700;">-->
|
||||
<!-- <slot name="button">{{text2}}</slot>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </van-dialog>-->
|
||||
<!-- </div>-->
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, watch } from 'vue'
|
||||
import { APP_Z_MODAL } from '@/utils/zIndex'
|
||||
|
||||
// import Icon from "/@/assets/icons/Icon.vue";
|
||||
import {ref, watch} from 'vue';
|
||||
defineOptions({ inheritAttrs: false })
|
||||
|
||||
const show = ref(true);
|
||||
const props = withDefaults(defineProps<{
|
||||
// modelValue: boolean,
|
||||
timeOut: number,
|
||||
text1?: string,
|
||||
text2?: string,
|
||||
text3?: string
|
||||
// top?: string,
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
show?: boolean
|
||||
timeOut?: number
|
||||
text1?: string
|
||||
text2?: string
|
||||
text3?: string
|
||||
closeOnClickOverlay?: boolean
|
||||
zIndex?: number
|
||||
}>(),
|
||||
{
|
||||
show: false,
|
||||
timeOut: 3000,
|
||||
closeOnClickOverlay: true,
|
||||
zIndex: APP_Z_MODAL,
|
||||
},
|
||||
)
|
||||
|
||||
}>(), {})
|
||||
const emit = defineEmits<{ (e: 'update:modelValue', value: boolean): void }>()
|
||||
watch(() => props.modelValue, (value) => {
|
||||
if (props.timeOut !== -1) showNotify()
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:show', value: boolean): void
|
||||
}>()
|
||||
|
||||
const show = computed({
|
||||
get: () => props.show,
|
||||
set: (value: boolean) => emit('update:show', value),
|
||||
})
|
||||
const showNotify = () => {
|
||||
console.log('notify', show.value)
|
||||
setTimeout(() => {
|
||||
emit('update:modelValue', false)
|
||||
}, props.timeOut);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.show,
|
||||
(value) => {
|
||||
if (value && props.timeOut !== -1) {
|
||||
setTimeout(() => {
|
||||
emit('update:show', false)
|
||||
}, props.timeOut)
|
||||
}
|
||||
},
|
||||
)
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
@@ -67,17 +77,13 @@ const showNotify = () => {
|
||||
animation: notify-in 0.2s reverse;
|
||||
}
|
||||
|
||||
.oneButtonDialog .van-dialog__confirm, .van-dialog__cancel {
|
||||
.oneButtonDialog .van-dialog__confirm,
|
||||
.oneButtonDialog .van-dialog__cancel {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
|
||||
.van-dialog__confirm, .van-dialog__cancel {
|
||||
//background-color: ;
|
||||
}
|
||||
|
||||
.oneButtonDialog .van-dialog__confirm .van-button__text {
|
||||
color: #1C2D56;
|
||||
color: #1c2d56;
|
||||
font-weight: 600;
|
||||
font-size: 15px;
|
||||
}
|
||||
@@ -87,4 +93,8 @@ const showNotify = () => {
|
||||
font-weight: 600;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.oneButtonDialog__body {
|
||||
color: #1e293b;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
<template>
|
||||
<a
|
||||
v-if="href && src"
|
||||
referrerpolicy="origin"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
:href="href"
|
||||
class="enamad-badge"
|
||||
:class="`enamad-badge--${size}`"
|
||||
>
|
||||
<img
|
||||
referrerpolicy="origin"
|
||||
:src="src"
|
||||
alt="enamad"
|
||||
class="enamad-badge__img"
|
||||
:code="code || undefined"
|
||||
/>
|
||||
</a>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue'
|
||||
import { useSettingsStore } from '@/store/settingsStore'
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
size?: 'sm' | 'lg'
|
||||
}>(),
|
||||
{ size: 'sm' },
|
||||
)
|
||||
|
||||
const settingsStore = useSettingsStore()
|
||||
|
||||
const href = computed(() =>
|
||||
String(settingsStore.getSettingByKey('enamad_url') ?? '').trim(),
|
||||
)
|
||||
const src = computed(() =>
|
||||
String(settingsStore.getSettingByKey('enamad_logo') ?? '').trim(),
|
||||
)
|
||||
const code = computed(() => {
|
||||
try {
|
||||
const u = new URL(href.value || src.value)
|
||||
return u.searchParams.get('Code') || u.searchParams.get('code') || ''
|
||||
} catch {
|
||||
return ''
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.enamad-badge {
|
||||
display: inline-flex;
|
||||
line-height: 0;
|
||||
}
|
||||
|
||||
.enamad-badge__img {
|
||||
width: auto;
|
||||
cursor: pointer;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.enamad-badge--sm .enamad-badge__img {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.enamad-badge--lg .enamad-badge__img {
|
||||
height: 120px;
|
||||
max-width: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,237 @@
|
||||
<template>
|
||||
<BasicModal
|
||||
v-model:visible="visible"
|
||||
width="400px"
|
||||
destroy-on-close
|
||||
custom-footer
|
||||
wrap-class-name="app-premium-modal--scroll-tall"
|
||||
>
|
||||
<template #title>
|
||||
<div class="app-premium-modal__title">
|
||||
<BasicIcon icon="vuesax-linear:calculator" size="20" class="app-premium-modal__title-icon" />
|
||||
<span>ماشین حساب</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div class="gold-day-calc" dir="rtl">
|
||||
<p class="gold-day-calc__hint text-xs text-gray-500">
|
||||
وزن مورد نظر را وارد کنید تا ارزش آن بر اساس قیمت لحظهای محاسبه شود.
|
||||
</p>
|
||||
|
||||
<BasicInput
|
||||
v-model:value="weight"
|
||||
:title="`وزن ${metalTypeLabel} (${weightUnit})`"
|
||||
type="tel"
|
||||
place-holder="مثلاً ۱۰.۵"
|
||||
inputmode="decimal"
|
||||
/>
|
||||
|
||||
<BasicInput
|
||||
:value="unitPriceInput"
|
||||
:title="`قیمت روز ${metalTypeLabel}`"
|
||||
type="tel"
|
||||
disabled
|
||||
addon-before="ریال"
|
||||
place-holder="قیمت صفحه اصلی"
|
||||
/>
|
||||
|
||||
<BasicInput
|
||||
v-model:value="feePercent"
|
||||
title="اجرت ساخت مفتول (%)"
|
||||
type="tel"
|
||||
place-holder="مثلاً ۷"
|
||||
inputmode="decimal"
|
||||
/>
|
||||
|
||||
<BasicInput
|
||||
v-model:value="profitPercent"
|
||||
title="سود مورد انتظار (%)"
|
||||
type="tel"
|
||||
place-holder="مثلاً ۵"
|
||||
inputmode="decimal"
|
||||
/>
|
||||
|
||||
<BasicInput
|
||||
v-model:value="taxPercent"
|
||||
title="مالیات ارزش افزوده (%)"
|
||||
type="tel"
|
||||
place-holder="مثلاً ۱۰"
|
||||
inputmode="decimal"
|
||||
/>
|
||||
|
||||
<div class="gold-day-calc__result rounded-xl border border-solid border-gray-200 bg-gray-50 p-3">
|
||||
<div class="text-xs text-gray-500 mb-1">کل نهایی</div>
|
||||
<div class="gold-day-calc__total text-lg font-bold text-primary">
|
||||
<span class="gold-day-calc__num">{{ formattedTotal }}</span>
|
||||
<span class="text-sm font-medium text-gray-600">ریال</span>
|
||||
</div>
|
||||
<div class="mt-2 flex flex-col gap-1 text-xs text-gray-600">
|
||||
<div class="flex justify-between gap-2">
|
||||
<span>هزینه {{ metalTypeLabel }}</span>
|
||||
<span class="gold-day-calc__num">{{ formatRial(breakdown.goldCost) }}</span>
|
||||
</div>
|
||||
<div class="flex justify-between gap-2">
|
||||
<span>اجرت ساخت مفتول</span>
|
||||
<span class="gold-day-calc__num">{{ formatRial(breakdown.feeCost) }}</span>
|
||||
</div>
|
||||
<div class="flex justify-between gap-2">
|
||||
<span>سود مورد انتظار</span>
|
||||
<span class="gold-day-calc__num">{{ formatRial(breakdown.profitCost) }}</span>
|
||||
</div>
|
||||
<div class="flex justify-between gap-2">
|
||||
<span>مالیات ارزش افزوده</span>
|
||||
<span class="gold-day-calc__num">{{ formatRial(breakdown.taxCost) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<BasicButton type="primary" class="app-premium-modal__btn-primary !w-full" size="middle" @click="recalculate">
|
||||
محاسبه مجدد
|
||||
</BasicButton>
|
||||
</template>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import BasicModal from '@/components/BasicPacks/BasicModal.vue'
|
||||
import BasicInput from '@/components/BasicPacks/BasicInput.vue'
|
||||
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||
import { goldDayCalculatorVisible } from '@/composables/useGoldDayCalculator'
|
||||
import {
|
||||
getLastPrices,
|
||||
getTradeBuyPrice,
|
||||
lastPrice,
|
||||
startLastPricePolling,
|
||||
stopLastPricePolling,
|
||||
} from '@/utils/price'
|
||||
import { getPriceDisplayState, NO_QUOTE_MESSAGE } from '@/utils/storeHours'
|
||||
import { usePriceWithoutType } from '@/utils/usePrice'
|
||||
import { persianToEnglishDigits } from '@/utils/persianDigits'
|
||||
import { useSettingsStore } from '@/store/settingsStore'
|
||||
|
||||
const visible = goldDayCalculatorVisible
|
||||
const settingsStore = useSettingsStore()
|
||||
|
||||
const metalTypeLabel = computed(() => settingsStore.metalTypeLabel)
|
||||
const weightUnit = computed(() => settingsStore.tradeWeightUnit)
|
||||
|
||||
const weight = ref<string | number>('')
|
||||
const feePercent = ref<string | number>('')
|
||||
const profitPercent = ref<string | number>('')
|
||||
const taxPercent = ref<string | number>('')
|
||||
const tick = ref(0)
|
||||
|
||||
function parseNum(raw: string | number | undefined): number {
|
||||
const s = persianToEnglishDigits(String(raw ?? ''))
|
||||
.replace(/,/g, '')
|
||||
.replace(/[^\d.]/g, '')
|
||||
const n = Number.parseFloat(s)
|
||||
return Number.isFinite(n) ? n : 0
|
||||
}
|
||||
|
||||
const liveUnitPrice = computed(() => {
|
||||
void tick.value
|
||||
if (getPriceDisplayState() !== 'open') return 0
|
||||
return getTradeBuyPrice(lastPrice.value) || 0
|
||||
})
|
||||
|
||||
const unitPriceInput = computed(() => {
|
||||
void tick.value
|
||||
const state = getPriceDisplayState()
|
||||
if (state === 'closed') return 'فروشگاه بسته است'
|
||||
if (state === 'no_quote') return NO_QUOTE_MESSAGE
|
||||
const p = liveUnitPrice.value
|
||||
return p > 0 ? usePriceWithoutType(p) : ''
|
||||
})
|
||||
|
||||
const breakdown = computed(() => {
|
||||
void tick.value
|
||||
const w = parseNum(weight.value)
|
||||
const fee = parseNum(feePercent.value)
|
||||
const profit = parseNum(profitPercent.value)
|
||||
const tax = parseNum(taxPercent.value)
|
||||
const unit = liveUnitPrice.value
|
||||
const goldCost = w * unit
|
||||
const feeCost = goldCost * (fee / 100)
|
||||
const afterFee = goldCost + feeCost
|
||||
const profitCost = afterFee * (profit / 100)
|
||||
const taxCost = (afterFee + profitCost) * (tax / 100)
|
||||
const total = afterFee + profitCost + taxCost
|
||||
return { goldCost, feeCost, profitCost, taxCost, total }
|
||||
})
|
||||
|
||||
const formattedTotal = computed(() => formatRial(breakdown.value.total))
|
||||
|
||||
function formatRial(n: number) {
|
||||
if (!Number.isFinite(n) || n <= 0) return '۰'
|
||||
return usePriceWithoutType(Math.round(n))
|
||||
}
|
||||
|
||||
function recalculate() {
|
||||
tick.value += 1
|
||||
void getLastPrices()
|
||||
}
|
||||
|
||||
watch(visible, async (open) => {
|
||||
if (open) {
|
||||
startLastPricePolling()
|
||||
await getLastPrices()
|
||||
tick.value += 1
|
||||
} else {
|
||||
stopLastPricePolling()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.gold-day-calc {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
direction: rtl;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.gold-day-calc :deep(.ant-input-group) {
|
||||
direction: ltr;
|
||||
display: table;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.gold-day-calc :deep(.ant-input-group > .ant-input) {
|
||||
direction: ltr;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.gold-day-calc :deep(.ant-input:not(.ant-input-group *)) {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.gold-day-calc__hint {
|
||||
margin: 0;
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
.gold-day-calc__result {
|
||||
direction: rtl;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.gold-day-calc__total {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: baseline;
|
||||
justify-content: flex-start;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
|
||||
.gold-day-calc__num {
|
||||
direction: ltr;
|
||||
unicode-bidi: isolate;
|
||||
display: inline-block;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,46 @@
|
||||
<template>
|
||||
<van-dialog
|
||||
v-model:show="open"
|
||||
class="completeButtonStyle"
|
||||
confirm-button-text="تکمیل اطلاعات"
|
||||
show-confirm-button
|
||||
@confirm="goProfile"
|
||||
>
|
||||
<div class="flex flex-col items-center p-2">
|
||||
<BasicIcon color="orange" icon="vuesax-linear:info-circle" size="50" />
|
||||
<div class="mt-2 text-center">{{ message }}</div>
|
||||
</div>
|
||||
</van-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue'
|
||||
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||
import router from '@/router'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
show?: boolean
|
||||
action?: string
|
||||
}>(),
|
||||
{ show: false, action: 'این کار' },
|
||||
)
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:show': [value: boolean]
|
||||
}>()
|
||||
|
||||
const open = computed({
|
||||
get: () => props.show,
|
||||
set: (value: boolean) => emit('update:show', value),
|
||||
})
|
||||
|
||||
const message = computed(
|
||||
() =>
|
||||
`برای ${props.action}، لطفا اطلاعات خود را تکمیل کنید یا در صورت تکمیل اطلاعات، منتظر تایید اطلاعات خود بمانید.`,
|
||||
)
|
||||
|
||||
function goProfile() {
|
||||
router.push({ name: 'user' })
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<div v-if="showInstallEntry" class="mt-2 w-full">
|
||||
<BasicButton class="!w-full" @click="onClick">
|
||||
{{ canNativeInstall ? 'نصب وب اپلیکیشن' : 'آموزش نصب' }}
|
||||
</BasicButton>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, onUnmounted, ref } from 'vue'
|
||||
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||
import { usePwaInstall } from '@/composables/usePwaInstall'
|
||||
import { PWA_MANIFEST_READY_EVENT } from '@/modules/pwa/manifest'
|
||||
import {
|
||||
hasNativeInstallPrompt,
|
||||
initPwaInstallPromptListener,
|
||||
} from '@/modules/pwa/pwaInstall'
|
||||
|
||||
const { tryInstallOrOpenGuide, showInstallEntry } = usePwaInstall()
|
||||
const canNativeInstall = ref(false)
|
||||
|
||||
function refreshCanInstall() {
|
||||
canNativeInstall.value = hasNativeInstallPrompt()
|
||||
}
|
||||
|
||||
async function onClick() {
|
||||
await tryInstallOrOpenGuide()
|
||||
refreshCanInstall()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
initPwaInstallPromptListener()
|
||||
refreshCanInstall()
|
||||
window.addEventListener(PWA_MANIFEST_READY_EVENT, refreshCanInstall)
|
||||
window.addEventListener('appinstalled', refreshCanInstall)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener(PWA_MANIFEST_READY_EVENT, refreshCanInstall)
|
||||
window.removeEventListener('appinstalled', refreshCanInstall)
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,64 @@
|
||||
<template>
|
||||
<img
|
||||
:src="currentSrc"
|
||||
:class="[imgClass, dimmed && 'product-image--dimmed']"
|
||||
:alt="alt"
|
||||
@error="handleError"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from 'vue'
|
||||
import { getProductDisplayImage } from '@/utils/productAssets'
|
||||
import type { Product } from '@/models/products'
|
||||
import defaultImg from '@/assets/img/coin.png'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
product?: Product | null
|
||||
imgClass?: string
|
||||
alt?: string
|
||||
dimmed?: boolean
|
||||
}>(),
|
||||
{
|
||||
imgClass: 'max-h-full max-w-full object-contain',
|
||||
alt: '',
|
||||
dimmed: false,
|
||||
},
|
||||
)
|
||||
|
||||
function productImageKey(product?: Product | null): string {
|
||||
return [
|
||||
product?.file_id ?? '',
|
||||
product?.file?.id ?? '',
|
||||
product?.file?.full_src ?? '',
|
||||
product?.file?.src ?? '',
|
||||
product?.file?.url ?? '',
|
||||
product?.img ?? '',
|
||||
].join('|')
|
||||
}
|
||||
|
||||
const currentSrc = ref(getProductDisplayImage(props.product) || defaultImg)
|
||||
const usingFallback = ref(false)
|
||||
|
||||
watch(
|
||||
() => productImageKey(props.product),
|
||||
() => {
|
||||
usingFallback.value = false
|
||||
currentSrc.value = getProductDisplayImage(props.product) || defaultImg
|
||||
},
|
||||
)
|
||||
|
||||
function handleError() {
|
||||
if (usingFallback.value) return
|
||||
usingFallback.value = true
|
||||
currentSrc.value = defaultImg
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.product-image--dimmed {
|
||||
opacity: 0.45;
|
||||
filter: grayscale(1);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,135 @@
|
||||
<template>
|
||||
<BasicModal
|
||||
v-model:visible="visible"
|
||||
custom-footer
|
||||
:closable="false"
|
||||
:width="modalWidth"
|
||||
wrap-class-name="required-kyc-modal-wrap"
|
||||
:z-index="99999"
|
||||
>
|
||||
<div class="kyc-modal-content text-center py-2" dir="rtl">
|
||||
<!-- Icon with soft glowing background -->
|
||||
<div class="inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-amber-50 text-amber-600 border border-amber-200 mb-4 shadow-sm">
|
||||
<BasicIcon icon="vuesax-linear:security-user" size="36" color="#d97706" />
|
||||
</div>
|
||||
|
||||
<!-- Title -->
|
||||
<h2 class="text-base font-bold text-slate-800 mb-2">
|
||||
احراز هویت الزامی است
|
||||
</h2>
|
||||
|
||||
<!-- Description: شیک، کوتاه، مختصر و مفید -->
|
||||
<p class="text-xs text-slate-600 leading-6 max-w-xs mx-auto mb-5">
|
||||
کاربر گرامی، جهت استفاده از کلیه امکانات سامانه و شروع معاملات، لطفاً ابتدا فرایند احراز هویت خود را تکمیل فرمایید.
|
||||
</p>
|
||||
|
||||
<!-- Tip info box -->
|
||||
<div class="bg-amber-50/70 border border-amber-200/80 rounded-xl p-3 text-right text-xs text-amber-900 mb-5 space-y-1.5">
|
||||
<div class="flex items-center gap-2">
|
||||
<BasicIcon icon="vuesax-linear:tick-circle" size="16" color="#d97706" class="shrink-0" />
|
||||
<span>استعلام و تایید آنی مشخصات از طریق سامانه ثبت احوال</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<BasicIcon icon="vuesax-linear:tick-circle" size="16" color="#d97706" class="shrink-0" />
|
||||
<span>کد ملی وارد شده باید متعلق به مالک شماره موبایل باشد</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Action buttons -->
|
||||
<div class="flex flex-col gap-2.5">
|
||||
<BasicButton
|
||||
type="primary"
|
||||
class="w-full h-11 text-sm font-semibold !rounded-xl flex items-center justify-center gap-2"
|
||||
@click="goToKyc"
|
||||
>
|
||||
<span>تکمیل و احراز هویت</span>
|
||||
<BasicIcon icon="vuesax-linear:arrow-left" size="16" />
|
||||
</BasicButton>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="text-xs text-red-600 hover:text-red-700 flex items-center justify-center gap-1.5 py-1.5 cursor-pointer transition-colors"
|
||||
@click="onLogout"
|
||||
>
|
||||
<BasicIcon icon="vuesax-linear:logout" size="14" color="#dc2626" />
|
||||
<span>خروج از حساب کاربری</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, onMounted, ref, watch } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import BasicModal from '@/components/BasicPacks/BasicModal.vue'
|
||||
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||
import { useUserStore } from '@/store/userStore'
|
||||
import { getToken } from '@/utils'
|
||||
import { performUserLogout } from '@/utils/authSession'
|
||||
import { useDesktopBreakpoint } from '@/layouts/composables/useAppLayout'
|
||||
import { isCustomerIdentityVerified } from '@/utils/customerIdentity'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const userStore = useUserStore()
|
||||
const isDesktop = useDesktopBreakpoint()
|
||||
|
||||
const modalWidth = computed(() => (isDesktop.value ? '420px' : '90vw'))
|
||||
|
||||
const isKycRequired = computed(() => {
|
||||
if (!getToken()) return false
|
||||
if (route.name === 'login' || route.name === 'tvMonitor' || route.name === 'aboutSoftware' || route.name === 'user') {
|
||||
return false
|
||||
}
|
||||
const info = userStore.userInfo
|
||||
if (!info) return false
|
||||
return !isCustomerIdentityVerified(info.is_legal)
|
||||
})
|
||||
|
||||
const visible = ref(false)
|
||||
|
||||
watch(
|
||||
isKycRequired,
|
||||
(val) => {
|
||||
visible.value = Boolean(val)
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
onMounted(async () => {
|
||||
if (getToken() && !userStore.userInfo) {
|
||||
try {
|
||||
await userStore.getMyInfo()
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
visible.value = Boolean(isKycRequired.value)
|
||||
})
|
||||
|
||||
function goToKyc() {
|
||||
visible.value = false
|
||||
void router.push({ name: 'user', query: { showEdit: 'true' } })
|
||||
}
|
||||
|
||||
async function onLogout() {
|
||||
visible.value = false
|
||||
await performUserLogout()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.required-kyc-modal-wrap {
|
||||
.ant-modal-content {
|
||||
border-radius: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style scoped>
|
||||
.kyc-modal-content {
|
||||
font-family: inherit;
|
||||
}
|
||||
</style>
|
||||
@@ -1,32 +1,100 @@
|
||||
<template>
|
||||
<div :class="variant === 'desktop' ? 'dpage-support' : 'wrap-fix bottom-0 px-10 pb-3rem flex gap-2 bg-white'">
|
||||
<a
|
||||
class="w-full"
|
||||
:href="supportHref"
|
||||
:target="opensSupportInNewTab ? '_blank' : undefined"
|
||||
:rel="opensSupportInNewTab ? 'noopener noreferrer' : undefined"
|
||||
<div :class="variant === 'desktop' ? desktopRootClass : mobileRootClass">
|
||||
<button
|
||||
ref="triggerEl"
|
||||
type="button"
|
||||
class="support-contact-bar__btn"
|
||||
:disabled="!canContactSupport"
|
||||
@click="onSupportClick"
|
||||
>
|
||||
<BasicButton class="w-full" type="primary">تماس با پشتیبانی</BasicButton>
|
||||
</a>
|
||||
<a :href="baleHref" target="_blank" rel="noopener noreferrer">
|
||||
<img src="@/assets/img/bale.png" alt="بله" :class="variant === 'desktop' ? 'dpage-support__bale' : 'h-10 w-10'" />
|
||||
</a>
|
||||
<BasicIcon icon="vuesax-linear:messages-2" size="20" color="#fff" />
|
||||
<span>ارتباط با پشتیبانی</span>
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue'
|
||||
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||
import { getProjectBaleContactLink, getProjectSupportContactLink } from '@/utils/config'
|
||||
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||
import { useSupportMessenger } from '@/composables/useSupportMessenger'
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
variant?: 'mobile' | 'desktop'
|
||||
mobileRootClass?: string
|
||||
desktopRootClass?: string
|
||||
}>(),
|
||||
{ variant: 'mobile' },
|
||||
{
|
||||
variant: 'mobile',
|
||||
mobileRootClass: 'wrap-fix bottom-0 px-10 pb-3rem flex bg-white',
|
||||
desktopRootClass: 'dpage-support',
|
||||
},
|
||||
)
|
||||
|
||||
const supportHref = computed(() => getProjectSupportContactLink())
|
||||
const baleHref = computed(() => getProjectBaleContactLink())
|
||||
const opensSupportInNewTab = computed(() => supportHref.value.startsWith('http'))
|
||||
const {
|
||||
supportPhoneLink,
|
||||
hasMessengerLink,
|
||||
hasSupportPhoneLink,
|
||||
openSupportMessenger,
|
||||
} = useSupportMessenger()
|
||||
|
||||
const triggerEl = ref<HTMLElement | null>(null)
|
||||
|
||||
const canContactSupport = computed(() => hasMessengerLink.value || hasSupportPhoneLink.value)
|
||||
|
||||
async function onSupportClick() {
|
||||
// همان رفتار دکمه شناور پشتیبانی — بدون پیشنویس واریز
|
||||
if (hasMessengerLink.value) {
|
||||
await openSupportMessenger(triggerEl.value)
|
||||
return
|
||||
}
|
||||
|
||||
if (hasSupportPhoneLink.value && supportPhoneLink.value) {
|
||||
window.location.href = supportPhoneLink.value
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.support-contact-bar__btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.5rem;
|
||||
width: 100%;
|
||||
min-height: 2.75rem;
|
||||
padding: 0.65rem 1rem;
|
||||
border: 0;
|
||||
border-radius: 0.75rem;
|
||||
background: var(--App-primary, var(--ant-color-primary, #7f1d1d));
|
||||
color: #fff;
|
||||
font-size: 0.9375rem;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: opacity 0.15s ease, transform 0.15s ease;
|
||||
|
||||
&:active {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.55;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
|
||||
.dpage-support {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
<template>
|
||||
<span
|
||||
class="block w-full h-full rounded-full overflow-hidden shrink-0 bg-slate-500"
|
||||
:class="{ 'bg-[#e37600]': normalized === 'eitaa' }"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<img
|
||||
v-if="logoSrc"
|
||||
:src="logoSrc"
|
||||
:alt="normalized"
|
||||
class="block w-full h-full object-cover object-center bg-white"
|
||||
draggable="false"
|
||||
/>
|
||||
<span v-else class="block w-full h-full bg-slate-500" />
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue'
|
||||
import baleLogo from '@/assets/messengers/bale.png'
|
||||
import callLogo from '@/assets/messengers/call.svg'
|
||||
import eitaaLogo from '@/assets/messengers/eitaa.png'
|
||||
import rubikaLogo from '@/assets/messengers/rubika.png'
|
||||
import smsLogo from '@/assets/messengers/sms.svg'
|
||||
import soroushLogo from '@/assets/messengers/soroush.svg'
|
||||
import telegramLogo from '@/assets/messengers/telegram.svg'
|
||||
import whatsappLogo from '@/assets/messengers/whatsapp.svg'
|
||||
|
||||
const LOGOS: Record<string, string> = {
|
||||
bale: baleLogo,
|
||||
telegram: telegramLogo,
|
||||
whatsapp: whatsappLogo,
|
||||
rubika: rubikaLogo,
|
||||
eitaa: eitaaLogo,
|
||||
soroush: soroushLogo,
|
||||
call: callLogo,
|
||||
sms: smsLogo,
|
||||
}
|
||||
|
||||
const props = defineProps<{ messenger: string }>()
|
||||
const normalized = computed(() => (props.messenger ?? '').trim().toLowerCase())
|
||||
const logoSrc = computed(() => LOGOS[normalized.value])
|
||||
</script>
|
||||
@@ -0,0 +1,266 @@
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<Transition name="support-picker-fade">
|
||||
<div
|
||||
v-if="open"
|
||||
class="fixed inset-0 bg-slate-900/20"
|
||||
:class="backdropActive ? 'pointer-events-auto' : 'pointer-events-none'"
|
||||
:style="{ zIndex: pickerZIndex }"
|
||||
@click="onBackdropClick"
|
||||
/>
|
||||
</Transition>
|
||||
|
||||
<div
|
||||
v-show="open || closing"
|
||||
class="fixed flex pointer-events-none"
|
||||
:class="expandUp ? 'flex-col-reverse' : 'flex-col'"
|
||||
:style="{ ...stackStyle, zIndex: stackZIndex }"
|
||||
role="menu"
|
||||
aria-label="انتخاب پیامرسان"
|
||||
>
|
||||
<div
|
||||
class="support-picker-panel pointer-events-auto flex flex-col gap-2 rounded-2xl p-1 shadow-lg"
|
||||
:class="{ 'is-open': panelOpen }"
|
||||
>
|
||||
<button
|
||||
v-for="(entry, index) in entries"
|
||||
:key="`${entry.messenger}-${entry.id}`"
|
||||
type="button"
|
||||
class="support-picker-item m-0 border-0 bg-transparent p-0 cursor-pointer"
|
||||
:style="{ '--i': index, '--total': entries.length }"
|
||||
:title="entry.label"
|
||||
:aria-label="entry.label"
|
||||
@click.stop="select(entry)"
|
||||
>
|
||||
<span class="support-picker-item-inner inline-flex items-center gap-2 min-h-[38px] rounded-full bg-white shadow-md py-1 pl-3 pr-1 w-full">
|
||||
<span class="block w-[30px] h-[30px] shrink-0 flex items-center justify-center">
|
||||
<BasicIcon
|
||||
v-if="entry.messenger === 'chat'"
|
||||
:icon="entry.icon || 'vuesax-linear:messages-2'"
|
||||
size="22"
|
||||
:color="entry.accent || '#16a34a'"
|
||||
/>
|
||||
<SupportMessengerBrandIcon v-else :messenger="entry.messenger" />
|
||||
</span>
|
||||
<span class="text-sm font-600 text-slate-800 whitespace-nowrap leading-none">
|
||||
{{ entry.label }}
|
||||
</span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { nextTick, onBeforeUnmount, ref, watch } from 'vue'
|
||||
import SupportMessengerBrandIcon from '@/components/SupportMessengerBrandIcon.vue'
|
||||
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||
import type { ResolvedSupportMessengerEntry } from '@/utils/supportMessenger'
|
||||
import { APP_Z_SUPPORT_PICKER } from '@/utils/zIndex'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
open: boolean
|
||||
entries: ResolvedSupportMessengerEntry[]
|
||||
anchorEl?: HTMLElement | null
|
||||
}>(),
|
||||
{
|
||||
anchorEl: null,
|
||||
},
|
||||
)
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:open': [value: boolean]
|
||||
select: [entry: ResolvedSupportMessengerEntry]
|
||||
}>()
|
||||
|
||||
const ITEM_H = 46
|
||||
const GAP = 8
|
||||
const PANEL_PAD = 24
|
||||
const STACK_GAP = 10
|
||||
const EDGE_PAD = 12
|
||||
const CLOSE_MS = 220
|
||||
const BACKDROP_GUARD_MS = 380
|
||||
const pickerZIndex = APP_Z_SUPPORT_PICKER
|
||||
const stackZIndex = APP_Z_SUPPORT_PICKER + 10
|
||||
|
||||
const stackStyle = ref<Record<string, string>>({})
|
||||
const closing = ref(false)
|
||||
const expandUp = ref(true)
|
||||
const backdropActive = ref(false)
|
||||
/** یک فریم بعد از open تا transition باز شدن دیده شود */
|
||||
const panelOpen = ref(false)
|
||||
let closeTimer: ReturnType<typeof setTimeout> | null = null
|
||||
let backdropTimer: ReturnType<typeof setTimeout> | null = null
|
||||
let openRaf = 0
|
||||
|
||||
function close() {
|
||||
emit('update:open', false)
|
||||
}
|
||||
|
||||
function select(entry: ResolvedSupportMessengerEntry) {
|
||||
emit('select', entry)
|
||||
close()
|
||||
}
|
||||
|
||||
function clearTimers() {
|
||||
if (closeTimer) {
|
||||
clearTimeout(closeTimer)
|
||||
closeTimer = null
|
||||
}
|
||||
if (backdropTimer) {
|
||||
clearTimeout(backdropTimer)
|
||||
backdropTimer = null
|
||||
}
|
||||
if (openRaf) {
|
||||
cancelAnimationFrame(openRaf)
|
||||
openRaf = 0
|
||||
}
|
||||
}
|
||||
|
||||
function onBackdropClick() {
|
||||
if (!backdropActive.value) return
|
||||
close()
|
||||
}
|
||||
|
||||
function armBackdropGuard() {
|
||||
backdropActive.value = false
|
||||
if (backdropTimer) clearTimeout(backdropTimer)
|
||||
backdropTimer = setTimeout(() => {
|
||||
backdropActive.value = true
|
||||
backdropTimer = null
|
||||
}, BACKDROP_GUARD_MS)
|
||||
}
|
||||
|
||||
function schedulePanelOpen() {
|
||||
panelOpen.value = false
|
||||
openRaf = requestAnimationFrame(() => {
|
||||
openRaf = requestAnimationFrame(() => {
|
||||
panelOpen.value = true
|
||||
openRaf = 0
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
async function reposition() {
|
||||
await nextTick()
|
||||
|
||||
const anchor = props.anchorEl
|
||||
const count = props.entries.length
|
||||
if (!anchor || count === 0) {
|
||||
expandUp.value = true
|
||||
stackStyle.value = {
|
||||
top: '50%',
|
||||
left: '50%',
|
||||
transform: 'translate(-50%, -50%)',
|
||||
right: 'auto',
|
||||
bottom: 'auto',
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
const rect = anchor.getBoundingClientRect()
|
||||
const stackHeight = count * ITEM_H + Math.max(0, count - 1) * GAP + PANEL_PAD
|
||||
const right = Math.max(EDGE_PAD, window.innerWidth - rect.right)
|
||||
const spaceAbove = rect.top
|
||||
const spaceBelow = window.innerHeight - rect.bottom
|
||||
expandUp.value = spaceAbove >= stackHeight + 24 || spaceAbove >= spaceBelow
|
||||
|
||||
if (expandUp.value) {
|
||||
stackStyle.value = {
|
||||
right: `${right}px`,
|
||||
bottom: `${Math.max(EDGE_PAD, window.innerHeight - rect.top + STACK_GAP)}px`,
|
||||
left: 'auto',
|
||||
top: 'auto',
|
||||
transform: 'none',
|
||||
}
|
||||
} else {
|
||||
stackStyle.value = {
|
||||
right: `${right}px`,
|
||||
top: `${Math.max(EDGE_PAD, rect.bottom + STACK_GAP)}px`,
|
||||
left: 'auto',
|
||||
bottom: 'auto',
|
||||
transform: 'none',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.open,
|
||||
async (isOpen) => {
|
||||
clearTimers()
|
||||
if (isOpen) {
|
||||
closing.value = false
|
||||
panelOpen.value = false
|
||||
armBackdropGuard()
|
||||
await reposition()
|
||||
await nextTick()
|
||||
schedulePanelOpen()
|
||||
return
|
||||
}
|
||||
|
||||
panelOpen.value = false
|
||||
backdropActive.value = false
|
||||
closing.value = true
|
||||
const delay = CLOSE_MS + Math.max(0, props.entries.length - 1) * 28
|
||||
closeTimer = setTimeout(() => {
|
||||
closing.value = false
|
||||
closeTimer = null
|
||||
}, delay)
|
||||
},
|
||||
{ flush: 'post' },
|
||||
)
|
||||
|
||||
watch(
|
||||
() => [props.entries.length, props.anchorEl] as const,
|
||||
() => {
|
||||
if (props.open) void reposition()
|
||||
},
|
||||
)
|
||||
|
||||
function onViewportChange() {
|
||||
if (props.open || closing.value) void reposition()
|
||||
}
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
window.addEventListener('resize', onViewportChange, { passive: true })
|
||||
window.addEventListener('scroll', onViewportChange, { passive: true, capture: true })
|
||||
}
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
clearTimers()
|
||||
if (typeof window === 'undefined') return
|
||||
window.removeEventListener('resize', onViewportChange, { capture: true })
|
||||
window.removeEventListener('scroll', onViewportChange, { capture: true })
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* انیمیشن باز/بسته — فقط جایی که utility کافی نیست */
|
||||
.support-picker-item {
|
||||
--i: 0;
|
||||
opacity: 0;
|
||||
transform: translateY(12px) scale(0.92);
|
||||
transform-origin: right center;
|
||||
transition:
|
||||
transform 0.22s cubic-bezier(0.2, 1, 0.3, 1),
|
||||
opacity 0.16s ease;
|
||||
transition-delay: calc(var(--i) * 38ms);
|
||||
}
|
||||
|
||||
.support-picker-panel.is-open .support-picker-item {
|
||||
opacity: 1;
|
||||
transform: translateY(0) scale(1);
|
||||
}
|
||||
|
||||
.support-picker-fade-enter-active,
|
||||
.support-picker-fade-leave-active {
|
||||
transition: opacity 0.16s ease;
|
||||
}
|
||||
|
||||
.support-picker-fade-enter-from,
|
||||
.support-picker-fade-leave-to {
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,229 @@
|
||||
<template>
|
||||
<div class="trade-fee-summary">
|
||||
<div class="trade-fee-summary__quote">
|
||||
<div class="trade-fee-summary__label">قیمت هر {{ weightUnit }}</div>
|
||||
<div class="trade-fee-summary__value trade-fee-summary__value--strong">
|
||||
<span>{{ formattedUnitPrice }}</span>
|
||||
<span class="trade-fee-summary__unit">ریال</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-for="(section, index) in breakdown.sections"
|
||||
:key="section.heading"
|
||||
class="trade-fee-summary__section"
|
||||
:class="{ 'trade-fee-summary__section--divided': index > 0 }"
|
||||
>
|
||||
<div class="trade-fee-summary__heading">{{ section.heading }}</div>
|
||||
|
||||
<div
|
||||
v-for="(row, rowIndex) in section.rows"
|
||||
:key="`${section.heading}-${rowIndex}`"
|
||||
class="trade-fee-summary__row"
|
||||
:class="{
|
||||
'trade-fee-summary__row--divider': row.dividerBefore,
|
||||
'trade-fee-summary__row--bold': row.bold,
|
||||
}"
|
||||
>
|
||||
<div
|
||||
class="trade-fee-summary__label"
|
||||
:class="{ 'trade-fee-summary__label--strong': row.bold }"
|
||||
>
|
||||
<span v-if="row.plus" class="trade-fee-summary__sign trade-fee-summary__sign--plus">+</span>
|
||||
<span v-else-if="row.minus && !row.bold" class="trade-fee-summary__sign trade-fee-summary__sign--minus">−</span>
|
||||
{{ row.label }}
|
||||
</div>
|
||||
<div
|
||||
class="trade-fee-summary__value"
|
||||
:class="{
|
||||
'trade-fee-summary__value--minus': row.minus && !row.bold,
|
||||
'trade-fee-summary__value--plus': row.plus,
|
||||
'trade-fee-summary__value--strong': row.bold,
|
||||
}"
|
||||
>
|
||||
<template v-if="row.gram != null">
|
||||
<span>{{ formatTradeGramDisplay(row.gram) }}</span>
|
||||
<span class="trade-fee-summary__unit">{{ weightUnit }}</span>
|
||||
</template>
|
||||
<template v-else-if="row.rial != null">
|
||||
<span v-if="row.minus && row.bold">−</span>
|
||||
<span>{{ formatRial(row.rial) }}</span>
|
||||
<span class="trade-fee-summary__unit">ریال</span>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="section.footnote" class="trade-fee-summary__footnote">
|
||||
{{ section.footnote }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue'
|
||||
import { usePriceWithoutType } from '@/utils/usePrice'
|
||||
import {
|
||||
buildTradeConfirmBreakdown,
|
||||
formatTradeGramDisplay,
|
||||
type TradeInputLock,
|
||||
} from '@/utils/serviceFee'
|
||||
|
||||
const props = defineProps<{
|
||||
isBuy: boolean
|
||||
inputLock: TradeInputLock
|
||||
displayTradeGoldAmount: number | string
|
||||
weightUnit: string
|
||||
unitPriceRial: number
|
||||
feeInGrams: number
|
||||
equivalentPrice: string
|
||||
payablePrice: number
|
||||
orderGoldAmount: number
|
||||
feeInRial: number
|
||||
sellGoldDebit?: number
|
||||
}>()
|
||||
|
||||
const formattedUnitPrice = computed(() =>
|
||||
usePriceWithoutType(Math.round(props.unitPriceRial)),
|
||||
)
|
||||
|
||||
function formatRial(value: number) {
|
||||
return usePriceWithoutType(Math.round(value))
|
||||
}
|
||||
|
||||
const breakdown = computed(() =>
|
||||
buildTradeConfirmBreakdown({
|
||||
isBuy: props.isBuy,
|
||||
inputLock: props.inputLock,
|
||||
orderGoldAmount: props.orderGoldAmount,
|
||||
feeInGrams: props.feeInGrams,
|
||||
feeInRial: props.feeInRial,
|
||||
payablePrice: props.payablePrice,
|
||||
unitPriceRial: props.unitPriceRial,
|
||||
sellGoldDebit: props.sellGoldDebit,
|
||||
metalName: 'مس',
|
||||
weightUnit: props.weightUnit || 'کیلوگرم',
|
||||
}),
|
||||
)
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.trade-fee-summary {
|
||||
width: 100%;
|
||||
padding: 0.75rem;
|
||||
border-radius: 0.75rem;
|
||||
background: var(--app-surface-inset, var(--app-surface));
|
||||
border: 1px solid var(--app-border);
|
||||
}
|
||||
|
||||
.trade-fee-summary__quote {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.75rem;
|
||||
padding-bottom: 0.75rem;
|
||||
border-bottom: 1px solid var(--app-border);
|
||||
}
|
||||
|
||||
.trade-fee-summary__section {
|
||||
margin-top: 0.75rem;
|
||||
|
||||
&--divided {
|
||||
padding-top: 0.75rem;
|
||||
border-top: 1px solid var(--app-border);
|
||||
}
|
||||
}
|
||||
|
||||
.trade-fee-summary__heading {
|
||||
margin-bottom: 0.5rem;
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 700;
|
||||
color: var(--app-text-primary);
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.trade-fee-summary__row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.75rem;
|
||||
padding: 0.25rem 0;
|
||||
|
||||
&--divider {
|
||||
margin-top: 0.25rem;
|
||||
padding-top: 0.5rem;
|
||||
border-top: 1px dashed var(--app-border);
|
||||
}
|
||||
|
||||
&--bold {
|
||||
font-size: 0.9375rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
|
||||
.trade-fee-summary__label {
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 500;
|
||||
color: var(--app-text-secondary);
|
||||
text-align: right;
|
||||
|
||||
&--strong {
|
||||
font-weight: 700;
|
||||
color: var(--app-text-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.trade-fee-summary__value {
|
||||
display: inline-flex;
|
||||
align-items: baseline;
|
||||
gap: 0.25rem;
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 600;
|
||||
color: var(--app-text-primary);
|
||||
text-align: left;
|
||||
direction: ltr;
|
||||
|
||||
&--strong {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
&--minus {
|
||||
color: var(--app-down, #ef4444);
|
||||
}
|
||||
|
||||
&--plus {
|
||||
color: var(--app-up, #22c55e);
|
||||
}
|
||||
}
|
||||
|
||||
.trade-fee-summary__unit {
|
||||
font-size: 0.6875rem;
|
||||
font-weight: 500;
|
||||
color: var(--app-text-muted);
|
||||
}
|
||||
|
||||
.trade-fee-summary__sign {
|
||||
margin-left: 0.25rem;
|
||||
|
||||
&--plus {
|
||||
color: var(--app-up, #22c55e);
|
||||
}
|
||||
|
||||
&--minus {
|
||||
color: var(--app-down, #ef4444);
|
||||
}
|
||||
}
|
||||
|
||||
.trade-fee-summary__footnote {
|
||||
margin-top: 0.5rem;
|
||||
padding: 0.5rem 0.625rem;
|
||||
border-radius: 0.625rem;
|
||||
background: var(--app-surface, rgba(255, 255, 255, 0.04));
|
||||
border: 1px solid var(--app-border);
|
||||
font-size: 0.75rem;
|
||||
font-weight: 500;
|
||||
line-height: 1.7;
|
||||
color: var(--app-text-secondary);
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,70 @@
|
||||
<script setup lang="ts">
|
||||
defineProps<{
|
||||
visible: boolean
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
install: []
|
||||
dismiss: []
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Transition name="pwa-install-banner">
|
||||
<button
|
||||
v-if="visible"
|
||||
type="button"
|
||||
class="pwa-install-banner"
|
||||
@click="emit('install')"
|
||||
>
|
||||
نصب وب اپلیکیشن
|
||||
</button>
|
||||
</Transition>
|
||||
</template>
|
||||
|
||||
<style scoped lang="less">
|
||||
.pwa-install-banner {
|
||||
position: fixed;
|
||||
left: 50%;
|
||||
z-index: 5095;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: fit-content;
|
||||
max-width: calc(100% - 24px);
|
||||
padding: 10px 18px;
|
||||
border-radius: 999px;
|
||||
background: #fff;
|
||||
border: 1px solid rgba(15, 23, 42, 0.08);
|
||||
box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
color: @App-primary-color;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
transform: translateX(-50%);
|
||||
bottom: calc(var(--app-bottom-chrome-height, 108px) + 8px);
|
||||
}
|
||||
|
||||
@media screen and (min-width: 768px) {
|
||||
.pwa-install-banner {
|
||||
/* بالاتر از متن نسخه در پنل برند لاگین */
|
||||
bottom: 64px;
|
||||
}
|
||||
|
||||
html.app-layout--desktop:not(.app-layout--desktop-no-sidebar) .pwa-install-banner {
|
||||
left: calc(50% - var(--app-desktop-sidebar-width, 260px) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
.pwa-install-banner-enter-active,
|
||||
.pwa-install-banner-leave-active {
|
||||
transition: opacity 0.2s ease, transform 0.2s ease;
|
||||
}
|
||||
|
||||
.pwa-install-banner-enter-from,
|
||||
.pwa-install-banner-leave-to {
|
||||
opacity: 0;
|
||||
transform: translate(-50%, 12px);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,383 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||
import {
|
||||
PWA_GUIDE_STEP_LABELS,
|
||||
PWA_INSTALL_GUIDE,
|
||||
type PwaPlatform,
|
||||
} from '@/modules/pwa/pwaInstallGuideSteps'
|
||||
import { getDefaultPwaPlatform } from '@/modules/pwa/pwaInstall'
|
||||
import PwaInstallStepIllustration from '@/components/pwa/PwaInstallStepIllustration.vue'
|
||||
|
||||
const props = defineProps<{
|
||||
open: boolean
|
||||
platform?: PwaPlatform
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:open': [value: boolean]
|
||||
complete: []
|
||||
close: []
|
||||
}>()
|
||||
|
||||
function normalizePlatform(value?: string | null): PwaPlatform {
|
||||
return value === 'ios' || value === 'android' ? value : getDefaultPwaPlatform()
|
||||
}
|
||||
|
||||
const activePlatform = ref<PwaPlatform>(normalizePlatform(props.platform))
|
||||
const stepIndex = ref(0)
|
||||
|
||||
const guide = computed(
|
||||
() => PWA_INSTALL_GUIDE[normalizePlatform(activePlatform.value)] ?? PWA_INSTALL_GUIDE.android,
|
||||
)
|
||||
const currentStep = computed(() => guide.value.steps[stepIndex.value] ?? guide.value.steps[0])
|
||||
const totalSteps = computed(() => guide.value.steps.length)
|
||||
const isFirstStep = computed(() => stepIndex.value === 0)
|
||||
const isLastStep = computed(() => stepIndex.value === totalSteps.value - 1)
|
||||
const stepLabel = computed(() => PWA_GUIDE_STEP_LABELS[stepIndex.value] ?? String(stepIndex.value + 1))
|
||||
|
||||
watch(
|
||||
() => props.open,
|
||||
(visible) => {
|
||||
if (!visible) return
|
||||
activePlatform.value = normalizePlatform(props.platform)
|
||||
stepIndex.value = 0
|
||||
},
|
||||
)
|
||||
|
||||
watch(
|
||||
() => props.platform,
|
||||
(value) => {
|
||||
if (value) activePlatform.value = normalizePlatform(value)
|
||||
},
|
||||
)
|
||||
|
||||
function close() {
|
||||
emit('update:open', false)
|
||||
emit('close')
|
||||
}
|
||||
|
||||
function selectPlatform(next: PwaPlatform) {
|
||||
const platform = normalizePlatform(next)
|
||||
if (activePlatform.value === platform) return
|
||||
activePlatform.value = platform
|
||||
stepIndex.value = 0
|
||||
}
|
||||
|
||||
function goNext() {
|
||||
if (isLastStep.value) {
|
||||
emit('complete')
|
||||
close()
|
||||
return
|
||||
}
|
||||
|
||||
stepIndex.value += 1
|
||||
}
|
||||
|
||||
function goPrev() {
|
||||
if (isFirstStep.value) return
|
||||
stepIndex.value -= 1
|
||||
}
|
||||
|
||||
function completeGuide() {
|
||||
emit('complete')
|
||||
close()
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<div
|
||||
v-if="open"
|
||||
class="pwa-install-guide"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby="pwa-install-guide-title"
|
||||
@click.self="close"
|
||||
>
|
||||
<div class="pwa-install-guide__card">
|
||||
<div class="pwa-install-guide__tabs">
|
||||
<button
|
||||
type="button"
|
||||
class="pwa-install-guide__tab"
|
||||
:class="{ 'pwa-install-guide__tab--active': activePlatform === 'ios' }"
|
||||
@click="selectPlatform('ios')"
|
||||
>
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" aria-hidden="true">
|
||||
<rect x="7" y="2" width="10" height="20" rx="2.5" stroke="currentColor" stroke-width="1.5" />
|
||||
<circle cx="12" cy="18.5" r="1" fill="currentColor" />
|
||||
</svg>
|
||||
<span>آیفون</span>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="pwa-install-guide__tab"
|
||||
:class="{ 'pwa-install-guide__tab--active': activePlatform === 'android' }"
|
||||
@click="selectPlatform('android')"
|
||||
>
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" aria-hidden="true">
|
||||
<path d="M12 4v12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
|
||||
<path d="M8.5 8.5 12 5l3.5 3.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
|
||||
<path d="M6 16h12v3a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1v-3Z" stroke="currentColor" stroke-width="1.5" />
|
||||
</svg>
|
||||
<span>اندروید</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="pwa-install-guide__header">
|
||||
<span class="pwa-install-guide__progress">
|
||||
مرحله {{ stepLabel }} از {{ PWA_GUIDE_STEP_LABELS.length }}
|
||||
</span>
|
||||
<h2 id="pwa-install-guide-title" class="pwa-install-guide__title">
|
||||
{{ guide.title }}
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div class="pwa-install-guide__content">
|
||||
<span class="pwa-install-guide__badge">{{ stepLabel }}</span>
|
||||
|
||||
<PwaInstallStepIllustration :type="currentStep.illustration" />
|
||||
|
||||
<p class="pwa-install-guide__text">{{ currentStep.text }}</p>
|
||||
<p v-if="currentStep.hint" class="pwa-install-guide__hint">{{ currentStep.hint }}</p>
|
||||
</div>
|
||||
|
||||
<div class="pwa-install-guide__nav">
|
||||
<template v-if="isLastStep">
|
||||
<BasicButton class="pwa-install-guide__primary" type="primary" @click="completeGuide">
|
||||
متوجه شدم
|
||||
</BasicButton>
|
||||
</template>
|
||||
<template v-else>
|
||||
<button
|
||||
type="button"
|
||||
class="pwa-install-guide__nav-btn"
|
||||
:disabled="isFirstStep"
|
||||
aria-label="مرحله قبل"
|
||||
@click="goPrev"
|
||||
>
|
||||
‹
|
||||
</button>
|
||||
|
||||
<div class="pwa-install-guide__dots" aria-hidden="true">
|
||||
<span
|
||||
v-for="(_, index) in totalSteps"
|
||||
:key="index"
|
||||
class="pwa-install-guide__dot"
|
||||
:class="{ 'pwa-install-guide__dot--active': index === stepIndex }"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="pwa-install-guide__nav-btn"
|
||||
aria-label="مرحله بعد"
|
||||
@click="goNext"
|
||||
>
|
||||
›
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<template v-if="!isLastStep">
|
||||
<BasicButton class="pwa-install-guide__primary" type="primary" @click="goNext">
|
||||
بعدی
|
||||
<span class="pwa-install-guide__primary-chevron">›</span>
|
||||
</BasicButton>
|
||||
|
||||
<button type="button" class="pwa-install-guide__close" @click="close">
|
||||
بستن
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<style scoped lang="less">
|
||||
.pwa-install-guide {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
/* بالاتر از نوار اعتبار (۱۰۰۰۰۰۰) و FAB پشتیبانی */
|
||||
z-index: 1000002;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 16px;
|
||||
background: rgba(15, 23, 42, 0.45);
|
||||
}
|
||||
|
||||
.pwa-install-guide__card {
|
||||
width: min(100%, 360px);
|
||||
background: #fff;
|
||||
border-radius: 24px;
|
||||
padding: 14px 16px 18px;
|
||||
box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
|
||||
}
|
||||
|
||||
.pwa-install-guide__tabs {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 4px;
|
||||
padding: 4px;
|
||||
border-radius: 14px;
|
||||
background: #f1f5f9;
|
||||
}
|
||||
|
||||
.pwa-install-guide__tab {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
padding: 10px 8px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #64748b;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
|
||||
|
||||
&--active {
|
||||
color: #0f172a;
|
||||
background: #fff;
|
||||
box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
|
||||
}
|
||||
}
|
||||
|
||||
.pwa-install-guide__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin: 14px 2px 10px;
|
||||
}
|
||||
|
||||
.pwa-install-guide__progress {
|
||||
font-size: 12px;
|
||||
color: #94a3b8;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.pwa-install-guide__title {
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #0f172a;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.pwa-install-guide__content {
|
||||
position: relative;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 18px;
|
||||
background: #f8fafc;
|
||||
padding: 14px 14px 16px;
|
||||
min-height: 280px;
|
||||
}
|
||||
|
||||
.pwa-install-guide__badge {
|
||||
position: absolute;
|
||||
top: 12px;
|
||||
right: 12px;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 999px;
|
||||
background: #2563eb;
|
||||
color: #fff;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.pwa-install-guide__text {
|
||||
margin: 10px 0 0;
|
||||
font-size: 13px;
|
||||
line-height: 1.8;
|
||||
color: #334155;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.pwa-install-guide__hint {
|
||||
margin: 8px 0 0;
|
||||
font-size: 11px;
|
||||
line-height: 1.7;
|
||||
color: #64748b;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.pwa-install-guide__nav {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 12px;
|
||||
margin: 14px 0 12px;
|
||||
|
||||
.pwa-install-guide__primary {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.pwa-install-guide__nav-btn {
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
color: #334155;
|
||||
font-size: 20px;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.35;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
|
||||
.pwa-install-guide__dots {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.pwa-install-guide__dot {
|
||||
width: 7px;
|
||||
height: 7px;
|
||||
border-radius: 999px;
|
||||
background: #cbd5e1;
|
||||
transition: width 0.15s ease, background 0.15s ease;
|
||||
|
||||
&--active {
|
||||
width: 22px;
|
||||
background: #2563eb;
|
||||
}
|
||||
}
|
||||
|
||||
.pwa-install-guide__primary {
|
||||
width: 100%;
|
||||
height: 44px;
|
||||
border-radius: 14px !important;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.pwa-install-guide__primary-chevron {
|
||||
margin-right: 4px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.pwa-install-guide__close {
|
||||
display: block;
|
||||
width: 100%;
|
||||
margin-top: 10px;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: #64748b;
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,413 @@
|
||||
<script setup lang="ts">
|
||||
import type { PwaGuideIllustration } from '@/modules/pwa/pwaInstallGuideSteps'
|
||||
import shareAppleIcon from '@/assets/img/share-apple.png'
|
||||
import addToHomeScreenIcon from '@/assets/img/Add-to-homeScreen.png'
|
||||
|
||||
defineProps<{
|
||||
type: PwaGuideIllustration
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="pwa-step-illustration"
|
||||
:class="{
|
||||
'pwa-step-illustration--android-menu': type === 'android-menu',
|
||||
'pwa-step-illustration--ios-safari': type === 'ios-safari',
|
||||
}"
|
||||
>
|
||||
<div
|
||||
class="pwa-step-illustration__phone"
|
||||
:class="{
|
||||
'pwa-step-illustration__phone--android-menu': type === 'android-menu',
|
||||
'pwa-step-illustration__phone--ios-safari': type === 'ios-safari',
|
||||
}"
|
||||
>
|
||||
<div
|
||||
class="pwa-step-illustration__screen"
|
||||
:class="{
|
||||
'pwa-step-illustration__screen--android-menu': type === 'android-menu',
|
||||
'pwa-step-illustration__screen--ios-safari': type === 'ios-safari',
|
||||
}"
|
||||
>
|
||||
<template v-if="type === 'android-chrome'">
|
||||
<div class="pwa-step-illustration__browser-bar">
|
||||
<span class="pwa-step-illustration__dot pwa-step-illustration__dot--red" />
|
||||
<span class="pwa-step-illustration__dot pwa-step-illustration__dot--yellow" />
|
||||
<span class="pwa-step-illustration__dot pwa-step-illustration__dot--green" />
|
||||
</div>
|
||||
<div class="pwa-step-illustration__chrome-body" />
|
||||
<div class="pwa-step-illustration__chrome-label">باز در Chrome</div>
|
||||
</template>
|
||||
|
||||
<template v-else-if="type === 'android-menu'">
|
||||
<div class="android-menu-scene">
|
||||
<div class="android-menu-scene__toolbar">
|
||||
<div class="android-menu-scene__url-bar" />
|
||||
<div class="android-menu-scene__menu-target" aria-hidden="true">
|
||||
<span class="android-menu-scene__menu-dots">⋮</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="android-menu-scene__viewport">
|
||||
<div class="android-menu-scene__dropdown">
|
||||
<div class="android-menu-scene__dropdown-line" />
|
||||
<div class="android-menu-scene__dropdown-line android-menu-scene__dropdown-line--short" />
|
||||
<div class="android-menu-scene__dropdown-install">
|
||||
Install app
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-else-if="type === 'android-install'">
|
||||
<div class="pwa-step-illustration__install-btn">Install</div>
|
||||
</template>
|
||||
|
||||
<template v-else-if="type === 'android-confirm'">
|
||||
<div class="pwa-step-illustration__app-icon" />
|
||||
<div class="pwa-step-illustration__home-label">روی صفحه اصلی</div>
|
||||
</template>
|
||||
|
||||
<template v-else-if="type === 'ios-safari'">
|
||||
<div class="ios-safari-scene">
|
||||
<div class="ios-safari-scene__toolbar">
|
||||
<span class="ios-safari-scene__toolbar-label">Safari</span>
|
||||
</div>
|
||||
|
||||
<div class="ios-safari-scene__viewport">
|
||||
<div class="ios-safari-scene__placeholder" />
|
||||
</div>
|
||||
|
||||
<div class="ios-safari-scene__caption">باز در Safari</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-else-if="type === 'ios-share'">
|
||||
<div class="pwa-step-illustration__share-wrap">
|
||||
<img :src="shareAppleIcon" alt="" class="pwa-step-illustration__share-icon" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-else-if="type === 'ios-add-home'">
|
||||
<div class="pwa-step-illustration__sheet">
|
||||
<div class="pwa-step-illustration__sheet-item">Share</div>
|
||||
<div class="pwa-step-illustration__sheet-item pwa-step-illustration__sheet-item--active">
|
||||
<img :src="addToHomeScreenIcon" alt="" class="pwa-step-illustration__sheet-icon" />
|
||||
Add to Home Screen
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-else-if="type === 'ios-confirm'">
|
||||
<div class="pwa-step-illustration__app-icon" />
|
||||
<div class="pwa-step-illustration__home-label">روی صفحه اصلی</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped lang="less">
|
||||
.pwa-step-illustration {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 8px 0 4px;
|
||||
}
|
||||
|
||||
.pwa-step-illustration__phone {
|
||||
width: 148px;
|
||||
height: 220px;
|
||||
border: 2px solid #cbd5e1;
|
||||
border-radius: 22px;
|
||||
padding: 10px 8px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.pwa-step-illustration__screen {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 14px;
|
||||
background: #f8fafc;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.pwa-step-illustration__browser-bar {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
left: 12px;
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.pwa-step-illustration__dot {
|
||||
width: 7px;
|
||||
height: 7px;
|
||||
border-radius: 999px;
|
||||
|
||||
&--red { background: #ef4444; }
|
||||
&--yellow { background: #f59e0b; }
|
||||
&--green { background: #22c55e; }
|
||||
}
|
||||
|
||||
.pwa-step-illustration__chrome-body {
|
||||
width: 78%;
|
||||
height: 42%;
|
||||
border-radius: 8px;
|
||||
background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
|
||||
margin-top: 18px;
|
||||
}
|
||||
|
||||
.pwa-step-illustration__chrome-label,
|
||||
.pwa-step-illustration__home-label {
|
||||
font-size: 10px;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.pwa-step-illustration--android-menu,
|
||||
.pwa-step-illustration--ios-safari {
|
||||
padding: 12px 0 0;
|
||||
}
|
||||
|
||||
.pwa-step-illustration__phone--android-menu,
|
||||
.pwa-step-illustration__phone--ios-safari {
|
||||
width: 132px;
|
||||
height: 208px;
|
||||
padding: 0;
|
||||
border-width: 1.5px;
|
||||
border-color: #cbd5e1;
|
||||
border-radius: 20px;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.pwa-step-illustration__screen--android-menu,
|
||||
.pwa-step-illustration__screen--ios-safari {
|
||||
border: none;
|
||||
border-radius: 18px;
|
||||
background: #fff;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.ios-safari-scene {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.ios-safari-scene__toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 28px;
|
||||
padding: 8px 10px 6px;
|
||||
border-bottom: 1px solid #eef2f7;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.ios-safari-scene__toolbar-label {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 72px;
|
||||
padding: 4px 10px;
|
||||
border-radius: 999px;
|
||||
background: #eef2f7;
|
||||
color: #64748b;
|
||||
font-size: 9px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.ios-safari-scene__viewport {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 14px 12px 8px;
|
||||
background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
|
||||
}
|
||||
|
||||
.ios-safari-scene__placeholder {
|
||||
width: 78%;
|
||||
height: 58%;
|
||||
border-radius: 12px;
|
||||
background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
|
||||
box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08);
|
||||
}
|
||||
|
||||
.ios-safari-scene__caption {
|
||||
padding: 0 10px 10px;
|
||||
text-align: center;
|
||||
font-size: 9px;
|
||||
color: #64748b;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.android-menu-scene {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.android-menu-scene__toolbar {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 6px;
|
||||
padding: 10px 8px 8px;
|
||||
border-bottom: 1px solid #eef2f7;
|
||||
}
|
||||
|
||||
.android-menu-scene__url-bar {
|
||||
flex: 1;
|
||||
height: 8px;
|
||||
border-radius: 999px;
|
||||
background: #e8edf5;
|
||||
}
|
||||
|
||||
.android-menu-scene__menu-target {
|
||||
flex: 0 0 auto;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
border: 1.5px dashed #2563eb;
|
||||
border-radius: 999px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgba(37, 99, 235, 0.04);
|
||||
}
|
||||
|
||||
.android-menu-scene__menu-dots {
|
||||
font-size: 14px;
|
||||
line-height: 1;
|
||||
font-weight: 700;
|
||||
color: #334155;
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.android-menu-scene__viewport {
|
||||
position: relative;
|
||||
height: calc(100% - 41px);
|
||||
background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
|
||||
}
|
||||
|
||||
.android-menu-scene__dropdown {
|
||||
position: absolute;
|
||||
top: 6px;
|
||||
right: 8px;
|
||||
width: 78px;
|
||||
padding: 8px 8px 10px;
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
border: 1px solid #e2e8f0;
|
||||
box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
|
||||
}
|
||||
|
||||
.android-menu-scene__dropdown-line {
|
||||
height: 4px;
|
||||
border-radius: 999px;
|
||||
background: #e2e8f0;
|
||||
margin-bottom: 6px;
|
||||
|
||||
&--short {
|
||||
width: 72%;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.android-menu-scene__dropdown-install {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 22px;
|
||||
padding: 4px 6px;
|
||||
border-radius: 6px;
|
||||
background: #eff6ff;
|
||||
border: 1px solid #bfdbfe;
|
||||
color: #2563eb;
|
||||
font-size: 8px;
|
||||
font-weight: 700;
|
||||
line-height: 1.2;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.pwa-step-illustration__install-btn {
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
color: #2563eb;
|
||||
border: 1px solid #2563eb;
|
||||
border-radius: 8px;
|
||||
padding: 6px 14px;
|
||||
background: #eff6ff;
|
||||
}
|
||||
|
||||
.pwa-step-illustration__app-icon {
|
||||
width: 42px;
|
||||
height: 42px;
|
||||
border-radius: 12px;
|
||||
background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
|
||||
}
|
||||
|
||||
.pwa-step-illustration__share-wrap {
|
||||
position: absolute;
|
||||
bottom: 14px;
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
border: 2px dashed #2563eb;
|
||||
border-radius: 999px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.pwa-step-illustration__share-icon {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.pwa-step-illustration__sheet {
|
||||
width: 88%;
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
border: 1px solid #e2e8f0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.pwa-step-illustration__sheet-item {
|
||||
padding: 8px 10px;
|
||||
font-size: 9px;
|
||||
color: #64748b;
|
||||
border-bottom: 1px solid #f1f5f9;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
|
||||
&--active {
|
||||
color: #2563eb;
|
||||
border: 1px solid #2563eb;
|
||||
border-radius: 8px;
|
||||
margin: 6px;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
|
||||
.pwa-step-illustration__sheet-icon {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
object-fit: contain;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,220 @@
|
||||
import { computed, onMounted, onUnmounted, ref, watch } from 'vue'
|
||||
import { notification } from 'ant-design-vue'
|
||||
import { getAppNotificationsUnreadCount } from '@/api/appNotifications'
|
||||
import { useSettingsStore } from '@/store/settingsStore'
|
||||
import { getToken } from '@/utils'
|
||||
import { showBrowserNotification } from '@/utils/browserNotification'
|
||||
import { priceSocketConnected, priceWssEnabled } from '@/utils/priceSocketState'
|
||||
import { APP_Z_TOAST } from '@/utils/zIndex'
|
||||
|
||||
const unreadCount = ref(0)
|
||||
let started = false
|
||||
let lastStreamNotifId = 0
|
||||
let hydratedUnread = false
|
||||
let lastShownNotifId = 0
|
||||
let toastConfigured = false
|
||||
let hydrateFallbackTimer: ReturnType<typeof setTimeout> | null = null
|
||||
|
||||
function ensureNotifToastConfig() {
|
||||
if (toastConfigured) return
|
||||
toastConfigured = true
|
||||
notification.config({
|
||||
placement: 'topRight',
|
||||
top: 'calc(var(--app-home-header-offset, 4.25rem) + 0.5rem)',
|
||||
duration: 5,
|
||||
})
|
||||
}
|
||||
|
||||
function notificationsEnabled(): boolean {
|
||||
return Boolean(getToken()) && useSettingsStore().isSettingTruthy('has_page_notification')
|
||||
}
|
||||
|
||||
function clearHydrateFallback() {
|
||||
if (hydrateFallbackTimer) {
|
||||
clearTimeout(hydrateFallbackTimer)
|
||||
hydrateFallbackTimer = null
|
||||
}
|
||||
}
|
||||
|
||||
/** از SSE رویداد unread-count — بدون HTTP */
|
||||
function applyUnreadCountFromStream(payload: Record<string, unknown>) {
|
||||
if (!notificationsEnabled()) {
|
||||
unreadCount.value = 0
|
||||
hydratedUnread = false
|
||||
return
|
||||
}
|
||||
|
||||
const next = Number(payload.unread_count ?? 0) || 0
|
||||
unreadCount.value = Math.max(0, next)
|
||||
hydratedUnread = true
|
||||
clearHydrateFallback()
|
||||
}
|
||||
|
||||
/** فقط وقتی SSE در دسترس نیست یا برای ریفرش دستی صفحه اعلانها */
|
||||
async function refreshUnreadCount() {
|
||||
if (!notificationsEnabled()) {
|
||||
unreadCount.value = 0
|
||||
hydratedUnread = false
|
||||
return
|
||||
}
|
||||
try {
|
||||
const data = await getAppNotificationsUnreadCount()
|
||||
unreadCount.value = Number(data?.unread_count ?? 0) || 0
|
||||
hydratedUnread = true
|
||||
} catch {
|
||||
// silent — badge optional
|
||||
}
|
||||
}
|
||||
|
||||
function clearUnreadLocally() {
|
||||
unreadCount.value = 0
|
||||
}
|
||||
|
||||
function showInAppToast(title: string, body: string) {
|
||||
try {
|
||||
ensureNotifToastConfig()
|
||||
notification.open({
|
||||
message: title || 'اعلان جدید',
|
||||
description: body || undefined,
|
||||
placement: 'topRight',
|
||||
duration: 5,
|
||||
class: 'app-notif-toast',
|
||||
style: { zIndex: APP_Z_TOAST },
|
||||
onClick: () => {
|
||||
void import('@/router').then((mod) => {
|
||||
mod.default.push({ name: 'appNotifications' }).catch(() => undefined)
|
||||
})
|
||||
},
|
||||
})
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
async function presentNotification(payload: {
|
||||
id?: number
|
||||
title?: string
|
||||
body?: string
|
||||
}) {
|
||||
const id = Number(payload.id ?? 0)
|
||||
if (id > 0 && id === lastShownNotifId) {
|
||||
return
|
||||
}
|
||||
if (id > 0) {
|
||||
lastShownNotifId = id
|
||||
}
|
||||
|
||||
const title = String(payload.title ?? '').trim() || 'اعلان جدید'
|
||||
const body = String(payload.body ?? '').trim()
|
||||
|
||||
showInAppToast(title, body)
|
||||
await showBrowserNotification({
|
||||
title,
|
||||
body,
|
||||
tag: id > 0 ? `app-notification-${id}` : undefined,
|
||||
url: '/appNotifications',
|
||||
})
|
||||
}
|
||||
|
||||
/** از SSE رویداد app_notification — بدون polling HTTP */
|
||||
function bumpUnreadFromStream(payload: Record<string, unknown>) {
|
||||
if (!notificationsEnabled()) {
|
||||
return
|
||||
}
|
||||
|
||||
const id = Number(payload.id ?? 0)
|
||||
if (id > 0 && id === lastStreamNotifId) {
|
||||
return
|
||||
}
|
||||
if (id > 0) {
|
||||
lastStreamNotifId = id
|
||||
}
|
||||
|
||||
if (payload.unread_count !== undefined && payload.unread_count !== null) {
|
||||
applyUnreadCountFromStream(payload)
|
||||
} else {
|
||||
unreadCount.value = Math.max(0, unreadCount.value) + 1
|
||||
hydratedUnread = true
|
||||
clearHydrateFallback()
|
||||
}
|
||||
|
||||
void presentNotification({
|
||||
id,
|
||||
title: String(payload.title ?? ''),
|
||||
body: String(payload.body ?? ''),
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* بدون interval: اگر استریم قیمت روشن است منتظر رویداد SSE میمانیم؛
|
||||
* فقط وقتی wss خاموش است یا SSE تا ۱۲ثانیه نیامد، یکبار HTTP میزنیم.
|
||||
*/
|
||||
function scheduleHydrate() {
|
||||
if (!notificationsEnabled()) {
|
||||
unreadCount.value = 0
|
||||
hydratedUnread = false
|
||||
clearHydrateFallback()
|
||||
return
|
||||
}
|
||||
|
||||
if (!priceWssEnabled.value) {
|
||||
void refreshUnreadCount()
|
||||
return
|
||||
}
|
||||
|
||||
if (priceSocketConnected.value || hydratedUnread) {
|
||||
clearHydrateFallback()
|
||||
return
|
||||
}
|
||||
|
||||
clearHydrateFallback()
|
||||
hydrateFallbackTimer = setTimeout(() => {
|
||||
hydrateFallbackTimer = null
|
||||
if (!hydratedUnread && notificationsEnabled() && !priceSocketConnected.value) {
|
||||
void refreshUnreadCount()
|
||||
}
|
||||
}, 12000)
|
||||
}
|
||||
|
||||
export function useAppNotificationBadge() {
|
||||
const settingsStore = useSettingsStore()
|
||||
const enabled = computed(() => settingsStore.isSettingTruthy('has_page_notification'))
|
||||
|
||||
onMounted(() => {
|
||||
started = true
|
||||
scheduleHydrate()
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
// module-level badge — keep state for other headers
|
||||
})
|
||||
|
||||
watch(enabled, (on) => {
|
||||
if (!on) {
|
||||
unreadCount.value = 0
|
||||
hydratedUnread = false
|
||||
clearHydrateFallback()
|
||||
} else {
|
||||
scheduleHydrate()
|
||||
}
|
||||
})
|
||||
|
||||
watch([priceSocketConnected, priceWssEnabled], () => {
|
||||
if (!started) return
|
||||
scheduleHydrate()
|
||||
})
|
||||
|
||||
return {
|
||||
enabled,
|
||||
unreadCount,
|
||||
refreshUnreadCount,
|
||||
clearUnreadLocally,
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
refreshUnreadCount,
|
||||
clearUnreadLocally,
|
||||
bumpUnreadFromStream,
|
||||
applyUnreadCountFromStream,
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { ref } from 'vue'
|
||||
|
||||
export const copperConvertModalVisible = ref(false)
|
||||
|
||||
export function openCopperConvert() {
|
||||
copperConvertModalVisible.value = true
|
||||
}
|
||||
|
||||
export function closeCopperConvert() {
|
||||
copperConvertModalVisible.value = false
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { ref } from 'vue'
|
||||
|
||||
/** باز/بسته بودن مدال محاسبهگر طلا — مشترک بین منوی کاربر و همبرگر */
|
||||
export const goldDayCalculatorVisible = ref(false)
|
||||
|
||||
export function openGoldDayCalculator() {
|
||||
goldDayCalculatorVisible.value = true
|
||||
}
|
||||
|
||||
export function closeGoldDayCalculator() {
|
||||
goldDayCalculatorVisible.value = false
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { message } from 'ant-design-vue'
|
||||
import type { PwaPlatform } from '@/modules/pwa/pwaInstallGuideSteps'
|
||||
import {
|
||||
getDefaultPwaPlatform,
|
||||
initPwaInstallPromptListener,
|
||||
isPwaInstallBannerDismissed,
|
||||
isStandalonePwa,
|
||||
markPwaInstallBannerAsShown,
|
||||
shouldOfferPwaInstall,
|
||||
shouldShowPwaInstallPrompt,
|
||||
triggerNativePwaInstall,
|
||||
} from '@/modules/pwa/pwaInstall'
|
||||
import { isTWA } from '@/utils/config'
|
||||
|
||||
const guideOpen = ref(false)
|
||||
const bannerVisible = ref(false)
|
||||
const platform = ref<PwaPlatform>(getDefaultPwaPlatform())
|
||||
const installBannerConsumed = ref(isPwaInstallBannerDismissed())
|
||||
/** false وقتی اپ بهصورت PWA/TWA باز شده یا همین الان نصب شده */
|
||||
const offerInstall = ref(shouldOfferPwaInstall())
|
||||
let listenerReady = false
|
||||
let offerListenersBound = false
|
||||
|
||||
function refreshOfferInstall() {
|
||||
offerInstall.value = shouldOfferPwaInstall()
|
||||
}
|
||||
|
||||
function bindOfferInstallListeners() {
|
||||
if (offerListenersBound || typeof window === 'undefined') return
|
||||
offerListenersBound = true
|
||||
|
||||
refreshOfferInstall()
|
||||
|
||||
const onInstalled = () => {
|
||||
offerInstall.value = false
|
||||
}
|
||||
window.addEventListener('appinstalled', onInstalled)
|
||||
|
||||
const modes = ['standalone', 'fullscreen', 'minimal-ui', 'window-controls-overlay'] as const
|
||||
const mediaLists = modes.map((mode) => window.matchMedia(`(display-mode: ${mode})`))
|
||||
const onDisplayModeChange = () => refreshOfferInstall()
|
||||
for (const mql of mediaLists) {
|
||||
mql.addEventListener('change', onDisplayModeChange)
|
||||
}
|
||||
}
|
||||
|
||||
function ensureListener() {
|
||||
if (listenerReady) return
|
||||
listenerReady = true
|
||||
initPwaInstallPromptListener()
|
||||
bindOfferInstallListeners()
|
||||
}
|
||||
|
||||
export function usePwaInstall() {
|
||||
ensureListener()
|
||||
|
||||
onMounted(() => {
|
||||
refreshOfferInstall()
|
||||
})
|
||||
|
||||
const canPrompt = computed(() => {
|
||||
if (installBannerConsumed.value) return false
|
||||
return shouldShowPwaInstallPrompt()
|
||||
})
|
||||
|
||||
const showInstallEntry = computed(() => offerInstall.value)
|
||||
|
||||
function consumeInstallBanner() {
|
||||
if (installBannerConsumed.value) return
|
||||
markPwaInstallBannerAsShown()
|
||||
installBannerConsumed.value = true
|
||||
bannerVisible.value = false
|
||||
}
|
||||
|
||||
function openGuide(nextPlatform?: PwaPlatform) {
|
||||
refreshOfferInstall()
|
||||
// فقط وقتی واقعاً داخل PWA/TWA هستیم راهنما را نشان نده
|
||||
if (isStandalonePwa() || isTWA()) return
|
||||
consumeInstallBanner()
|
||||
const next = nextPlatform === 'ios' || nextPlatform === 'android'
|
||||
? nextPlatform
|
||||
: getDefaultPwaPlatform()
|
||||
platform.value = next
|
||||
guideOpen.value = true
|
||||
}
|
||||
|
||||
function closeGuide() {
|
||||
guideOpen.value = false
|
||||
}
|
||||
|
||||
function showBanner() {
|
||||
if (!canPrompt.value) return
|
||||
bannerVisible.value = true
|
||||
markPwaInstallBannerAsShown()
|
||||
installBannerConsumed.value = true
|
||||
}
|
||||
|
||||
function hideBanner() {
|
||||
bannerVisible.value = false
|
||||
}
|
||||
|
||||
function dismissBanner() {
|
||||
consumeInstallBanner()
|
||||
}
|
||||
|
||||
async function completeGuide() {
|
||||
await triggerNativePwaInstall()
|
||||
consumeInstallBanner()
|
||||
closeGuide()
|
||||
}
|
||||
|
||||
/** نصب مستقیم مرورگر؛ اگر ممکن نبود مدال آموزش. */
|
||||
async function tryInstallOrOpenGuide(nextPlatform?: PwaPlatform) {
|
||||
ensureListener()
|
||||
refreshOfferInstall()
|
||||
|
||||
if (isStandalonePwa() || isTWA()) {
|
||||
message.info('نسخه وباپ از قبل نصب شده است')
|
||||
offerInstall.value = false
|
||||
return false
|
||||
}
|
||||
|
||||
const installed = await triggerNativePwaInstall()
|
||||
if (installed) {
|
||||
offerInstall.value = false
|
||||
consumeInstallBanner()
|
||||
message.success('نصب وباپ آغاز شد')
|
||||
return true
|
||||
}
|
||||
|
||||
// Chrome روی HTTP/IP یا Safari معمولاً prompt بومی ندارد — راهنما را باز کن
|
||||
openGuide(nextPlatform)
|
||||
return false
|
||||
}
|
||||
|
||||
return {
|
||||
guideOpen,
|
||||
bannerVisible,
|
||||
platform,
|
||||
canPrompt,
|
||||
showInstallEntry,
|
||||
openGuide,
|
||||
closeGuide,
|
||||
showBanner,
|
||||
hideBanner,
|
||||
dismissBanner,
|
||||
completeGuide,
|
||||
tryInstallOrOpenGuide,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,344 @@
|
||||
import { computed, ref } from 'vue'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { useConfigStore } from '@/store/configStore'
|
||||
import {
|
||||
getProjectBaleContactLink,
|
||||
getProjectSupportContactLink,
|
||||
getProjectSupportPhoneLink,
|
||||
isBazretalaProject,
|
||||
} from '@/utils/config'
|
||||
import {
|
||||
buildDepositSmsUrl,
|
||||
buildSupportPhoneUrl,
|
||||
loadSupportMessengerFromSettings,
|
||||
messengerNeedsClipboardCopy,
|
||||
openSupportMessengerEntry,
|
||||
resolveDepositGuideText,
|
||||
resolveDepositSupportMessage,
|
||||
resolveSupportMessengerEntries,
|
||||
resolveSupportMessengerLink,
|
||||
resolveSupportMessengerMeta,
|
||||
supportMessengerPickerAnchor,
|
||||
supportMessengerPickerOpen,
|
||||
supportMessengerSettings,
|
||||
type ResolvedSupportMessengerEntry,
|
||||
} from '@/utils/supportMessenger'
|
||||
import {
|
||||
copyDepositFieldValue,
|
||||
displayDepositAccountNumber,
|
||||
displayDepositCardNumber,
|
||||
displayDepositSheba,
|
||||
getDepositGuideVarsFromSettings,
|
||||
getDepositSettingLabel,
|
||||
hasDepositFieldValue,
|
||||
} from '@/utils/depositGuideText'
|
||||
import { useSettingsStore } from '@/store/settingsStore'
|
||||
import { isUserSupportChatEnabled } from '@/utils/chat'
|
||||
|
||||
/** plain: منوی شناور / درباره ما — بدون پیشمتن | deposit: مودال واریز — با deposit_support_message_text */
|
||||
type SupportPickerIntent = 'plain' | 'deposit'
|
||||
|
||||
const CHAT_PICKER_ENTRY: ResolvedSupportMessengerEntry = {
|
||||
messenger: 'chat',
|
||||
id: 'support-chat',
|
||||
label: 'چت پشتیبانی',
|
||||
icon: 'vuesax-linear:messages-2',
|
||||
accent: '#16a34a',
|
||||
url: '',
|
||||
}
|
||||
|
||||
export function useSupportMessenger() {
|
||||
const config = useConfigStore()
|
||||
const settingsStore = useSettingsStore()
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const supportPickerOpen = supportMessengerPickerOpen
|
||||
const supportPickerIntent = ref<SupportPickerIntent>('plain')
|
||||
|
||||
/** چت فقط بعد از لاگین — روی صفحه ورود در picker نیاید */
|
||||
const isChatEnabled = computed(() => {
|
||||
void route.name
|
||||
return isUserSupportChatEnabled()
|
||||
})
|
||||
|
||||
const legacySupportLink = computed(() => {
|
||||
if (config.config?.name === 'garoosi' || isBazretalaProject()) {
|
||||
return getProjectBaleContactLink()
|
||||
}
|
||||
return getProjectSupportContactLink()
|
||||
})
|
||||
|
||||
const depositSupportMessage = computed(() => resolveDepositSupportMessage())
|
||||
|
||||
const supportMessengerEntries = computed(() =>
|
||||
resolveSupportMessengerEntries(supportMessengerSettings.value),
|
||||
)
|
||||
|
||||
const pickerEntries = computed(() => {
|
||||
const list = [...supportMessengerEntries.value]
|
||||
if (isChatEnabled.value) {
|
||||
list.unshift(CHAT_PICKER_ENTRY)
|
||||
}
|
||||
return list
|
||||
})
|
||||
|
||||
const primaryMessengerEntry = computed(() => supportMessengerEntries.value[0] ?? null)
|
||||
|
||||
const messengerType = computed(
|
||||
() => (primaryMessengerEntry.value?.messenger ?? supportMessengerSettings.value.messenger ?? '').trim().toLowerCase(),
|
||||
)
|
||||
|
||||
const messengerMeta = computed(() => {
|
||||
if (isChatEnabled.value && supportMessengerEntries.value.length === 0) {
|
||||
return {
|
||||
label: CHAT_PICKER_ENTRY.label,
|
||||
icon: CHAT_PICKER_ENTRY.icon,
|
||||
accent: CHAT_PICKER_ENTRY.accent,
|
||||
}
|
||||
}
|
||||
return primaryMessengerEntry.value
|
||||
? {
|
||||
label: primaryMessengerEntry.value.label,
|
||||
icon: primaryMessengerEntry.value.icon,
|
||||
accent: primaryMessengerEntry.value.accent,
|
||||
}
|
||||
: resolveSupportMessengerMeta(messengerType.value)
|
||||
})
|
||||
|
||||
const messengerLink = computed(() =>
|
||||
primaryMessengerEntry.value?.url
|
||||
|| resolveSupportMessengerLink(
|
||||
supportMessengerSettings.value.messenger,
|
||||
supportMessengerSettings.value.messengerId,
|
||||
legacySupportLink.value,
|
||||
),
|
||||
)
|
||||
|
||||
function goToSupportChat() {
|
||||
void router.push({ name: 'support' })
|
||||
return true
|
||||
}
|
||||
|
||||
async function openMessengerEntry(entry: ResolvedSupportMessengerEntry, text?: string) {
|
||||
if (entry.messenger === 'chat') {
|
||||
return goToSupportChat()
|
||||
}
|
||||
|
||||
const messageText =
|
||||
text !== undefined
|
||||
? text.trim()
|
||||
: supportPickerIntent.value === 'deposit'
|
||||
? depositSupportMessage.value.trim()
|
||||
: ''
|
||||
const opened = await openSupportMessengerEntry(entry, messageText, legacySupportLink.value)
|
||||
if (!opened) return false
|
||||
|
||||
if (messageText && messengerNeedsClipboardCopy(entry.messenger)) {
|
||||
message.success('متن پیام کپی شد — در پیامرسان paste کنید')
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
let supportPickerOpenedAt = 0
|
||||
|
||||
async function openSupportPicker(
|
||||
intent: SupportPickerIntent,
|
||||
anchorEl?: HTMLElement | null,
|
||||
) {
|
||||
supportPickerIntent.value = intent
|
||||
if (anchorEl !== undefined) {
|
||||
supportMessengerPickerAnchor.value = anchorEl
|
||||
}
|
||||
|
||||
const draft =
|
||||
intent === 'deposit' ? depositSupportMessage.value.trim() : ''
|
||||
const messengerEntries = supportMessengerEntries.value
|
||||
const entries = pickerEntries.value
|
||||
|
||||
// لیست خالی + چت خاموش → هیچکار
|
||||
if (entries.length === 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
// فقط چت (لیست پیامرسان خالی) → مستقیم چت
|
||||
if (isChatEnabled.value && messengerEntries.length === 0) {
|
||||
return goToSupportChat()
|
||||
}
|
||||
|
||||
// فقط یک گزینه (چت یا یک پیامرسان) → مستقیم همان
|
||||
if (entries.length === 1) {
|
||||
return openMessengerEntry(entries[0], draft)
|
||||
}
|
||||
|
||||
// چند گزینه (چت + لینکها یا چند پیامرسان) → منوی انتخاب
|
||||
const now = Date.now()
|
||||
if (supportPickerOpen.value) {
|
||||
if (now - supportPickerOpenedAt < 450) return true
|
||||
supportPickerOpen.value = false
|
||||
return true
|
||||
}
|
||||
|
||||
supportPickerOpen.value = true
|
||||
supportPickerOpenedAt = now
|
||||
return true
|
||||
}
|
||||
|
||||
async function openSupportMessenger(anchorEl?: HTMLElement | null) {
|
||||
return openSupportPicker('plain', anchorEl)
|
||||
}
|
||||
|
||||
async function openDepositSupportMessenger(anchorEl?: HTMLElement | null) {
|
||||
return openSupportPicker('deposit', anchorEl)
|
||||
}
|
||||
|
||||
function handleSupportMessengerClick(event?: Event) {
|
||||
const target = event?.currentTarget
|
||||
const anchor = target instanceof HTMLElement ? target : null
|
||||
void openSupportMessenger(anchor)
|
||||
}
|
||||
|
||||
const depositSmsLink = computed(() =>
|
||||
buildDepositSmsUrl(
|
||||
supportMessengerSettings.value.depositSmsSupportNumber,
|
||||
depositSupportMessage.value,
|
||||
),
|
||||
)
|
||||
|
||||
const supportPhoneLink = computed(() => {
|
||||
const fromSettings = buildSupportPhoneUrl(
|
||||
supportMessengerSettings.value.depositSmsSupportNumber,
|
||||
)
|
||||
if (fromSettings) return fromSettings
|
||||
|
||||
const legacyPhone = getProjectSupportPhoneLink()
|
||||
if (legacyPhone && legacyPhone !== 'tel:') return legacyPhone
|
||||
|
||||
const legacy = legacySupportLink.value
|
||||
if (legacy.startsWith('tel:') && legacy.length > 4) return legacy
|
||||
|
||||
return ''
|
||||
})
|
||||
|
||||
const supportMessengerText = computed(() => resolveDepositGuideText())
|
||||
|
||||
const depositCardNumberRaw = computed(() => {
|
||||
void settingsStore.settings
|
||||
const fromMessenger = supportMessengerSettings.value.depositCardNumber?.trim()
|
||||
if (fromMessenger) return fromMessenger
|
||||
return String(getDepositGuideVarsFromSettings().cardNumber ?? '').trim()
|
||||
})
|
||||
|
||||
const depositAccountNumberRaw = computed(() => {
|
||||
void settingsStore.settings
|
||||
const fromMessenger = supportMessengerSettings.value.depositAccountNumber?.trim()
|
||||
if (fromMessenger) return fromMessenger
|
||||
return String(getDepositGuideVarsFromSettings().accountNumber ?? '').trim()
|
||||
})
|
||||
|
||||
const depositShebaRaw = computed(() => {
|
||||
void settingsStore.settings
|
||||
const fromMessenger = supportMessengerSettings.value.depositSheba?.trim()
|
||||
if (fromMessenger) return fromMessenger
|
||||
return String(getDepositGuideVarsFromSettings().sheba ?? '').trim()
|
||||
})
|
||||
|
||||
const depositCardNumber = computed(() => displayDepositCardNumber(depositCardNumberRaw.value))
|
||||
const depositAccountNumber = computed(() =>
|
||||
displayDepositAccountNumber(depositAccountNumberRaw.value),
|
||||
)
|
||||
const depositSheba = computed(() => displayDepositSheba(depositShebaRaw.value))
|
||||
|
||||
const depositCardLabel = computed(() => {
|
||||
void settingsStore.settings
|
||||
return getDepositSettingLabel('deposit_card_number', 'شماره کارت واریز')
|
||||
})
|
||||
|
||||
const depositAccountNumberLabel = computed(() => {
|
||||
void settingsStore.settings
|
||||
return getDepositSettingLabel('deposit_account_number', 'شماره حساب واریز')
|
||||
})
|
||||
|
||||
const depositShebaLabel = computed(() => {
|
||||
void settingsStore.settings
|
||||
return getDepositSettingLabel('deposit_sheba', 'شبا واریز')
|
||||
})
|
||||
|
||||
const hasDepositCardValue = computed(() => hasDepositFieldValue(depositCardNumberRaw.value))
|
||||
const hasDepositAccountNumberValue = computed(() =>
|
||||
hasDepositFieldValue(depositAccountNumberRaw.value),
|
||||
)
|
||||
const hasDepositShebaValue = computed(() => hasDepositFieldValue(depositShebaRaw.value))
|
||||
|
||||
async function copyDepositCardNumber() {
|
||||
await copyDepositFieldValue(
|
||||
depositCardNumberRaw.value,
|
||||
'card',
|
||||
'شماره کارت ثبت نشده است',
|
||||
)
|
||||
}
|
||||
|
||||
async function copyDepositAccountNumber() {
|
||||
await copyDepositFieldValue(
|
||||
depositAccountNumberRaw.value,
|
||||
'account',
|
||||
'شماره حساب ثبت نشده است',
|
||||
)
|
||||
}
|
||||
|
||||
async function copyDepositShebaNumber() {
|
||||
await copyDepositFieldValue(
|
||||
depositShebaRaw.value,
|
||||
'sheba',
|
||||
'شماره شبا ثبت نشده است',
|
||||
)
|
||||
}
|
||||
|
||||
const hasMessengerLink = computed(
|
||||
() => isChatEnabled.value || supportMessengerEntries.value.length > 0,
|
||||
)
|
||||
const hasMultipleMessengers = computed(() => pickerEntries.value.length > 1)
|
||||
const hasSupportPhoneLink = computed(() => !!supportPhoneLink.value)
|
||||
const hasSupportActions = computed(() => hasSupportPhoneLink.value || hasMessengerLink.value)
|
||||
const opensInNewTab = computed(() => /^https?:\/\//i.test(messengerLink.value))
|
||||
|
||||
return {
|
||||
supportPickerOpen,
|
||||
supportPickerAnchor: supportMessengerPickerAnchor,
|
||||
supportMessengerEntries: pickerEntries,
|
||||
isChatEnabled,
|
||||
messengerType,
|
||||
messengerMeta,
|
||||
messengerLink,
|
||||
supportPhoneLink,
|
||||
depositSmsLink,
|
||||
supportMessengerText,
|
||||
depositSupportMessage,
|
||||
depositCardNumber,
|
||||
depositAccountNumber,
|
||||
depositSheba,
|
||||
depositCardNumberRaw,
|
||||
depositAccountNumberRaw,
|
||||
depositShebaRaw,
|
||||
depositCardLabel,
|
||||
depositAccountNumberLabel,
|
||||
depositShebaLabel,
|
||||
hasDepositCardValue,
|
||||
hasDepositAccountNumberValue,
|
||||
hasDepositShebaValue,
|
||||
copyDepositCardNumber,
|
||||
copyDepositAccountNumber,
|
||||
copyDepositShebaNumber,
|
||||
openSupportMessenger,
|
||||
openDepositSupportMessenger,
|
||||
openMessengerEntry,
|
||||
handleSupportMessengerClick,
|
||||
goToSupportChat,
|
||||
hasMessengerLink,
|
||||
hasMultipleMessengers,
|
||||
hasSupportPhoneLink,
|
||||
hasSupportActions,
|
||||
opensInNewTab,
|
||||
loadSupportMessengerFromSettings,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { fetchTrackingSettings, isTrackingSystemsEnabled } from '@/utils/trackingSystemsSettings'
|
||||
|
||||
export function useTrackingSystemsFeature() {
|
||||
const trackingSystemsEnabled = ref(false)
|
||||
const trackingSystemsReady = ref(false)
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const settings = await fetchTrackingSettings()
|
||||
trackingSystemsEnabled.value = isTrackingSystemsEnabled(settings)
|
||||
} finally {
|
||||
trackingSystemsReady.value = true
|
||||
}
|
||||
})
|
||||
|
||||
return {
|
||||
trackingSystemsEnabled,
|
||||
trackingSystemsReady,
|
||||
}
|
||||
}
|
||||
@@ -71,13 +71,26 @@ function setAppleTouchIconFallback() {
|
||||
appleTitle.content = getConfig('name_fa', 'اپ مشتری')
|
||||
}
|
||||
|
||||
function resolveConfigBase(url: string) {
|
||||
try {
|
||||
const parsed = new URL(url)
|
||||
parsed.search = ''
|
||||
parsed.hash = ''
|
||||
parsed.pathname = parsed.pathname.replace(/\/get_user\/?$/i, '')
|
||||
if (!parsed.pathname || parsed.pathname === '/') {
|
||||
return parsed.origin
|
||||
}
|
||||
return `${parsed.origin}${parsed.pathname.replace(/\/+$/, '')}`
|
||||
} catch {
|
||||
return url.replace(/[?#].*$/, '').replace(/\/get_user\/?$/i, '').replace(/\/+$/, '')
|
||||
}
|
||||
}
|
||||
|
||||
function resolveRemoteLogo(path: string) {
|
||||
if (/^(https?:\/\/|data:|blob:)/i.test(path)) return path
|
||||
|
||||
const lastSuccess = localStorage.getItem('CONFIG_Success_URL')
|
||||
const base = lastSuccess
|
||||
? lastSuccess.replace(/\/get_user\/?$/i, '').replace(/\/+$/, '')
|
||||
: 'https://nerkh.gold'
|
||||
const base = lastSuccess ? resolveConfigBase(lastSuccess) : 'https://adm.montzar.ir'
|
||||
|
||||
return `${base}/${path.replace(/^\/+/, '')}`
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import type { AppConfig } from '@/config/types'
|
||||
import { resetVersionCheckCache } from '@/config/load-version'
|
||||
import { clearCachedPwaManifest } from '@/modules/pwa/manifest-cache'
|
||||
import { resolveTenantDomain } from '@/config/superadmin'
|
||||
import { collectAuthTokensForPreserve } from '@/utils/authToken'
|
||||
|
||||
const CONFIG_COOKIE_NAME = 'APP_CONFIG_CACHE'
|
||||
const APP_CONFIG_LS_KEY = 'APP_CONFIG_LS_CACHE'
|
||||
const CONFIG_SUCCESS_URL_KEY = 'CONFIG_Success_URL'
|
||||
const VERSION_SUCCESS_URL_KEY = 'VERSION_Success_URL'
|
||||
const CONFIG_COOKIE_MAX_AGE_SECONDS = 60 * 60 * 24 * 7
|
||||
@@ -18,6 +20,13 @@ type CachedConfigPayload = {
|
||||
config: AppConfig
|
||||
}
|
||||
|
||||
export type VersionedAppConfigCache = {
|
||||
version: string
|
||||
domain: string
|
||||
cached_at: number
|
||||
config: AppConfig
|
||||
}
|
||||
|
||||
type VersionUpdateLock = {
|
||||
version: string
|
||||
started_at: number
|
||||
@@ -62,6 +71,54 @@ export function readCachedAppConfig(): AppConfig | null {
|
||||
}
|
||||
}
|
||||
|
||||
/** کش بزرگ get_user در localStorage — با version باطل میشود */
|
||||
export function readVersionedAppConfigCache(domain?: string): VersionedAppConfigCache | null {
|
||||
try {
|
||||
const raw = localStorage.getItem(APP_CONFIG_LS_KEY)
|
||||
if (!raw) return null
|
||||
|
||||
const payload = JSON.parse(raw) as VersionedAppConfigCache
|
||||
if (!payload?.config || !payload.version) return null
|
||||
|
||||
if (domain && payload.domain && payload.domain !== domain) {
|
||||
return null
|
||||
}
|
||||
|
||||
return payload
|
||||
} catch (error) {
|
||||
console.warn('Failed to read versioned app config cache:', error)
|
||||
clearVersionedAppConfigCache()
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
export function writeVersionedAppConfigCache(
|
||||
config: AppConfig,
|
||||
version: string,
|
||||
domain: string,
|
||||
) {
|
||||
const normalizedVersion = String(version || '').trim()
|
||||
if (!normalizedVersion) return
|
||||
|
||||
try {
|
||||
const payload: VersionedAppConfigCache = {
|
||||
version: normalizedVersion,
|
||||
domain: String(domain || '').trim(),
|
||||
cached_at: Date.now(),
|
||||
config,
|
||||
}
|
||||
localStorage.setItem(APP_CONFIG_LS_KEY, JSON.stringify(payload))
|
||||
} catch (error) {
|
||||
console.warn('Failed to write versioned app config cache:', error)
|
||||
}
|
||||
|
||||
writeCachedAppConfig(config)
|
||||
}
|
||||
|
||||
export function clearVersionedAppConfigCache() {
|
||||
localStorage.removeItem(APP_CONFIG_LS_KEY)
|
||||
}
|
||||
|
||||
export function writeCachedAppConfig(config: AppConfig) {
|
||||
try {
|
||||
const payload: CachedConfigPayload = {
|
||||
@@ -84,6 +141,7 @@ export function writeCachedAppConfig(config: AppConfig) {
|
||||
|
||||
export function clearCachedAppConfig() {
|
||||
document.cookie = `${CONFIG_COOKIE_NAME}=; Path=/; Max-Age=0; SameSite=Lax`
|
||||
clearVersionedAppConfigCache()
|
||||
clearCachedPwaManifest()
|
||||
}
|
||||
|
||||
@@ -223,6 +281,7 @@ export function clearAppStorageExceptToken() {
|
||||
export function clearAllBootstrapFetchCaches() {
|
||||
localStorage.removeItem(CONFIG_SUCCESS_URL_KEY)
|
||||
localStorage.removeItem(VERSION_SUCCESS_URL_KEY)
|
||||
clearVersionedAppConfigCache()
|
||||
clearCachedPwaManifest()
|
||||
resetVersionCheckCache()
|
||||
window.__APP_CONFIG__ = undefined
|
||||
@@ -253,6 +312,7 @@ export async function refreshConfigCacheForVersion(
|
||||
await clearBrowserRuntimeCaches()
|
||||
|
||||
writeCachedAppConfig(freshConfig)
|
||||
writeVersionedAppConfigCache(freshConfig, normalizedVersion, resolveTenantDomain())
|
||||
finishVersionUpdateBeforeReload(normalizedVersion)
|
||||
|
||||
return freshConfig
|
||||
@@ -275,6 +335,7 @@ export async function resetAppAndRefreshConfig(
|
||||
|
||||
if (normalizedVersion) {
|
||||
writeStoredAppVersion(normalizedVersion)
|
||||
writeVersionedAppConfigCache(freshConfig, normalizedVersion, resolveTenantDomain())
|
||||
}
|
||||
|
||||
return freshConfig
|
||||
|
||||
@@ -1,33 +1,54 @@
|
||||
import type { AppConfig } from '@/config/types'
|
||||
import { readCachedAppConfig, writeCachedAppConfig } from '@/config/config-cache'
|
||||
import {
|
||||
clearCachedAppConfig,
|
||||
getNormalizedVersion,
|
||||
readCachedAppConfig,
|
||||
readVersionedAppConfigCache,
|
||||
writeCachedAppConfig,
|
||||
writeStoredAppVersion,
|
||||
writeVersionedAppConfigCache,
|
||||
} from '@/config/config-cache'
|
||||
import { loadRemoteAppVersion } from '@/config/load-version'
|
||||
import {
|
||||
assertServerReachableConfig,
|
||||
hideServerUnavailableOverlay,
|
||||
isServerUnreachableConfig,
|
||||
} from '@/utils/serverUnavailable'
|
||||
import {
|
||||
allowSuperAdminFallback,
|
||||
getSuperAdminBase,
|
||||
getSuperAdminBases,
|
||||
isSuperAdminUrl,
|
||||
resolveTenantDomain,
|
||||
SA_RETRY_ROUNDS,
|
||||
} from '@/config/superadmin'
|
||||
|
||||
const CONFIG_SUCCESS_URL_KEY = 'CONFIG_Success_URL'
|
||||
export const CONFIG_RETRY_ROUNDS = 5
|
||||
const VERSION_SUCCESS_URL_KEY = 'VERSION_Success_URL'
|
||||
export const CONFIG_RETRY_ROUNDS = SA_RETRY_ROUNDS
|
||||
|
||||
function getProtocol() {
|
||||
return window.location.protocol === 'https:' ? 'https:' : 'http:'
|
||||
}
|
||||
export { getSuperAdminBase, resolveTenantDomain } from '@/config/superadmin'
|
||||
|
||||
/** فقط SuperAdmin — بدون رجیستری قدیمی */
|
||||
export function getConfigUrls() {
|
||||
const protocol = getProtocol()
|
||||
|
||||
return [
|
||||
`${protocol}//nerkh.gold/get_user`,
|
||||
`${protocol}//tablo.talasevin.ir/get_user`,
|
||||
`${protocol}//abshode-service.montgit.ir/server/get_user`,
|
||||
`${protocol}//212.23.201.173:8381/get_user`,
|
||||
`${protocol}//91.212.174.137:4040/server/get_user`
|
||||
]
|
||||
const domain = encodeURIComponent(resolveTenantDomain())
|
||||
return getSuperAdminBases().map((base) => `${base}/get_user?domain=${domain}`)
|
||||
}
|
||||
|
||||
/** اولویت با last successful SuperAdmin؛ رجیستری قدیمی sticky نشود */
|
||||
export function sortConfigUrls(urls: string[]) {
|
||||
const lastSuccessUrl = localStorage.getItem(CONFIG_SUCCESS_URL_KEY)
|
||||
|
||||
return [...urls].sort((a, b) => {
|
||||
if (a === lastSuccessUrl) return -1
|
||||
if (b === lastSuccessUrl) return 1
|
||||
return 0
|
||||
})
|
||||
if (
|
||||
!lastSuccessUrl ||
|
||||
!urls.includes(lastSuccessUrl) ||
|
||||
!isSuperAdminUrl(lastSuccessUrl)
|
||||
) {
|
||||
if (lastSuccessUrl && !isSuperAdminUrl(lastSuccessUrl)) {
|
||||
localStorage.removeItem(CONFIG_SUCCESS_URL_KEY)
|
||||
}
|
||||
return [...urls]
|
||||
}
|
||||
return [lastSuccessUrl, ...urls.filter((url) => url !== lastSuccessUrl)]
|
||||
}
|
||||
|
||||
function clearStaleConfigSuccessUrl(url: string) {
|
||||
@@ -36,6 +57,22 @@ function clearStaleConfigSuccessUrl(url: string) {
|
||||
}
|
||||
}
|
||||
|
||||
/** پاککردن کامل کش کانفیگ قدیمی (کوکی + localStorage) */
|
||||
function purgeLegacyConfigCache() {
|
||||
clearCachedAppConfig()
|
||||
localStorage.removeItem(CONFIG_SUCCESS_URL_KEY)
|
||||
localStorage.removeItem(VERSION_SUCCESS_URL_KEY)
|
||||
window.__APP_CONFIG__ = undefined
|
||||
}
|
||||
|
||||
function assertValidAppConfig(config: AppConfig, url: string): AppConfig {
|
||||
const user = (config as { user?: unknown })?.user
|
||||
if (!user || typeof user !== 'object') {
|
||||
throw new Error(`SuperAdmin config invalid (no user) from ${url}`)
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
async function fetchConfig(url: string, timeout = 3000): Promise<AppConfig> {
|
||||
const controller = new AbortController()
|
||||
const timeoutId = window.setTimeout(() => controller.abort(), timeout)
|
||||
@@ -44,10 +81,10 @@ async function fetchConfig(url: string, timeout = 3000): Promise<AppConfig> {
|
||||
const response = await fetch(url, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Accept: 'application/json'
|
||||
Accept: 'application/json',
|
||||
},
|
||||
cache: 'no-store',
|
||||
signal: controller.signal
|
||||
signal: controller.signal,
|
||||
})
|
||||
|
||||
if (!response.ok) {
|
||||
@@ -60,14 +97,17 @@ async function fetchConfig(url: string, timeout = 3000): Promise<AppConfig> {
|
||||
throw new Error('Config response is not JSON')
|
||||
}
|
||||
|
||||
return await response.json()
|
||||
return assertValidAppConfig(await response.json(), url)
|
||||
} finally {
|
||||
clearTimeout(timeoutId)
|
||||
}
|
||||
}
|
||||
|
||||
export async function fetchFreshAppConfig(rounds = CONFIG_RETRY_ROUNDS): Promise<AppConfig> {
|
||||
const urls = sortConfigUrls(getConfigUrls())
|
||||
async function tryFetchFromUrls(
|
||||
urls: string[],
|
||||
rounds: number,
|
||||
): Promise<AppConfig | null> {
|
||||
if (!urls.length) return null
|
||||
|
||||
for (let round = 1; round <= rounds; round++) {
|
||||
for (let index = 0; index < urls.length; index++) {
|
||||
@@ -77,9 +117,13 @@ export async function fetchFreshAppConfig(rounds = CONFIG_RETRY_ROUNDS): Promise
|
||||
const timeout = index === urls.length - 1 ? 7000 : 4000
|
||||
const config = await fetchConfig(url, timeout)
|
||||
|
||||
localStorage.setItem(CONFIG_SUCCESS_URL_KEY, url)
|
||||
if (isSuperAdminUrl(url)) {
|
||||
localStorage.setItem(CONFIG_SUCCESS_URL_KEY, url)
|
||||
} else {
|
||||
clearStaleConfigSuccessUrl(url)
|
||||
}
|
||||
writeCachedAppConfig(config)
|
||||
|
||||
console.info('[config] loaded from SuperAdmin:', url, (config as { user?: { name?: string } })?.user?.name)
|
||||
return config
|
||||
} catch (error) {
|
||||
clearStaleConfigSuccessUrl(url)
|
||||
@@ -88,15 +132,157 @@ export async function fetchFreshAppConfig(rounds = CONFIG_RETRY_ROUNDS): Promise
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error('Cannot load app config from any server')
|
||||
return null
|
||||
}
|
||||
|
||||
export async function loadAppConfig(): Promise<AppConfig> {
|
||||
const cachedConfig = readCachedAppConfig()
|
||||
|
||||
if (cachedConfig) {
|
||||
return cachedConfig
|
||||
export async function fetchFreshAppConfig(
|
||||
rounds = CONFIG_RETRY_ROUNDS,
|
||||
options?: { skipPurge?: boolean },
|
||||
): Promise<AppConfig> {
|
||||
// cold load: کش قدیمی را دور بریز — poll/background نباید کش قطع را پاک کند
|
||||
if (!options?.skipPurge) {
|
||||
purgeLegacyConfigCache()
|
||||
}
|
||||
|
||||
return await fetchFreshAppConfig()
|
||||
const urls = sortConfigUrls(getConfigUrls())
|
||||
const saUrls = urls.filter(isSuperAdminUrl)
|
||||
const otherUrls = urls.filter((url) => !isSuperAdminUrl(url))
|
||||
|
||||
// اول SA؛ در DEV اگر allowSuperAdminFallback فعال باشد به رجیستری میرود (در boursecu غیرفعال)
|
||||
const lists =
|
||||
saUrls.length > 0
|
||||
? allowSuperAdminFallback()
|
||||
? [saUrls, otherUrls]
|
||||
: [saUrls]
|
||||
: [urls]
|
||||
|
||||
console.info('[config] SuperAdmin-only URLs:', saUrls.length ? saUrls : urls)
|
||||
|
||||
for (const list of lists) {
|
||||
const config = await tryFetchFromUrls(list, rounds)
|
||||
if (config) return config
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
`Cannot load from SuperAdmin (${getSuperAdminBase() || 'none'}). دامنه tenant در سوپرادمین ثبت نشده یا API/CORS مشکل دارد.`,
|
||||
)
|
||||
}
|
||||
|
||||
const UNBLOCK_POLL_MS = 5000
|
||||
let unblockPollTimer: number | null = null
|
||||
|
||||
function stopUnblockPoll() {
|
||||
if (unblockPollTimer != null) {
|
||||
window.clearInterval(unblockPollTimer)
|
||||
unblockPollTimer = null
|
||||
}
|
||||
}
|
||||
|
||||
function persistFreshConfig(config: AppConfig, domain: string, remoteVersion = '') {
|
||||
writeCachedAppConfig(config)
|
||||
if (remoteVersion) {
|
||||
writeVersionedAppConfigCache(config, remoteVersion, domain)
|
||||
writeStoredAppVersion(remoteVersion)
|
||||
}
|
||||
}
|
||||
|
||||
/** وقتی overlay قطع فعال است، وصل شدن از SA را بدون پاککردن کش چک کن */
|
||||
function startUnblockPoll(domain: string) {
|
||||
if (unblockPollTimer != null) return
|
||||
|
||||
unblockPollTimer = window.setInterval(() => {
|
||||
void (async () => {
|
||||
try {
|
||||
const fresh = await fetchFreshAppConfig(2, { skipPurge: true })
|
||||
if (isServerUnreachableConfig(fresh)) return
|
||||
|
||||
let remoteVersion = ''
|
||||
try {
|
||||
remoteVersion = getNormalizedVersion(await loadRemoteAppVersion({ rounds: 2 }))
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
|
||||
stopUnblockPoll()
|
||||
persistFreshConfig(fresh, domain, remoteVersion)
|
||||
hideServerUnavailableOverlay()
|
||||
window.location.reload()
|
||||
} catch (error) {
|
||||
console.warn('Unblock poll get_user failed:', error)
|
||||
}
|
||||
})()
|
||||
}, UNBLOCK_POLL_MS)
|
||||
}
|
||||
|
||||
function lockForBlockedServer(config: AppConfig, domain: string, remoteVersion = ''): never {
|
||||
persistFreshConfig(config, domain, remoteVersion)
|
||||
startUnblockPoll(domain)
|
||||
assertServerReachableConfig(config)
|
||||
throw new Error('unreachable')
|
||||
}
|
||||
|
||||
/**
|
||||
* اول get_version (سبک) — فقط اگر ورژن عوض شده یا کش نبود get_user میزند.
|
||||
* اگر کش «قطع» باشد همیشه get_user تازه میزنیم تا وصل مجدد گیر نکند.
|
||||
*/
|
||||
export async function loadAppConfig(): Promise<AppConfig> {
|
||||
const domain = resolveTenantDomain()
|
||||
|
||||
let remoteVersion = ''
|
||||
try {
|
||||
remoteVersion = getNormalizedVersion(await loadRemoteAppVersion({ rounds: 3 }))
|
||||
} catch (error) {
|
||||
console.warn('get_version failed during config load:', error)
|
||||
}
|
||||
|
||||
const cached = readVersionedAppConfigCache(domain)
|
||||
|
||||
if (cached && remoteVersion && cached.version === remoteVersion) {
|
||||
const config = cached.config
|
||||
if (!isServerUnreachableConfig(config)) {
|
||||
writeStoredAppVersion(remoteVersion)
|
||||
// عمداً get_user در بکگراند نیست — فقط با عوض شدن ورژن
|
||||
return config
|
||||
}
|
||||
// کش قطع است با ورژن یکسان → fall through به fetch تازه
|
||||
}
|
||||
|
||||
// اگر get_version در دسترس نبود و کش سالم است، از کش استفاده کن
|
||||
if (cached && !remoteVersion) {
|
||||
console.warn('Using cached get_user because get_version is unavailable')
|
||||
const config = cached.config
|
||||
if (!isServerUnreachableConfig(config)) {
|
||||
return config
|
||||
}
|
||||
}
|
||||
|
||||
// سازگاری قدیمی بدون SA: کوکی کوچک
|
||||
if (!getSuperAdminBase() && !cached) {
|
||||
const cookieCached = readCachedAppConfig()
|
||||
if (cookieCached && !remoteVersion && !isServerUnreachableConfig(cookieCached)) {
|
||||
return cookieCached
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
const config = await fetchFreshAppConfig()
|
||||
if (isServerUnreachableConfig(config)) {
|
||||
lockForBlockedServer(config, domain, remoteVersion)
|
||||
}
|
||||
|
||||
stopUnblockPoll()
|
||||
if (remoteVersion) {
|
||||
writeVersionedAppConfigCache(config, remoteVersion, domain)
|
||||
writeStoredAppVersion(remoteVersion)
|
||||
} else {
|
||||
writeCachedAppConfig(config)
|
||||
}
|
||||
|
||||
return config
|
||||
} catch (error) {
|
||||
if (cached && isServerUnreachableConfig(cached.config)) {
|
||||
lockForBlockedServer(cached.config, domain, remoteVersion)
|
||||
}
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
import {
|
||||
allowSuperAdminFallback,
|
||||
getSuperAdminBases,
|
||||
isSuperAdminUrl,
|
||||
resolveTenantDomain,
|
||||
SA_RETRY_ROUNDS,
|
||||
} from '@/config/superadmin'
|
||||
|
||||
type VersionResponse =
|
||||
| string
|
||||
| number
|
||||
@@ -9,36 +17,25 @@ type VersionResponse =
|
||||
}
|
||||
|
||||
const VERSION_SUCCESS_URL_KEY = 'VERSION_Success_URL'
|
||||
export const VERSION_RETRY_ROUNDS = 5
|
||||
export const VERSION_RETRY_ROUNDS = SA_RETRY_ROUNDS
|
||||
|
||||
let versionFetchPromise: Promise<string | null> | null = null
|
||||
let cachedVersionResult: string | null | undefined
|
||||
|
||||
function getProtocol() {
|
||||
return window.location.protocol === 'https:' ? 'https:' : 'http:'
|
||||
}
|
||||
|
||||
/** فقط SuperAdmin — بدون رجیستری قدیمی */
|
||||
function getVersionUrls() {
|
||||
const protocol = getProtocol()
|
||||
|
||||
return [
|
||||
'https://nerkh.gold/get_version',
|
||||
'https://tablo.talasevin.ir/get_version',
|
||||
'https://abshode-service.montgit.ir/server/get_version',
|
||||
`${protocol}//212.23.201.173:8381/get_version`,
|
||||
`${protocol}//91.212.174.137:4040/server/get_version`
|
||||
]
|
||||
const domain = encodeURIComponent(resolveTenantDomain())
|
||||
return getSuperAdminBases().map((base) => `${base}/get_version?domain=${domain}`)
|
||||
}
|
||||
|
||||
function sortVersionUrls(urls: string[]) {
|
||||
const lastSuccessUrl = localStorage.getItem(VERSION_SUCCESS_URL_KEY)
|
||||
|
||||
if (!lastSuccessUrl) {
|
||||
return urls
|
||||
if (!lastSuccessUrl || !urls.includes(lastSuccessUrl) || !isSuperAdminUrl(lastSuccessUrl)) {
|
||||
if (lastSuccessUrl && !isSuperAdminUrl(lastSuccessUrl)) {
|
||||
localStorage.removeItem(VERSION_SUCCESS_URL_KEY)
|
||||
}
|
||||
return [...urls]
|
||||
}
|
||||
|
||||
const others = urls.filter((url) => url !== lastSuccessUrl)
|
||||
return [lastSuccessUrl, ...others]
|
||||
return [lastSuccessUrl, ...urls.filter((url) => url !== lastSuccessUrl)]
|
||||
}
|
||||
|
||||
function clearStaleVersionSuccessUrl(url: string) {
|
||||
@@ -89,10 +86,10 @@ async function fetchVersion(url: string, timeout = 3500): Promise<string | null>
|
||||
const response = await fetch(url, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Accept: 'application/json'
|
||||
Accept: 'application/json',
|
||||
},
|
||||
cache: 'no-store',
|
||||
signal: controller.signal
|
||||
signal: controller.signal,
|
||||
})
|
||||
|
||||
if (!response.ok) {
|
||||
@@ -100,10 +97,11 @@ async function fetchVersion(url: string, timeout = 3500): Promise<string | null>
|
||||
}
|
||||
|
||||
const contentType = response.headers.get('content-type') ?? ''
|
||||
if (!contentType.includes('application/json')) {
|
||||
throw new Error('Version response is not JSON')
|
||||
}
|
||||
|
||||
const data = contentType.includes('application/json')
|
||||
? ((await response.json()) as VersionResponse)
|
||||
: ((await response.text()) as VersionResponse)
|
||||
const data = (await response.json()) as VersionResponse
|
||||
|
||||
const version = normalizeVersionResponse(data)
|
||||
|
||||
@@ -112,15 +110,17 @@ async function fetchVersion(url: string, timeout = 3500): Promise<string | null>
|
||||
}
|
||||
|
||||
localStorage.setItem(VERSION_SUCCESS_URL_KEY, url)
|
||||
|
||||
return version
|
||||
} finally {
|
||||
window.clearTimeout(timeoutId)
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchVersionWithRetry(rounds = VERSION_RETRY_ROUNDS): Promise<string | null> {
|
||||
const urls = sortVersionUrls(getVersionUrls())
|
||||
async function tryFetchVersionFromUrls(
|
||||
urls: string[],
|
||||
rounds: number,
|
||||
): Promise<string | null> {
|
||||
if (!urls.length) return null
|
||||
|
||||
for (let round = 1; round <= rounds; round++) {
|
||||
for (let index = 0; index < urls.length; index++) {
|
||||
@@ -142,8 +142,27 @@ async function fetchVersionWithRetry(rounds = VERSION_RETRY_ROUNDS): Promise<str
|
||||
return null
|
||||
}
|
||||
|
||||
async function fetchVersionWithRetry(rounds = VERSION_RETRY_ROUNDS): Promise<string | null> {
|
||||
const urls = sortVersionUrls(getVersionUrls())
|
||||
const saUrls = urls.filter(isSuperAdminUrl)
|
||||
const otherUrls = urls.filter((url) => !isSuperAdminUrl(url))
|
||||
|
||||
const lists =
|
||||
saUrls.length > 0
|
||||
? allowSuperAdminFallback()
|
||||
? [saUrls, otherUrls]
|
||||
: [saUrls]
|
||||
: [urls]
|
||||
|
||||
for (const list of lists) {
|
||||
const version = await tryFetchVersionFromUrls(list, rounds)
|
||||
if (version) return version
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export function resetVersionCheckCache() {
|
||||
cachedVersionResult = undefined
|
||||
versionFetchPromise = null
|
||||
}
|
||||
|
||||
@@ -158,22 +177,13 @@ export async function loadRemoteAppVersion(options?: {
|
||||
resetVersionCheckCache()
|
||||
}
|
||||
|
||||
if (cachedVersionResult !== undefined) {
|
||||
return cachedVersionResult
|
||||
}
|
||||
|
||||
if (versionFetchPromise) {
|
||||
return versionFetchPromise
|
||||
}
|
||||
|
||||
versionFetchPromise = fetchVersionWithRetry(rounds)
|
||||
.then((version) => {
|
||||
cachedVersionResult = version
|
||||
return version
|
||||
})
|
||||
.finally(() => {
|
||||
versionFetchPromise = null
|
||||
})
|
||||
versionFetchPromise = fetchVersionWithRetry(rounds).finally(() => {
|
||||
versionFetchPromise = null
|
||||
})
|
||||
|
||||
return versionFetchPromise
|
||||
}
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
/** سوپرادمین — مستر، بعد دو اسلیو */
|
||||
export const SUPERADMIN_BASES = [
|
||||
'https://adm.montzar.ir',
|
||||
'https://adm.montech.ir',
|
||||
'https://adm.montest.ir',
|
||||
] as const
|
||||
|
||||
/** هر API: سه دامنه × سه دور */
|
||||
export const SA_RETRY_ROUNDS = 3
|
||||
|
||||
/** تنظیمات پیشرفته نسخه — همان دادهٔ /get_settings بدون نیاز به nginx جدا */
|
||||
export const SA_PROGRAM_SETTINGS_PATH = '/api/public/program-settings'
|
||||
|
||||
const PRODUCTION_SA = SUPERADMIN_BASES[0]
|
||||
/** پروکسی Vite در توسعه — بدون مشکل CORS */
|
||||
const DEV_SA_PROXY = '/__sa'
|
||||
|
||||
function isLoopbackBase(url: string) {
|
||||
try {
|
||||
const host = new URL(url, 'http://localhost').hostname
|
||||
return host === 'localhost' || host === '127.0.0.1'
|
||||
} catch {
|
||||
return /localhost|127\.0\.0\.1/i.test(url)
|
||||
}
|
||||
}
|
||||
|
||||
function isDevProxyBase(url: string) {
|
||||
return url === DEV_SA_PROXY || url.startsWith(`${DEV_SA_PROXY}/`)
|
||||
}
|
||||
|
||||
function normalizeBase(url: string) {
|
||||
return String(url || '').trim().replace(/\/$/, '')
|
||||
}
|
||||
|
||||
/** همه پایههای سوپرادمین به ترتیب اولویت (env اول، بعد لیست) */
|
||||
export function getSuperAdminBases(): string[] {
|
||||
const fromEnv = normalizeBase(String(import.meta.env.VITE_SUPERADMIN_URL || ''))
|
||||
const bases = [...SUPERADMIN_BASES]
|
||||
|
||||
// در DEV همیشه اول پروکسی Vite — بدون CORS؛ بعد failover به دامنههای SA
|
||||
if (import.meta.env.DEV && !fromEnv) {
|
||||
return [DEV_SA_PROXY, ...bases]
|
||||
}
|
||||
|
||||
if (fromEnv) {
|
||||
return [fromEnv, ...bases.filter((base) => base !== fromEnv)]
|
||||
}
|
||||
|
||||
return bases
|
||||
}
|
||||
|
||||
/** پایه سوپرادمین اول لیست — برای سازگاری با کد قبلی */
|
||||
export function getSuperAdminBase(): string {
|
||||
return getSuperAdminBases()[0] || ''
|
||||
}
|
||||
|
||||
/**
|
||||
* دامنه tenant برای get_user:
|
||||
* - VITE_TENANT_DOMAIN اگر ست باشد
|
||||
* - در DEV روی localhost → دمو خانگی
|
||||
* - در DEV روی IP/hostname LAN → همان host (برای domains[] در سوپرادمین)
|
||||
* - در prod → hostname
|
||||
*/
|
||||
export function resolveTenantDomain(): string {
|
||||
const override = String(import.meta.env.VITE_TENANT_DOMAIN || '').trim()
|
||||
if (override) return override
|
||||
|
||||
const host = String(window.location.hostname || '').trim()
|
||||
if (import.meta.env.DEV) {
|
||||
if (!host || host === 'localhost' || host === '127.0.0.1') {
|
||||
return 'k.montzar.ir'
|
||||
}
|
||||
return host
|
||||
}
|
||||
|
||||
return host || 'k.montzar.ir'
|
||||
}
|
||||
|
||||
export function isSuperAdminUrl(url: string): boolean {
|
||||
return getSuperAdminBases().some((base) => url.startsWith(base))
|
||||
}
|
||||
|
||||
/** boursecu: فقط SuperAdmin — fallback به رجیستری غیرفعال (modular در DEV=true) */
|
||||
export function allowSuperAdminFallback(): boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
/** آدرس SA جایگزین وقتی primary لوکال/پروکسی است */
|
||||
export function getFallbackSuperAdminBase(): string {
|
||||
const primary = getSuperAdminBase()
|
||||
if (!primary) return PRODUCTION_SA
|
||||
if (isLoopbackBase(primary) || isDevProxyBase(primary)) return PRODUCTION_SA
|
||||
const next = SUPERADMIN_BASES.find((base) => base !== primary)
|
||||
return next || ''
|
||||
}
|
||||
|
||||
export async function fetchSuperAdminJson<T>(
|
||||
buildUrl: (base: string) => string,
|
||||
timeout = 5000,
|
||||
): Promise<T> {
|
||||
let lastError: unknown
|
||||
const bases = getSuperAdminBases()
|
||||
for (let round = 1; round <= SA_RETRY_ROUNDS; round++) {
|
||||
for (const base of bases) {
|
||||
const controller = new AbortController()
|
||||
const timer = window.setTimeout(() => controller.abort(), timeout)
|
||||
try {
|
||||
const res = await fetch(buildUrl(base), {
|
||||
method: 'GET',
|
||||
cache: 'no-store',
|
||||
signal: controller.signal,
|
||||
headers: { Accept: 'application/json' },
|
||||
})
|
||||
if (!res.ok) {
|
||||
throw new Error(`HTTP ${res.status}`)
|
||||
}
|
||||
const contentType = res.headers.get('content-type') || ''
|
||||
if (!contentType.includes('application/json')) {
|
||||
throw new Error('SuperAdmin response is not JSON')
|
||||
}
|
||||
return (await res.json()) as T
|
||||
} catch (error) {
|
||||
lastError = error
|
||||
} finally {
|
||||
window.clearTimeout(timer)
|
||||
}
|
||||
}
|
||||
}
|
||||
throw lastError instanceof Error ? lastError : new Error('SuperAdmin unreachable')
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import { computed, ref } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { isGuestHomeActive } from '@/utils/guestHome'
|
||||
|
||||
export function useAppNavigation() {
|
||||
const router = useRouter()
|
||||
@@ -7,10 +8,29 @@ export function useAppNavigation() {
|
||||
|
||||
const popVisible = ref(false)
|
||||
const currentRoute = computed(() => route.name)
|
||||
const hideMenu = computed(() => !!route.meta.hideMenu)
|
||||
const hideMenu = computed(() => !!route.meta.hideMenu || isGuestHomeActive(route))
|
||||
/** فقط ناو پایین موبایل — سایدبار دسکتاپ را مخفی نمیکند */
|
||||
const hideBottomNav = computed(
|
||||
() => !!route.meta.hideBottomNav || !!route.meta.hideMenu,
|
||||
)
|
||||
|
||||
function isNavActive(routeName: string) {
|
||||
return currentRoute.value === routeName
|
||||
if (currentRoute.value === routeName) return true
|
||||
|
||||
// parent route (e.g. physicalReceive → list/new)
|
||||
if (route.matched.some((record) => record.name === routeName)) return true
|
||||
|
||||
// fund detail/add are sibling routes of fund
|
||||
if (routeName === 'fund') {
|
||||
return currentRoute.value === 'fund_info' || currentRoute.value === 'fund_add'
|
||||
}
|
||||
|
||||
// piggy detail/add are sibling routes of piggy
|
||||
if (routeName === 'piggy') {
|
||||
return currentRoute.value === 'piggy_info' || currentRoute.value === 'piggy_add'
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
function navItemClass(routeName: string) {
|
||||
@@ -34,6 +54,7 @@ export function useAppNavigation() {
|
||||
popVisible,
|
||||
currentRoute,
|
||||
hideMenu,
|
||||
hideBottomNav,
|
||||
isNavActive,
|
||||
navItemClass,
|
||||
navigateTo,
|
||||
|
||||
@@ -8,7 +8,7 @@ const BOURSECU_PRIMARY_NAV: AppNavItem[] = [
|
||||
{
|
||||
id: 'buyProduct',
|
||||
routeName: 'buyProduct',
|
||||
label: 'سفارشها',
|
||||
label: 'خرید و فروش',
|
||||
icon: 'vuesax-linear:box',
|
||||
iconSrc: getBoursecuActionIconSrc('buySell'),
|
||||
},
|
||||
@@ -33,19 +33,51 @@ const BOURSECU_PRIMARY_NAV: AppNavItem[] = [
|
||||
icon: 'vuesax-linear:wallet-1',
|
||||
iconSrc: getBoursecuActionIconSrc('wallet'),
|
||||
},
|
||||
{
|
||||
id: 'fund',
|
||||
routeName: 'fund',
|
||||
label: 'دارایی ها',
|
||||
icon: 'vuesax-linear:cup',
|
||||
iconSrc: getBoursecuActionIconSrc('assets'),
|
||||
},
|
||||
{
|
||||
id: 'physicalReceive',
|
||||
routeName: 'physicalReceive',
|
||||
label: 'تحویل فیزیکی',
|
||||
icon: 'vuesax-linear:direct-inbox',
|
||||
iconSrc: getBoursecuActionIconSrc('physicalReceive'),
|
||||
},
|
||||
{
|
||||
id: 'user',
|
||||
routeName: 'user',
|
||||
label: 'تنظیمات',
|
||||
label: 'امکانات بیشتر',
|
||||
icon: 'vuesax-linear:setting-2',
|
||||
iconSrc: getBoursecuActionIconSrc('settings'),
|
||||
},
|
||||
]
|
||||
|
||||
export const SECONDARY_NAV: AppNavItem[] = [
|
||||
{ id: 'notifyTrigger', routeName: 'notifyTrigger', label: 'هشدار قیمت', icon: 'vuesax-linear:bill' },
|
||||
{ id: 'about', routeName: 'about', label: 'درباره ما', icon: 'vuesax-linear:info-circle' },
|
||||
{ id: 'rules', routeName: 'rules', label: 'قوانین و مقررات', icon: 'vuesax-linear:task' },
|
||||
{
|
||||
id: 'notifyTrigger',
|
||||
routeName: 'notifyTrigger',
|
||||
label: 'هشدار قیمت',
|
||||
icon: 'vuesax-linear:bill',
|
||||
iconSrc: getBoursecuActionIconSrc('priceTrigger'),
|
||||
},
|
||||
{
|
||||
id: 'about',
|
||||
routeName: 'about',
|
||||
label: 'درباره ما',
|
||||
icon: 'vuesax-linear:info-circle',
|
||||
iconSrc: getBoursecuActionIconSrc('about'),
|
||||
},
|
||||
{
|
||||
id: 'rules',
|
||||
routeName: 'rules',
|
||||
label: 'قوانین و مقررات',
|
||||
icon: 'vuesax-linear:task',
|
||||
iconSrc: getBoursecuActionIconSrc('rules'),
|
||||
},
|
||||
]
|
||||
|
||||
export function getPrimaryNavItems(): AppNavItem[] {
|
||||
|
||||
@@ -8,31 +8,33 @@
|
||||
/>
|
||||
</div>
|
||||
|
||||
<nav class="desktop-sidebar__section" aria-label="منوی اصلی">
|
||||
<DesktopNavItem
|
||||
v-for="item in primaryItems"
|
||||
:key="item.id"
|
||||
:icon="item.icon"
|
||||
:icon-src="item.iconSrc"
|
||||
:label="item.label"
|
||||
:active="isNavActive(item.routeName)"
|
||||
@click="navigateTo(item.routeName)"
|
||||
/>
|
||||
</nav>
|
||||
<div class="desktop-sidebar__nav-scroll">
|
||||
<nav class="desktop-sidebar__section" aria-label="منوی اصلی">
|
||||
<DesktopNavItem
|
||||
v-for="item in primaryItems"
|
||||
:key="item.id"
|
||||
:icon="item.icon"
|
||||
:icon-src="item.iconSrc"
|
||||
:label="item.label"
|
||||
:active="isNavActive(item.routeName)"
|
||||
@click="navigateTo(item.routeName)"
|
||||
/>
|
||||
</nav>
|
||||
|
||||
<div class="desktop-sidebar__divider" />
|
||||
<div class="desktop-sidebar__divider" />
|
||||
|
||||
<nav class="desktop-sidebar__section desktop-sidebar__section--secondary" aria-label="منوی فرعی">
|
||||
<DesktopNavItem
|
||||
v-for="item in secondaryItems"
|
||||
:key="item.id"
|
||||
:icon="item.icon"
|
||||
:icon-src="item.iconSrc"
|
||||
:label="item.label"
|
||||
:active="isNavActive(item.routeName)"
|
||||
@click="navigateTo(item.routeName)"
|
||||
/>
|
||||
</nav>
|
||||
<nav class="desktop-sidebar__section desktop-sidebar__section--secondary" aria-label="منوی فرعی">
|
||||
<DesktopNavItem
|
||||
v-for="item in secondaryItems"
|
||||
:key="item.id"
|
||||
:icon="item.icon"
|
||||
:icon-src="item.iconSrc"
|
||||
:label="item.label"
|
||||
:active="isNavActive(item.routeName)"
|
||||
@click="navigateTo(item.routeName)"
|
||||
/>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div class="desktop-sidebar__credit">
|
||||
<AppCreditLink variant="sidebar" />
|
||||
@@ -43,16 +45,33 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue'
|
||||
import { useConfigStore } from '@/store/configStore'
|
||||
import { useSettingsStore } from '@/store/settingsStore'
|
||||
import { getProjectSplashLogo } from '@/utils/config'
|
||||
import { featureSettingForRoute } from '@/utils/superAdminMenuGates'
|
||||
import { getPrimaryNavItems, SECONDARY_NAV } from '../config/navigation'
|
||||
import { useAppNavigation } from '../composables/useAppNavigation'
|
||||
import DesktopNavItem from './DesktopNavItem.vue'
|
||||
import AppCreditLink from '@/components/AppCreditLink.vue'
|
||||
|
||||
const config = useConfigStore()
|
||||
const settingsStore = useSettingsStore()
|
||||
const navLogo = computed(() => getProjectSplashLogo(config.config?.avatar))
|
||||
const primaryItems = getPrimaryNavItems()
|
||||
const secondaryItems = SECONDARY_NAV
|
||||
|
||||
const primaryItems = computed(() =>
|
||||
getPrimaryNavItems().filter((item) => {
|
||||
const featureKey = featureSettingForRoute(item.routeName)
|
||||
if (featureKey) return settingsStore.isSettingTruthy(featureKey)
|
||||
return true
|
||||
}),
|
||||
)
|
||||
|
||||
const secondaryItems = computed(() =>
|
||||
SECONDARY_NAV.filter((item) => {
|
||||
const featureKey = featureSettingForRoute(item.routeName)
|
||||
if (featureKey) return settingsStore.isSettingTruthy(featureKey)
|
||||
return true
|
||||
}),
|
||||
)
|
||||
|
||||
const { isNavActive, navigateTo } = useAppNavigation()
|
||||
</script>
|
||||
|
||||
@@ -27,6 +27,11 @@
|
||||
background: @prefixCls-background-color;
|
||||
}
|
||||
|
||||
.desktop-app-layout__content.support-page {
|
||||
overflow: hidden;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.desktop-sidebar {
|
||||
flex-shrink: 0;
|
||||
width: var(--app-desktop-sidebar-width, 260px);
|
||||
@@ -95,6 +100,7 @@
|
||||
justify-content: center;
|
||||
padding: 8px 12px 20px;
|
||||
margin-bottom: 4px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.desktop-sidebar__logo {
|
||||
@@ -105,27 +111,50 @@
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.desktop-sidebar__nav-scroll {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0;
|
||||
padding-bottom: 8px;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
.desktop-sidebar__section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.desktop-sidebar__section--secondary {
|
||||
margin-top: auto;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.desktop-sidebar__credit {
|
||||
margin-top: 12px;
|
||||
padding: 12px 8px 4px;
|
||||
flex-shrink: 0;
|
||||
margin-top: 8px;
|
||||
padding: 14px 10px 6px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
border-top: 1px solid rgba(15, 23, 42, 0.08);
|
||||
}
|
||||
|
||||
.desktop-sidebar--boursecu .desktop-sidebar__credit {
|
||||
border-top-color: rgba(255, 255, 255, 0.12);
|
||||
}
|
||||
|
||||
.desktop-sidebar__divider {
|
||||
height: 1px;
|
||||
background: rgba(0, 0, 0, 0.08);
|
||||
margin: 12px 8px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.desktop-nav-item {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="mobile-app-layout">
|
||||
<div :class="['main-with-bottom-chrome', { 'main-with-bottom-chrome--no-nav': hideMenu }]">
|
||||
<div :class="['main-with-bottom-chrome', { 'main-with-bottom-chrome--no-nav': hideBottomNav }]">
|
||||
<router-view v-slot="{ Component, route: activeRoute }">
|
||||
<transition :name="activeRoute.meta.transition || 'fade'">
|
||||
<component :is="Component" :key="activeRoute.fullPath" class="main-with-bottom-chrome-inner" />
|
||||
@@ -9,7 +9,7 @@
|
||||
</div>
|
||||
|
||||
<MobileBottomNav
|
||||
v-if="!hideMenu"
|
||||
v-if="!hideBottomNav"
|
||||
:nav-item-class="navItemClass"
|
||||
@navigate="navigateTo"
|
||||
/>
|
||||
@@ -26,7 +26,7 @@ import MobileBottomNav from './MobileBottomNav.vue'
|
||||
const route = useRoute()
|
||||
|
||||
const {
|
||||
hideMenu,
|
||||
hideBottomNav,
|
||||
navItemClass,
|
||||
navigateTo,
|
||||
} = useAppNavigation()
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
class="tab__icon-image"
|
||||
/>
|
||||
</div>
|
||||
<div class="text-xs mt-1 font-bold">تنظیمات</div>
|
||||
<div class="text-xs mt-1 font-bold">امکانات بیشتر</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -77,15 +77,19 @@ html.app-layout--desktop {
|
||||
}
|
||||
}
|
||||
|
||||
/* Splash — always full viewport; never sidebar-offset */
|
||||
/* Splash — always full viewport; never sidebar-offset or 426px mobile frame */
|
||||
.app-splash-screen {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
max-width: none;
|
||||
position: fixed !important;
|
||||
inset: 0 !important;
|
||||
width: 100vw !important;
|
||||
min-width: 100vw !important;
|
||||
max-width: none !important;
|
||||
min-height: 100vh !important;
|
||||
min-height: 100dvh !important;
|
||||
left: 0 !important;
|
||||
right: 0 !important;
|
||||
margin: 0 !important;
|
||||
transform: none !important;
|
||||
z-index: 1000000000000;
|
||||
|
||||
&__gradient {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* Mobile shell width rules.
|
||||
* Below 426px: full viewport (phones).
|
||||
* 426px–767px: centered 426px frame (tablet-ish mobile).
|
||||
* از ۷۶۸px شل دسکتاپ (سایدبار) فعال میشود.
|
||||
*/
|
||||
|
||||
html:not(.app-layout--desktop) {
|
||||
@@ -83,6 +84,15 @@ html:not(.app-layout--desktop) {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
/* Prevent flex shrink-to-content: otherwise #app collapses and white
|
||||
gutters appear beside splash/boot during refresh. */
|
||||
#app {
|
||||
width: 100% !important;
|
||||
max-width: 100% !important;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.desktopConfig {
|
||||
width: 426px !important;
|
||||
max-width: 426px !important;
|
||||
|
||||