|
@@ -17,7 +17,8 @@ import {
|
|
|
Dialog,
|
|
|
Sticky,
|
|
|
Swipe,
|
|
|
- SwipeItem
|
|
|
+ SwipeItem,
|
|
|
+ Picker
|
|
|
} from 'vant'
|
|
|
import styles from './index.module.less'
|
|
|
import TheSticky from '@/components/the-sticky'
|
|
@@ -28,6 +29,7 @@ import iconMenu from './images/icon-menu.png'
|
|
|
import iconRightTop from './images/icon-right-top.png'
|
|
|
import iconAlbumCover from '../../images/icon-album-cover.png'
|
|
|
import iconTimer from './images/icon-timer.png'
|
|
|
+import iconArrow from './images/icon-arrow.png'
|
|
|
import { state as baseState, setLogout } from '@/state'
|
|
|
import Song from '../component/song'
|
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
@@ -80,7 +82,13 @@ export default defineComponent({
|
|
|
heightV: 0,
|
|
|
hasBuyStatus: true, // 是否能继续购买
|
|
|
albumList: [] as any, // 专辑列表
|
|
|
- initialSlide: 0
|
|
|
+ initialSlide: 0,
|
|
|
+ subjectStatus: false,
|
|
|
+ openStatus: false,
|
|
|
+ teacherSubjectId: null as any,
|
|
|
+ teacherSubjectName: null as any,
|
|
|
+ teacherSubjectIndex: 0,
|
|
|
+ subjectList: [] // 声部列表
|
|
|
})
|
|
|
const params = reactive({
|
|
|
page: 1,
|
|
@@ -206,8 +214,8 @@ export default defineComponent({
|
|
|
|
|
|
// 老师端默认查询声部
|
|
|
if (baseState.platformType === 'TEACHER') {
|
|
|
- const users = baseState.user.data
|
|
|
- tempParams.subjectId = users.defaultSubject || null
|
|
|
+ // const users = baseState.user.data
|
|
|
+ tempParams.subjectId = state.teacherSubjectId || null
|
|
|
}
|
|
|
|
|
|
try {
|
|
@@ -236,6 +244,25 @@ export default defineComponent({
|
|
|
state.loading = false
|
|
|
}
|
|
|
|
|
|
+ const getSubjectList = async () => {
|
|
|
+ try {
|
|
|
+ const res = await request.get('/api-tenant/open/subject/queryPage', {
|
|
|
+ data: { page: 1, rows: 9999 }
|
|
|
+ })
|
|
|
+ const result = res.data.rows || []
|
|
|
+ result.forEach((item: any) => {
|
|
|
+ item.text = item.name
|
|
|
+ })
|
|
|
+ state.subjectList = result || []
|
|
|
+ const index = state.subjectList.findIndex(
|
|
|
+ (item: any) => item.id == state.teacherSubjectId
|
|
|
+ )
|
|
|
+ state.teacherSubjectIndex = index === -1 ? 0 : index
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
onMounted(async () => {
|
|
|
// useEventListener(document, 'scroll', evt => {
|
|
|
// const { y } = useWindowScroll()
|
|
@@ -246,10 +273,18 @@ export default defineComponent({
|
|
|
// }
|
|
|
// })
|
|
|
|
|
|
+ // 老师端默认查询声部
|
|
|
+ if (baseState.platformType === 'TEACHER') {
|
|
|
+ const users = baseState.user.data
|
|
|
+ state.teacherSubjectId = users.defaultSubject || null
|
|
|
+ state.teacherSubjectName = users.defaultSubjectName || null
|
|
|
+ }
|
|
|
+
|
|
|
state.loading = true
|
|
|
state.loadingAlbum = true
|
|
|
await getDetails()
|
|
|
await FetchList()
|
|
|
+ getSubjectList()
|
|
|
state.loadingAlbum = false
|
|
|
state.loading = false
|
|
|
|
|
@@ -406,7 +441,27 @@ export default defineComponent({
|
|
|
hideHeader={route.query.taId ? true : false}
|
|
|
// color={color.value}
|
|
|
// backIconColor="white"
|
|
|
- />
|
|
|
+ >
|
|
|
+ {{
|
|
|
+ right: () =>
|
|
|
+ baseState.platformType === 'TEACHER' && (
|
|
|
+ <div
|
|
|
+ class={styles.changeSubjectSection}
|
|
|
+ onClick={() => {
|
|
|
+ state.subjectStatus = true
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <span class={styles.subjectName}>
|
|
|
+ {state.teacherSubjectName}
|
|
|
+ </span>
|
|
|
+ <img
|
|
|
+ class={state.subjectStatus && styles.active}
|
|
|
+ src={iconArrow}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }}
|
|
|
+ </ColHeader>
|
|
|
</TheSticky>
|
|
|
|
|
|
{/* <img class={styles.bgImg} src={state.details?.coverImg} /> */}
|
|
@@ -664,6 +719,34 @@ export default defineComponent({
|
|
|
</>
|
|
|
)
|
|
|
)}
|
|
|
+
|
|
|
+ {/* 选择声部 */}
|
|
|
+ <Popup
|
|
|
+ show={state.subjectStatus}
|
|
|
+ position="bottom"
|
|
|
+ round
|
|
|
+ safe-area-inset-bottom
|
|
|
+ onClose={() => (state.subjectStatus = false)}
|
|
|
+ onClosed={() => (state.openStatus = false)}
|
|
|
+ >
|
|
|
+ <Picker
|
|
|
+ defaultIndex={state.teacherSubjectIndex}
|
|
|
+ columns={state.subjectList}
|
|
|
+ onCancel={() => {
|
|
|
+ state.subjectStatus = false
|
|
|
+ }}
|
|
|
+ onConfirm={(val: any) => {
|
|
|
+ console.log(val, 'val')
|
|
|
+ state.teacherSubjectId = val.id
|
|
|
+ state.teacherSubjectName = val.name
|
|
|
+ params.page = 1
|
|
|
+ state.finished = false
|
|
|
+ state.list = []
|
|
|
+ FetchList()
|
|
|
+ state.subjectStatus = false
|
|
|
+ }}
|
|
|
+ ></Picker>
|
|
|
+ </Popup>
|
|
|
</div>
|
|
|
)
|
|
|
}
|