|
@@ -30,41 +30,54 @@ export default defineComponent({
|
|
|
/** 学生获取我的乐团 */
|
|
|
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)
|
|
|
+ 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] || {}
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ setTimeout(() => {
|
|
|
+ data.loading = false
|
|
|
+ }, 300)
|
|
|
+ })
|
|
|
}
|
|
|
- const getOrchestras = async () => {
|
|
|
+ const getTeacherOrchestras = async () => {
|
|
|
data.loading = true
|
|
|
- try {
|
|
|
- const res: any = await request.post(`${state.platformApi}/orchestra/page`, {
|
|
|
- data: { page: 1, rows: 1000 }
|
|
|
+ request
|
|
|
+ .post(`${state.platformApi}/orchestra/teacherOrchestra`)
|
|
|
+ .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] || {}
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ setTimeout(() => {
|
|
|
+ data.loading = false
|
|
|
+ }, 300)
|
|
|
})
|
|
|
- if (Array.isArray(res?.data?.rows)) {
|
|
|
- data.orchestraList = res.data.rows
|
|
|
- modelData.orchestra = res.data.rows[0] || {}
|
|
|
- }
|
|
|
- } catch {}
|
|
|
- data.loading = false
|
|
|
}
|
|
|
const getData = () => {
|
|
|
- getStudentOrchestras()
|
|
|
- // if (state.platformType === 'STUDENT') {
|
|
|
- // } else {
|
|
|
- // getOrchestras()
|
|
|
- // }
|
|
|
+ if (state.platformType === 'STUDENT') {
|
|
|
+ getStudentOrchestras()
|
|
|
+ } else if (state.platformType === 'TEACHER') {
|
|
|
+ getTeacherOrchestras()
|
|
|
+ }
|
|
|
}
|
|
|
onMounted(() => {
|
|
|
getData()
|
|
@@ -119,47 +132,46 @@ export default defineComponent({
|
|
|
}}
|
|
|
style="min-height: calc(100vh - var(--van-nav-bar-height) - var(--header-height))"
|
|
|
>
|
|
|
- <CellGroup inset>
|
|
|
- <Cell
|
|
|
- class={styles.select}
|
|
|
- center
|
|
|
- isLink
|
|
|
- onClick={() => (modelData.orchestraStatus = true)}
|
|
|
- >
|
|
|
- {{
|
|
|
- icon: () => <img class={styles.icon} src={iconOrchestra} />,
|
|
|
- title: () => <div class="van-ellipsis">{modelData.orchestra.name}</div>
|
|
|
- }}
|
|
|
- </Cell>
|
|
|
- </CellGroup>
|
|
|
{!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
|
|
|
- list={modelData.orchestra?.classGroupIdList || []}
|
|
|
- orchestraId={modelData.orchestra?.id || ''}
|
|
|
- />
|
|
|
- </div>
|
|
|
- </Tab>
|
|
|
- <Tab name="photo" title="乐团相册">
|
|
|
- <div class={styles.content}>
|
|
|
- <MyPhoto orchestraId={modelData.orchestra?.id || ''} />
|
|
|
- </div>
|
|
|
- </Tab>
|
|
|
- <Tab name="deeds" title="乐团事迹">
|
|
|
- <div class={styles.content}>
|
|
|
- <OrchestraDeeds orchestraId={modelData.orchestra?.id || ''} />
|
|
|
- </div>
|
|
|
- </Tab>
|
|
|
- </Tabs>
|
|
|
+ <>
|
|
|
+ <CellGroup inset>
|
|
|
+ <Cell
|
|
|
+ class={styles.select}
|
|
|
+ center
|
|
|
+ isLink
|
|
|
+ onClick={() => (modelData.orchestraStatus = true)}
|
|
|
+ >
|
|
|
+ {{
|
|
|
+ icon: () => <img class={styles.icon} src={iconOrchestra} />,
|
|
|
+ title: () => <div class="van-ellipsis">{modelData.orchestra.name}</div>
|
|
|
+ }}
|
|
|
+ </Cell>
|
|
|
+ </CellGroup>
|
|
|
+ <Tabs
|
|
|
+ v-model:active={tabActive.value}
|
|
|
+ class={styles.tabs}
|
|
|
+ lazyRender={true}
|
|
|
+ background="transparent"
|
|
|
+ animated
|
|
|
+ swipeable
|
|
|
+ >
|
|
|
+ <Tab name="course" title="我的班级">
|
|
|
+ <div class={styles.content}>
|
|
|
+ <MyClass list={modelData.orchestra?.classGroupIdList || []} />
|
|
|
+ </div>
|
|
|
+ </Tab>
|
|
|
+ <Tab name="photo" title="乐团相册">
|
|
|
+ <div class={styles.content}>
|
|
|
+ <MyPhoto orchestraId={modelData.orchestra?.id || ''} />
|
|
|
+ </div>
|
|
|
+ </Tab>
|
|
|
+ <Tab name="deeds" title="乐团事迹">
|
|
|
+ <div class={styles.content}>
|
|
|
+ <OrchestraDeeds orchestraId={modelData.orchestra?.id || ''} />
|
|
|
+ </div>
|
|
|
+ </Tab>
|
|
|
+ </Tabs>
|
|
|
+ </>
|
|
|
)}
|
|
|
{!data.loading && !data.orchestraList.length && (
|
|
|
<OEmpty btnStatus={false} tips="暂无乐团" />
|
|
@@ -179,7 +191,6 @@ export default defineComponent({
|
|
|
}
|
|
|
const active = data.orchestraList.find((n: any) => n.id == val) || {}
|
|
|
modelData.orchestra = active
|
|
|
- console.log(active)
|
|
|
}}
|
|
|
/>
|
|
|
</Popup>
|