|
@@ -0,0 +1,118 @@
|
|
|
+import OHeader from '@/components/o-header'
|
|
|
+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 styles from './index.module.less'
|
|
|
+import iconOrchestra from './images/icon-or.png'
|
|
|
+import MyClass from './my-class'
|
|
|
+import OEmpty from '@/components/o-empty'
|
|
|
+import OFullRefresh from '@/components/o-full-refresh'
|
|
|
+import OrchestraDeeds from './orchestra-deeds'
|
|
|
+import MyPhoto from './my-photo'
|
|
|
+
|
|
|
+export default defineComponent({
|
|
|
+ name: 'my-orchestra',
|
|
|
+ setup(props, ctx) {
|
|
|
+ const tabActive = ref('乐团相册')
|
|
|
+ const data = reactive({
|
|
|
+ orchestraList: [] as any[],
|
|
|
+ loading: true
|
|
|
+ })
|
|
|
+ const modelData = reactive({
|
|
|
+ orchestra: {} as any,
|
|
|
+ orchestraStatus: false
|
|
|
+ })
|
|
|
+ const getOrchestras = async () => {
|
|
|
+ data.loading = true
|
|
|
+ try {
|
|
|
+ const res: any = await request.post(`${state.platformApi}/orchestra/page`, {
|
|
|
+ data: { page: 1, rows: 1000 }
|
|
|
+ })
|
|
|
+ if (Array.isArray(res?.data?.rows)) {
|
|
|
+ data.orchestraList = res.data.rows
|
|
|
+ modelData.orchestra = res.data.rows[0] || {}
|
|
|
+ }
|
|
|
+ } catch {}
|
|
|
+ data.loading = false
|
|
|
+ }
|
|
|
+ onMounted(() => {
|
|
|
+ getOrchestras()
|
|
|
+ })
|
|
|
+
|
|
|
+ return () => (
|
|
|
+ <div class={styles.mineOrchestra}>
|
|
|
+ <OSticky
|
|
|
+ onGetHeight={(height: number) => {
|
|
|
+ document.documentElement.style.setProperty('--header-height', height + 'px')
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <OHeader title="我的乐团" />
|
|
|
+ </OSticky>
|
|
|
+ <OFullRefresh
|
|
|
+ v-model:modelValue={data.loading}
|
|
|
+ onRefresh={() => {
|
|
|
+ data.orchestraList = []
|
|
|
+ getOrchestras()
|
|
|
+ }}
|
|
|
+ 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.orchestraList.length && (
|
|
|
+ <Tabs v-model:active={tabActive.value} class={styles.tabs} lazyRender={true} background="transparent" animated swipeable>
|
|
|
+ <Tab name="我的班级" title="我的班级">
|
|
|
+ <div class={styles.content}>
|
|
|
+ <MyClass orchestraId={modelData.orchestra?.id || ''} />
|
|
|
+ </div>
|
|
|
+ </Tab>
|
|
|
+ <Tab name="乐团相册" title="乐团相册">
|
|
|
+ <div class={styles.content}>
|
|
|
+ <MyPhoto orchestraId={modelData.orchestra?.id || ''} />
|
|
|
+ </div>
|
|
|
+ </Tab>
|
|
|
+ <Tab name="乐团事迹" title="乐团事迹">
|
|
|
+ <div class={styles.content}>
|
|
|
+ <OrchestraDeeds orchestraId={modelData.orchestra?.id || ''} />
|
|
|
+ </div>
|
|
|
+ </Tab>
|
|
|
+ </Tabs>
|
|
|
+ )}
|
|
|
+ {!data.loading && !data.orchestraList.length && (
|
|
|
+ <OEmpty btnStatus={false} tips="暂无乐团" />
|
|
|
+ )}
|
|
|
+ </OFullRefresh>
|
|
|
+
|
|
|
+ <Popup v-model:show={modelData.orchestraStatus} position="bottom" round>
|
|
|
+ <Picker
|
|
|
+ columns={data.orchestraList}
|
|
|
+ columnsFieldNames={{ text: 'name', value: 'id' }}
|
|
|
+ onCancel={() => (modelData.orchestraStatus = false)}
|
|
|
+ onConfirm={({ selectedValues }: any) => {
|
|
|
+ const val = selectedValues[0] || ''
|
|
|
+ modelData.orchestraStatus = false
|
|
|
+ if (val == modelData.orchestra?.id) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const active = data.orchestraList.find((n: any) => n.id == val) || {}
|
|
|
+ modelData.orchestra = active
|
|
|
+ console.log(active)
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </Popup>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }
|
|
|
+})
|