<template>
    <el-card class="m-5">
      <!-- 维护中 -->
      <el-result
          v-if="website.status == 1"
          :icon="'warning'"
          :title="status"
          :sub-title="website.statusText"
      >
        <template #extra>
          <el-button @click="navigateTo(`https://${website.tenantId}.wsdns.cn`)">网站首页</el-button>
          <el-button @click="navigateTo(`https://${website.tenantId}.websoft.top`)">管理后台</el-button>
        </template>
      </el-result>
      <!-- 已关闭 -->
      <el-result
          v-if="website.status == 2"
          :icon="'error'"
          :title="status"
          :sub-title="website.statusClose || '网站功能未开通或管理员操作关闭'"
      >
        <template #extra>
          <el-button type="primary" v-if="!website.statusClose" @click="navigateTo(`https://www.websoft.top/product/124`)">{{ website.statusClose }}去开通</el-button>
        </template>
      </el-result>
    </el-card>
    <div></div>
</template>
<script setup lang="ts">
import {useWebsite} from "~/composables/configState";

const website = useWebsite()

const status = ['运行中','维护中','已关闭'][Number(website.value.status)];

const navigateTo = (url: string) => {
  window.location.href = url;
}
</script>
