|
@@ -25,6 +25,7 @@ import OSearch from '@/components/o-search'
|
|
|
import OHeader from '@/components/o-header'
|
|
|
import { getInstrumentName } from '@/constant/instruments'
|
|
|
|
|
|
+const subjectKey = "accompany-music-list-subject"
|
|
|
export default defineComponent({
|
|
|
name: 'accompany-music-list',
|
|
|
props: {
|
|
@@ -37,6 +38,7 @@ export default defineComponent({
|
|
|
const route = useRoute()
|
|
|
const imgDefault = getImage('icon-music.svg')
|
|
|
const userInfo = ref<any>({})
|
|
|
+ const subjectId = localStorage.getItem(subjectKey) || state.user?.data?.subjectId?.split(',')?.[0] || ''
|
|
|
const data = reactive({
|
|
|
loading: false,
|
|
|
finished: false,
|
|
@@ -50,7 +52,9 @@ export default defineComponent({
|
|
|
value2: null,
|
|
|
PopoverOpen: false,
|
|
|
list: [] as any,
|
|
|
- keyword: ''
|
|
|
+ keyword: '',
|
|
|
+ musicSubject: subjectId,
|
|
|
+ subjectList: [] as any
|
|
|
})
|
|
|
const getTree = async () => {
|
|
|
try {
|
|
@@ -67,6 +71,27 @@ export default defineComponent({
|
|
|
console.log(error)
|
|
|
}
|
|
|
}
|
|
|
+ // 获取声部信息
|
|
|
+ const getSubjects = async () => {
|
|
|
+ try {
|
|
|
+ const subjects = await request.post(state.platformApi + '/open/subjectBasicConfig/page', {
|
|
|
+ data: {
|
|
|
+ enableFlag: true,
|
|
|
+ page: 1,
|
|
|
+ rows: 100
|
|
|
+ }
|
|
|
+ })
|
|
|
+ const rows = subjects.data.rows || []
|
|
|
+ rows.forEach((item: any) => {
|
|
|
+ data.subjectList.push({
|
|
|
+ text: item.subjectName,
|
|
|
+ value: item.subjectId + ''
|
|
|
+ })
|
|
|
+ })
|
|
|
+ } catch {
|
|
|
+ //
|
|
|
+ }
|
|
|
+ }
|
|
|
/**获取会员购买记录 */
|
|
|
const getUserInfo = async () => {
|
|
|
try {
|
|
@@ -121,7 +146,8 @@ export default defineComponent({
|
|
|
...data.pagenation,
|
|
|
keyword: data.keyword,
|
|
|
musicSheetCategoriesId: data.value2 || data.value1,
|
|
|
- status: 1
|
|
|
+ status: 1,
|
|
|
+ musicSubject: data.musicSubject
|
|
|
},
|
|
|
hideLoading: true
|
|
|
})
|
|
@@ -165,6 +191,9 @@ export default defineComponent({
|
|
|
if (state.platformType == 'STUDENT') {
|
|
|
getUserInfo()
|
|
|
}
|
|
|
+ if (state.platformType == 'TEACHER') {
|
|
|
+ getSubjects()
|
|
|
+ }
|
|
|
getTree()
|
|
|
})
|
|
|
|
|
@@ -185,13 +214,13 @@ export default defineComponent({
|
|
|
parts = parts.filter((n) => !n.textContent?.toLocaleUpperCase()?.includes('COMMON'))
|
|
|
for (let i = 0; i < parts.length; i++) {
|
|
|
const name = getInstrumentName(parts[i].textContent || '')
|
|
|
- partNames.push({ text: name ? (parts[i].textContent + `(${name})`) : '', value: i })
|
|
|
+ partNames.push({ text: name ? parts[i].textContent + `(${name})` : '', value: i })
|
|
|
}
|
|
|
closeToast()
|
|
|
} catch (error) {
|
|
|
console.log(error)
|
|
|
}
|
|
|
- console.log("🚀 ~ partNames:", partNames)
|
|
|
+ console.log('🚀 ~ partNames:', partNames)
|
|
|
return partNames
|
|
|
}
|
|
|
|
|
@@ -233,13 +262,31 @@ export default defineComponent({
|
|
|
</DropdownMenu>
|
|
|
<div class={styles.filter}>
|
|
|
<OSearch
|
|
|
- style={{ width: '100%' }}
|
|
|
- background="transparent"
|
|
|
+ class={styles.filterBox}
|
|
|
onSearch={(keyword: string) => {
|
|
|
data.keyword = keyword
|
|
|
onSearch()
|
|
|
}}
|
|
|
- />
|
|
|
+ >
|
|
|
+ {{
|
|
|
+ left: () => (
|
|
|
+ <>
|
|
|
+ {state.platformType == 'TEACHER' ? (
|
|
|
+ <DropdownMenu activeColor="var(--van-primary)">
|
|
|
+ <DropdownItem
|
|
|
+ v-model:modelValue={data.musicSubject}
|
|
|
+ options={data.subjectList}
|
|
|
+ onChange={() => {
|
|
|
+ localStorage.setItem(subjectKey, data.musicSubject)
|
|
|
+ onSearch()
|
|
|
+ }}
|
|
|
+ ></DropdownItem>
|
|
|
+ </DropdownMenu>
|
|
|
+ ) : null}
|
|
|
+ </>
|
|
|
+ )
|
|
|
+ }}
|
|
|
+ </OSearch>
|
|
|
</div>
|
|
|
</div>
|
|
|
</OSticky>
|
|
@@ -292,7 +339,7 @@ export default defineComponent({
|
|
|
onConfirm={(value) => {
|
|
|
staffData.open = false
|
|
|
staffData.partIndex = value.selectedValues[0]
|
|
|
- openView({id: staffData.instrumentName})
|
|
|
+ openView({ id: staffData.instrumentName })
|
|
|
}}
|
|
|
onCancel={() => (staffData.open = false)}
|
|
|
/>
|