<script setup>
import info from './components/info.vue'
import dia from './components/dia.vue'
import { user } from '~/store/user'
const loading = ref(false)

let dialog_visible = $ref(false)
function handleClickEdit() {
  dialog_visible = true
}

function handleEmitClose(data, ifRefresh) {
  console.log('data :>> ', data)
  dialog_visible = false
  if (ifRefresh)
    handleQuery()
}

let data_detail = $ref({})

function handleQuery() {
  if (user?.sm_info?.sm_id === undefined)
    return ElMessage.error('当前用户学校错误')

  request({
    baseURL: window.GLOBAL_CONFIG.uc,
    url: '/school/main/detail',
    data: {
      sm_id: user?.sm_info?.sm_id,
    },
  }).then((res) => {
    if (res.code === '1')
      data_detail = res.data.one_info
  })
}

handleQuery()
</script>

<template>
  <div v-loading="loading" class="card h-full py-6 px-12">
    <div class="flex justify-end mb-2">
      <el-button type="primary" @click="handleClickEdit">
        编辑
      </el-button>
    </div>
    <info :d="data_detail" />
  </div>

  <el-dialog v-model="dialog_visible" class="_" title="编辑" width="680" align-center destroy-on-close>
    <el-scrollbar height="80vh">
      <dia :d="data_detail" @emitClose="handleEmitClose" />
    </el-scrollbar>
  </el-dialog>
</template>

<style lang="scss" scoped>
@use "~/styles/dialog.scss";
// .flex {
//   display: flex;
//   align-items: center;
//   .el-form-item {
//     flex: 1;
//   }
// }

// :deep() .el-dialog__body {
//   padding: 24px 88px;
// }

// :deep() .el-form-item__content {
//   width: 240px;
// }

// :deep() .el-input__wrapper {
//   width: 240px;
//   height: 40px;
//   box-shadow: none;
//   background: #f7f7f7;
//   border-radius: 8px;
// }

// .logo,
// :deep() .el-form-item__label {
//   font-size: 14px;
//   font-family: PingFangSC, PingFangSC-Semibold;
//   font-weight: 600;
//   text-align: left;
//   color: #3f3f44;
// }

// :deep() .el-input .el-input__count .el-input__count-inner {
//   background: none;
// }
</style>
