<template>
  <Dialog :title="dialogTitle" v-model="dialogVisible">
    <div>
      <UserAvatarVue :img="userInfo?.avatar" v-if="dialogTitle == '修改头像'" />
      <BasicInfo @success="handleBasicInfoSuccess" v-if="dialogTitle == '修改个人信息'" />
      <ResetPwd @success="handleBasicInfoSuccess" v-if="dialogTitle == '修改密码'" />
    </div>
    <!-- <template #footer>
      <el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
      <el-button @click="dialogVisible = false">取 消</el-button>
    </template> -->
  </Dialog>
</template>
<script setup>
import {
  BasicInfo,
  ProfileUser,
  ResetPwd,
  UserSocial,
  UserAvatarVue
} from '@/views/Profile/components'
// import { NoticeApi, Notice } from '@/api/company/companynotice'

/** 公司通知 表单 */
defineOptions({ name: 'ResetInfo' })

const message = useMessage() // 消息弹窗

const dialogVisible = ref(false) // 弹窗的是否展示
const dialogTitle = ref('') // 弹窗的标题

// 处理基本信息更新成功
const handleBasicInfoSuccess = async () => {
  dialogVisible.value = false
}
/** 打开弹窗 */
const open = async (title) => {
  dialogVisible.value = true
  dialogTitle.value = title
  // resetForm()
  // 修改时，设置数据
}
defineExpose({ open }) // 提供 open 方法，用于打开弹窗

/** 提交表单 */
// const emit = defineEmits(['success']) // 定义 success 事件，用于操作成功后的回调
const submitForm = async () => {}
</script>
