orchestra-detail.tsx 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. // 获取头部高度
  23. const onGetHeight = (height: any) => {
  24. tabHeight.value = height
  25. }
  26. const getDefaultParams = async () => {
  27. // last_term_time 上学期
  28. // next_term_time 下学期
  29. const { data } = await request.get('/api-school/sysParamConfig/queryByParamNameList', {
  30. params: {
  31. paramNames: 'last_term_time,next_term_time'
  32. }
  33. })
  34. ;(data || []).forEach((item: any) => {
  35. if (item.paramName === 'last_term_time') {
  36. termTimes.value.start = item.paramValue
  37. } else if (item.paramName === 'next_term_time') {
  38. termTimes.value.end = item.paramValue
  39. }
  40. })
  41. }
  42. getDefaultParams()
  43. return () => (
  44. <div class={styles.orchestraDetail}>
  45. <OSticky position="top" onGetHeight={onGetHeight}>
  46. <OHeader />
  47. <Tabs sticky lineWidth={20} lineHeight={4} v-model:active={tabValue.value}>
  48. <Tab title="乐团信息" name="information"></Tab>
  49. <Tab title="训练进度" name="plan"></Tab>
  50. <Tab title="训练照片" name="photo"></Tab>
  51. {/* <Tab title="乐团资讯" name="info"></Tab> */}
  52. </Tabs>
  53. </OSticky>
  54. {tabValue.value === 'information' && <Information termTimes={termTimes.value} />}
  55. {tabValue.value === 'plan' && <Plan height={tabHeight.value} termTimes={termTimes.value} />}
  56. {tabValue.value === 'photo' && <Photo height={tabHeight.value} />}
  57. </div>
  58. )
  59. }
  60. })