index.tsx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { defineComponent, ref, watch } from 'vue';
  2. import styles from './index.module.less';
  3. import { NTabs, NTabPane } from 'naive-ui';
  4. import PersonInfo from './components/personInfo';
  5. import SchoolInfo from './components/schoolInfo/index';
  6. import { useUserStore } from '/src/store/modules/users';
  7. import { useRoute } from 'vue-router';
  8. export default defineComponent({
  9. name: 'base-setting',
  10. setup(props, { emit, attrs }) {
  11. const activeTab = ref('person' as any);
  12. const user = useUserStore();
  13. const route = useRoute();
  14. if (route.query.activeTab) {
  15. activeTab.value = route.query.activeTab;
  16. }
  17. watch(
  18. () => route.query.activeTab,
  19. val => {
  20. activeTab.value = val;
  21. }
  22. );
  23. return () => (
  24. <div class={styles.listWrap}>
  25. <NTabs
  26. class={styles.customTabs}
  27. v-model:value={activeTab.value}
  28. size="large"
  29. animated
  30. pane-wrapper-style="margin: 0 -4px"
  31. pane-style="padding-left: 4px; padding-right: 4px; box-sizing: border-box;">
  32. <NTabPane name="person" tab="个人信息">
  33. <PersonInfo></PersonInfo>
  34. </NTabPane>
  35. {user.info.isSuperAdmin && (
  36. <NTabPane name="school" tab="学校设置">
  37. <SchoolInfo />
  38. </NTabPane>
  39. )}
  40. </NTabs>
  41. </div>
  42. );
  43. }
  44. });