瀏覽代碼

Merge branch 'main' into iteration-select-courseware

lex-xin 6 月之前
父節點
當前提交
7d53e96a06

文件差異過大導致無法顯示
+ 0 - 0
dist/css/205.f37c7b39.css


文件差異過大導致無法顯示
+ 0 - 1
dist/css/227.e132ead8.css


文件差異過大導致無法顯示
+ 0 - 0
dist/css/269.f7d42cc1.css


文件差異過大導致無法顯示
+ 0 - 0
dist/css/498.d91f7fff.css


文件差異過大導致無法顯示
+ 0 - 1
dist/css/722.f9a346f0.css


文件差異過大導致無法顯示
+ 0 - 0
dist/css/879.140529e9.css


文件差異過大導致無法顯示
+ 0 - 0
dist/css/958.8450b858.css


二進制
dist/img/classlist.25aa5fb7.png


二進制
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.8be5612b.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%;

文件差異過大導致無法顯示
+ 0 - 0
dist/js/205.e3967cc1.js


文件差異過大導致無法顯示
+ 0 - 0
dist/js/227.d218c26a.js


文件差異過大導致無法顯示
+ 0 - 0
dist/js/269.829e887a.js


文件差異過大導致無法顯示
+ 0 - 0
dist/js/378.ee568555.js


文件差異過大導致無法顯示
+ 0 - 0
dist/js/498.ea5c6363.js


文件差異過大導致無法顯示
+ 0 - 0
dist/js/530.53950c4a.js


文件差異過大導致無法顯示
+ 0 - 0
dist/js/530.a9aeccbb.js


文件差異過大導致無法顯示
+ 0 - 0
dist/js/549.e5d3c5b0.js


文件差異過大導致無法顯示
+ 0 - 0
dist/js/722.96aa9929.js


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


文件差異過大導致無法顯示
+ 0 - 0
dist/js/879.92c2464d.js


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


文件差異過大導致無法顯示
+ 0 - 0
dist/js/958.2fdf9896.js


文件差異過大導致無法顯示
+ 0 - 0
dist/js/app.8be5612b.js


文件差異過大導致無法顯示
+ 0 - 0
dist/js/app.c6030437.js


文件差異過大導致無法顯示
+ 0 - 0
dist/js/app.d339d0b2.js


文件差異過大導致無法顯示
+ 0 - 0
dist/js/chunk-vendors.55bb013e.js


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

@@ -1053,7 +1053,13 @@ export default defineComponent({
                const osmdImg = e.data.osmdImg
                const imgs = []
                for (let i = 0; i < osmdImg.length; i++) {
-                  const img = await svgtoblob(osmdImg[i].img, osmdImg[i].width, osmdImg[i].height, musicName)
+                  const img = await svgtoblob(
+                     osmdImg[i].img,
+                     osmdImg[i].width,
+                     osmdImg[i].height,
+                     musicName,
+                     userStoreHook.roles === "GYM" ? false : true
+                  )
                   imgs.push({
                      url: img,
                      name: i + 1 + ".png"
@@ -1343,12 +1349,12 @@ export default defineComponent({
                                        class={styles.btn}
                                        onClick={async (e: any) => {
                                           e.stopPropagation()
-                                          if (state.listActive !== index) {
-                                             state.listActive = index
+                                          const status = state.listActive !== index
+                                          handlePlay(item)
+                                          if (status) {
                                              await handleGetDetail()
                                              searchContent()
                                           }
-                                          handlePlay(item)
                                        }}
                                     >
                                        {state.listActive === index && (

+ 9 - 34
src/views/cloudPractice/formatSvgToImg.ts

@@ -54,7 +54,7 @@ export const addMusicTitle = (canvas: any, title: any) => {
 }
 
 let canvas = null as any
-export const svgtoblob = async (svg: any, width: any, height: any, name: string) => {
+export const svgtoblob = async (svg: any, width: any, height: any, name: string, isShowPadding = true) => {
    if (!canvas) {
       // eslint-disable-next-line @typescript-eslint/ban-ts-comment
       // @ts-ignore
@@ -77,38 +77,13 @@ export const svgtoblob = async (svg: any, width: any, height: any, name: string)
    await v.start()
    // const blob = await canvas.convertToBlob()
    // const base64 = await blobToBase64(blob)
-   const base64 = await canvasAddPadding(canvas, name)
+   const base64 = await canvasAddPadding(canvas, name, isShowPadding)
    ctx.clearRect(0, 0, canvas.width, canvas.height)
    await v.stop()
    v = null
    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) => {
@@ -121,10 +96,10 @@ const convertToBlob = (canvas: any, type = "image/png") => {
    })
 }
 
-const canvasAddPadding = async (sourceCanvas: any, name: string) => {
+const canvasAddPadding = async (sourceCanvas: any, name: string, isShowPadding = true) => {
    const targetCanvas = document.createElement("canvas")
-   targetCanvas.width = sourceCanvas.width + 400
-   targetCanvas.height = sourceCanvas.height + 200
+   targetCanvas.width = sourceCanvas.width + (isShowPadding ? 400 : 160)
+   targetCanvas.height = sourceCanvas.height + (isShowPadding ? 200 : 0)
 
    // 坐标(0,0) 表示从此处开始绘制,相当于偏移。
    const targetContext = targetCanvas.getContext("2d") as CanvasRenderingContext2D
@@ -145,14 +120,14 @@ const canvasAddPadding = async (sourceCanvas: any, name: string) => {
 
    // 小水印画布大小
    // const waterCtx = water.getContext("2d") as CanvasRenderingContext2D
-   targetContext.font = `66pt Calibri`
+   targetContext.font = `30pt Calibri`
    targetContext.fillStyle = "#000"
    targetContext.textAlign = "center"
-   targetContext.drawImage(sourceCanvas, 200, 240)
-   targetContext.fillText(name, targetCanvas.width / 2, 200)
+   targetContext.drawImage(sourceCanvas, isShowPadding ? 200 : 80, isShowPadding ? 240 : 40)
+   targetContext.fillText(name, targetCanvas.width / 2, isShowPadding ? 200 : 60)
 
    const blob = await convertToBlob(targetCanvas)
-   // const base64 = await blobToBase64(blob)
+   const base64 = await blobToBase64(blob)
    targetContext.clearRect(0, 0, targetCanvas.width, targetCanvas.height)
    return blob
 }

部分文件因文件數量過多而無法顯示