lex-xin 3 months ago
parent
commit
6cca2dceab

+ 3 - 2
src/api/cloudPractice.api.ts

@@ -29,10 +29,11 @@ export const queryPage2_gym = (data: any) => {
    })
 }
 
-export const cbsDetail_gym = (id: number) => {
+export const cbsDetail_gym = (id: number, data?: any) => {
    return httpAxios_gym.axioseRquest({
       method: "get",
-      url: `/api-teacher/musicSheet/cbsDetail/${id}`
+      url: `/api-teacher/musicSheet/cbsDetail/${id}`,
+      params: data
    })
 }
 

+ 7 - 4
src/views/cloudPractice/cloudPractice.tsx

@@ -12,7 +12,7 @@ import iconBtnPlay from "../../img/cloudPractice/icon-btn-play.png"
 import btnSubmit from "../../img/cloudPractice/btn-submit.png"
 import iconTransfer from "../../img/cloudPractice/icon-transfer.png"
 import iconDownload from "../../img/cloudPractice/icon-download.png"
-import { httpAjax, httpAjaxErrMsg } from "@/plugin/httpAjax"
+import { httpAjaxErrMsg } from "@/plugin/httpAjax"
 import {
    queryPage2_gym,
    queryPage2_gyt,
@@ -35,7 +35,7 @@ import PlayLoading from "./component/play-loading"
 import PracticeForm from "@/businessComponents/practiceForm"
 import { saveAs } from "file-saver"
 import JSZip from "jszip"
-import { canvasAddTitle, imgToCanvas, svgtoblob } from "./formatSvgToImg"
+import { svgtoblob } from "./formatSvgToImg"
 import { penShow, whitePenShow } from "@/businessComponents/globalTools/globalTools"
 import { handleFullscreen } from "@/libs/fullscreen"
 
@@ -251,7 +251,7 @@ export default defineComponent({
          loading.value = true
          const { id } = state.list[state.listActive] || {}
          if (!id) return
-         await httpAjaxErrMsg(cbsDetail_gym, id).then(res => {
+         await httpAjaxErrMsg(cbsDetail_gym, id, { simpleFlag: "1" }).then(res => {
             loading.value = false
             if (res.code === 200) {
                const result = res.data || {}
@@ -752,6 +752,7 @@ export default defineComponent({
          state.playState = "pause"
          state.partNames = []
          state.partList = []
+         state.details = {}
          state.selectedPartName = ""
          state.selectedTrack = ""
          state.selectedPartIndex = 0
@@ -776,6 +777,7 @@ export default defineComponent({
          }
          // state.partNames = await getPartNames(row.xmlUrl)
          let partList = details.musicSheetSoundList || []
+         partList = partList.filter((item: any) => item.audioPlayType === "PLAY")
          partList = partList.filter((item: any) => !item.track?.toLocaleUpperCase()?.includes("COMMON"))
          partColumns.value = partList.map((item: any, index: number) => {
             const instrumentName = getInstrumentName(item.track)
@@ -1072,7 +1074,8 @@ export default defineComponent({
          if (e.data?.api === "musicStaffRender") {
             const musicName =
                activeItem.value.name +
-               ((activeItem.value.musicSheetType === "CONCERT" && state.selectedPartName) || state.selectedTrack
+               (((activeItem.value.musicSheetType === "CONCERT" || state.details.musicSheetType === "CONCERT") && state.selectedPartName) ||
+               state.selectedTrack
                   ? `(${state.selectedPartName || state.selectedTrack})`
                   : "")
             try {

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

@@ -70,7 +70,8 @@ export const svgtoblob = async (svg: any, width: any, height: any, name: string)
     * @param height
     * @param preserveAspectRatio
     */
-   v.resize(width * 2, height * 2, "xMidYMid meet")
+   // v.resize(width * 2, height * 2, "xMidYMid meet")
+   v.resize(width / 1.2, height / 1.2, "xMidYMid meet")
 
    // Render only first frame, ignoring animations and mouse.
    await v.start()
@@ -83,6 +84,31 @@ export const svgtoblob = async (svg: any, width: any, height: any, name: string)
    return base64
 }
 
+// export const svgtopng = async (svg: any, width: any, height: any) => {
+//    let canvas: any = new OffscreenCanvas(width, height);
+//    const ctx = canvas.getContext("2d")!;
+//    let v: any = await Canvg.fromString(ctx!, svg, preset);
+
+//    /**
+//     * Resize SVG to fit in given size.
+//     * @param width
+//     * @param height
+//     * @param preserveAspectRatio
+//     */
+//    v.resize(width / 1.2, height / 1.2, "xMidYMid meet");
+
+//    // Render only first frame, ignoring animations and mouse.
+//    await v.start();
+//    let blob: any = await canvas.convertToBlob();
+//    const base64 = await blobToBase64(blob);
+//    ctx.clearRect(0, 0, canvas.width, canvas.height);
+//    canvas = null;
+//    v.stop();
+//    v = null;
+//    blob = null;
+//    return base64;
+//  };
+
 const convertToBlob = (canvas: any, type = "image/png") => {
    return new Promise((resolve, reject) => {
       canvas.toBlob((blob: Blob) => {

+ 1 - 1
src/views/cloudPractice/index.module.scss

@@ -302,7 +302,7 @@
          display: flex;
          align-items: center;
          justify-content: space-between;
-         padding: 15px 10px 15px 26px;
+         padding: 15px 10px 15px 15px;
          border-radius: 12px;
 
          cursor: pointer;

+ 1 - 1
src/views/cloudPractice/useData.ts

@@ -39,7 +39,7 @@ export const useFunction = () => {
 
    function getPreViewCloud(musicId: string, partIndex = 0, track = "") {
       //  GYM,GYT,KLX 区分   云教练
-      let gymUrl = `${URL_TEACH_GYM}?t=${Date.now()}#/?id=${musicId}&Authorization=${getToken()}&isPreView=true&systemType=teacher`
+      let gymUrl = `${URL_TEACH_GYM}?t=${Date.now()}#/?id=${musicId}&Authorization=${getToken()}&isPreView=true&zoom=1&downPng=A4&systemType=teacher`
       if (partIndex === 999) {
          gymUrl += `&part-index=${partIndex}`
       } else {

+ 2 - 1
src/views/cloudTextbooks/useData.ts

@@ -236,7 +236,7 @@ export const useDataDetailList = () => {
    function handlePage(type: "next" | "prev") {
       type === "next" ? pageNum.value++ : pageNum.value--
    }
-   const flattenCoursewareListData: any[] = []
+   let flattenCoursewareListData: any[] = []
    // 获取管乐迷
    function handleGetDetaList_gym(id: string, isSearch = false, search?: string) {
       if (coursewareDetailController) {
@@ -310,6 +310,7 @@ export const useDataDetailList = () => {
 
    function filterPointList(pointList: any[], parentData?: { ids: string[]; name: string }): any[] {
       // 设置父级及以上id数组和父级name
+      flattenCoursewareListData = []
       return pointList.map(point => {
          if (point.children) {
             return Object.assign(point, {