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:
@@ -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