|  | @@ -3,7 +3,7 @@ import OSticky from '@/components/o-sticky'
 | 
	
		
			
				|  |  |  import request from '@/helpers/request'
 | 
	
		
			
				|  |  |  import { state } from '@/state'
 | 
	
		
			
				|  |  |  import { Cell, CellGroup, Picker, Popup, Tab, Tabs } from 'vant'
 | 
	
		
			
				|  |  | -import { defineComponent, onMounted, reactive, ref } from 'vue'
 | 
	
		
			
				|  |  | +import { defineComponent, nextTick, onMounted, reactive, ref } from 'vue'
 | 
	
		
			
				|  |  |  import styles from './index.module.less'
 | 
	
		
			
				|  |  |  import iconOrchestra from './images/icon-or.png'
 | 
	
		
			
				|  |  |  import MyClass from './my-class'
 | 
	
	
		
			
				|  | @@ -11,11 +11,14 @@ import OEmpty from '@/components/o-empty'
 | 
	
		
			
				|  |  |  import OFullRefresh from '@/components/o-full-refresh'
 | 
	
		
			
				|  |  |  import OrchestraDeeds from './orchestra-deeds'
 | 
	
		
			
				|  |  |  import MyPhoto from './my-photo'
 | 
	
		
			
				|  |  | +import { useRoute, useRouter } from 'vue-router'
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  export default defineComponent({
 | 
	
		
			
				|  |  |    name: 'my-orchestra',
 | 
	
		
			
				|  |  |    setup(props, ctx) {
 | 
	
		
			
				|  |  | -    const tabActive = ref('乐团相册')
 | 
	
		
			
				|  |  | +    const route = useRoute()
 | 
	
		
			
				|  |  | +    const router = useRouter()
 | 
	
		
			
				|  |  | +    const tabActive = ref<'course' | 'photo' | 'deeds'>((route.query as any)?.tab || 'course')
 | 
	
		
			
				|  |  |      const data = reactive({
 | 
	
		
			
				|  |  |        orchestraList: [] as any[],
 | 
	
		
			
				|  |  |        loading: true
 | 
	
	
		
			
				|  | @@ -24,6 +27,25 @@ export default defineComponent({
 | 
	
		
			
				|  |  |        orchestra: {} as any,
 | 
	
		
			
				|  |  |        orchestraStatus: false
 | 
	
		
			
				|  |  |      })
 | 
	
		
			
				|  |  | +    /** 学生获取我的乐团 */
 | 
	
		
			
				|  |  | +    const getStudentOrchestras = () => {
 | 
	
		
			
				|  |  | +      data.loading = true
 | 
	
		
			
				|  |  | +      request.post(`${state.platformApi}/orchestra/studentOrchestra`).then((res: any) => {
 | 
	
		
			
				|  |  | +        if (Array.isArray(res?.data)) {
 | 
	
		
			
				|  |  | +          data.orchestraList = res.data.map((n: any) => {
 | 
	
		
			
				|  |  | +            return {
 | 
	
		
			
				|  |  | +              ...n,
 | 
	
		
			
				|  |  | +              name: n.name || n.orchestraName || '',
 | 
	
		
			
				|  |  | +              id: n.id || n.orchestraId || ''
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +          })
 | 
	
		
			
				|  |  | +          modelData.orchestra = data.orchestraList[0] || {}
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +      setTimeout(() => {
 | 
	
		
			
				|  |  | +        data.loading = false
 | 
	
		
			
				|  |  | +      }, 300)
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |      const getOrchestras = async () => {
 | 
	
		
			
				|  |  |        data.loading = true
 | 
	
		
			
				|  |  |        try {
 | 
	
	
		
			
				|  | @@ -37,8 +59,15 @@ export default defineComponent({
 | 
	
		
			
				|  |  |        } catch {}
 | 
	
		
			
				|  |  |        data.loading = false
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +    const getData = () => {
 | 
	
		
			
				|  |  | +      getStudentOrchestras()
 | 
	
		
			
				|  |  | +      // if (state.platformType === 'STUDENT') {
 | 
	
		
			
				|  |  | +      // } else {
 | 
	
		
			
				|  |  | +      //   getOrchestras()
 | 
	
		
			
				|  |  | +      // }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |      onMounted(() => {
 | 
	
		
			
				|  |  | -      getOrchestras()
 | 
	
		
			
				|  |  | +      getData()
 | 
	
		
			
				|  |  |      })
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      return () => (
 | 
	
	
		
			
				|  | @@ -48,13 +77,45 @@ export default defineComponent({
 | 
	
		
			
				|  |  |              document.documentElement.style.setProperty('--header-height', height + 'px')
 | 
	
		
			
				|  |  |            }}
 | 
	
		
			
				|  |  |          >
 | 
	
		
			
				|  |  | -          <OHeader title="我的乐团" />
 | 
	
		
			
				|  |  | +          <OHeader
 | 
	
		
			
				|  |  | +            title="我的乐团"
 | 
	
		
			
				|  |  | +            v-slots={{
 | 
	
		
			
				|  |  | +              right: () => (
 | 
	
		
			
				|  |  | +                <>
 | 
	
		
			
				|  |  | +                  {state.platformType == 'STUDENT' && (
 | 
	
		
			
				|  |  | +                    <>
 | 
	
		
			
				|  |  | +                      {(modelData.orchestra?.status === 'REGISTER' ||
 | 
	
		
			
				|  |  | +                        modelData.orchestra?.status === 'LEARNING') && (
 | 
	
		
			
				|  |  | +                        <span
 | 
	
		
			
				|  |  | +                          onClick={() => {
 | 
	
		
			
				|  |  | +                            router.push({
 | 
	
		
			
				|  |  | +                              path: '/apply-withdrawal',
 | 
	
		
			
				|  |  | +                              query: {
 | 
	
		
			
				|  |  | +                                id: modelData.orchestra?.orchestraId
 | 
	
		
			
				|  |  | +                              }
 | 
	
		
			
				|  |  | +                            })
 | 
	
		
			
				|  |  | +                          }}
 | 
	
		
			
				|  |  | +                        >
 | 
	
		
			
				|  |  | +                          申请退团
 | 
	
		
			
				|  |  | +                        </span>
 | 
	
		
			
				|  |  | +                      )}
 | 
	
		
			
				|  |  | +                      {modelData.orchestra?.status === 'AUTH' && (
 | 
	
		
			
				|  |  | +                        <span style={{ color: 'red' }}>申请退团中</span>
 | 
	
		
			
				|  |  | +                      )}
 | 
	
		
			
				|  |  | +                    </>
 | 
	
		
			
				|  |  | +                  )}
 | 
	
		
			
				|  |  | +                </>
 | 
	
		
			
				|  |  | +              )
 | 
	
		
			
				|  |  | +            }}
 | 
	
		
			
				|  |  | +          />
 | 
	
		
			
				|  |  |          </OSticky>
 | 
	
		
			
				|  |  |          <OFullRefresh
 | 
	
		
			
				|  |  |            v-model:modelValue={data.loading}
 | 
	
		
			
				|  |  |            onRefresh={() => {
 | 
	
		
			
				|  |  |              data.orchestraList = []
 | 
	
		
			
				|  |  | -            getOrchestras()
 | 
	
		
			
				|  |  | +            nextTick(() => {
 | 
	
		
			
				|  |  | +              getData()
 | 
	
		
			
				|  |  | +            })
 | 
	
		
			
				|  |  |            }}
 | 
	
		
			
				|  |  |            style="min-height: calc(100vh - var(--van-nav-bar-height) - var(--header-height))"
 | 
	
		
			
				|  |  |          >
 | 
	
	
		
			
				|  | @@ -71,21 +132,31 @@ export default defineComponent({
 | 
	
		
			
				|  |  |                }}
 | 
	
		
			
				|  |  |              </Cell>
 | 
	
		
			
				|  |  |            </CellGroup>
 | 
	
		
			
				|  |  | -          {!!data.orchestraList.length && (
 | 
	
		
			
				|  |  | -            <Tabs v-model:active={tabActive.value} class={styles.tabs} lazyRender={true} background="transparent" animated swipeable>
 | 
	
		
			
				|  |  | -              <Tab name="我的班级" title="我的班级">
 | 
	
		
			
				|  |  | +          {!data.loading && !!data.orchestraList.length && (
 | 
	
		
			
				|  |  | +            <Tabs
 | 
	
		
			
				|  |  | +              v-model:active={tabActive.value}
 | 
	
		
			
				|  |  | +              class={styles.tabs}
 | 
	
		
			
				|  |  | +              lazyRender={true}
 | 
	
		
			
				|  |  | +              background="transparent"
 | 
	
		
			
				|  |  | +              animated
 | 
	
		
			
				|  |  | +              swipeable
 | 
	
		
			
				|  |  | +            >
 | 
	
		
			
				|  |  | +              <Tab name="course" title="我的班级">
 | 
	
		
			
				|  |  |                  <div class={styles.content}>
 | 
	
		
			
				|  |  | -                  <MyClass orchestraId={modelData.orchestra?.id || ''} />
 | 
	
		
			
				|  |  | +                  <MyClass
 | 
	
		
			
				|  |  | +                    list={modelData.orchestra?.classGroupIdList || []}
 | 
	
		
			
				|  |  | +                    orchestraId={modelData.orchestra?.id || ''}
 | 
	
		
			
				|  |  | +                  />
 | 
	
		
			
				|  |  |                  </div>
 | 
	
		
			
				|  |  |                </Tab>
 | 
	
		
			
				|  |  | -              <Tab name="乐团相册" title="乐团相册">
 | 
	
		
			
				|  |  | +              <Tab name="photo" title="乐团相册">
 | 
	
		
			
				|  |  |                  <div class={styles.content}>
 | 
	
		
			
				|  |  | -                    <MyPhoto orchestraId={modelData.orchestra?.id || ''} />
 | 
	
		
			
				|  |  | +                  <MyPhoto orchestraId={modelData.orchestra?.id || ''} />
 | 
	
		
			
				|  |  |                  </div>
 | 
	
		
			
				|  |  |                </Tab>
 | 
	
		
			
				|  |  | -              <Tab name="乐团事迹" title="乐团事迹">
 | 
	
		
			
				|  |  | +              <Tab name="deeds" title="乐团事迹">
 | 
	
		
			
				|  |  |                  <div class={styles.content}>
 | 
	
		
			
				|  |  | -                    <OrchestraDeeds orchestraId={modelData.orchestra?.id || ''} />
 | 
	
		
			
				|  |  | +                  <OrchestraDeeds orchestraId={modelData.orchestra?.id || ''} />
 | 
	
		
			
				|  |  |                  </div>
 | 
	
		
			
				|  |  |                </Tab>
 | 
	
		
			
				|  |  |              </Tabs>
 |