Browse Source

Merge branch 'feature-tianyong-newVersion' into ktyq-online-new

TIANYONG 5 months ago
parent
commit
7adf20e490

+ 1 - 1
osmd-extended

@@ -1 +1 @@
-Subproject commit 4282eb7cbebffd4427350db176c3de0f37bf0fc4
+Subproject commit 3689e3c4aac7182ec7cc8ed24b0953dd37c41227

+ 5 - 0
src/page-instrument/header-top/settting/index.module.less

@@ -219,6 +219,11 @@
                         }
                     }
                 }
+                .speBox {
+                    >div {
+                        width: 48px;
+                    }
+                }
                 .frequency{
                     display: flex;
                     align-items: center;

+ 27 - 1
src/page-instrument/header-top/settting/index.tsx

@@ -25,6 +25,7 @@ export default defineComponent({
 			screenModelShow: false, // 投屏帮助
 			recommendationShow: false, // 建议
 		});
+        const zoomList = [{name:'默认',value: 0.8},{name:'1.25x',value: 1.25},{name:'1.5x',value: 1.5},{name:'1.75x',value: 1.75}] 
 		const parentClassName = "recommenBoxClass_drag";
 		const userId = storeData.user?.id ? String(storeData.user?.id) : "";
 		const positionInfo =
@@ -252,7 +253,32 @@ export default defineComponent({
                                 </div>
                             </div> : null
                         }
-
+                        {
+                            !state.isCbsView ? 
+                            <div class={styles.cellBox}>
+                                <div class={styles.tit}>谱面大小</div>
+                                <div class={[styles.radioBox, styles.speBox]}>
+                                    {
+                                        zoomList.map(item=>{
+                                            return <div class={ state.zoom===item.value && styles.active } onClick={ async ()=>{ 
+                                                if(state.zoom === item.value){
+                                                    return
+                                                }
+                                                await checkMoveNoSave();
+                                                headTopData.settingMode = false
+                                                // resetRenderMusicScore(state.musicRenderType)
+                                                const _time = setTimeout(() => {
+                                                    state.zoom = item.value as any
+                                                    localStorage.setItem('scoreZoom',String(state.zoom))
+                                                    clearTimeout(_time)
+                                                    refreshMusicSvg();
+                                                }, 100);
+                                            } }>{item.name}</div>
+                                        })
+                                    }
+                                </div>
+                            </div> : null
+                        }
                         <div class={styles.cellBtnBox}>
                             <img  src={headImg("tpbz.png")} onClick={() => (helperData.screenModelShow = true)} />
                             {

+ 1 - 1
src/page-instrument/view-detail/index.module.less

@@ -185,7 +185,7 @@
         }
 
         .headTopBackBtn {
-            display: none;
+            // display: none;
         }
 
         .pcTitle {

+ 2 - 2
src/page-instrument/view-detail/smoothAnimation/index.ts

@@ -443,8 +443,8 @@ function getPointsPosByBatePos(): pointsPosType {
    }
    extendPoint.MeasureNumberXML += 100 // 防止MeasureNumberXML重复
    extendPoint.noteId += 100 // 防止noteId重复
-   // 当总长度减30小于最后一个音符时候,取最后一个音符加15
-   extendPoint.x = smoothAnimationState.canvasDomWith - 30 > extendPoint.x ? smoothAnimationState.canvasDomWith - 30 : extendPoint.x + 15
+   // 当总长度减10 和 最后一个音符加 10 取最大值 34是一倍的边距
+   extendPoint.x = Math.max(smoothAnimationState.canvasDomWith - 34 * state.zoom - 10, extendPoint.x + 10)
    pointsPos.push(extendPoint)
    return pointsPos
 }

+ 9 - 2
src/state.ts

@@ -675,7 +675,7 @@ const dynamicShowPlaySpeed = (index: number) => {
 export const initSetPlayRate = () => {
   const item: any = (state.sectionStatus && state.section.length === 2) ? state.sectionFirst || state.section[0] : state.times[state.activeNoteIndex];
   if (item && item.measureSpeed) {
-    const ratio = state.speed / item.measureSpeed
+    const ratio = state.speed / Math.floor(item.measureSpeed)
     // state.audiosInstance?.setSpeed(ratio)
     state.basePlayRate = ratio || 1;
     console.log('播放倍率',state.basePlayRate)
@@ -1723,11 +1723,18 @@ const setState = (data: any, index: number) => {
   // 如果是PC端,放大曲谱
   state.platform = query.platform?.toLocaleUpperCase() || "";
   if (state.platform === IPlatform.PC) {
+    // pc端,谱面默认初始大小设置为1.5
+    state.zoom = 1.5;
     if (query.zoom <= 1) {
-      state.zoom = query.zoom || state.zoom;
+      state.zoom = query.zoom ? Number(query.zoom) : state.zoom;
+    } else {
+      state.zoom = localStorage.getItem('scoreZoom') ? Number(localStorage.getItem('scoreZoom')) : state.zoom
     }
     state.enableEvaluation = false;
   }
+  if (storeData.isApp) {
+    state.zoom = localStorage.getItem('scoreZoom') ? Number(localStorage.getItem('scoreZoom')) : state.zoom
+  }
   /**
    * 默认渲染什么谱面类型 & 能否转谱逻辑
    * 渲染类型:首先取url参数musicRenderType,没有该参数则取musicalInstruments字段匹配的当前分轨的defaultScore,没有匹配到则取默认值('firstTone')

+ 2 - 2
vite.config.ts

@@ -76,8 +76,8 @@ export default defineConfig({
         // target: "https://kt.colexiu.com",
         // target: "https://test.lexiaoya.cn",
         // target: "https://kt.colexiu.com",
-        target: "https://test.resource.colexiu.com", // 内容平台开发环境,内容平台开发,需在url链接上加上isCbs=true
-        // target: "https://test.kt.colexiu.com",
+        // target: "https://test.resource.colexiu.com", // 内容平台开发环境,内容平台开发,需在url链接上加上isCbs=true
+        target: "https://test.kt.colexiu.com",
         // target: "https://mec.colexiu.com",
         changeOrigin: true,
         rewrite: (path) => path.replace(/^\/instrument/, ""),