Selaa lähdekoodia

Merge branch 'main' into iteration-temp-http

lex-xin 5 kuukautta sitten
vanhempi
commit
f6c1d527cb

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/css/129.5c07b075.css


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 1
dist/css/227.e132ead8.css


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/css/269.f7d42cc1.css


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/css/498.d91f7fff.css


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 1
dist/css/722.f9a346f0.css


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/css/879.140529e9.css


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/css/897.2be7450b.css


BIN
dist/img/classlist.25aa5fb7.png


BIN
dist/img/icon-left-active.b8a84756.png


+ 1 - 5
dist/index.html

@@ -1,10 +1,6 @@
 <!doctype html><html lang=""><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="renderer" content="webkit"/><meta name="force-rendering" content="webkit"/><link rel="icon" href="/favicon.ico"/><title>乐教通</title><script>if (!!window.ActiveXObject || "ActiveXObject" in window) {
             window.location.href = "./ieIncompatible/index.html"
-<<<<<<< HEAD
-         }</script><script defer="defer" src="/js/chunk-vendors.55bb013e.js"></script><script defer="defer" src="/js/app.c6030437.js"></script><link href="/css/app.2ae84a6b.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but classroom doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"><style>.firstLoading {
-=======
-         }</script><script defer="defer" src="/js/chunk-vendors.caf6c2f9.js"></script><script defer="defer" src="/js/app.d339d0b2.js"></script><link href="/css/app.2ae84a6b.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but classroom doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"><style>.firstLoading {
->>>>>>> main
+         }</script><script defer="defer" src="/js/chunk-vendors.caf6c2f9.js"></script><script defer="defer" src="/js/app.2d4b3a57.js"></script><link href="/css/app.2ae84a6b.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but classroom doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"><style>.firstLoading {
                position: fixed;
                left: 50%;
                top: 50%;

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/js/129.8595022d.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/js/227.d218c26a.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/js/269.c2dce303.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/js/378.ee568555.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/js/498.ea5c6363.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/js/530.53950c4a.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/js/530.a9aeccbb.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/js/549.e5d3c5b0.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/js/722.96aa9929.js


+ 0 - 0
dist/js/818.fff01c39.js → dist/js/818.db77d3a5.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/js/879.92c2464d.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/js/897.0caad131.js


+ 0 - 0
dist/js/921.88f8f8ff.js → dist/js/921.3d1dbb53.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/js/app.2d4b3a57.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/js/app.c6030437.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/js/app.d339d0b2.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/js/chunk-vendors.55bb013e.js


+ 9 - 1
src/api/cloudPractice.api.ts

@@ -86,7 +86,7 @@ export const querySubjectIds_klx = (data?: any) => {
 export const queryPage2_klx = (data: any) => {
    return httpAxios_klx.axioseRquest({
       method: "post",
-      url: "/api-teacher/tenantAlbumMusic/page",
+      url: "/api-teacher/tenantAlbumMusic/pageSimple",
       data
    })
 }
@@ -98,3 +98,11 @@ export const selectCondition_klx = (data: any) => {
       data
    })
 }
+
+export const cbsDetail_klx = (id: number, data = {}) => {
+   return httpAxios_klx.axioseRquest({
+      method: "get",
+      url: `/api-teacher/musicSheet/cbsDetail/${id}`,
+      params: data
+   })
+}

+ 16 - 4
src/api/cloudTextbooks.api.ts

@@ -59,10 +59,16 @@ export const getMyCourseware_gyt = () => {
 }
 
 // 课程详情列表
