Bläddra i källkod

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

TIANYONG 11 månader sedan
förälder
incheckning
461478f08c

+ 1 - 1
src/helpers/customMusicScore.ts

@@ -592,7 +592,7 @@ const transSinglePage = () => {
 	if (state.isSingleLine && !state.isSimplePage) {
 		const svgPage = document?.getElementById('osmdSvgPage1')?.getBoundingClientRect();
 		const staffLine = document?.querySelector('.staffline')?.getBoundingClientRect();
-		if (svgPage && staffLine && svgPage.height > 130) {
+		if (svgPage && staffLine && svgPage.height > 200) {
 			// 需要上移的距离
 			console.log('need',svgPage.height,staffLine.height)
 			const rate = svgPage.height > 400 ? 1.2 : 2;

+ 0 - 2
src/page-instrument/component/authorName/index.module.less

@@ -1,7 +1,5 @@
 .authorName{
     height: 1.8rem;
-    position: relative;
-    top: 36px;
 }
 .title{
     width: 280px;

+ 3 - 0
src/page-instrument/custom-plugins/helper-model/recommendation/index.module.less

@@ -177,6 +177,9 @@
                             font-size: 14px;
                             color: #AAAAAA;
                         }
+                        &::-webkit-scrollbar {
+                            display: none;
+                        }
                     }
                 }
             }

+ 1 - 0
src/page-instrument/evaluat-model/evaluat-result/index.module.less

@@ -98,6 +98,7 @@
         .scoreSection {
             display: flex;
             align-items: flex-end;
+            justify-content: center;
         }
 
         .text {

+ 12 - 11
src/page-instrument/follow-model/microphone/index.module.less

@@ -54,19 +54,20 @@
         height: 60%;
         transform: translateX(-50%);
     }
-    .microCancel {
+    .microBtn {
         position: absolute;
-        bottom: 85px;
-        left: 39.5%;
-        width: 91px;
-        height: 39px;
+        bottom: 23.5%;
+        left: 50%;
+        transform: translate(-45%);
+    }
+    .microCancel {
+        width: 11.2vw;
+        height: 100%;
+        margin-right: 2px;
     }
     .microConfirm {
-        position: absolute;
-        bottom: 85px;
-        right: 28.5%;
-        transform: translateX(-80%);
-        width: 91px;
-        height: 39px;
+        width: 11.2vw;
+        height: 100%;
+        margin-left: 2px;
     }
 }

+ 4 - 2
src/page-instrument/follow-model/microphone/index.tsx

@@ -14,8 +14,10 @@ export default defineComponent({
 		return () => (
 			<div class={styles.microBox}>
 				<img class={styles.microBg} src={microBg} />
-				<img class={styles.microCancel} src={microCancel} onClick={() => emit("close")} />
-				<img class={styles.microConfirm} src={microConfirm} onClick={() => emit("close")} />
+				<div class={styles.microBtn}>
+					<img class={styles.microCancel} src={microCancel} onClick={() => emit("close")} />
+					<img class={styles.microConfirm} src={microConfirm} onClick={() => emit("close")} />
+				</div>
 			</div>
 		);
 	},

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

@@ -281,6 +281,7 @@
             top: -9px;
             display: flex;
             align-items: center;
+            justify-content: center;
             background: #FFC121;
             border-radius: 120px 120px 120px 1px;
             border: 1px solid #FFFFFF;
@@ -423,12 +424,13 @@
 
     .modeBox {
         width: 100%;
-        margin-top: 90px;
         display: flex;
         justify-content: space-between;
         padding: 0 36px;
-
-        &.twoModeBox {
+        position: relative;
+        top: 50%;
+        transform: translateY(-50%);
+        &.twoModeBox{
             justify-content: center;
 
             >.modeImg+.modeImg {

+ 2 - 2
src/page-instrument/header-top/speed/index.tsx

@@ -66,7 +66,7 @@ export default defineComponent({
 			  if (storeData.isApp && state.enableEvaluation) {
 				// 加载弹窗的开始时间
 				let startTime = +new Date();
-				state.loadingText = '节拍器准备中,请稍等…'
+				state.loadingText = res ? '节拍器准备中,请稍等…' : '节拍器关闭中,请稍等…';
 				state.isLoading = true;
 				const targetSrc = res ? state.beatSong.accompany || state.beatSong.music : state.accompany || state.music;
 				const resData = await api_updateMusicPlayer({
@@ -89,7 +89,7 @@ export default defineComponent({
 							state.isLoading = false;
 							metronomeDisable.value = res;
 							switchLoading.value = false;
-						}, continueTime);
+						}, 1200);
 					}
 				}
 				// api_checkSocketStatus();

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

@@ -80,17 +80,18 @@
 
     .container {
         position: sticky;
-        top: 36px;
-        height: calc(100vh - 36px);
+        top: 0;
+        height: 100vh;
         border-radius: 10px;
         transition: height .2s;
         transition: padding-bottom .2s;
         overflow: hidden;
-    }
-
-    .multiContainer {
-        top: 0;
-        height: calc(100vh);
+        :global{
+            #musicAndSelection {
+                // 其他位置 这个高度留白是36,这里加了一点,让旋律线靠下一点
+                padding-top: 40px;
+            }
+        }
     }
 
     .pcContainer {
@@ -263,8 +264,13 @@
     align-items: center;
     z-index: 10000;
     background: rgba(0, 0, 0, .6);
-
-    .lottie {
+    &.isPreView{
+        background:transparent;
+        .loadingTip{
+            color: #999;
+        }
+    }
+    .lottie{
         width: 120px;
     }
 

+ 3 - 3
src/page-instrument/view-detail/index.tsx

@@ -271,8 +271,8 @@ export default defineComponent({
       handleInitTick(osmd?.Sheet?.SheetPlaybackSetting?.Rhythm?.Numerator || 4);
       // }
       // api_cloudLoading();
-      state.playBtnDirection = query.imagePos === "left" ? "left" : "right";
-      state.isAttendClass = query.imagePos === "left" || query.imagePos === "right" ? true : false;
+      // state.playBtnDirection = query.imagePos === 'left' ? 'left' : 'right';
+      // state.isAttendClass = (query.imagePos === 'left' || query.imagePos === 'right') ? true : false;
       // if (state.fingeringInfo.direction === "vertical" && state.setting.displayFingering) {
       //   state.musicScoreBtnDirection = state.playBtnDirection === 'right' ? 'left' : 'right';
       // } else {
@@ -494,7 +494,7 @@ export default defineComponent({
         <div
           id="scrollContainer"
           style={{ ...fingerConfig.value.container }}
-          class={[styles.container, !state.setting.displayCursor && "hideCursor", browsInfo.xiaomi && styles.xiaomi, state.platform === IPlatform.PC && styles.pcContainer, (!state.isSingleLine || state.isCombineRender) && styles.multiContainer]}
+          class={[styles.container, !state.setting.displayCursor && "hideCursor", browsInfo.xiaomi && styles.xiaomi, state.platform === IPlatform.PC && styles.pcContainer]}
           onClick={(e: Event) => {
             e.stopPropagation();
             // if (state.playState === "play" && state.platform != IPlatform.PC) {

+ 1 - 1
src/page-instrument/view-detail/loading.tsx

@@ -18,7 +18,7 @@ export default defineComponent({
    setup(props) {
       return () =>
          (
-            <div class={styles.loadingPop} style={{display:state.isLoading? "flex" : "none"}}>
+            <div class={[styles.loadingPop, state.isPreView && styles.isPreView]} style={{display:state.isLoading? "flex" : "none"}}>
                <img class={styles.lottie} src={animGif} />
                {/* <Vue3Lottie class={styles.lottie} animationData={animBg}></Vue3Lottie> */}
                <div class={styles.loadingTip}>{props.tipText}</div>

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

@@ -187,7 +187,7 @@ export function moveSmoothAnimation(progress: number, activeIndex: number, isMov
  */
 function move_osmd(nowPointsPos: pointsPosType[0]) {
    // 评测移动太快看不到前面小节的分数,评测改成0.5倍速移动谱面
-   const speed = (state.modeType === 'evaluating' ? smoothAnimationState.aveSpeed * 0.5 : smoothAnimationState.aveSpeed) * (state.speed / 60)
+   const speed = (state.modeType === "evaluating" ? smoothAnimationState.aveSpeed * 0.5 : smoothAnimationState.aveSpeed) * (state.speed / 60)
    // 视口宽度
    const clientWidth = smoothAnimationState.osdmScrollDomWith
    const clientMidWidth = clientWidth / 2
@@ -316,27 +316,20 @@ function createSmoothAnimation() {
  * 根据音符获取坐标
  */
 function getPointsPosByBatePos(): pointsPosType {
-   let totalAvInde = 0
-   // 取平均值
-   const totalAv =
-      state.times.reduce((total, item) => {
-         if (item.frequency !== -1) {
-            // -1 为休止符
-            total += item.frequency
-            totalAvInde++
-         }
-         return total
-      }, 0) / totalAvInde
-   const pointsPos = state.times.reduce((posArr: any[], item) => {
+   // 得到音符频率数据
+   const frequencyData = state.times.map(item => {
+      return !item.frequency || item.frequency === -1 ? 0 : item.frequency
+   })
+   console.log(frequencyData,"没线性化之前的数据")
+   // 线性频率数据
+   const frequencyLineData = quantileScale(frequencyData, 4, 76)
+   const pointsPos = state.times.reduce((posArr: any[], item, index) => {
       // 当休止小节,可能当前音符在谱面上没有实际的音符(没有bbox),所以往后找谱面上有的音符
       if (item.bbox) {
          posArr.push({
             MeasureNumberXML: item.MeasureNumberXML,
             x: item.bbox.x,
-            // 当为休止符的时候 取最下面的位置*0.9,确保能显示完整
-            y:
-               smoothAnimationState.canvasDomHeight / 2 -
-               ((((item.frequency === -1 ? 2 * totalAv * 0.1 : item.frequency) - totalAv) / totalAv) * smoothAnimationState.canvasDomHeight) / 2
+            y: 80 - frequencyLineData[index]
          })
       }
       return posArr
@@ -352,6 +345,16 @@ function getPointsPosByBatePos(): pointsPosType {
    return pointsPos
 }
 
+// 数据平滑算法
+function quantileScale(data: number[], minRange = 0, maxRange = 80) {
+   const sortedData = [...data].sort((a, b) => a - b)
+   return data.map(value => {
+      const rank = sortedData.indexOf(value) / (sortedData.length - 1)
+      const scaledValue = rank * (maxRange - minRange) + minRange
+      return Math.max(minRange, Math.min(scaledValue, maxRange))
+   })
+}
+
 /**
  * 使用传入的曲线的顶点坐标创建平滑曲线的顶点。
  * @param  {Array}   points  曲线顶点坐标数组,

+ 9 - 1
src/page-instrument/view-evaluat-report/component/share-top/index.module.less

@@ -160,6 +160,11 @@
     }
 }
 
+.padMiddle {
+    .cItem {
+        width: 50px;
+    }
+}
 .right {
     display: flex;
     align-items: center;
@@ -326,7 +331,10 @@
             }
         }
     }
-
+    &.padPlayerBox{
+        width: 418px;
+        height: 248px;
+    }
     .videoBox {
         width: 100%;
         height: 100%;

+ 7 - 2
src/page-instrument/view-evaluat-report/component/share-top/index.tsx

@@ -81,6 +81,11 @@ export default defineComponent({
       return "video";
     });
 
+    // 资源类型
+    const isPad = computed(() => {
+      return navigator?.userAgent?.includes("UAWEIVRD-W09") || browserInfo?.iPad;
+    });
+
 		const openAudioAndVideo = () => {
 			shareData.show = true;
 			if (shareData.isInitPlyr) return;
@@ -231,7 +236,7 @@ export default defineComponent({
 
           {/* 音准、节奏、完整度纬度 */}
 
-          <div class={styles.middle}>
+          <div class={[styles.middle, isPad.value && styles.padMiddle]}>
             {state.isPercussion ? null : (
               <div onClick={() => handleChange("intonation")} class={[styles.cItem, "evaluting-report-1", itemType.value === "intonation" && styles.active]}>
                 <span class={styles.mScore}>{scoreData.value.intonation}分</span>
@@ -434,7 +439,7 @@ export default defineComponent({
               shareData._plrl?.pause();
             }}
           >
-            <div class={styles.playerBox}>
+            <div class={[styles.playerBox, isPad.value && styles.padPlayerBox]}>
               {mediaType.value === "audio" ? (
                 <div class={styles.audioBox}>
                   <canvas class={styles.audioVisualizer} id="audioVisualizer"></canvas>

+ 2 - 0
src/state.ts

@@ -1665,6 +1665,8 @@ const setState = (data: any, index: number) => {
   } else {
     state.setting.frequency = state.setting.frequency || state.baseFrequency
   }
+  state.playBtnDirection = query.imagePos === 'left' ? 'left' : 'right';
+  state.isAttendClass = (query.imagePos === 'left' || query.imagePos === 'right') ? true : false;
 };
 
 // 多分轨合并显示标示

+ 1 - 0
src/view/music-score/index.tsx

@@ -104,6 +104,7 @@ export default defineComponent({
 				// drawMetronomeMarks: false,
 				// ...this.opotions,
 				colorStemsLikeNoteheads: true, // 是否将音符柄的颜色设置为与它们的音符头相同,默认false
+				// drawingParameters: "compact" // 使用紧凑布局
 			});
 			// osmd.EngravingRules.CompactMode = true // 紧凑模式
 			// osmd.EngravingRules.PageRightMargin = state.isSingleLine ? (window.innerWidth+200)/10 : 2;

+ 10 - 7
src/view/plugins/toggleMusicSheet/choosePartName/index.tsx

@@ -1,4 +1,4 @@
-import { PropType, computed, defineComponent, ref, toRefs, onMounted, watch } from 'vue'
+import { PropType, computed, defineComponent, ref, toRefs, onMounted, watch, nextTick } from 'vue'
 import { Picker, Button, Icon } from 'vant'
 import styles from './index.module.less'
 import state, { IPlatform } from "/src/state";
@@ -76,12 +76,15 @@ export default defineComponent({
               }}
             />
             <div class={styles.button} onClick={() => {
-                // console.log(1111,selectIndex.value)
-                if (partIndexChanged.value) {
-                  emit('close', selectIndex.value)
-                } else {
-                  emit('close', partIndex.value)
-                }
+                myPicker.value.confirm()
+                nextTick(()=>{
+                  // console.log(1111,selectIndex.value)
+                  if (partIndexChanged.value) {
+                    emit('close', selectIndex.value)
+                  } else {
+                    emit('close', partIndex.value)
+                  }
+                })
               }
             }></div>
           </div>