<template>
  <div>
    <el-row :gutter="10">
      <el-col :span="12">
        <el-card shadow="never">
          <template #header>
            <CardTitle title="人才详情" />
          </template>
          <Info :id="id" :user-id="userId" />
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card shadow="never">
          <template #header>
            <CardTitle title="账户信息" />
          </template>
          <Account :user-id="userId" />
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card shadow="never">
          <template #header>
            <CardTitle title="职位收藏、企业收藏数" />
          </template>
          <Collect :user-id="userId" />
        </el-card>
        <el-card shadow="never" class="m-t-10px">
          <template #header>
            <CardTitle title="附件简历" />
          </template>
          <Attachment :user-id="userId" />
        </el-card>
      </el-col>
    </el-row>

    <el-row class="m-t-20px">
      <el-col :span="24">
        <el-card shadow="never">
          <el-tabs>
            <el-tab-pane v-hasPermi="['menduner:system:edu-exp:query']" label="教育经历">
              <Edu :user-id="userId" />
            </el-tab-pane>
            <el-tab-pane v-hasPermi="['menduner:system:work-exp:query']" label="工作经历">
              <Exp :user-id="userId" />
            </el-tab-pane>
            <!-- <el-tab-pane v-hasPermi="['menduner:system:project-exp:query']" label="项目经历">
              <Project :user-id="userId" />
            </el-tab-pane> -->
            <el-tab-pane v-hasPermi="['menduner:system:job-interested:query']" label="求职意向">
              <JobIntention :user-id="userId" />
            </el-tab-pane>
            <el-tab-pane v-hasPermi="['menduner:system:user-account:query']" label="钱包充值记录">
              <RechargeOrder :user-id="userId" />
            </el-tab-pane>
            <el-tab-pane v-hasPermi="['menduner:system:user-account-record:query']" label="积分变动记录">
              <PointsChange :user-id="userId" />
            </el-tab-pane>
          </el-tabs>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script setup>
defineOptions({ name: 'PersonDetails'})
import { useTagsViewStore } from '@/store/modules/tagsView'
import { ElMessage } from 'element-plus'
import Info from './components/info.vue'
import Account from './components/account.vue'
import Edu from './components/edu.vue'
import Exp from './components/exp.vue'
// import Project from './components/project.vue'
import JobIntention from './components/jobIntention.vue'
import RechargeOrder from './components/rechargeOrder.vue'
import PointsChange from './components/pointsChange.vue'
import Collect from './components/collect.vue'
import Attachment from './components/attachment.vue'

/** 初始化 */
const { currentRoute } = useRouter() // 路由
const { delView } = useTagsViewStore() // 视图操作
const route = useRoute()
const { id, userId } = route.query
onMounted(() => {
  if (!userId) {
    ElMessage.warning('参数错误，用户编号不能为空！')
    delView(unref(currentRoute))
    return
  }
})
</script>
