|
@@ -3,7 +3,7 @@ import OSticky from '@/components/o-sticky'
|
|
import request from '@/helpers/request'
|
|
import request from '@/helpers/request'
|
|
import { state } from '@/state'
|
|
import { state } from '@/state'
|
|
import { Cell, CellGroup, Picker, Popup, Tab, Tabs } from 'vant'
|
|
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 styles from './index.module.less'
|
|
import iconOrchestra from './images/icon-or.png'
|
|
import iconOrchestra from './images/icon-or.png'
|
|
import MyClass from './my-class'
|
|
import MyClass from './my-class'
|
|
@@ -11,11 +11,14 @@ import OEmpty from '@/components/o-empty'
|
|
import OFullRefresh from '@/components/o-full-refresh'
|
|
import OFullRefresh from '@/components/o-full-refresh'
|
|
import OrchestraDeeds from './orchestra-deeds'
|
|
import OrchestraDeeds from './orchestra-deeds'
|
|
import MyPhoto from './my-photo'
|
|
import MyPhoto from './my-photo'
|
|
|
|
+import { useRoute, useRouter } from 'vue-router'
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
name: 'my-orchestra',
|
|
name: 'my-orchestra',
|
|
setup(props, ctx) {
|
|
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({
|
|
const data = reactive({
|
|
orchestraList: [] as any[],
|
|
orchestraList: [] as any[],
|
|
loading: true
|
|
loading: true
|
|
@@ -24,6 +27,25 @@ export default defineComponent({
|
|
orchestra: {} as any,
|
|
orchestra: {} as any,
|
|
orchestraStatus: false
|
|
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 () => {
|
|
const getOrchestras = async () => {
|
|
data.loading = true
|
|
data.loading = true
|
|
try {
|
|
try {
|
|
@@ -37,8 +59,15 @@ export default defineComponent({
|
|
} catch {}
|
|
} catch {}
|
|
data.loading = false
|
|
data.loading = false
|
|
}
|
|
}
|
|
|
|
+ const getData = () => {
|
|
|
|
+ getStudentOrchestras()
|
|
|
|
+ // if (state.platformType === 'STUDENT') {
|
|
|
|
+ // } else {
|
|
|
|
+ // getOrchestras()
|
|
|
|
+ // }
|
|
|
|
+ }
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
- getOrchestras()
|
|
|
|
|
|
+ getData()
|
|
})
|
|
})
|
|
|
|
|
|
return () => (
|
|
return () => (
|
|
@@ -48,13 +77,45 @@ export default defineComponent({
|
|
document.documentElement.style.setProperty('--header-height', height + 'px')
|
|
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>
|
|
</OSticky>
|
|
<OFullRefresh
|
|
<OFullRefresh
|
|
v-model:modelValue={data.loading}
|
|
v-model:modelValue={data.loading}
|
|
onRefresh={() => {
|
|
onRefresh={() => {
|
|
data.orchestraList = []
|
|
data.orchestraList = []
|
|
- getOrchestras()
|
|
|
|
|
|
+ nextTick(() => {
|
|
|
|
+ getData()
|
|
|
|
+ })
|
|
}}
|
|
}}
|
|
style="min-height: calc(100vh - var(--van-nav-bar-height) - var(--header-height))"
|
|
style="min-height: calc(100vh - var(--van-nav-bar-height) - var(--header-height))"
|
|
>
|
|
>
|
|
@@ -71,21 +132,31 @@ export default defineComponent({
|
|
}}
|
|
}}
|
|
</Cell>
|
|
</Cell>
|
|
</CellGroup>
|
|
</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}>
|
|
<div class={styles.content}>
|
|
- <MyClass orchestraId={modelData.orchestra?.id || ''} />
|
|
|
|
|
|
+ <MyClass
|
|
|
|
+ list={modelData.orchestra?.classGroupIdList || []}
|
|
|
|
+ orchestraId={modelData.orchestra?.id || ''}
|
|
|
|
+ />
|
|
</div>
|
|
</div>
|
|
</Tab>
|
|
</Tab>
|
|
- <Tab name="乐团相册" title="乐团相册">
|
|
|
|
|
|
+ <Tab name="photo" title="乐团相册">
|
|
<div class={styles.content}>
|
|
<div class={styles.content}>
|
|
- <MyPhoto orchestraId={modelData.orchestra?.id || ''} />
|
|
|
|
|
|
+ <MyPhoto orchestraId={modelData.orchestra?.id || ''} />
|
|
</div>
|
|
</div>
|
|
</Tab>
|
|
</Tab>
|
|
- <Tab name="乐团事迹" title="乐团事迹">
|
|
|
|
|
|
+ <Tab name="deeds" title="乐团事迹">
|
|
<div class={styles.content}>
|
|
<div class={styles.content}>
|
|
- <OrchestraDeeds orchestraId={modelData.orchestra?.id || ''} />
|
|
|
|
|
|
+ <OrchestraDeeds orchestraId={modelData.orchestra?.id || ''} />
|
|
</div>
|
|
</div>
|
|
</Tab>
|
|
</Tab>
|
|
</Tabs>
|
|
</Tabs>
|