Ver código fonte

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

TIANYONG 1 ano atrás
pai
commit
99572358e3

+ 8 - 1
src/page-instrument/evaluat-model/index.tsx

@@ -3,7 +3,7 @@ import { connectWebsocket, evaluatingData, handleEndBegin, handleStartBegin, han
 import Earphone from "./earphone";
 import styles from "./index.module.less";
 import SoundEffect from "./sound-effect";
-import state, { handleRessetState, resetPlaybackToStart, musicalInstrumentCodeInfo } from "/src/state";
+import state, { handleRessetState, resetPlaybackToStart, musicalInstrumentCodeInfo, clearSelection } from "/src/state";
 import { storeData } from "/src/store";
 import { browser } from "/src/utils";
 import { getNoteByMeasuresSlursStart } from "/src/helpers/formateMusic";
@@ -135,6 +135,7 @@ export default defineComponent({
         evaluatingData.earPhoneType = res?.content?.type || "";
         if (evaluatingData.earPhoneType === "有线耳机") {
           clearTimeout(checkErjiTimer);
+          checkErjiTimer = null;
           setTimeout(() => {
             evaluatingData.earphoneMode = false;
           }, 3000);
@@ -364,6 +365,10 @@ export default defineComponent({
     };
 
     const startBtnHandle = async () => {
+      // 选段未完成时,清除选段状态
+      if (state.sectionStatus && state.section.length < 2) {
+        clearSelection();
+      }
       // 如果是异常状态,先等待500ms再执行后续流程
       if (evaluatingData.isErrorState && !state.setting.soundEffect) {
         // console.log('异常流程1')
@@ -441,6 +446,7 @@ export default defineComponent({
     
     onUnmounted(() => {
 			clearTimeout(checkErjiTimer);
+      checkErjiTimer = null;
 		});
 
     return () => (
@@ -484,6 +490,7 @@ export default defineComponent({
             earphoneType={evaluatingData.earPhoneType}
             onClose={() => {
               clearTimeout(checkErjiTimer);
+              checkErjiTimer = null;
               evaluatingData.earphoneMode = false;
               // handlePerformDetection();
               checkEarphoneStatus("start");

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

@@ -398,6 +398,8 @@ export default defineComponent({
     });
     /** 模式切换按钮 */
     const toggleBtn = computed(() => {
+      // 不是演奏模式 影藏
+      if(state.playType !== "play") return { display: false, disabled: false }
       // 选择模式, url设置模式 不显示
       if (headTopData.modeType !== "show" || !headTopData.showBack) return { display: false, disabled: false };
       // 跟练开始, 评测开始 播放开始 隐藏
@@ -626,20 +628,19 @@ export default defineComponent({
               </div>
           }
           {/* 模式切换 */}
-          { 
-            state.playType === "play" &&
-              <div 
-                id={state.platform === IPlatform.PC ? "teacherTop-0" : "studnetT-0"}
-                style={{ display: toggleBtn.value.display ? "" : "none" }}
-                class={["driver-9", styles.modeChangeBox, toggleBtn.value.disabled && styles.disabled]} 
-                onClick={() => {
-                    handleRessetState();
-                    headTopData.modeType = "init";
-                }}
-              >
-                <img class={styles.img} src={iconMode} />
-                <div class={styles.title}>{state.modeType==="practise" ? '练习模式' : state.modeType==="follow" ? "跟练模式" : state.modeType==="evaluating" ? "评测模式" : ""}</div>
-              </div>
+          {
+            <div 
+              id={state.platform === IPlatform.PC ? "teacherTop-0" : "studnetT-0"}
+              style={{ display: toggleBtn.value.display ? "" : "none" }}
+              class={["driver-9", styles.modeChangeBox, toggleBtn.value.disabled && styles.disabled]} 
+              onClick={() => {
+                  handleRessetState();
+                  headTopData.modeType = "init";
+              }}
+            >
+              <img class={styles.img} src={iconMode} />
+              <div class={styles.title}>{state.modeType==="practise" ? '练习模式' : state.modeType==="follow" ? "跟练模式" : state.modeType==="evaluating" ? "评测模式" : ""}</div>
+            </div>
           }
           {/* 模式提醒 */}
           {
@@ -702,6 +703,12 @@ export default defineComponent({
                 } else {
                   handlerModeChange(oldPlayType, oldPlaySource, true);
                 }
+                showToast({
+                  message: state.playType === "play" ? "已切换为演奏场景" : "已切换为演唱场景",
+                  duration: 0,
+                  position: "top",
+                  className: "selectionToast",
+                });
               }}
             >
               <img style={{ display: state.playType === "play" ? "" : "none" }} class={styles.iconBtn} src={headImg(`perform.png`)} />
@@ -727,6 +734,12 @@ export default defineComponent({
                   }
                 }
                 handlerModeChange(oldPlayType, oldPlaySource);
+                showToast({
+                  message: state.playType === "play" ? (state.playSource === "music"?"已切换为原声":"已切换为伴奏") : (state.playSource === "music"?"已切换为范唱":(state.playSource === "background"?"已切换为伴唱":"已切换为唱名")),
+                  duration: 0,
+                  position: "top",
+                  className: "selectionToast",
+                });
               }}
             >
               <img style={{ display: state.playSource === "music" ? "" : "none" }} class={styles.iconBtn} src={state.playType === "play" ? headImg(`music.png`) : headImg(`music1.png`)} />

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

@@ -35,7 +35,7 @@ export default defineComponent({
         const formatterTimeMs = (value: any) => value = String(Math.min(3000, value));
 
         const notationList = computed(() => {
-            const list = state.enableNotation ? [{name:'五线谱',value:'staff'},{name:'首调',value:'firstTone'},{name:'固定谱',value:'fixedTone'}] : [{name:'首调',value:'firstTone'},{name:'固定谱',value:'fixedTone'}];
+            const list = state.enableNotation ? [{name:'五线谱',value:'staff'},{name:'首调',value:'firstTone'},{name:'固定调',value:'fixedTone'}] : [{name:'首调',value:'firstTone'},{name:'固定调',value:'fixedTone'}];
             return list;
         });
 

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

@@ -467,13 +467,13 @@ export default defineComponent({
         }}
       >
         {/* 骨架屏 */}
-        <Transition name="van-fade">
+        {/* <Transition name="van-fade">
           {detailData.skeletonLoading && (
             <div class={styles.skeleton}>
               <Skeleton row={8} />
             </div>
           )}
-        </Transition>
+        </Transition> */}
         {/* 曲目加载错误的缺省 */}
         <EmptyMusic></EmptyMusic>
         {/** 功能按钮 */}

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

@@ -104,11 +104,6 @@ export function destroySmoothAnimation() {
       aveSpeed: 0,
       clientWidth: 0
    })
-   Object.assign(moveState, {
-      oldIndex: -1,
-      progress: 0,
-      activeIndex: 0
-   })
 }
 
 /**
@@ -143,14 +138,7 @@ export function moveSmoothAnimationByPlayTime(time?: number) {
  * progress  当前音符到下一个音符的距离百分比
  * activeIndex 当前
  */
-const moveState = {
-   oldIndex: -1, // 上一次index
-   progress: 0,
-   activeIndex: 0
-}
 export function moveSmoothAnimation(progress: number, activeIndex: number, isMoveOsmd = true) {
-   moveState.progress = progress
-   moveState.activeIndex = activeIndex
    // if (!smoothAnimationState.isShow.value) {
    //    return
    // }
@@ -160,11 +148,6 @@ export function moveSmoothAnimation(progress: number, activeIndex: number, isMov
    const progressCalcIndex = Math.round(progress * _numberOfSegments)
    // // 当前的index
    let nowIndex = nextPointsIndex - _numberOfSegments + progressCalcIndex
-   // 当前计算的位置和上一次值一样时候不运行
-   if (moveState.oldIndex === nowIndex) {
-      return
-   }
-   moveState.oldIndex = nowIndex
    const nowPointsPos = smoothAnimationState.pointsPos[nowIndex]
    smoothAnimationState.canvasCtx?.clearRect(0, 0, smoothAnimationState.canvasDomWith, smoothAnimationState.canvasDomHeight)
    // 移动

+ 1 - 1
src/state.ts

@@ -515,7 +515,7 @@ const state = reactive({
   /** 作词家 */
   musicLyricist: '',
   // 加载条
-  isLoading: false,
+  isLoading: true,
   /** 加载中的文案 */
   loadingText: '音频资源加载中,请稍后…',
   /** 是否是简单的单行谱模式页面 */

+ 5 - 1
src/style.css

@@ -7,7 +7,11 @@ img {
   -webkit-touch-callout: none;
 }
 body {
-  user-select: none;
+  -webkit-user-select: none; /* Safari */
+  -moz-user-select: none; /* Firefox */
+  -ms-user-select: none; /* Internet Explorer/Edge */
+  user-select: none; /* Non-prefixed version, currently supported by Chrome and Opera,禁用文本选择 */
+  -webkit-touch-callout: none; /* iOS Safari,禁用长按行为 */
 }
 
 :root {

+ 5 - 1
src/view/audio-list/index.tsx

@@ -278,7 +278,11 @@ export default defineComponent({
 			return Promise.all([createAudio(state.beatSong.music), createAudio(state.beatSong.accompany), createAudio(state.beatSong.fanSong), createAudio(state.beatSong.banSong), createAudio(state.beatSong.mingSong)])
 		}
 		onMounted(async () => {
-			state.isLoading = true
+			// 预览的时候不走音频加载逻辑
+			if(state.isPreView){
+				state.isLoading = false;
+				return
+			}			
 			if (state.playMode !== "MIDI") {
 				console.time("音频加载时间")
 				// 处理音源

+ 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://dev.resource.colexiu.com", // 内容平台开发环境,内容平台开发,需在url链接上加上isCbs=true
-        // target: "https://test.kt.colexiu.com",
+        // target: "https://dev.resource.colexiu.com", // 内容平台开发环境,内容平台开发,需在url链接上加上isCbs=true
+        target: "https://test.kt.colexiu.com",
         //target: "https://mec.colexiu.com",
         changeOrigin: true,
         rewrite: (path) => path.replace(/^\/instrument/, ""),