diff --git a/components.d.ts b/components.d.ts index 217ca62..e9be9b0 100644 --- a/components.d.ts +++ b/components.d.ts @@ -14,12 +14,16 @@ declare module 'vue' { AInput: typeof import('ant-design-vue/es')['Input'] AInputPassword: typeof import('ant-design-vue/es')['InputPassword'] AModal: typeof import('ant-design-vue/es')['Modal'] + ARadio: typeof import('ant-design-vue/es')['Radio'] ARadioButton: typeof import('ant-design-vue/es')['RadioButton'] ARadioGroup: typeof import('ant-design-vue/es')['RadioGroup'] ASelect: typeof import('ant-design-vue/es')['Select'] ASelectOption: typeof import('ant-design-vue/es')['SelectOption'] ASlider: typeof import('ant-design-vue/es')['Slider'] ASpin: typeof import('ant-design-vue/es')['Spin'] + ASwitch: typeof import('ant-design-vue/es')['Switch'] + ATag: typeof import('ant-design-vue/es')['Tag'] + ATextarea: typeof import('ant-design-vue/es')['Textarea'] ATooltip: typeof import('ant-design-vue/es')['Tooltip'] BaseDatePicker: typeof import('./src/components/BasicPacks/BaseDatePicker/src/BaseDatePicker.vue')['default'] Basic: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/basic.vue')['default'] @@ -63,5 +67,6 @@ declare module 'vue' { TransactionSkeleton: typeof import('./src/components/TransactionSkeleton.vue')['default'] VanActionSheet: typeof import('vant/es')['ActionSheet'] VanDialog: typeof import('vant/es')['Dialog'] + VanField: typeof import('vant/es')['Field'] } } diff --git a/src/views/base/home/components/ActionButton.vue b/src/views/base/home/components/ActionButton.vue new file mode 100644 index 0000000..f7ed11c --- /dev/null +++ b/src/views/base/home/components/ActionButton.vue @@ -0,0 +1,32 @@ + + + \ No newline at end of file diff --git a/src/views/base/home/components/AppHeader.vue b/src/views/base/home/components/AppHeader.vue new file mode 100644 index 0000000..ca43d94 --- /dev/null +++ b/src/views/base/home/components/AppHeader.vue @@ -0,0 +1,40 @@ + + + \ No newline at end of file diff --git a/src/views/base/home/components/AssetItem.vue b/src/views/base/home/components/AssetItem.vue new file mode 100644 index 0000000..fc8431a --- /dev/null +++ b/src/views/base/home/components/AssetItem.vue @@ -0,0 +1,13 @@ + + + \ No newline at end of file diff --git a/src/views/base/home/components/AssetsSection.vue b/src/views/base/home/components/AssetsSection.vue new file mode 100644 index 0000000..138115d --- /dev/null +++ b/src/views/base/home/components/AssetsSection.vue @@ -0,0 +1,31 @@ + + + \ No newline at end of file diff --git a/src/views/base/home/components/BalanceSheet.vue b/src/views/base/home/components/BalanceSheet.vue new file mode 100644 index 0000000..c804b2a --- /dev/null +++ b/src/views/base/home/components/BalanceSheet.vue @@ -0,0 +1,84 @@ + + + \ No newline at end of file diff --git a/src/views/base/home/components/BannerSlider.vue b/src/views/base/home/components/BannerSlider.vue new file mode 100644 index 0000000..038ff08 --- /dev/null +++ b/src/views/base/home/components/BannerSlider.vue @@ -0,0 +1,59 @@ + + + + + \ No newline at end of file diff --git a/src/views/base/home/components/CurrentPrice.vue b/src/views/base/home/components/CurrentPrice.vue new file mode 100644 index 0000000..2fc32d4 --- /dev/null +++ b/src/views/base/home/components/CurrentPrice.vue @@ -0,0 +1,61 @@ + + + \ No newline at end of file diff --git a/src/views/base/home/components/LogoutConfirmDialog.vue b/src/views/base/home/components/LogoutConfirmDialog.vue new file mode 100644 index 0000000..32f88b3 --- /dev/null +++ b/src/views/base/home/components/LogoutConfirmDialog.vue @@ -0,0 +1,41 @@ + + + \ No newline at end of file diff --git a/src/views/base/home/components/MarketClosedMessage.vue b/src/views/base/home/components/MarketClosedMessage.vue new file mode 100644 index 0000000..3157a53 --- /dev/null +++ b/src/views/base/home/components/MarketClosedMessage.vue @@ -0,0 +1,13 @@ + + + \ No newline at end of file diff --git a/src/views/base/home/components/PriceChart.vue b/src/views/base/home/components/PriceChart.vue new file mode 100644 index 0000000..a54b74e --- /dev/null +++ b/src/views/base/home/components/PriceChart.vue @@ -0,0 +1,104 @@ + + + \ No newline at end of file diff --git a/src/views/base/home/components/PriceStats.vue b/src/views/base/home/components/PriceStats.vue new file mode 100644 index 0000000..5023cc1 --- /dev/null +++ b/src/views/base/home/components/PriceStats.vue @@ -0,0 +1,34 @@ + + + \ No newline at end of file diff --git a/src/views/base/home/components/ReferralSection.vue b/src/views/base/home/components/ReferralSection.vue new file mode 100644 index 0000000..b03caec --- /dev/null +++ b/src/views/base/home/components/ReferralSection.vue @@ -0,0 +1,63 @@ + + + \ No newline at end of file diff --git a/src/views/base/home/components/ShareModal.vue b/src/views/base/home/components/ShareModal.vue new file mode 100644 index 0000000..c7a44d5 --- /dev/null +++ b/src/views/base/home/components/ShareModal.vue @@ -0,0 +1,78 @@ + + + \ No newline at end of file diff --git a/src/views/base/home/composables/useBanners.ts b/src/views/base/home/composables/useBanners.ts new file mode 100644 index 0000000..de7dfb6 --- /dev/null +++ b/src/views/base/home/composables/useBanners.ts @@ -0,0 +1,37 @@ +import { ref } from 'vue' +import { getConstByKey } from '@/api/const' + +export function useBanners() { + const banners = ref([]) + const loading = ref(false) + + const loadBanners = async () => { + try { + loading.value = true + const response = await getConstByKey('header_banner') + if (!response) return + + let list = [] + if (typeof response === 'string') { + list = JSON.parse(response) + } else if (typeof response === 'object' && !Array.isArray(response) && 'value' in response) { + list = typeof response.value === 'string' ? JSON.parse(response.value) : response.value + } else if (Array.isArray(response) && response.length > 0) { + const first = response[0] + if (first.value) { + list = typeof first.value === 'string' ? JSON.parse(first.value) : first.value + } else if (first.icon) { + list = response + } + } + + banners.value = Array.isArray(list) ? list.filter(b => b.show === true) : [] + } catch (error) { + console.error('Error loading banners:', error) + } finally { + loading.value = false + } + } + + return { banners, loading, loadBanners } +} \ No newline at end of file diff --git a/src/views/base/home/composables/usePriceChart.ts b/src/views/base/home/composables/usePriceChart.ts new file mode 100644 index 0000000..9a56a33 --- /dev/null +++ b/src/views/base/home/composables/usePriceChart.ts @@ -0,0 +1,33 @@ +import { ref } from 'vue' +import { getAllPrices } from '@/api/home' + +export function usePriceChart() { + const priceChartSeries = ref([{ name: 'قیمت', data: [] }]) + const selection = ref('DAILY') + const chartLoading = ref(false) + + const toPersianNumber = (num: number) => { + return num.toString().replace(/\d/g, (d) => '۰۱۲۳۴۵۶۷۸۹'[d]) + } + + const fetchPrices = async () => { + try { + chartLoading.value = true + const response = await getAllPrices() + const data = response.data?.prices + const selectedData = data[selection.value] || [] + priceChartSeries.value[0].data = selectedData.map((item: any) => [item.timestamp, item.value - 1]) + } catch (error) { + console.error('Error fetching prices:', error) + } finally { + chartLoading.value = false + } + } + + const updateChartData = (timeline: string) => { + selection.value = timeline + fetchPrices() + } + + return { priceChartSeries, chartLoading, updateChartData, fetchPrices } +} \ No newline at end of file diff --git a/src/views/base/home/composables/useUserFunds.ts b/src/views/base/home/composables/useUserFunds.ts new file mode 100644 index 0000000..f85f53d --- /dev/null +++ b/src/views/base/home/composables/useUserFunds.ts @@ -0,0 +1,22 @@ +import { ref } from 'vue' +import { useFundUserStore } from '@/store/fundStore' + +export function useUserFunds() { + const funds = ref([]) + const loading = ref(false) + const fundStore = useFundUserStore() + + const loadFunds = async () => { + try { + loading.value = true + const result = await fundStore.getMyFund() + funds.value = result?.rows || [] + } catch (error) { + console.error('Error loading funds:', error) + } finally { + loading.value = false + } + } + + return { funds, loading, loadFunds } +} \ No newline at end of file diff --git a/src/views/base/home/index.vue b/src/views/base/home/index.vue index 1b1b324..4cccb41 100644 --- a/src/views/base/home/index.vue +++ b/src/views/base/home/index.vue @@ -1,1160 +1,310 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/src/views/base/home/index_old3.vue b/src/views/base/home/index_old3.vue new file mode 100644 index 0000000..d393bf5 --- /dev/null +++ b/src/views/base/home/index_old3.vue @@ -0,0 +1,1161 @@ + + + + + + + \ No newline at end of file