fix bugs
This commit is contained in:
Vendored
+3
@@ -20,8 +20,10 @@ declare module 'vue' {
|
|||||||
ARadioGroup: typeof import('ant-design-vue/es')['RadioGroup']
|
ARadioGroup: typeof import('ant-design-vue/es')['RadioGroup']
|
||||||
ASelect: typeof import('ant-design-vue/es')['Select']
|
ASelect: typeof import('ant-design-vue/es')['Select']
|
||||||
ASelectOption: typeof import('ant-design-vue/es')['SelectOption']
|
ASelectOption: typeof import('ant-design-vue/es')['SelectOption']
|
||||||
|
ASlider: typeof import('ant-design-vue/es')['Slider']
|
||||||
ASpin: typeof import('ant-design-vue/es')['Spin']
|
ASpin: typeof import('ant-design-vue/es')['Spin']
|
||||||
ASwitch: typeof import('ant-design-vue/es')['Switch']
|
ASwitch: typeof import('ant-design-vue/es')['Switch']
|
||||||
|
ATag: typeof import('ant-design-vue/es')['Tag']
|
||||||
ATextarea: typeof import('ant-design-vue/es')['Textarea']
|
ATextarea: typeof import('ant-design-vue/es')['Textarea']
|
||||||
ATooltip: typeof import('ant-design-vue/es')['Tooltip']
|
ATooltip: typeof import('ant-design-vue/es')['Tooltip']
|
||||||
BaseDatePicker: typeof import('./src/components/BasicPacks/BaseDatePicker/src/BaseDatePicker.vue')['default']
|
BaseDatePicker: typeof import('./src/components/BasicPacks/BaseDatePicker/src/BaseDatePicker.vue')['default']
|
||||||
@@ -68,5 +70,6 @@ declare module 'vue' {
|
|||||||
TransactionSkeleton: typeof import('./src/components/TransactionSkeleton.vue')['default']
|
TransactionSkeleton: typeof import('./src/components/TransactionSkeleton.vue')['default']
|
||||||
VanActionSheet: typeof import('vant/es')['ActionSheet']
|
VanActionSheet: typeof import('vant/es')['ActionSheet']
|
||||||
VanDialog: typeof import('vant/es')['Dialog']
|
VanDialog: typeof import('vant/es')['Dialog']
|
||||||
|
VanField: typeof import('vant/es')['Field']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { setupRouterGuards } from '@/app/setupRouter'
|
|||||||
import router from '@/router'
|
import router from '@/router'
|
||||||
import { applyProjectTheme } from '@/utils/config'
|
import { applyProjectTheme } from '@/utils/config'
|
||||||
import { useSettingsStore } from '@/store/settingsStore'
|
import { useSettingsStore } from '@/store/settingsStore'
|
||||||
|
import { useUserStore } from '@/store/userStore'
|
||||||
import { getToken } from '@/utils'
|
import { getToken } from '@/utils'
|
||||||
|
|
||||||
type BootWindow = Window & {
|
type BootWindow = Window & {
|
||||||
@@ -93,9 +94,14 @@ export async function bootstrapApp() {
|
|||||||
|
|
||||||
const { app } = createVueApp()
|
const { app } = createVueApp()
|
||||||
const settingsStore = useSettingsStore()
|
const settingsStore = useSettingsStore()
|
||||||
|
const userStore = useUserStore()
|
||||||
|
|
||||||
await withTimeout(settingsStore.fetchSettings(), 45000, 'Settings loading timeout')
|
await withTimeout(settingsStore.fetchSettings(), 45000, 'Settings loading timeout')
|
||||||
|
|
||||||
|
if (getToken()) {
|
||||||
|
await withTimeout(userStore.getMyInfo(), 45000, 'User session loading timeout')
|
||||||
|
}
|
||||||
|
|
||||||
setupRouterGuards()
|
setupRouterGuards()
|
||||||
|
|
||||||
app.mount('#app')
|
app.mount('#app')
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ import bazretalaNavLogo from '@/assets/img/bazretala-nav-logo.png'
|
|||||||
import bazretalaFundBg from '@/assets/img/bazretala-fund-bg.png'
|
import bazretalaFundBg from '@/assets/img/bazretala-fund-bg.png'
|
||||||
import bazretalaEmptyFund from '@/assets/img/bazretala-empty-fund.png'
|
import bazretalaEmptyFund from '@/assets/img/bazretala-empty-fund.png'
|
||||||
|
|
||||||
import { useSettingsStore } from '@/store/settingsStore'
|
|
||||||
|
|
||||||
export function getConfigApp(key: string) {
|
export function getConfigApp(key: string) {
|
||||||
const config = window.__APP_CONFIG__ ? window.__APP_CONFIG__.user:{}
|
const config = window.__APP_CONFIG__ ? window.__APP_CONFIG__.user:{}
|
||||||
|
|
||||||
@@ -241,103 +239,3 @@ export function applyProjectTheme() {
|
|||||||
document.documentElement.style.setProperty('--App-brand-red-100', '#f0d8d8')
|
document.documentElement.style.setProperty('--App-brand-red-100', '#f0d8d8')
|
||||||
document.documentElement.style.setProperty('--App-brand-red-700', '#963130')
|
document.documentElement.style.setProperty('--App-brand-red-700', '#963130')
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getReferralShareTitle(projectName?: string | null) {
|
|
||||||
return projectName ?? getConfigApp('name_fa') ?? getConfigApp('name') ?? 'طلا'
|
|
||||||
}
|
|
||||||
|
|
||||||
/** جایگزینی ٪نام / %نام و ٪لینک / %لینک در قالب متن دعوت */
|
|
||||||
export function renderInviteLinkText(
|
|
||||||
template: string,
|
|
||||||
options: { userName?: string | null; link?: string | null },
|
|
||||||
): string {
|
|
||||||
const userName = String(options.userName ?? '').trim()
|
|
||||||
const link = String(options.link ?? '').trim()
|
|
||||||
|
|
||||||
return template
|
|
||||||
.replace(/[%٪]\s*لینک/gu, link)
|
|
||||||
.replace(/[%٪]\s*نام/gu, userName)
|
|
||||||
}
|
|
||||||
|
|
||||||
function resolveReferralLoginLink(referralId?: string | number | null): string {
|
|
||||||
const id = String(referralId ?? '').trim()
|
|
||||||
if (!id) return ''
|
|
||||||
|
|
||||||
let base = ''
|
|
||||||
try {
|
|
||||||
base = String(useSettingsStore().getSettingByKey('app_url') ?? '').trim()
|
|
||||||
} catch {
|
|
||||||
base = ''
|
|
||||||
}
|
|
||||||
|
|
||||||
if (base) {
|
|
||||||
return `${base.replace(/\/+$/, '')}/login?id=${encodeURIComponent(id)}`
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof window !== 'undefined' && window.location?.origin) {
|
|
||||||
return `${window.location.origin}/login?id=${encodeURIComponent(id)}`
|
|
||||||
}
|
|
||||||
|
|
||||||
return `/login?id=${encodeURIComponent(id)}`
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getReferralShareText(options: {
|
|
||||||
userName?: string | null
|
|
||||||
projectName?: string | null
|
|
||||||
referralId?: string | number | null
|
|
||||||
}) {
|
|
||||||
const userName = options.userName ?? ''
|
|
||||||
const referralId = options.referralId ?? ''
|
|
||||||
const link = resolveReferralLoginLink(referralId)
|
|
||||||
const marketText = options.projectName
|
|
||||||
? `بازار طلای ${options.projectName}`
|
|
||||||
: 'بازار طلا'
|
|
||||||
|
|
||||||
let template = ''
|
|
||||||
try {
|
|
||||||
template = String(useSettingsStore().getSettingByKey('invite_link_text') ?? '').trim()
|
|
||||||
} catch {
|
|
||||||
template = ''
|
|
||||||
}
|
|
||||||
|
|
||||||
if (template) {
|
|
||||||
return renderInviteLinkText(template, { userName, link })
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isBoursecuProject()) {
|
|
||||||
return `مس؛ فلز آینده جهان
|
|
||||||
|
|
||||||
⭐️ امروز در آینده مس سرمایهگذاری کن؛ ثمره آن را در سالهای پیش رو برداشت کن!
|
|
||||||
|
|
||||||
رشد صنایع انرژی پاک، خودروهای برقی و زیرساختهای نوین، تقاضا برای مس را در سالهای آینده افزایش خواهد داد.
|
|
||||||
|
|
||||||
با سرمایهگذاری تدریجی و مستمر در بازار مس، از رشد بلندمدت یکی از مهمترین فلزات استراتژیک جهان بهرهمند شوید.
|
|
||||||
|
|
||||||
این دعوتنامه از طرف «${userName}» برای شما ارسال شده است تا شما نیز از فرصتهای سرمایهگذاری در بورس مس جا نمانید.
|
|
||||||
|
|
||||||
برای مشاهده قیمتها، تحلیل بازار و تکمیل ثبتنام، روی لینک زیر کلیک کنید
|
|
||||||
|
|
||||||
${link}`
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isBazretalaProject()) {
|
|
||||||
return `️سلام به مناسبت افتتاحیه بذرطلا وایّام عیدغدیر ومباهله با ثبت نام آنلاین واَمن بدون کارمزد0/5% از بذرطلا با تائیدمُعرف خرید کنید و نذارین پول خُرداتون خاک بخوره (عضویت فقط ازطریق مُعرف امکان پذیرمیباشد)
|
|
||||||
بذرش کن بکار،پس اندازکن هروقت خواستی
|
|
||||||
طلا برداشت کن بدون مالیات
|
|
||||||
با پول های کوچک و بیکارت
|
|
||||||
ی پس انداز طلایی برای خودت و خونوادت درست کن ما در بذرطلا آنلاین کنارت هستیم
|
|
||||||
|
|
||||||
این دعوت نامه از طرف "${userName}" عضوفعالِ اَپ بذرطلا برای شما ارسال شده تا شما هم از کاشت بذر طلای خودتون جا نمونید.
|
|
||||||
روی لینک زیر کلیک کنید و کاشت بذرطلای خودتونو با ثبت نام و خرید اول تکمیل کنید.
|
|
||||||
|
|
||||||
${link}`
|
|
||||||
}
|
|
||||||
|
|
||||||
return `⭐️الان طلا بخر؛ آخر ماه سودشو ببر!
|
|
||||||
با خرید طلای آبشده در مقدارهای کم ولی مستمر، سود بیشتری ببر!
|
|
||||||
|
|
||||||
این دعوت نامه از طرف "${userName}" عزیز برای شما ارسال شده تا شما هم از ${marketText} جا نمونید.
|
|
||||||
روی لینک زیر کلیک کنید و ثبت نام خود را تکمیل کنید.
|
|
||||||
|
|
||||||
${link}`
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -0,0 +1,95 @@
|
|||||||
|
import { message } from 'ant-design-vue'
|
||||||
|
import { useSettingsStore } from '@/store/settingsStore'
|
||||||
|
import { getConfigApp } from '@/utils/config'
|
||||||
|
|
||||||
|
export function getReferralShareTitle(projectName?: string | null) {
|
||||||
|
return projectName ?? getConfigApp('name_fa') ?? getConfigApp('name') ?? 'طلا'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const DEFAULT_INVITE_LINK_TEXT = `⭐️الان طلا بخر؛ آخر ماه سودشو ببر!
|
||||||
|
با خرید طلای آبشده در مقدارهای کم ولی مستمر، سود بیشتری ببر!
|
||||||
|
|
||||||
|
این دعوت نامه از طرف "٪نام" عزیز برای شما ارسال شده تا شما هم از بازار طلای ما جا نمونید.
|
||||||
|
روی لینک زیر کلیک کنید و ثبت نام خود را تکمیل کنید.
|
||||||
|
|
||||||
|
٪لینک`
|
||||||
|
|
||||||
|
export function getInviteLinkTemplate(): string {
|
||||||
|
try {
|
||||||
|
const fromSettings = String(useSettingsStore().getSettingByKey('invite_link_text') ?? '').trim()
|
||||||
|
if (fromSettings) {
|
||||||
|
return fromSettings
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// settings store may not be ready yet
|
||||||
|
}
|
||||||
|
return DEFAULT_INVITE_LINK_TEXT
|
||||||
|
}
|
||||||
|
|
||||||
|
/** جایگزینی ٪نام / %نام و ٪لینک / %لینک در قالب متن دعوت */
|
||||||
|
export function renderInviteLinkText(
|
||||||
|
template: string,
|
||||||
|
options: { userName?: string | null; link?: string | null },
|
||||||
|
): string {
|
||||||
|
const userName = String(options.userName ?? '').trim()
|
||||||
|
const link = String(options.link ?? '').trim()
|
||||||
|
|
||||||
|
return template
|
||||||
|
.replace(/[%٪]\s*لینک/gu, link)
|
||||||
|
.replace(/[%٪]\s*نام/gu, userName)
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveReferralLoginLink(referralId?: string | number | null): string {
|
||||||
|
const id = String(referralId ?? '').trim()
|
||||||
|
if (!id) return ''
|
||||||
|
|
||||||
|
let base = ''
|
||||||
|
try {
|
||||||
|
base = String(useSettingsStore().getSettingByKey('app_url') ?? '').trim()
|
||||||
|
} catch {
|
||||||
|
base = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
if (base) {
|
||||||
|
return `${base.replace(/\/+$/, '')}/login?id=${encodeURIComponent(id)}`
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof window !== 'undefined' && window.location?.origin) {
|
||||||
|
return `${window.location.origin}/login?id=${encodeURIComponent(id)}`
|
||||||
|
}
|
||||||
|
|
||||||
|
return `/login?id=${encodeURIComponent(id)}`
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getReferralShareText(options: {
|
||||||
|
userName?: string | null
|
||||||
|
projectName?: string | null
|
||||||
|
referralId?: string | number | null
|
||||||
|
}) {
|
||||||
|
const userName = options.userName ?? ''
|
||||||
|
const link = resolveReferralLoginLink(options.referralId)
|
||||||
|
return renderInviteLinkText(getInviteLinkTemplate(), { userName, link })
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function shareReferralText(text: string, title?: string | null): Promise<void> {
|
||||||
|
const shareTitle = title ?? getReferralShareTitle()
|
||||||
|
|
||||||
|
if (typeof navigator !== 'undefined' && typeof navigator.share === 'function') {
|
||||||
|
try {
|
||||||
|
await navigator.share({ title: shareTitle, text })
|
||||||
|
return
|
||||||
|
} catch (err) {
|
||||||
|
if ((err as Error)?.name === 'AbortError') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof navigator !== 'undefined' && navigator.clipboard?.writeText) {
|
||||||
|
await navigator.clipboard.writeText(text)
|
||||||
|
message.info('متن دعوتنامه رونوشت شد')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
message.error('اشتراکگذاری در این مرورگر پشتیبانی نمیشود')
|
||||||
|
}
|
||||||
@@ -4,7 +4,7 @@ import { getEarnMoney } from '@/api/earnMoney'
|
|||||||
import type { EarnMoney } from '@/models/earnMoney'
|
import type { EarnMoney } from '@/models/earnMoney'
|
||||||
import { useUserStore } from '@/store/userStore'
|
import { useUserStore } from '@/store/userStore'
|
||||||
import { useConfigStore } from '@/store/configStore'
|
import { useConfigStore } from '@/store/configStore'
|
||||||
import { getReferralShareText, getReferralShareTitle } from '@/utils/config'
|
import { getReferralShareText, getReferralShareTitle, shareReferralText } from '@/utils/referralShare'
|
||||||
import { loading } from '@/utils'
|
import { loading } from '@/utils'
|
||||||
|
|
||||||
export interface EarnMoneyPageContext {
|
export interface EarnMoneyPageContext {
|
||||||
@@ -44,10 +44,7 @@ export function useEarnMoneyPage() {
|
|||||||
projectName: nameProject,
|
projectName: nameProject,
|
||||||
referralId: userStore.userInfo?.referral_id,
|
referralId: userStore.userInfo?.referral_id,
|
||||||
})
|
})
|
||||||
navigator.share({
|
void shareReferralText(val, getReferralShareTitle(nameProject))
|
||||||
title: getReferralShareTitle(nameProject),
|
|
||||||
text: val,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadEarnMoney() {
|
async function loadEarnMoney() {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
import { useUserStore } from '@/store/userStore'
|
import { useUserStore } from '@/store/userStore'
|
||||||
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||||
import { message } from 'ant-design-vue'
|
import { message } from 'ant-design-vue'
|
||||||
import { getReferralShareText, getReferralShareTitle } from '@/utils/config'
|
import { getReferralShareText, getReferralShareTitle, shareReferralText } from '@/utils/referralShare'
|
||||||
|
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ const shareCode = () => {
|
|||||||
referralId: userStore.userInfo?.referral_id,
|
referralId: userStore.userInfo?.referral_id,
|
||||||
})
|
})
|
||||||
|
|
||||||
navigator.share({ title: getReferralShareTitle(), text })
|
void shareReferralText(text, getReferralShareTitle())
|
||||||
}
|
}
|
||||||
|
|
||||||
const copyCode = () => {
|
const copyCode = () => {
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ import BasicModal from '@/components/BasicPacks/BasicModal.vue'
|
|||||||
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||||
import { message } from 'ant-design-vue'
|
import { message } from 'ant-design-vue'
|
||||||
import { useUserStore } from '@/store/userStore'
|
import { useUserStore } from '@/store/userStore'
|
||||||
import { getReferralShareText, getReferralShareTitle } from '@/utils/config'
|
import { getReferralShareText, getReferralShareTitle, shareReferralText } from '@/utils/referralShare'
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
@@ -69,7 +69,7 @@ const shareCode = () => {
|
|||||||
referralId: props.referralId,
|
referralId: props.referralId,
|
||||||
})
|
})
|
||||||
|
|
||||||
navigator.share({ title: getReferralShareTitle(), text })
|
void shareReferralText(text, getReferralShareTitle())
|
||||||
}
|
}
|
||||||
|
|
||||||
const copyCode = () => {
|
const copyCode = () => {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { useConfigStore } from '@/store/configStore'
|
|||||||
import { getTradeBuyPrice, lastPrice, stopLastPricePolling } from '@/utils/price'
|
import { getTradeBuyPrice, lastPrice, stopLastPricePolling } from '@/utils/price'
|
||||||
import { getStoreClosedMessage, isStoreClosed } from '@/utils/storeHours'
|
import { getStoreClosedMessage, isStoreClosed } from '@/utils/storeHours'
|
||||||
import { message, Modal } from 'ant-design-vue'
|
import { message, Modal } from 'ant-design-vue'
|
||||||
import { getReferralShareText, getReferralShareTitle } from '@/utils/config'
|
import { getReferralShareText, getReferralShareTitle, shareReferralText } from '@/utils/referralShare'
|
||||||
import { useBanners } from './useBanners'
|
import { useBanners } from './useBanners'
|
||||||
import { usePriceChart, type ChartMetalType } from './usePriceChart'
|
import { usePriceChart, type ChartMetalType } from './usePriceChart'
|
||||||
import type { HomeActionItem } from '../layouts/types'
|
import type { HomeActionItem } from '../layouts/types'
|
||||||
@@ -122,14 +122,7 @@ export function useHomePage() {
|
|||||||
referralId: userStore.userInfo?.referral_id,
|
referralId: userStore.userInfo?.referral_id,
|
||||||
})
|
})
|
||||||
|
|
||||||
try {
|
await shareReferralText(text, getReferralShareTitle(configStore.config.name))
|
||||||
await navigator.share({
|
|
||||||
title: getReferralShareTitle(configStore.config.name),
|
|
||||||
text,
|
|
||||||
})
|
|
||||||
} catch {
|
|
||||||
copyCode()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyCode() {
|
function copyCode() {
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ import { updateMe, updatePass } from '@/api/me'
|
|||||||
import { useUserStore } from '@/store/userStore'
|
import { useUserStore } from '@/store/userStore'
|
||||||
import { getUserAvatarUrl } from '@/utils/file'
|
import { getUserAvatarUrl } from '@/utils/file'
|
||||||
import { useConfigStore } from '@/store/configStore'
|
import { useConfigStore } from '@/store/configStore'
|
||||||
import { getConfigApp, getReferralShareText, getReferralShareTitle, isBoursecuProject, getBoursecuActionIconSrc } from '@/utils/config'
|
import { getConfigApp, isBoursecuProject, getBoursecuActionIconSrc } from '@/utils/config'
|
||||||
|
import { getReferralShareText, getReferralShareTitle, shareReferralText } from '@/utils/referralShare'
|
||||||
|
|
||||||
export interface UserMenuAction {
|
export interface UserMenuAction {
|
||||||
id: string
|
id: string
|
||||||
@@ -199,10 +200,7 @@ export function useUserPage() {
|
|||||||
projectName: nameProject,
|
projectName: nameProject,
|
||||||
referralId: userStore.userInfo?.referral_id,
|
referralId: userStore.userInfo?.referral_id,
|
||||||
})
|
})
|
||||||
navigator.share({
|
void shareReferralText(val, getReferralShareTitle(nameProject))
|
||||||
title: getReferralShareTitle(nameProject),
|
|
||||||
text: val,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function ok() {
|
function ok() {
|
||||||
@@ -246,6 +244,15 @@ export function useUserPage() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => userStore.userInfo,
|
||||||
|
(info) => {
|
||||||
|
if (!info) return
|
||||||
|
setForm()
|
||||||
|
},
|
||||||
|
{ immediate: true },
|
||||||
|
)
|
||||||
|
|
||||||
const context: UserPageContext = {
|
const context: UserPageContext = {
|
||||||
userStore,
|
userStore,
|
||||||
userFormState,
|
userFormState,
|
||||||
|
|||||||
Reference in New Issue
Block a user