|
|
@@ -1,5 +1,6 @@
|
|
|
import { onUnmounted, reactive, readonly, watch } from 'vue'
|
|
|
import { useBaseConstsStore } from '~/stores/baseConsts'
|
|
|
+import type { BaseConstsConfig } from '~/types/api'
|
|
|
|
|
|
export interface FindPartnerTag {
|
|
|
id: string
|
|
|
@@ -25,15 +26,6 @@ export interface FindPartnerPopupState {
|
|
|
selected: Record<FindPartnerSection['id'], string | undefined>
|
|
|
}
|
|
|
|
|
|
-interface CommonAreaItem {
|
|
|
- code: string
|
|
|
- name: string
|
|
|
-}
|
|
|
-
|
|
|
-interface BaseConstsConfig {
|
|
|
- commonAreaConsts?: CommonAreaItem[][] | CommonAreaItem[]
|
|
|
-}
|
|
|
-
|
|
|
export interface FindPartnerFilterPayload {
|
|
|
/** 后端 gender 参数 */
|
|
|
gender: number
|
|
|
@@ -274,18 +266,12 @@ const setupRegionTagsFromBaseConsts = () => {
|
|
|
|
|
|
const baseConstsStore = useBaseConstsStore()
|
|
|
|
|
|
- const updateRegionTags = (config: Record<string, unknown> | null) => {
|
|
|
+ const updateRegionTags = (config: BaseConstsConfig | null) => {
|
|
|
const regionSection = state.sections.find(section => section.id === 'region')
|
|
|
if (!regionSection)
|
|
|
return
|
|
|
|
|
|
- const typedConfig = config as BaseConstsConfig | null
|
|
|
- const raw = typedConfig?.commonAreaConsts
|
|
|
-
|
|
|
- if (!raw)
|
|
|
- return
|
|
|
-
|
|
|
- const list = Array.isArray(raw[0]) ? raw[0] as CommonAreaItem[] : raw as CommonAreaItem[]
|
|
|
+ const list = config?.commonAreaConsts
|
|
|
|
|
|
if (!Array.isArray(list) || list.length === 0)
|
|
|
return
|
|
|
@@ -305,7 +291,7 @@ const setupRegionTagsFromBaseConsts = () => {
|
|
|
watch(
|
|
|
() => baseConstsStore.config,
|
|
|
(config) => {
|
|
|
- updateRegionTags(config as Record<string, unknown> | null)
|
|
|
+ updateRegionTags(config)
|
|
|
},
|
|
|
{
|
|
|
immediate: true,
|