fix(user): register dialog, KYC modal, and home loading gaps
Repair gift-card register success modal text, enforce KYC with correct identity checks, and show skeleton/fallback while home layout loads. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
<template>
|
||||
<a-modal
|
||||
v-model:open="isModalVisible"
|
||||
:open="requiresKyc"
|
||||
:closable="false"
|
||||
:mask-closable="false"
|
||||
:keyboard="false"
|
||||
:footer="null"
|
||||
:centered="true"
|
||||
:z-index="5500"
|
||||
:z-index="APP_Z_MODAL"
|
||||
:width="modalWidth"
|
||||
:get-container="getModalContainer"
|
||||
class="required-kyc-modal"
|
||||
wrap-class-name="required-kyc-modal-wrap"
|
||||
>
|
||||
@@ -206,7 +207,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, reactive, ref, watch } from 'vue'
|
||||
import { computed, onMounted, reactive, ref, watch } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import type { FormInstance } from 'ant-design-vue'
|
||||
import { message } from 'ant-design-vue'
|
||||
@@ -221,6 +222,8 @@ import { isValidPersian, requireNationalCode, required } from '@/utils/inputRule
|
||||
import { normalizeAuthFormFields } from '@/utils/persianDigits'
|
||||
import { performUserLogout } from '@/utils/authSession'
|
||||
import { useDesktopBreakpoint } from '@/layouts/composables/useAppLayout'
|
||||
import { isCustomerIdentityVerified } from '@/utils/customerIdentity'
|
||||
import { APP_Z_MODAL, getModalContainer } from '@/utils/zIndex'
|
||||
|
||||
const route = useRoute()
|
||||
const userStore = useUserStore()
|
||||
@@ -241,22 +244,22 @@ const formState = reactive({
|
||||
|
||||
const modalWidth = computed(() => (isDesktop.value ? '460px' : '92vw'))
|
||||
|
||||
const isModalVisible = computed(() => {
|
||||
const requiresKyc = computed(() => {
|
||||
if (!getToken()) return false
|
||||
if (route.name === 'login' || route.name === 'tvMonitor' || route.name === 'aboutSoftware') {
|
||||
return false
|
||||
}
|
||||
const info = userStore.userInfo
|
||||
if (!info) return false
|
||||
// 0 indicates unverified. 1 and 2 indicate verified customer.
|
||||
return info.is_legal === 0 || !info.is_legal
|
||||
return !isCustomerIdentityVerified(info.is_legal)
|
||||
})
|
||||
|
||||
const isPendingApproval = computed(() => {
|
||||
const info = userStore.userInfo
|
||||
if (!info) return false
|
||||
// If national code is set and user is still unverified (is_legal === 0)
|
||||
return Boolean(info.n_code && info.is_legal === 0)
|
||||
return Boolean(
|
||||
String(info.n_code ?? '').trim() && !isCustomerIdentityVerified(info.is_legal),
|
||||
)
|
||||
})
|
||||
|
||||
function populateFormFromUser() {
|
||||
@@ -295,8 +298,7 @@ async function onSubmit() {
|
||||
const res: any = await updateMe(payload)
|
||||
await userStore.getMyInfo()
|
||||
|
||||
const currentLegal = userStore.userInfo?.is_legal
|
||||
if (currentLegal === 1 || currentLegal === 2) {
|
||||
if (isCustomerIdentityVerified(userStore.userInfo?.is_legal)) {
|
||||
message.success('احراز هویت شما با موفقیت انجام و تأیید شد.')
|
||||
isEditing.value = false
|
||||
} else {
|
||||
@@ -317,8 +319,7 @@ async function onCheckStatus() {
|
||||
try {
|
||||
checkingStatus.value = true
|
||||
await userStore.getMyInfo()
|
||||
const currentLegal = userStore.userInfo?.is_legal
|
||||
if (currentLegal === 1 || currentLegal === 2) {
|
||||
if (isCustomerIdentityVerified(userStore.userInfo?.is_legal)) {
|
||||
message.success('حساب کاربری شما تأیید شد!')
|
||||
} else {
|
||||
message.info('اطلاعات شما همچنان در صف بررسی و تایید مدیریت است.')
|
||||
@@ -333,8 +334,22 @@ async function onCheckStatus() {
|
||||
async function onLogout() {
|
||||
await performUserLogout()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
if (getToken() && !userStore.userInfo) {
|
||||
void userStore.getMyInfo()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.required-kyc-modal-wrap {
|
||||
.ant-modal-content {
|
||||
color: #1e293b;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style scoped>
|
||||
.kyc-modal-content {
|
||||
font-family: inherit;
|
||||
|
||||
Reference in New Issue
Block a user