import { NTabPane, NTabs } from 'naive-ui'
import { defineComponent, h, reactive, resolveDynamicComponent } from 'vue'
import Student from './component/student'
import Teacher from './component/teacher'
import School from './component/school'
import { getTabsCache, setTabsCaches } from '@/hooks/use-async'
import { useRoute } from 'vue-router'
export default defineComponent({
  name: 'city-manage',
  setup() {
    const state = reactive({
      tabName: 'Student' as 'Student' | 'Teacher' | 'School'
    })
    const route = useRoute()
    getTabsCache((val: any) => {
      if (val.form.tabName) {
        state.tabName = val.form.tabName
      }
    })
    const setTabs = (val: any) => {
      setTabsCaches(val, 'tabName', route)
    }
    return () => {
      return (
        <div class="system-menu-container">
          <h2>APP按钮管理</h2>

          <div class={['section-container']} style="padding-top: 0">
            <NTabs
              type="line"
              size="large"
              v-model:value={state.tabName}
              onUpdate:value={(val: any) => setTabs(val)}
            >
              <NTabPane name="Student" tab="学生端"
                        //v-auth="sysMenuButton/page1600386298522472450"
              >
                <Student />
              </NTabPane>
              <NTabPane name="Teacher" tab="老师端"
                        //v-auth="sysMenuButton/page1600386947867840514"
              >
                <Teacher />
              </NTabPane>
              <NTabPane name="School" tab="管理端"
                        //v-auth="sysMenuButton/page1600386947867840515"
              >
                <School />
              </NTabPane>
            </NTabs>
          </div>
        </div>
      )
    }
  }
})
