lex 1 年之前
父节点
当前提交
ec652c55ef
共有 2 个文件被更改,包括 58 次插入33 次删除
  1. 12 0
      src/views/co-ai/index.module.less
  2. 46 33
      src/views/co-ai/index.tsx

+ 12 - 0
src/views/co-ai/index.module.less

@@ -29,6 +29,18 @@
   }
 }
 
+.subjectListContainer {
+  // font-size: 20px;
+
+  :global {
+    .van-popover__content {
+      max-height: 50vh;
+      overflow-x: hidden;
+      overflow-y: auto;
+    }
+  }
+}
+
 .popoverMusic {
   width: 160px;
 

+ 46 - 33
src/views/co-ai/index.tsx

@@ -251,11 +251,14 @@ export default defineComponent({
           ...musicForms,
           musicalInstrumentId: data.subjectItem.value || null
         });
-        if (res.code === 200 && Array.isArray(res?.data?.rows)) {
-          data.musics = [...data.musics, ...res.data.rows];
-          data.finshed = !res.data.next;
-        }
-        showGuide.value = true;
+        if (res.code === 200) {
+          if (Array.isArray(res?.data?.rows)) {
+            data.musics = [...data.musics, ...res.data.rows];
+            data.finshed = !res.data.next;
+          } else {
+            data.finshed = true;
+          }
+        } else showGuide.value = true;
       } catch (error) {
         console.log('🚀 ~ error:', error);
       }
@@ -311,8 +314,8 @@ export default defineComponent({
       if (musics && musics.length) {
         let list: any = [];
         const arr = musics.forEach((item: any) => {
-          list.push({'name': item.name,'code': item.code})
-        })
+          list.push({ name: item.name, code: item.code });
+        });
       }
       if (musics && musics.length > 1) {
         return true;
@@ -364,16 +367,26 @@ export default defineComponent({
       const details = data.musics[data.musicIndex];
       if (details.musicalInstruments?.length > 1) {
         if (details.xmlFileUrl) {
-          const res = await fetch(details.xmlFileUrl).then((response) => response.text());
-          filterTracks(res)
+          const res = await fetch(details.xmlFileUrl).then(response =>
+            response.text()
+          );
+          filterTracks(res);
         }
       } else {
         // showMusicImg: 'first' as 'staff' | 'first' | 'fixed',
-        const { defaultScore, transferFlag } = details.musicalInstruments[0] || {}
+        const { defaultScore, transferFlag } =
+          details.musicalInstruments[0] || {};
         let musicImgType: 'staff' | 'first' | 'fixed' = 'staff';
-        musicImgType = defaultScore === 'STAVE' ? 'staff' : defaultScore === 'JIAN' ? 'fixed' : defaultScore === 'FIRST' ? 'first' : 'staff'
-        data.showMusicImg = musicImgType
-        data.showTransBtn = transferFlag
+        musicImgType =
+          defaultScore === 'STAVE'
+            ? 'staff'
+            : defaultScore === 'JIAN'
+            ? 'fixed'
+            : defaultScore === 'FIRST'
+            ? 'first'
+            : 'staff';
+        data.showMusicImg = musicImgType;
+        data.showTransBtn = transferFlag;
       }
     };
 
@@ -570,6 +583,7 @@ export default defineComponent({
                               offset={[0, 18]}
                               actions={data.subjectList}
                               placement="bottom-start"
+                              class={styles.subjectListContainer}
                               onSelect={(item: any) => {
                                 data.subjectList.forEach((c: any) => {
                                   c.className = '';
@@ -827,26 +841,25 @@ export default defineComponent({
             }}
           />
         </Popup>
-        {
-        data.showChangeVoice &&    
-        <Popup
-          class="popup-custom van-scale"
-          transition="van-scale"
-          closeOnClickOverlay={false}
-          v-model:show={data.showChangeVoice}>
-          <ChangeVoice
-            musicalInstruments={data.trackList || []}
-            musicalInstrumentIndex={data.selectMusicInstrumentIndex}
-            onClose={() => (data.showChangeVoice = false)}
-            onConfirm={async (index: number) => {
-              data.selectMusicInstrumentIndex = index;
-              await analyzeXml();
-              musicIframeLoad();
-              data.showChangeVoice = false;
-            }}
-          />
-        </Popup>
-        }
+        {data.showChangeVoice && (
+          <Popup
+            class="popup-custom van-scale"
+            transition="van-scale"
+            closeOnClickOverlay={false}
+            v-model:show={data.showChangeVoice}>
+            <ChangeVoice
+              musicalInstruments={data.trackList || []}
+              musicalInstrumentIndex={data.selectMusicInstrumentIndex}
+              onClose={() => (data.showChangeVoice = false)}
+              onConfirm={async (index: number) => {
+                data.selectMusicInstrumentIndex = index;
+                await analyzeXml();
+                musicIframeLoad();
+                data.showChangeVoice = false;
+              }}
+            />
+          </Popup>
+        )}
       </div>
     );
   }