lex-xin 6 months ago
parent
commit
97da215a40

BIN
src/views/hot-music-more/images/icon-change.png


BIN
src/views/hot-music-more/images/icon-download.png


BIN
src/views/hot-music-more/images/icon-staff.png


+ 0 - 1
src/views/hot-music-more/index.module.less

@@ -456,7 +456,6 @@
       border: 1px solid #1CACF1;
       background: #EBF8FF;
       color: #1CACF1;
-      font-weight: bold;
 
       &::after {
         border-bottom: 4px solid #1CACF1;

+ 26 - 8
src/views/hot-music-more/index.tsx

@@ -308,6 +308,15 @@ export default defineComponent({
       try {
         const res = await request.get('/edu-app/musicTag/tree');
         const result = res.data || [];
+        // 去掉上下册
+        result.forEach((item: any) => {
+          if (item.children && item.children.length > 0) {
+            const child = item.children;
+            child?.forEach((c: any) => {
+              c.children = null;
+            });
+          }
+        });
         data.tags = [
           {
             columnName: result[0].columnName,
@@ -324,7 +333,7 @@ export default defineComponent({
 
     const changeTag = (item: any, activeIndex?: any) => {
       data.tagActiveId = item.id;
-      data.childSelectId = null;
+      data.childSelectId = activeIndex;
       let children: any;
       let columnName = '';
       if (item.children) {
@@ -435,7 +444,6 @@ export default defineComponent({
 
       window.addEventListener('resize', tabResize);
       useEventListener(document, 'scroll', () => {
-        console.log('1111', state.isFocus)
         if(state.isFocus) {
           mSearchRef.value?.searchBlur()
         }
@@ -496,16 +504,26 @@ export default defineComponent({
                             }
                             state.sNt = allSearch.musicTagIds
                             if(allSearch.bookVersionId) {
-                              const ids = formatParentId(allSearch.bookVersionId,data.tags)
-                              console.log(ids)
-
+                              let ids: any = []
+                              data.tags.forEach((item: any) => {
+                                if(item.id === allSearch.bookVersionId) {
+                                  ids.push(item.id)
+                                }
+                              })
+                              if(ids.length <= 0) {
+                                ids = formatParentId(allSearch.bookVersionId, data.tags)
+                              }
+                              // console.log(ids, 'ids', allSearch.bookVersionId)
                               data.tagActiveId = ids[0]
 
-                              if(data.tagActiveId && ids[1]) {
+                              if(data.tagActiveId) {
                                 const item = data.tags.find((item) => item.id === ids[0])
-                                console.log(item, 'item')
-                                if(item)  changeTag(item, ids[1])
+                                if(item) changeTag(item, ids[1])
                               }
+                            } else {
+                              data.tagActiveId = ''
+                              data.childSelectId = null
+                              data.selectParents = {};
                             }
                           }
                         } else {