<template>
  <div id="app">
    <!-- <LoginForm></LoginForm> -->
    <div style="position: absolute; z-index: 5; left: 240px; top: 64px;">
      <el-select v-model="error" placeholder="测试用" clearable>
        <el-option
          v-for="item in options"
          :label="item.label"
          :value="item.value"
          :key="item.value"
        >
        </el-option>
      </el-select>
    </div>
    <koala-header
      :clickAppkey="appkey"
      platformType="license-client"
      @getRoutes="handleGetRoutes"
      @getUser="handleGetUser"
    ></koala-header>
    <koala-side
      v-if="!error"
      :activeIndex="activeIndex"
      :hideNav="false"
    >
    <Test></Test>
    </koala-side>
    <Error403 v-if="error === '403'"></Error403>
    <Error404 v-if="error === '404'"></Error404>
    <div v-if="error === 'NoData'" style="width: 400px; height: 400px; margin: 0 auto;">
      <NoData></NoData>
    </div>
  </div>
</template>
<script>
import Test from '@/packages/Test/Test.vue'
import useAppStore from '@/store/app'
import useUserStore from '@/store/app'
// import routes from '../../mock/routes/routes-children.json'
// import routes from '../../mock/routes/routes.json'
import routes from '../../mock/routes/routes-learn.json'

const appKeyList = [
  "991A58D0A1D844E3B53AD58B9AFF267D", // 0 数据总览
  "DD506A16A20B4CEB8AF2D43FEAA92A01", // 1 大模型
  "EB00C851519C4D89B769E530F4D77B06", // 2 能力中心
  "ECFE2F054250494A8FB0EAF75277180F", // 3 大模型管理平台
  "6E1CE7C262624FB295DE8A00B07A6B09", // 4 运管中心
  "D2C733740BE14E028C3FA3023CBB53F4", // 5 事件中心
  "1697D3FE9843473CA32D1EC582BFC40F", // 6 文件管理平台
  "B7FDAFD4B48A4444A483D08C078304A9", // 7 升级服务
  "667ADF8B9C9C414F8F9A551A171B2A03", // 8 系统运营test
  "5561F007A0D14AED96096437F0C2C798", // 9 运营中心
  "D1B8C58A96994B5EB31AE394543E58A8", // 10 学习中心
  "7B9DF80F095F4E48A2B855A95C77B8D1", // 11 license授权
  "D065E0A8831F4CDBB2EACB75DE70D94E", // 12 license授权客户端
  "BF19AD8F15EF4230B5AA83A4A4B47723", // 13 文档中心
]

export default {
  name: 'app',
  components: { Test },
  data() {
    return {
      bgColor: 'blue',
      routes,
      // activeIndex: routes[0].route,
      activeIndex: '/navigator',
      error: '',
      options: [
        { label: '403', value: '403' },
        { label: '404', value: '404' },
        { label: '暂无数据', value: 'NoData' }
      ],
      appkey: appKeyList[2] // 所有平台的appKey请查看 mock/user.js
    }
  },
  created() {
    const appStore = useAppStore()
    appStore.setAppkey(this.appkey)
  },
  mounted() {
    console.log(this.activeIndex)
  },
  methods: {
    handleGetRoutes(routes) {
      // console.log(routes)
    },
    handleGetUser(user) {
      // console.log(user)
    }
  }
}
</script>
<style>
html,
body,
#app {
  width: 100%;
  height: 100%;
  font-family: PingFang SC;
  scroll-behavior: smooth;
}
</style>
