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-radius: 4px;
|
||||
background-color: white;
|
||||
color: #111827;
|
||||
caret-color: #111827;
|
||||
-webkit-text-fill-color: #111827;
|
||||
color-scheme: light;
|
||||
//@apply bg-gray-50;
|
||||
|
||||
&:focus-visible {
|
||||
background-color: #fff;
|
||||
color: #111827;
|
||||
-webkit-text-fill-color: #111827;
|
||||
//display: none;
|
||||
outline: none;
|
||||
border: 1px solid #a72b77 !important;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
:width="props.width"
|
||||
:ok-text="props.okText"
|
||||
:cancel-text="props.cancelText"
|
||||
:confirm-loading="props.loading"
|
||||
:closable="props.closable"
|
||||
: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 {
|
||||
guideTypePassword,
|
||||
@@ -78,7 +78,7 @@ export function useUserPage() {
|
||||
|
||||
const isLegal = computed(() => {
|
||||
const result = { title: '', color: '', icon: '' }
|
||||
switch (userFormState.value.is_legal) {
|
||||
switch (userStore.userInfo?.is_legal) {
|
||||
case 0:
|
||||
result.title = 'احراز هویت نشده'
|
||||
result.color = 'reject'
|
||||
@@ -205,6 +205,7 @@ kh.kashkolgold.ir/login?id=${userStore.userInfo?.referral_id}`
|
||||
loading.value = true
|
||||
const res: any = await updateMe(userFormState.value)
|
||||
await userStore.getMyInfo()
|
||||
setForm()
|
||||
editPassVisible.value = false
|
||||
message.success(
|
||||
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 = {
|
||||
userStore,
|
||||
userFormState,
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
<BasicButton
|
||||
v-if="showActions"
|
||||
:disabled="loading"
|
||||
:loading="loading"
|
||||
class="w-full mt-5"
|
||||
html-type="submit"
|
||||
type="primary"
|
||||
>
|
||||
<a-spin v-if="loading" size="small" />
|
||||
<span v-else>ثبت</span>
|
||||
ثبت
|
||||
</BasicButton>
|
||||
</a-form>
|
||||
</template>
|
||||
|
||||
@@ -15,6 +15,7 @@ import { useDesktopBreakpoint } from '@/layouts/composables/useAppLayout'
|
||||
import type { TableEngineInput, TableOutput } from '@/models/table'
|
||||
import { getTransactionTable, getTransactionTable2 } from '@/api/transaction'
|
||||
import { formatWalletMinHint, parseWalletMinRial } from '@/utils/walletMinAmount'
|
||||
import { useWalletAssets } from '@/composables/useWalletAssets'
|
||||
|
||||
export interface WalletPageContext {
|
||||
isDeposit: ReturnType<typeof ref<boolean>>
|
||||
@@ -53,11 +54,13 @@ export function useWalletPage() {
|
||||
const walletStore = useWalletStore()
|
||||
const userStore = useUserStore()
|
||||
const settingsStore = useSettingsStore()
|
||||
const { loadWalletAssets } = useWalletAssets()
|
||||
const isDesktop = useDesktopBreakpoint()
|
||||
const showAddCard = ref(false)
|
||||
const chargeAccountModal = ref(false)
|
||||
const showConfirmCode = ref(false)
|
||||
const infoVisible = ref(false)
|
||||
const withdrawInFlight = ref(false)
|
||||
const refOtpInput = ref<InstanceType<typeof OtpInput> | null>(null)
|
||||
const mobileDepositScrollEl = ref<HTMLElement | null>(null)
|
||||
const desktopDepositScrollEl = ref<HTMLElement | null>(null)
|
||||
@@ -151,15 +154,16 @@ export function useWalletPage() {
|
||||
}
|
||||
|
||||
async function addCard() {
|
||||
if (loading.value) return
|
||||
try {
|
||||
loading.value = true
|
||||
const res: any = await createCard(cardForm.value)
|
||||
await getCards()
|
||||
showAddCard.value = false
|
||||
cardForm.value = { birth_date: 0, shaba_number: '' }
|
||||
message.success(
|
||||
res?.message || 'اطلاعات کارت بانکی شما ثبت شد و پس از تایید ادمین فعال سازی خواهد شد',
|
||||
)
|
||||
await getCards()
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
} finally {
|
||||
@@ -223,18 +227,27 @@ export function useWalletPage() {
|
||||
}
|
||||
|
||||
async function handleOnComplete(value: string) {
|
||||
if (withdrawInFlight.value) {
|
||||
return
|
||||
}
|
||||
withdrawInFlight.value = true
|
||||
try {
|
||||
infoVisible.value = true
|
||||
showConfirmCode.value = false
|
||||
await withdraw({ ...form.value, otp: value })
|
||||
await walletStore.getMyWallet()
|
||||
await Promise.all([
|
||||
walletStore.getMyWallet(),
|
||||
loadWalletAssets(true),
|
||||
])
|
||||
await message.success('عملیات با موفقیت انجام شد')
|
||||
resetData()
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
} finally {
|
||||
infoVisible.value = false
|
||||
refOtpInput.value?.clearInput()
|
||||
withdrawInFlight.value = false
|
||||
}
|
||||
infoVisible.value = false
|
||||
refOtpInput.value?.clearInput()
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
|
||||
@@ -188,12 +188,12 @@
|
||||
</a-form-item>
|
||||
<BasicButton
|
||||
:disabled="loading"
|
||||
:loading="loading"
|
||||
class="w-full mt-5 md:mt-10"
|
||||
type="primary"
|
||||
@click="addCard"
|
||||
>
|
||||
<a-spin v-if="loading" size="small" />
|
||||
<div v-else>ثبت</div>
|
||||
ثبت
|
||||
</BasicButton>
|
||||
<BasicButton class="w-full mt-2" @click="showAddCard = false">بازگشت</BasicButton>
|
||||
</a-form>
|
||||
|
||||
Reference in New Issue
Block a user