orchestra-detail.tsx 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import OHeader from '@/components/o-header'
  2. import OSticky from '@/components/o-sticky'
  3. import request from '@/helpers/request'
  4. import { Sticky, Tab, Tabs } from 'vant'
  5. import { defineComponent, onMounted, ref } from 'vue'
  6. import Information from './compontent/information'
  7. import Photo from './compontent/photo'
  8. import Plan from './compontent/plan'
  9. import styles from './orchestra-detail.module.less'
  10. export default defineComponent({
  11. name: 'orchestra-detail',
  12. setup() {
  13. const tabs = sessionStorage.getItem('orchestra-detail-tab')
  14. // console.log(tabs, 'tabs')
  15. const tabValue = ref(tabs || 'information')
  16. sessionStorage.removeItem('orchestra-detail-tab')
  17. const tabHeight = ref('auto')
  18. const termTimes = ref({
  19. start: '09-01',
  20. end: '03-01'
  21. })
  22. const getDefaultParams = async () => {
  23. // last_term_time 上学期
  24. // next_term_time 下学期
  25. const { data } = await request.get('/api-school/sysParamConfig/queryByParamNameList', {
  26. params: {
  27. paramNames: 'last_term_time,next_term_time'
  28. }
  29. })
  30. ;(data || []).forEach((item: any) => {
  31. if (item.paramName === 'last_term_time') {
  32. termTimes.value.start = item.paramValue
  33. } else if (item.paramName === 'next_term_time') {
  34. termTimes.value.end = item.paramValue
  35. }
  36. })
  37. }
  38. getDefaultParams()
  39. return () => (
  40. <div class={styles.orchestraDetail}>
  41. <OSticky
  42. position="top"
  43. onGetHeight={(height: any) => {
  44. tabHeight.value = height
  45. document.documentElement.style.setProperty('--header-height', height + 'px')
  46. }}
  47. >
  48. <OHeader />
  49. </OSticky>
  50. <Tabs
  51. sticky
  52. lineWidth={20}
  53. lineHeight={4}
  54. v-model:active={tabValue.value}
  55. animated
  56. offsetTop={tabHeight.value}
  57. swipeable
  58. >
  59. <Tab title="乐团信息" name="information">
  60. <Information termTimes={termTimes.value} />
  61. </Tab>
  62. <Tab title="训练进度" name="plan">
  63. <Plan height={tabHeight.value} termTimes={termTimes.value} />
  64. </Tab>
  65. {/* <Tab title="训练照片" name="photo"></Tab> */}
  66. {/* <Tab title="乐团资讯" name="info"></Tab> */}
  67. </Tabs>
  68. {/* {tabValue.value === 'information' && <Information termTimes={termTimes.value} />} */}
  69. {/* {tabValue.value === 'plan' && <Plan height={tabHeight.value} termTimes={termTimes.value} />} */}
  70. {/* {tabValue.value === 'photo' && <Photo height={tabHeight.value} />} */}
  71. </div>
  72. )
  73. }
  74. })