feat: landing settings helper plus wallet and profile UX fixes
Expose landing_* readers, fix OTP contrast on dark modal, and keep auth badge/card submit loading consistent. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -179,10 +179,16 @@ body.van-overflow-hidden {
|
|||||||
border: 1px solid #d1d5db;
|
border: 1px solid #d1d5db;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
|
color: #111827;
|
||||||
|
caret-color: #111827;
|
||||||
|
-webkit-text-fill-color: #111827;
|
||||||
|
color-scheme: light;
|
||||||
//@apply bg-gray-50;
|
//@apply bg-gray-50;
|
||||||
|
|
||||||
&:focus-visible {
|
&:focus-visible {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
|
color: #111827;
|
||||||
|
-webkit-text-fill-color: #111827;
|
||||||
//display: none;
|
//display: none;
|
||||||
outline: none;
|
outline: none;
|
||||||
border: 1px solid #a72b77 !important;
|
border: 1px solid #a72b77 !important;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
:width="props.width"
|
:width="props.width"
|
||||||
:ok-text="props.okText"
|
:ok-text="props.okText"
|
||||||
:cancel-text="props.cancelText"
|
:cancel-text="props.cancelText"
|
||||||
|
:confirm-loading="props.loading"
|
||||||
:closable="props.closable"
|
:closable="props.closable"
|
||||||
:wrapClassName="props.wrapClassName"
|
:wrapClassName="props.wrapClassName"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
export const LANDING_SETTING_PREFIXES = [
|
||||||
|
'landing_site',
|
||||||
|
'landing_header',
|
||||||
|
'landing_hero',
|
||||||
|
'landing_live_price',
|
||||||
|
'landing_calculator',
|
||||||
|
'landing_feature',
|
||||||
|
'landing_steps',
|
||||||
|
'landing_trust',
|
||||||
|
'landing_faq',
|
||||||
|
'landing_buttom_cta',
|
||||||
|
'landing_footer'
|
||||||
|
] as const
|
||||||
|
|
||||||
|
export type LandingSettingPrefix = (typeof LANDING_SETTING_PREFIXES)[number]
|
||||||
|
|
||||||
|
function isFlagOn(value: unknown): boolean {
|
||||||
|
const v = String(value ?? '').trim().toLowerCase()
|
||||||
|
return v === 'true' || v === '1' || v === 'yes' || v === 'activate'
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isLandingEnabled(getByKey: (key: string) => unknown): boolean {
|
||||||
|
return isFlagOn(getByKey('has_landing'))
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getLandingSetting(getByKey: (key: string) => unknown, key: string): string {
|
||||||
|
return String(getByKey(key) ?? '')
|
||||||
|
}
|
||||||
|
|
||||||
|
export function matchesLandingPrefix(key: string, prefix: string): boolean {
|
||||||
|
return key === prefix || key.startsWith(`${prefix}_`)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function pickLandingSettings(
|
||||||
|
settings: Array<{ key?: string | number; value?: unknown }>,
|
||||||
|
prefix: string
|
||||||
|
): Record<string, string> {
|
||||||
|
const out: Record<string, string> = {}
|
||||||
|
for (const row of settings) {
|
||||||
|
const key = String(row.key ?? '')
|
||||||
|
if (!matchesLandingPrefix(key, prefix)) continue
|
||||||
|
out[key] = String(row.value ?? '')
|
||||||
|
}
|
||||||
|
return out
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { computed, inject, onMounted, provide, ref, type InjectionKey } from 'vue'
|
import { computed, inject, onMounted, provide, ref, watch, type InjectionKey } from 'vue'
|
||||||
import { loading, removeToken } from '@/utils'
|
import { loading, removeToken } from '@/utils'
|
||||||
import {
|
import {
|
||||||
guideTypePassword,
|
guideTypePassword,
|
||||||
@@ -78,7 +78,7 @@ export function useUserPage() {
|
|||||||
|
|
||||||
const isLegal = computed(() => {
|
const isLegal = computed(() => {
|
||||||
const result = { title: '', color: '', icon: '' }
|
const result = { title: '', color: '', icon: '' }
|
||||||
switch (userFormState.value.is_legal) {
|
switch (userStore.userInfo?.is_legal) {
|
||||||
case 0:
|
case 0:
|
||||||
result.title = 'احراز هویت نشده'
|
result.title = 'احراز هویت نشده'
|
||||||
result.color = 'reject'
|
result.color = 'reject'
|
||||||
@@ -205,6 +205,7 @@ kh.kashkolgold.ir/login?id=${userStore.userInfo?.referral_id}`
|
|||||||
loading.value = true
|
loading.value = true
|
||||||
const res: any = await updateMe(userFormState.value)
|
const res: any = await updateMe(userFormState.value)
|
||||||
await userStore.getMyInfo()
|
await userStore.getMyInfo()
|
||||||
|
setForm()
|
||||||
editPassVisible.value = false
|
editPassVisible.value = false
|
||||||
message.success(
|
message.success(
|
||||||
res?.message || 'اطلاعات شما با موفقیت به روز رسانی شد',
|
res?.message || 'اطلاعات شما با موفقیت به روز رسانی شد',
|
||||||
@@ -254,6 +255,14 @@ kh.kashkolgold.ir/login?id=${userStore.userInfo?.referral_id}`
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => userStore.userInfo,
|
||||||
|
(info) => {
|
||||||
|
if (!info) return
|
||||||
|
setForm()
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
const context: UserPageContext = {
|
const context: UserPageContext = {
|
||||||
userStore,
|
userStore,
|
||||||
userFormState,
|
userFormState,
|
||||||
|
|||||||
@@ -6,12 +6,12 @@
|
|||||||
<BasicButton
|
<BasicButton
|
||||||
v-if="showActions"
|
v-if="showActions"
|
||||||
:disabled="loading"
|
:disabled="loading"
|
||||||
|
:loading="loading"
|
||||||
class="w-full mt-5"
|
class="w-full mt-5"
|
||||||
html-type="submit"
|
html-type="submit"
|
||||||
type="primary"
|
type="primary"
|
||||||
>
|
>
|
||||||
<a-spin v-if="loading" size="small" />
|
ثبت
|
||||||
<span v-else>ثبت</span>
|
|
||||||
</BasicButton>
|
</BasicButton>
|
||||||
</a-form>
|
</a-form>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import { useDesktopBreakpoint } from '@/layouts/composables/useAppLayout'
|
|||||||
import type { TableEngineInput, TableOutput } from '@/models/table'
|
import type { TableEngineInput, TableOutput } from '@/models/table'
|
||||||
import { getTransactionTable, getTransactionTable2 } from '@/api/transaction'
|
import { getTransactionTable, getTransactionTable2 } from '@/api/transaction'
|
||||||
import { formatWalletMinHint, parseWalletMinRial } from '@/utils/walletMinAmount'
|
import { formatWalletMinHint, parseWalletMinRial } from '@/utils/walletMinAmount'
|
||||||
|
import { useWalletAssets } from '@/composables/useWalletAssets'
|
||||||
|
|
||||||
export interface WalletPageContext {
|
export interface WalletPageContext {
|
||||||
isDeposit: ReturnType<typeof ref<boolean>>
|
isDeposit: ReturnType<typeof ref<boolean>>
|
||||||
@@ -53,11 +54,13 @@ export function useWalletPage() {
|
|||||||
const walletStore = useWalletStore()
|
const walletStore = useWalletStore()
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const settingsStore = useSettingsStore()
|
const settingsStore = useSettingsStore()
|
||||||
|
const { loadWalletAssets } = useWalletAssets()
|
||||||
const isDesktop = useDesktopBreakpoint()
|
const isDesktop = useDesktopBreakpoint()
|
||||||
const showAddCard = ref(false)
|
const showAddCard = ref(false)
|
||||||
const chargeAccountModal = ref(false)
|
const chargeAccountModal = ref(false)
|
||||||
const showConfirmCode = ref(false)
|
const showConfirmCode = ref(false)
|
||||||
const infoVisible = ref(false)
|
const infoVisible = ref(false)
|
||||||
|
const withdrawInFlight = ref(false)
|
||||||
const refOtpInput = ref<InstanceType<typeof OtpInput> | null>(null)
|
const refOtpInput = ref<InstanceType<typeof OtpInput> | null>(null)
|
||||||
const mobileDepositScrollEl = ref<HTMLElement | null>(null)
|
const mobileDepositScrollEl = ref<HTMLElement | null>(null)
|
||||||
const desktopDepositScrollEl = ref<HTMLElement | null>(null)
|
const desktopDepositScrollEl = ref<HTMLElement | null>(null)
|
||||||
@@ -151,15 +154,16 @@ export function useWalletPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function addCard() {
|
async function addCard() {
|
||||||
|
if (loading.value) return
|
||||||
try {
|
try {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
const res: any = await createCard(cardForm.value)
|
const res: any = await createCard(cardForm.value)
|
||||||
await getCards()
|
|
||||||
showAddCard.value = false
|
showAddCard.value = false
|
||||||
cardForm.value = { birth_date: 0, shaba_number: '' }
|
cardForm.value = { birth_date: 0, shaba_number: '' }
|
||||||
message.success(
|
message.success(
|
||||||
res?.message || 'اطلاعات کارت بانکی شما ثبت شد و پس از تایید ادمین فعال سازی خواهد شد',
|
res?.message || 'اطلاعات کارت بانکی شما ثبت شد و پس از تایید ادمین فعال سازی خواهد شد',
|
||||||
)
|
)
|
||||||
|
await getCards()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
} finally {
|
} finally {
|
||||||
@@ -223,18 +227,27 @@ export function useWalletPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function handleOnComplete(value: string) {
|
async function handleOnComplete(value: string) {
|
||||||
|
if (withdrawInFlight.value) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
withdrawInFlight.value = true
|
||||||
try {
|
try {
|
||||||
infoVisible.value = true
|
infoVisible.value = true
|
||||||
showConfirmCode.value = false
|
showConfirmCode.value = false
|
||||||
await withdraw({ ...form.value, otp: value })
|
await withdraw({ ...form.value, otp: value })
|
||||||
await walletStore.getMyWallet()
|
await Promise.all([
|
||||||
|
walletStore.getMyWallet(),
|
||||||
|
loadWalletAssets(true),
|
||||||
|
])
|
||||||
await message.success('عملیات با موفقیت انجام شد')
|
await message.success('عملیات با موفقیت انجام شد')
|
||||||
resetData()
|
resetData()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
|
} finally {
|
||||||
|
infoVisible.value = false
|
||||||
|
refOtpInput.value?.clearInput()
|
||||||
|
withdrawInFlight.value = false
|
||||||
}
|
}
|
||||||
infoVisible.value = false
|
|
||||||
refOtpInput.value?.clearInput()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
|||||||
@@ -188,12 +188,12 @@
|
|||||||
</a-form-item>
|
</a-form-item>
|
||||||
<BasicButton
|
<BasicButton
|
||||||
:disabled="loading"
|
:disabled="loading"
|
||||||
|
:loading="loading"
|
||||||
class="w-full mt-5 md:mt-10"
|
class="w-full mt-5 md:mt-10"
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="addCard"
|
@click="addCard"
|
||||||
>
|
>
|
||||||
<a-spin v-if="loading" size="small" />
|
ثبت
|
||||||
<div v-else>ثبت</div>
|
|
||||||
</BasicButton>
|
</BasicButton>
|
||||||
<BasicButton class="w-full mt-2" @click="showAddCard = false">بازگشت</BasicButton>
|
<BasicButton class="w-full mt-2" @click="showAddCard = false">بازگشت</BasicButton>
|
||||||
</a-form>
|
</a-form>
|
||||||
|
|||||||
Reference in New Issue
Block a user