<!-- 注册企业进度 -->
<template>
  <div class="my-5">
    <v-card class="default-width" elevation="3">
      <div style="margin: 70px auto; width: 600px;">
        <!-- 提交企业注册以后跳转显示页面 -->
        <div v-if="applyInfo && applyInfo?.school?.authStatus === '0'" class="d-flex flex-column align-center">
          <svg-icon name="submit" size="300"></svg-icon>
          <div><strong class="color-primary font-size-20">已收到您的老师账号注册申请，</strong>审核时间预计在1~3个工作日内，申请结果会以短信方式通知到您的手机上，请注意查收。</div>
          <div style="width: 100%;">
            <div class="mt-5 mb-1">如有疑问请扫码添加下方企业微信联系我们：</div>
            <div style="width: 150px; height: 150px; margin: auto;">
              <v-img src="https://minio.menduner.com/dev/menduner/contact.png" width="150" height="150"></v-img>
            </div>
            <div class="text-center ml-5">潘青海先生（Peter Pan）</div> 
          </div>
        </div>

        <!-- 审核不通过 -->
        <div v-else-if="applyInfo?.school?.authStatus === '2'"> 
          <div class="mb-3" style="color: red;">
            您的老师账号注册申请<strong class="color-error font-size-20"> 审核不通过，</strong>
            具体原因如下：{{ reason }}
          </div>
          <div class="mt-5">
            <span>审核时间：{{ createTime }}</span>
          </div>
          <div style="width: 100%;">
            <div class="mt-5 mb-1">如有疑问请扫码添加下方企业微信联系我们：</div>
            <div style="width: 150px; height: 150px; margin: auto;">
              <v-img src="https://minio.menduner.com/dev/menduner/contact.png" width="150" height="150"></v-img>
            </div>
            <div class="text-center ml-5">潘青海先生（Peter Pan）</div>
          </div>
        </div>

        <div class="text-center">
          <!-- 应把登录缓存清空 -->
          <v-btn class="mt-16 mr-3 buttons" color="primary" to="/flame">回到火苗儿校企</v-btn>
          <v-btn v-if="applyInfo.status === '2'" class="mt-16 buttons" color="primary" @click="handleConfirm">{{ $t('common.resubmit') }}</v-btn>
        </div>
      </div>
    </v-card>
  </div>
</template>

<script setup>
defineOptions({ name: 'register-schoolForm'})
import { ref, onMounted } from 'vue'
import { webContentStore } from '@/store/webContent'
import Snackbar from '@/plugins/snackbar'
// import navBar from '@/layout/personal/navBar.vue'
import { useRouter } from 'vue-router'
import { getSchoolAuditById } from '@/api/school'
import { timesTampChange } from '@/utils/date'

const applyInfo = ref(localStorage.getItem('registerSchoolInfo') ? JSON.parse(localStorage.getItem('registerSchoolInfo')) : {})
console.log(applyInfo.value, '注册审核信息')

const reason = ref('')
const createTime = ref('')

const getRefuseInfo = async () => {
  try {
    const data = await getSchoolAuditById({ schoolId: applyInfo.value.school.schoolId })
    reason.value = data.message
    createTime.value = data?.createDate ? timesTampChange(data.createDate) : ''
  } catch {}
}
// 获取申请被拒绝的原因
if (applyInfo.value && applyInfo.value?.school?.authStatus === '2') {
  getRefuseInfo()
}

const router = useRouter()
const webContent = webContentStore()

onMounted(async () => {
  await webContent.getSystemWebContent()
})

// 重新提交
const handleConfirm = async () => {

}
</script>

<style scoped lang="scss">
.navBar {
  position: absolute;
  top: 0;
}
.box {
  position: relative;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center center;
}
.content {
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  width: 600px;
  height: 80%;
  overflow: auto;
  background-color: #fff;
  border-radius: 10px;
}
.upload-box {
	width: 100px;
}
</style>
