Browse Source

只有老师端有

liushengqiang 1 year ago
parent
commit
0d493954b9
1 changed files with 14 additions and 10 deletions
  1. 14 10
      src/views/accompany/music-list.tsx

+ 14 - 10
src/views/accompany/music-list.tsx

@@ -25,7 +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"
+const subjectKey = 'accompany-music-list-subject'
 export default defineComponent({
   name: 'accompany-music-list',
   props: {
@@ -38,7 +38,8 @@ 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 subjectId =
+      localStorage.getItem(subjectKey) || state.user?.data?.subjectId?.split(',')?.[0] || ''
     const data = reactive({
       loading: false,
       firstRender: false,
@@ -141,15 +142,18 @@ export default defineComponent({
     const getList = async () => {
       if (data.loading) return
       data.loading = true
+      const bodyData: any = {
+        ...data.pagenation,
+        keyword: data.keyword,
+        musicSheetCategoriesId: data.value2 || data.value1,
+        status: 1,
+      }
+      if (state.platformType == 'TEACHER'){
+        bodyData.musicSubject = data.musicSubject
+      }
       try {
         const res: any = await request.post(state.platformApi + '/musicSheet/page', {
-          data: {
-            ...data.pagenation,
-            keyword: data.keyword,
-            musicSheetCategoriesId: data.value2 || data.value1,
-            status: 1,
-            musicSubject: data.musicSubject
-          },
+          data: bodyData,
           hideLoading: true
         })
         if (Array.isArray(res?.data?.rows)) {
@@ -332,7 +336,7 @@ export default defineComponent({
                 )
               })}
             </CellGroup>
-            <div style={{height: '40px'}}></div>
+            <div style={{ height: '40px' }}></div>
           </List>
           {data.firstRender && !data.loading && !data.list.length && <OEmpty tips="暂无曲谱" />}
         </OFullRefresh>