<!-- 企业信息设置 -->
<template>
  <div>
    <v-card class="card-box pa-5" style="min-height: 500px">
      <v-tabs v-model="tab" @update:model-value="handleTabClick" align-tabs="start" color="primary" bg-color="#f7f8fa">
        <v-tab v-for="val in tabList" :key="val.value" :value="val.value">{{ val.label }}</v-tab>
      </v-tabs>
      <v-window v-model="tab" class="mt-3">
        <v-window-item :value="val.value" v-for="val in tabList" :key="val.value">
          <component :is="val.path" ref="tabRef"></component>
        </v-window-item>
      </v-window>
    </v-card>
  </div>
</template>

<script setup>
defineOptions({ name: 'enterprise-system-management-information-settings'})
import basicInfo from './informationSettingsComponents/basicInfo.vue'
import enterpriseLogo from './informationSettingsComponents/enterpriseLogo.vue'
import enterpriseAlbum from './informationSettingsComponents/enterpriseAlbum.vue'
import welfareLabel from './informationSettingsComponents/welfareLabel.vue'
import enterpriseLabel from './informationSettingsComponents/enterpriseLabel.vue'
import businessInformation from './informationSettingsComponents/businessInformation.vue'
import authentication from './informationSettingsComponents/authentication.vue'
import { ref, watch } from 'vue'
import { 
  useRoute, 
  // useRouter
} from 'vue-router'
import { useI18n } from '@/hooks/web/useI18n'

const route = useRoute()
// const router = useRouter()
const { t } = useI18n()
// tab
const tabRef = ref()
const tab = ref(1)
const tabList = [
  { label: t('enterprise.infoSetting.basicInfo'), value: 1, path: basicInfo },
  { label: t('enterprise.infoSetting.enterpriseLogo'), value: 2, path: enterpriseLogo },
  { label: t('enterprise.infoSetting.enterpriseAlbum'), value: 3, path: enterpriseAlbum },
  { label: t('enterprise.infoSetting.welfareLabel'), value: 4, path: welfareLabel },
  { label: t('enterprise.infoSetting.enterpriseLabel'), value: 7, path: enterpriseLabel },
  { label: t('enterprise.infoSetting.businessInformation'), value: 5, path: businessInformation },
  { label: t('setting.realNameAuthentication'), value: 6, path: authentication },
]


watch(() => route?.query?.tabKey, (newVal) => { if (newVal) tab.value = newVal - 0 })
const handleTabClick = () => {
  // 基本信息-获取企业管理员实名认证信息
  if (tab.value === 1) {
    tabRef.value[0].getAuthInfo()
  }
  // router.push(`${route.path}?tabKey=${tab.value.toString()}`)
}
</script>

<style scoped lang="scss">
</style>