-export const getMyCoursewareDetail_gyt = (id: string) => {
+export const getMyCoursewareDetail_gyt = (params: {
+   id: string
+   data: { search?: string; detailFlag?: string }
+   abortController: AbortController
+}) => {
    return httpAxios_gyt.axioseRquest({
+      signal: params.abortController.signal,
       method: "post",
-      url: "/api-teacher/courseSchedule/myCoursewareDetail/" + id
+      url: `/api-teacher/courseSchedule/myCoursewareDetail/${params.id}`,
+      params: params.data
    })
 }
 
@@ -111,10 +117,16 @@ export const queryLessonCourseware_klx = (type: string, albumId: string, abortCo
 }
 
 // 课程详情列表
-export const getLessonCoursewareCourseList_klx = (id: string) => {
+export const getLessonCoursewareCourseList_klx = (params: {
+   id: string
+   data: { search?: string; detailFlag?: string }
+   abortController: AbortController
+}) => {
    return httpAxios_klx.axioseRquest({
+      signal: params.abortController.signal,
       method: "get",
-      url: "/api-teacher/tenantAlbumMusic/getLessonCoursewareCourseList/" + id
+      url: `/api-teacher/tenantAlbumMusic/getLessonCoursewareCourseList/${params.id}`,
+      params: params.data
    })
 }
 

+ 97 - 46
src/views/cloudPractice/cloudPractice.tsx

@@ -24,7 +24,8 @@ import {
    queryTree_gyt,
    queryTree_klx,
    selectCondition_klx,
-   cbsDetail_gym
+   cbsDetail_gym,
+   cbsDetail_klx
 } from "@/api/cloudPractice.api"
 import axios from "axios"
 import { getInstrumentName } from "@/libs/instruments"
@@ -89,6 +90,19 @@ export default defineComponent({
       })
       const partColumns = ref<any>([])
 
+      const musicRenderType = computed(() => {
+         const details = state.details
+         const template: any = {
+            STAVE: "staff",
+            JIAN: "fixedTone",
+            FIRST: "firstTone"
+         }
+         if (details.scoreType) {
+            return template[details.scoreType] || "staff"
+         }
+         return "staff"
+      })
+
       /** 选中的item */
       const activeItem = computed(() => {
          const list = state.list[state.listActive] || {}
@@ -128,22 +142,23 @@ export default defineComponent({
                defaultScoreRender: list?.defaultScoreRender,
                musicPdfUrl: list?.musicPdfUrl
             }
+            console.log(tempList, "tempList --- tempList")
          } else if (userStoreHook.roles === "KLX") {
-            const item: any = list.background?.[0]
+            // const item: any = list.background?.[0]
             tempList = {
                id: list?.id,
-               name: list?.musicSheetName,
-               background: list?.background,
-               xmlUrl: list?.xmlFileUrl,
-               musicSheetType: list?.musicSheetType,
-               audioFileUrl: item?.audioFileUrl,
-               titleImg: list?.titleImg,
-               musicImg: list.musicImg,
-               musicJianImg: list.musicJianSvg,
-               musicFirstImg: list.musicFirstSvg,
-               isScoreRender: false,
-               defaultScoreRender: false,
-               musicPdfUrl: list?.musicPdfUrl
+               name: list?.name,
+               // background: list?.background,
+               // xmlUrl: list?.xmlFileUrl,
+               // musicSheetType: list?.musicSheetType,
+               audioFileUrl: list?.audioFileUrl,
+               titleImg: list?.titleImg
+               // musicImg: list.musicImg,
+               // musicJianImg: list.musicJianSvg,
+               // musicFirstImg: list.musicFirstSvg,
+               // isScoreRender: false,
+               // defaultScoreRender: false,
+               // musicPdfUrl: list?.musicPdfUrl
             }
          }
          return tempList
@@ -420,7 +435,7 @@ export default defineComponent({
                   return {
                      label: item.name,
                      value: item.id,
-                     instrumentIds: item.instrumentIds
+                     instrumentIds: item.instrumentId
                   }
                })
 
@@ -465,11 +480,7 @@ export default defineComponent({
                   state.list = []
                   state.reshing = false
                }
-
                if (Array.isArray(result.rows)) {
-                  result.rows.forEach((item: any) => {
-                     item.name = item.musicSheetName
-                  })
                   state.list = [...state.list, ...result.rows]
                   state.finshed = state.page >= result.totalPage
                } else {
@@ -481,6 +492,19 @@ export default defineComponent({
          })
       }
 
+      const handleGetDetail_klx = async () => {
+         loading.value = true
+         const { id } = state.list[state.listActive] || {}
+         if (!id) return (loading.value = false)
+         await httpAjaxErrMsg(cbsDetail_klx, id, { simpleFlag: "1", providerType: "TENANT" }).then(res => {
+            loading.value = false
+            if (res.code === 200) {
+               const result = res.data || {}
+               state.details = result
+            }
+         })
+      }
+
       const handleSelectCondition_klx = async () => {
          if (!state.categoryId || !state.firstTreeId) return
          loading.value = true
@@ -569,9 +593,9 @@ export default defineComponent({
          if (userStoreHook.roles === "GYM") {
             await handleGetDetail_gym()
          } else if (userStoreHook.roles === "GYT") {
-            // await handleGetList_gyt()
+            //
          } else if (userStoreHook.roles === "KLX") {
-            // await handleGetList_klx()
+            await handleGetDetail_klx()
          }
       }
 
@@ -756,7 +780,7 @@ export default defineComponent({
          state.selectedPartName = ""
          state.selectedTrack = ""
          state.selectedPartIndex = 0
-         // state.musicPdfUrl = ""
+         //    state.musicPdfUrl = ""
          state.partXmlIndex = 0
          document.querySelector(".musicList-container")?.scroll(0, 0)
          state.page = 1
@@ -766,13 +790,26 @@ export default defineComponent({
          await handleAllGetList()
       }
 
+      // 获取PDF
+      const getCurrentPdf = (item: any, scoreType: string) => {
+         let pdfUrl = ""
+         if (scoreType === "FIRST") {
+            pdfUrl = item.firstPdfUrl
+         } else if (scoreType === "JIAN") {
+            pdfUrl = item.jianPdfUrl
+         } else if (scoreType === "STAVE") {
+            pdfUrl = item.musicPdfUrl
+         }
+         return pdfUrl || ""
+      }
+
       const toDetailGYM = () => {
          // const row: any = activeItem.value
          const details: any = state.details
          state.imgs = []
          if (details.musicSheetType === "SINGLE") {
             loading.value = false
-            state.musicPdfUrl = details.musicPdfUrl
+            state.musicPdfUrl = getCurrentPdf(details, details.scoreType)
             return
          }
          // state.partNames = await getPartNames(row.xmlUrl)
@@ -786,7 +823,7 @@ export default defineComponent({
                label: item.track + (instrumentName ? `(${instrumentName})` : ""),
                instrumentName: instrumentName,
                track: item.track,
-               musicPdfUrl: item.musicPdfUrl,
+               musicPdfUrl: getCurrentPdf(item, details.scoreType),
                // xmlIndex: -1,
                value: index
             }
@@ -799,7 +836,7 @@ export default defineComponent({
                label: "总谱",
                instrumentName: null,
                track: null,
-               musicPdfUrl: "",
+               musicPdfUrl: getCurrentPdf(details, details.scoreType),
                xmlIndex: 999,
                value: 999
             })
@@ -832,20 +869,19 @@ export default defineComponent({
          }
 
          defaultShowStaff || (defaultShowStaff = partColumns.value.find((item: any) => item.value === state.selectedPartIndex))
-
          state.selectedPartName = defaultShowStaff?.instrumentName
          state.selectedTrack = defaultShowStaff?.track
          state.partXmlIndex = defaultShowStaff?.xmlIndex
          state.selectedPartIndex = defaultShowStaff?.value
          if (details.isScoreRender && details.defaultScoreRender) {
-            state.musicPdfUrl = details?.musicPdfUrl || ""
+            state.musicPdfUrl = getCurrentPdf(details, details.scoreType)
          } else {
             state.musicPdfUrl = defaultShowStaff?.musicPdfUrl || ""
          }
       }
 
       const toDetail = async () => {
-         if (userStoreHook.roles === "GYM") {
+         if (userStoreHook.roles === "GYM" || userStoreHook.roles === "KLX") {
             toDetailGYM()
             return
          }
@@ -854,6 +890,7 @@ export default defineComponent({
          if (row.musicSheetType === "SINGLE") {
             loading.value = false
             state.musicPdfUrl = row.musicPdfUrl
+            return
          }
          state.partNames = await getPartNames(row.xmlUrl)
          let partList = row.background || []
@@ -925,7 +962,7 @@ export default defineComponent({
       }
 
       const musicIframeLoad = async () => {
-         if (userStoreHook.roles === "GYM") {
+         if (userStoreHook.roles === "GYM" || userStoreHook.roles === "KLX") {
             // 判断是用哪个渲染的
             loading.value = false
             staffLoading.value = false
@@ -952,8 +989,10 @@ export default defineComponent({
       }
       const resetRender = async () => {
          const iframeRef: any = document.getElementById("staffIframeRef")
-         if (userStoreHook.roles === "GYM") {
-            iframeRef.contentWindow.location.replace(getPreViewCloud(activeItem.value.id, state.partXmlIndex, state.selectedTrack))
+         if (userStoreHook.roles === "GYM" || userStoreHook.roles === "KLX") {
+            iframeRef.contentWindow.location.replace(
+               getPreViewCloud(activeItem.value.id, state.partXmlIndex, state.selectedTrack, musicRenderType.value)
+            )
             // state.iframeSrc = getPreViewCloud(activeItem.value.id, state.partXmlIndex)
             return
          }
@@ -980,13 +1019,15 @@ export default defineComponent({
                // https://cdn.oss.dayaedu.com/daya202409/UOFVK2A.pdf
                // https://cdn.oss.dayaedu.com/daya202409/UODQffO.pdf
             } else {
-               if (userStoreHook.roles === "GYM") {
+               if (userStoreHook.roles === "GYM" || userStoreHook.roles === "KLX") {
                   nextTick(() => {
                      const iframeRef: any = document.getElementById("staffIframeRef")
                      if (iframeRef) {
-                        iframeRef.contentWindow.location.replace(getPreViewCloud(activeItem.value.id, state.partXmlIndex, state.selectedTrack))
+                        iframeRef.contentWindow.location.replace(
+                           getPreViewCloud(activeItem.value.id, state.partXmlIndex, state.selectedTrack, musicRenderType.value)
+                        )
                      } else {
-                        state.iframeSrc = getPreViewCloud(activeItem.value.id, state.partXmlIndex, state.selectedTrack)
+                        state.iframeSrc = getPreViewCloud(activeItem.value.id, state.partXmlIndex, state.selectedTrack, musicRenderType.value)
                      }
                   })
                } else {
@@ -999,7 +1040,7 @@ export default defineComponent({
       }
 
       /** 音频控制 */
-      const handleChangeAudio = (type: "play" | "pause" | "pre" | "next") => {
+      const handleChangeAudio = async (type: "play" | "pause" | "pre" | "next") => {
          if (type === "play") {
             state.playState = "play"
          } else if (type === "pause") {
@@ -1007,10 +1048,16 @@ export default defineComponent({
          } else if (type === "pre") {
             if (state.list[state.listActive - 1]) {
                handlePlay(state.list[state.listActive - 1])
+
+               await handleGetDetail()
+               searchContent()
             }
          } else if (type === "next") {
             if (state.list[state.listActive + 1]) {
                handlePlay(state.list[state.listActive + 1])
+
+               await handleGetDetail()
+               searchContent()
             }
          }
       }
@@ -1058,7 +1105,7 @@ export default defineComponent({
                      osmdImg[i].width,
                      osmdImg[i].height,
                      musicName,
-                     userStoreHook.roles === "GYM" ? false : true
+                     userStoreHook.roles === "GYM" || userStoreHook.roles === "KLX" ? false : true
                   )
                   imgs.push({
                      url: img,
@@ -1130,12 +1177,10 @@ export default defineComponent({
          if (instrumentIds) {
             //  GYM,GYT,KLX 区分   查询声部数据
             let cbsDetails: any = []
-            if (userStoreHook.roles === "GYM") {
+            if (userStoreHook.roles === "GYM" || userStoreHook.roles === "KLX") {
                cbsDetails = state.details.musicalInstruments || []
             } else if (userStoreHook.roles === "GYT") {
                //
-            } else if (userStoreHook.roles === "KLX") {
-               //
             }
             const { code } =
                cbsDetails.find((item: any) => {
@@ -1389,7 +1434,8 @@ export default defineComponent({
                   {/* <i class={styles.leftArrow}></i> */}
 
                   <NSpin show={staffLoading.value} stroke="#FF531C">
-                     {activeItem.value?.id ? (
+                     {(userStoreHook.roles === "GYT" && activeItem.value?.id) ||
+                     ((userStoreHook.roles === "GYM" || userStoreHook.roles === "KLX") && state.details?.id) ? (
                         state.musicPdfUrl ? (
                            <div class={[styles.staffImgs]}>
                               <iframe
@@ -1444,7 +1490,7 @@ export default defineComponent({
                      src={btnSubmit as any}
                      onClick={() => {
                         handleChangeAudio("pause")
-                        goToCloud(activeItem.value.id, state.partXmlIndex, state.selectedTrack)
+                        goToCloud(activeItem.value.id, state.partXmlIndex, state.selectedTrack, musicRenderType.value)
                      }}
                   />
 
@@ -1481,13 +1527,18 @@ export default defineComponent({
                               state.imgs = []
                               nextTick(() => {
                                  let tempPdf = ""
-                                 if (activeItem.value?.isScoreRender && value === 999) {
-                                    if (activeItem.value?.musicPdfUrl) {
-                                       tempPdf = activeItem.value?.musicPdfUrl
-                                    }
-                                 } else {
+                                 if (userStoreHook.roles === "GYM" || userStoreHook.roles === "KLX") {
                                     tempPdf = item.musicPdfUrl
+                                 } else {
+                                    if (activeItem.value?.isScoreRender && value === 999) {
+                                       if (activeItem.value?.musicPdfUrl) {
+                                          tempPdf = activeItem.value?.musicPdfUrl
+                                       }
+                                    } else {
+                                       tempPdf = item.musicPdfUrl
+                                    }
                                  }
+
                                  if (tempPdf) {
                                     state.musicPdfUrl = tempPdf
                                     staffLoading.value = true

+ 0 - 1
src/views/cloudPractice/formatSvgToImg.ts

@@ -127,7 +127,6 @@ const canvasAddPadding = async (sourceCanvas: any, name: string, isShowPadding =
    targetContext.fillText(name, targetCanvas.width / 2, isShowPadding ? 200 : 60)
 
    const blob = await convertToBlob(targetCanvas)
-   const base64 = await blobToBase64(blob)
    targetContext.clearRect(0, 0, targetCanvas.width, targetCanvas.height)
    return blob
 }

+ 10 - 4
src/views/cloudPractice/useData.ts

@@ -21,18 +21,21 @@ export const useFunction = () => {
    /** 跳转云教练 */
    const isPracticeShow = ref(false)
    const practiceUrl = ref("")
-   function goToCloud(musicId: string, partIndex = 0, track = "") {
+   function goToCloud(musicId: string, partIndex = 0, track = "", musicRenderType = "") {
       //  GYM,GYT,KLX 区分   云教练
       let gymUrl = `${URL_TEACH_GYM}#/?id=${musicId}&Authorization=${getToken()}&platform=pc&isYjt=1&isHideMusicList=true&systemType=teacher`
+      let klxUrl = `${URL_TEACH_KLX}#/?id=${musicId}&Authorization=${getToken()}&platform=pc&isYjt=1&isHideMusicList=true&systemType=teacher&musicRenderType=${musicRenderType}`
       if (partIndex === 999) {
          gymUrl += `&part-index=${partIndex}`
+         klxUrl += `&part-index=${partIndex}`
       } else {
          gymUrl += `&part-name=${track}`
+         klxUrl += `&part-name=${track}`
       }
       const urlObj = {
          GYT: `${URL_TEACH_GYT}?id=${musicId}&modelType=practice&modeType=json&part-index=${partIndex}&Authorization=${getToken()}&isYjt=1&&isHideBack=false`,
          GYM: gymUrl,
-         KLX: `${URL_TEACH_KLX}#/?id=${musicId}&Authorization=${getToken()}&platform=pc&part-index=${partIndex}&isYjt=1&isHideMusicList=true&systemType=teacher`
+         KLX: klxUrl
       }
       isPracticeShow.value = true
       practiceUrl.value = urlObj[userStoreHook.roles!]
@@ -43,19 +46,22 @@ export const useFunction = () => {
       practiceUrl.value = ""
    }
 
-   function getPreViewCloud(musicId: string, partIndex = 0, track = "") {
+   function getPreViewCloud(musicId: string, partIndex = 0, track = "", musicRenderType = "") {
       //  GYM,GYT,KLX 区分   云教练
       let gymUrl = `${URL_TEACH_GYM}?t=${Date.now()}#/?id=${musicId}&Authorization=${getToken()}&isPreView=true&zoom=1&downPng=A4&systemType=teacher`
+      let klxUrl = `${URL_TEACH_KLX}?t=${Date.now()}#/?id=${musicId}&Authorization=${getToken()}&isPreView=true&zoom=1&downPng=A4&systemType=teacher&musicRenderType=${musicRenderType}`
       if (partIndex === 999) {
          gymUrl += `&part-index=${partIndex}`
+         klxUrl += `&part-index=${partIndex}`
       } else {
          gymUrl += `&part-name=${track}`
+         klxUrl += `&part-name=${track}`
       }
 
       const urlObj = {
          GYT: `${URL_TEACH_GYT}?id=${musicId}&modelType=practice&modeType=json&part-index=${partIndex}&Authorization=${getToken()}&isYjt=1&&isHideBack=false`,
          GYM: gymUrl,
-         KLX: `${URL_TEACH_KLX}?t=${Date.now()}#/?id=${musicId}&Authorization=${getToken()}&part-index=${partIndex}&isPreView=true&systemType=teacher`
+         KLX: klxUrl
       }
       return urlObj[userStoreHook.roles!]
    }

+ 2 - 8
src/views/cloudTextbooks/chooseDialog.vue

@@ -6,7 +6,7 @@
 <template>
    <div class="chooseDialog">
       <div class="close" @click="close"></div>
-      <div class="chooseHeader" v-if="isShowTabs">
+      <div class="chooseHeader">
          <img
             key="classlist"
             v-if="chooseType === 'classlist'"
@@ -74,15 +74,13 @@
 </template>
 
 <script setup lang="ts">
-import { computed, ref } from "vue"
+import { ref } from "vue"
 import { useDataDetailList } from "./useData"
 import myInput from "@/components/myInput"
 import searchCollapse from "./searchCollapse"
-import userStore from "@/store/modules/user"
 const { handleGetDetailList, loading, searchLoading, listDetailData, listSearchData, activeCollapse, listData, pageNum, handlePage } =
    useDataDetailList()
 import router from "@/router"
-const userStoreHook = userStore()
 
 const chooseType = ref<"classlist" | "search">("classlist")
 const queryStr = ref("")
@@ -98,10 +96,6 @@ const emits = defineEmits<{
 
 handleGetDetailList(props.modalData.id)
 
-const isShowTabs = computed(() => {
-   return userStoreHook.roles === "GYM" ? true : false
-})
-
 function close() {
    emits("onClose")
 }

+ 2 - 2
src/views/cloudTextbooks/searchCollapse/searchCollapse.vue

@@ -1,7 +1,7 @@
 <!--
 * @FileDescription: 折叠菜单
-* @Author: 黄琪勇
-* @Date:2024-04-01 18:40:50
+* @Author: 王新雷
+* @Date:2024-12-01 18:40:50
 -->
 <template>
    <el-collapse class="courseCollapse" accordion v-model="activeCollapseId">

+ 56 - 12
src/views/cloudTextbooks/useData.ts

@@ -227,9 +227,9 @@ export const useDataDetailList = () => {
       if (userStoreHook.roles === "GYM") {
          handleGetDetaList_gym(id, isSearch, search)
       } else if (userStoreHook.roles === "GYT") {
-         handleGetDetailList_gyt(id)
+         handleGetDetailList_gyt(id, isSearch, search)
       } else if (userStoreHook.roles === "KLX") {
-         handleGetDetailList_klx(id)
+         handleGetDetailList_klx(id, isSearch, search)
       }
    }
 
@@ -275,10 +275,16 @@ export const useDataDetailList = () => {
       })
    }
    // 获取管乐团
-   function handleGetDetailList_gyt(id: string) {
-      loading.value = true
-      httpAjaxErrMsg(getMyCoursewareDetail_gyt, id).then(res => {
-         loading.value = false
+   function handleGetDetailList_gyt(id: string, isSearch = false, search?: string) {
+      if (coursewareDetailController) {
+         coursewareDetailController.abort()
+      }
+      coursewareDetailController = new AbortController()
+      if (!isSearch) loading.value = true
+      searchLoading.value = true
+      httpAjax(getMyCoursewareDetail_gyt, { id, data: { search }, abortController: coursewareDetailController }).then(res => {
+         if (!isSearch) loading.value = false
+         searchLoading.value = false
          if (res.code === 200) {
             const data = (res.data || []).map((item: any) => {
                return {
@@ -288,15 +294,37 @@ export const useDataDetailList = () => {
                   lockFlag: false // 云课堂默认不锁
                }
             })
-            listData.value = chunkArray(chunkArray(data, 7), 2)
+
+            if (!isSearch) {
+               listData.value = chunkArray(chunkArray(data, 7), 2)
+            }
+
+            const resultList = res.data || []
+            resultList.forEach((item: any) => {
+               item.children = item.knowledgePointList || []
+               item.id = item.coursewareDetailId || item.lessonCoursewareDetailId
+               item.name = item.coursewareDetailName
+            })
+            flattenCoursewareListData = []
+            listSearchData.value = filterPointList(resultList)
+            flattenCoursewareList.value = flattenCoursewareListData
+            if (flattenCoursewareList.value[0]) {
+               activeCollapse.value = flattenCoursewareList.value[0]
+            }
          }
       })
    }
    // 获取酷乐秀
-   function handleGetDetailList_klx(id: string) {
-      loading.value = true
-      httpAjaxErrMsg(getLessonCoursewareCourseList_klx, id).then(res => {
-         loading.value = false
+   function handleGetDetailList_klx(id: string, isSearch = false, search?: string) {
+      if (coursewareDetailController) {
+         coursewareDetailController.abort()
+      }
+      coursewareDetailController = new AbortController()
+      if (!isSearch) loading.value = true
+      searchLoading.value = true
+      httpAjax(getLessonCoursewareCourseList_klx, { id, data: { search }, abortController: coursewareDetailController }).then(res => {
+         if (!isSearch) loading.value = false
+         searchLoading.value = false
          if (res.code === 200) {
             const data = (res.data || []).map((item: any) => {
                return {
@@ -304,7 +332,23 @@ export const useDataDetailList = () => {
                   id: item.coursewareDetailId
                }
             })
-            listData.value = chunkArray(chunkArray(data, 7), 2)
+
+            if (!isSearch) {
+               listData.value = chunkArray(chunkArray(data, 7), 2)
+            }
+
+            const resultList = res.data || []
+            resultList.forEach((item: any) => {
+               item.children = item.knowledgePointList || []
+               item.id = item.coursewareDetailId
+               item.name = item.coursewareDetailName
+            })
+            flattenCoursewareListData = []
+            listSearchData.value = filterPointList(resultList)
+            flattenCoursewareList.value = flattenCoursewareListData
+            if (flattenCoursewareList.value[0]) {
+               activeCollapse.value = flattenCoursewareList.value[0]
+            }
          }
       })
    }

+ 17 - 12
src/views/coursewarePlay/coursewarePlay.vue

@@ -165,7 +165,9 @@ import {
    getLessonCourseDetail_gym,
    getLessonCoursewareDetail_gyt,
    getLessonCourseDetail_klx,
-   getLessonCoursewareCourseList_gym
+   getLessonCoursewareCourseList_gym,
+   getMyCoursewareDetail_gyt,
+   getLessonCoursewareCourseList_klx
 } from "@/api/cloudTextbooks.api"
 import myInput from "@/components/myInput"
 import { checkWebCourse_gyt, refLevel_gym, refLevel_gyt, refLevel_klx } from "@/api/coursewarePlay.api"
@@ -313,16 +315,16 @@ async function getCoursewareList(id?: string) {
 async function getLessCoursewareList(id?: string) {
    //  GYM,GYT,KLX 区分   查询接口
    const LessonCoursewareDetailApi = {
-      // GYT: getLessonCoursewareCourseList_gym
-      GYM: getLessonCoursewareCourseList_gym
-      // KLX: getLessonCourseDetail_klx
+      GYT: getMyCoursewareDetail_gyt,
+      GYM: getLessonCoursewareCourseList_gym,
+      KLX: getLessonCoursewareCourseList_klx
    }
    if (coursewareDetailController) {
       coursewareDetailController.abort()
    }
    coursewareDetailController = new AbortController()
    searchObj.loading = true
-   await httpAjax(LessonCoursewareDetailApi["GYM"], {
+   await httpAjax(LessonCoursewareDetailApi[userStoreHook.roles!], {
       id: id || (route.params.id as string),
       data: {
          search: searchObj.queryStr,
@@ -336,7 +338,7 @@ async function getLessCoursewareList(id?: string) {
          for (let i = 0; i < result.length; i++) {
             const itemResult = result[i]
             itemResult.name = itemResult.coursewareDetailName
-            itemResult.id = itemResult.coursewareDetailId
+            itemResult.id = itemResult.coursewareDetailId || itemResult.lessonCoursewareDetailId
             itemResult.lessonTargetDesc = itemResult.lessonTargetDesc ? itemResult.lessonTargetDesc.replace(/\n/g, "<br />") : ""
             itemResult.children = itemResult.knowledgePointList || []
             itemResult.knowledgePointList = []
@@ -464,15 +466,18 @@ function handleCourseClick(value: any) {
       return value.id === item.id && value.knowledgePointId === item.knowledgePointId
    })
 
-   const newItem = flattenCoursewareList.value[newIndex]
-   const newParentId = newItem ? newItem.parentData?.ids[0] : ""
+   if (searchObj.source === "search") {
+      const newItem = flattenCoursewareList.value[newIndex]
+      const newParentId = newItem ? newItem.parentData?.ids[0] : ""
 
-   if (newParentId) {
-      const parentItem = coursewareList.value.find((item: any) => item.id === newParentId)
-      if (parentItem) {
-         lessonTargetDetail.value = parentItem.lessonTargetDesc
+      if (newParentId) {
+         const parentItem = coursewareList.value.find((item: any) => item.id === newParentId)
+         if (parentItem) {
+            lessonTargetDetail.value = parentItem.lessonTargetDesc
+         }
       }
    }
+
    activeCoursewareIndex.value = newIndex
    drawerShow.value = false
 }

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä