Browse Source

Merge branch 'feature-903' into online

TIANYONG 7 months ago
parent
commit
bf0abe8a07

+ 32 - 27
index.html

@@ -31,15 +31,18 @@
         instance.postMessage(JSON.stringify(data))
       }
     }
-    _postMessage({
-      api: 'cloudLoading',
-      content: {
-        show: true,
-        type: 'fullscreen',
-      },
-    })
+    // 是否隐藏APP的loading动画
+    if (!window.location.href.includes('isHideLoading')) {
+      _postMessage({
+        api: 'cloudLoading',
+        content: {
+          show: true,
+          type: 'fullscreen',
+        },
+      })
+    }
   </script>
-  
+
   <script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
   <script>
     // VConsole will be exported to `window.VConsole` by default.
@@ -47,7 +50,7 @@
   </script>
 
   <style>
-    #lottieWeb {
+    #lottieWeb,.lottieWeb{
       position: fixed;
       z-index: 100;
       top: 50%;
@@ -62,27 +65,29 @@
 </head>
 
 <body>
-  <div id="app"></div>
+  <div id="app">
+    <img class="lottieWeb" src="./loading.gif" alt="">
+  </div>
   <div id="lottieWeb"></div>
   <script>
-    lottie.loadAnimation({
-      container: document.getElementById('lottieWeb'),
-      renderer: 'svg',
-      width: '30px',
-      height: '30px',
-      loop: true,
-      autoplay: true,
-      path: '/orchestra-music-score/loading.json'
-    });
-    window.addEventListener('load', function () {
-      const loadingEle = document.getElementById('lottieWeb')
-      loadingEle.style.opacity = '0'
-      setTimeout(() => {
-        loadingEle.style.display = 'none'
-      }, 1000)
-    })
+    // lottie.loadAnimation({
+    //   container: document.getElementById('lottieWeb'),
+    //   renderer: 'svg',
+    //   width: '30px',
+    //   height: '30px',
+    //   loop: true,
+    //   autoplay: true,
+    //   path: '/orchestra-music-score/loading.json'
+    // });
+    // window.addEventListener('load', function () {
+    //   const loadingEle = document.getElementById('lottieWeb')
+    //   loadingEle.style.opacity = '0'
+    //   setTimeout(() => {
+    //     loadingEle.style.display = 'none'
+    //   }, 1000)
+    // })
   </script>
   <script type="module" src="/src/subpages/colexiu/main.ts"></script>
 </body>
 
-</html>
+</html>

+ 11 - 0
npm-shrinkwrap.json

@@ -12,6 +12,7 @@
         "@bugsnag/plugin-vue": "^7.10.0",
         "@dotlottie/player-component": "^1.1.0",
         "@vant/icons": "^1.8.0",
+        "@vant/touch-emulator": "^1.4.0",
         "animate.css": "^4.1.1",
         "canvg": "^4.0.0",
         "classnames": "^2.2.6",
@@ -2505,6 +2506,11 @@
         "@popperjs/core": "^2.9.2"
       }
     },
+    "node_modules/@vant/touch-emulator": {
+      "version": "1.4.0",
+      "resolved": "https://registry.npmmirror.com/@vant/touch-emulator/-/touch-emulator-1.4.0.tgz",
+      "integrity": "sha512-Zt+zISV0+wpOew2S1siOJ3G22y+hapHAKmXM+FhpvWzsRc4qahaYXatCAITuuXt0EcDp7WvEeTO4F7p9AtX/pw=="
+    },
     "node_modules/@vant/use": {
       "version": "1.3.4",
       "resolved": "https://registry.npmjs.org/@vant/use/-/use-1.3.4.tgz",
@@ -12472,6 +12478,11 @@
         "@popperjs/core": "^2.9.2"
       }
     },
+    "@vant/touch-emulator": {
+      "version": "1.4.0",
+      "resolved": "https://registry.npmmirror.com/@vant/touch-emulator/-/touch-emulator-1.4.0.tgz",
+      "integrity": "sha512-Zt+zISV0+wpOew2S1siOJ3G22y+hapHAKmXM+FhpvWzsRc4qahaYXatCAITuuXt0EcDp7WvEeTO4F7p9AtX/pw=="
+    },
     "@vant/use": {
       "version": "1.3.4",
       "resolved": "https://registry.npmjs.org/@vant/use/-/use-1.3.4.tgz",

+ 30 - 25
orchestra.html

@@ -31,13 +31,16 @@
         instance.postMessage(JSON.stringify(data))
       }
     }
-    _postMessage({
-      api: 'cloudLoading',
-      content: {
-        show: true,
-        type: 'fullscreen',
-      },
-    })
+    // 是否隐藏APP的loading动画
+    if (!window.location.href.includes('isHideLoading')) {
+      _postMessage({
+        api: 'cloudLoading',
+        content: {
+          show: true,
+          type: 'fullscreen',
+        },
+      })
+    }
   </script>
 
 <script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
@@ -47,7 +50,7 @@
 </script>
   
   <style>
-    #lottieWeb {
+    #lottieWeb,.lottieWeb {
       position: fixed;
       z-index: 100;
       top: 50%;
@@ -62,25 +65,27 @@
 </head>
 
 <body>
-  <div id="app"></div>
+  <div id="app">
+    <img class="lottieWeb" src="./loading.gif" alt="">
+  </div>
   <div id="lottieWeb"></div>
   <script>
-    lottie.loadAnimation({
-      container: document.getElementById('lottieWeb'),
-      renderer: 'svg',
-      width: '30px',
-      height: '30px',
-      loop: true,
-      autoplay: true,
-      path: '/orchestra-music-score/loading.json'
-    });
-    window.addEventListener('load', function () {
-      const loadingEle = document.getElementById('lottieWeb')
-      loadingEle.style.opacity = '0'
-      setTimeout(() => {
-        loadingEle.style.display = 'none'
-      }, 1000)
-    })
+    // lottie.loadAnimation({
+    //   container: document.getElementById('lottieWeb'),
+    //   renderer: 'svg',
+    //   width: '30px',
+    //   height: '30px',
+    //   loop: true,
+    //   autoplay: true,
+    //   path: '/orchestra-music-score/loading.json'
+    // });
+    // window.addEventListener('load', function () {
+    //   const loadingEle = document.getElementById('lottieWeb')
+    //   loadingEle.style.opacity = '0'
+    //   setTimeout(() => {
+    //     loadingEle.style.display = 'none'
+    //   }, 1000)
+    // })
   </script>
   <script type="module" src="/src/subpages/colexiu/main.ts"></script>
 </body>

+ 1 - 0
package.json

@@ -11,6 +11,7 @@
     "@bugsnag/plugin-vue": "^7.10.0",
     "@dotlottie/player-component": "^1.1.0",
     "@vant/icons": "^1.8.0",
+    "@vant/touch-emulator": "^1.4.0",
     "animate.css": "^4.1.1",
     "canvg": "^4.0.0",
     "classnames": "^2.2.6",

BIN
public/loading.gif


+ 2 - 2
src/pages/detail/speed.module.less

@@ -26,8 +26,8 @@
   display: flex;
   align-items: center;
   justify-content: space-between;
-  height: calc(90% - 65px);
-  max-height: 400PX;
+  height: calc(80% - 65px);
+  // max-height: 400PX;
   >span{
       margin-right: calc(10px * var(--screen));
   }

+ 7 - 0
src/subpages/colexiu/App.tsx

@@ -149,6 +149,13 @@ export default defineComponent({
     }
 
     onMounted(() => {
+      if (location.href.includes('isYjt')) {
+        window.document.title = '乐教通'
+        // 禁用右键菜单
+        document.addEventListener("contextmenu", function (event) {
+          event.preventDefault();
+        });
+      }
       // 进入页面设置常量
       postMessage({
         api: 'keepScreenLongLight',

+ 22 - 9
src/subpages/colexiu/buttons/index.tsx

@@ -92,6 +92,16 @@ const beforeCheck = (cb: (status: boolean) => void) => {
 }
 
 const back: () => void = () => {
+  // 如果是乐教通,点击返回按钮,需要关闭当前窗口
+  if (window.location.href.includes('isYjt')) {
+    window.parent.postMessage(
+      {
+        api: "api_YjtClose"
+      },
+      "*"
+    );
+    return
+  }
   submitMaxScore()
   sendBackRecordTotalTime()
   postMessage({
@@ -206,7 +216,10 @@ export default defineComponent({
           style={search.headerHeight ? { height: '1rem', paddingTop: '0.25rem' } : ''}
         >
           <div class={styles.leftButton}>
-            {search?.modelType && !search.unitId ? null : <img class={styles.backbtn} src={iconBack} onClick={back} />}
+            {(search?.modelType && !search.unitId) ? null : <img class={styles.backbtn} src={iconBack} onClick={back} />}
+            {
+              search.isHideBack === 'false' ? <img class={styles.backbtn} src={iconBack} onClick={back} /> : null
+            }
             <div class={styles.titleWrap}>
               <div class={styles.title}>{detailState.activeDetail?.musicSheetName}</div>
               {search.albumName && <div class={styles.album}>{search.albumName}</div>}
@@ -239,7 +252,7 @@ export default defineComponent({
               )}
             </Transition>
           </div>
-          <div class={[styles.moreButton]} style={{ opacity: detailState.initRendered ? 1 : 0 }}>           
+          <div class={[styles.moreButton]} style={{ opacity: detailState.initRendered ? 1 : 0 }}>
             {!search?.modelType && modelType.value !== 'init' && !detailState.frozenMode && !detailState.isLessonTrain && (
               <Button
                 data-step="m0"
@@ -299,8 +312,8 @@ export default defineComponent({
                     <div class={classNames(styles['botton-tips'],metronomeData.cursorMode === 3 ? styles.tipSpec : '')}>{metronomeData.cursorTips}</div>
                   </>}
                 </span>
-              </Button>            
-            </>             
+              </Button>
+            </>
             {detailState.initRendered && !search.lessonTrainingId && !search.questionId &&  detailState.activeDetail?.musicSheetType == 'CONCERT' && (
               <Button
                 class={[styles.button, styles.hasText]}
@@ -321,7 +334,7 @@ export default defineComponent({
             {['practice', 'evaluation'].includes(modelType.value) && (
               <>
                 {
-                  modelType.value === 'practice' ? 
+                  modelType.value === 'practice' ?
                   <Button
                     data-step="m1"
                     class={[styles.button, styles.hasText]}
@@ -353,7 +366,7 @@ export default defineComponent({
                   </Button>
                 )}
                 {
-                  modelType.value === 'practice' ? 
+                  modelType.value === 'practice' ?
                   <Button
                     data-step="m3"
                     class={[styles.button, styles.hasText]}
@@ -365,7 +378,7 @@ export default defineComponent({
                   >
                     <ButtonIcon key="music" name={SettingState.sett.fingering ? 'fingeringOn' : 'fingeringOff'} />
                     <span>指法</span>
-                  </Button> : null               
+                  </Button> : null
                 }
               </>
             )}
@@ -421,8 +434,8 @@ export default defineComponent({
 
                 <Evaluating ref={evaluatingRef} />
               </>
-            )}    
-                    
+            )}
+
             {['practice', 'evaluation'].includes(modelType.value) && !search.lessonTrainingId && (
               <Popover
                 trigger="manual"

+ 1 - 0
src/subpages/colexiu/main.ts

@@ -7,6 +7,7 @@ import './app.css'
 import '../../base.css'
 import App from './App'
 // import router from './router'
+import '@vant/touch-emulator';
 
 appState.clintNmae = 'colexiu'
 ;(window as any).DYEnvironment = 'colexiu'

+ 42 - 2
src/subpages/colexiu/popups/follow/index.tsx

@@ -12,6 +12,7 @@ import detailState from '/src/pages/detail/state'
 import iconFollwBtn from './icons/icon-follwBtn.png'
 import { unitTestData } from '/src/subpages/colexiu/unitTest/index'
 import { formatPitch } from '/src/subpages/colexiu/buttons/evaluating'
+import SettingState from '/src/pages/detail/setting-state'
 
 // 显示或隐藏播放按钮
 const togglePlayer = (show: boolean = false) => {
@@ -106,6 +107,7 @@ const getDefaultIndex = () => {
 
 // 开始
 const handleStart = () => {
+  checking = false;
   onClear()
   data.start = true
   openToggleRecord(true)
@@ -121,9 +123,46 @@ const handleEnd = () => {
   data.start = false
   openToggleRecord(false)
   data.index = getDefaultIndex()
-  setStepIndex(state.osmd, data.index)
+  setStepIndex(state.osmd, 0)
   // state.osmd.cursor.reset()
   getNoteIndex()
+  onClear()
+}
+
+/**
+ * 2024.7.9 新增自动结束跟练模式功能
+ * 如果跟练模式,唱完了最后一个有频率的音符,需要自动结束掉跟练模式
+ * 需要判断当前音符的后面是否都是休止音符(休止音符的频率都是-1),或者是否是最后一个音符了
+ */
+const autoEndFollow = () => {
+	if (data.index >= detailState.times.length-1) {
+    // 如果开了自动循环需要重新开始跟练
+    if (SettingState.sett.loop) {
+      handleEnd()
+      setTimeout(() => {
+        handleStart()
+      }, 0);
+    } else {
+      handleEnd()
+    }
+		return
+	}
+	let nextIndex = data.index + 1;
+	const rightTimes = detailState.times.slice(data.index,detailState.times.length)
+	// 后面的音符是否都是休止音符
+	const isAllRest = !rightTimes.some((item: any) => item?.frequency > 1);
+	if (isAllRest && detailState.times[data.index]?.frequency < 1) {
+    // 如果开了自动循环需要重新开始跟练
+    if (SettingState.sett.loop) {
+      handleEnd()
+      setTimeout(() => {
+        handleStart()
+      }, 0);
+    } else {
+      handleEnd()
+    }
+		return
+	}
 }
 
 // 下一个
@@ -134,6 +173,7 @@ const next = () => {
     state.osmd.cursor.next()
   }
   refreshView()
+  autoEndFollow()
 }
 
 // 获取当前音符
@@ -174,7 +214,7 @@ const checked = () => {
   for (let i = 0; i < data.list.length; i++) {
     const frequency = data.list[i]
     if (frequency > item.min && frequency < item.max) {
-      console.log(item.min, frequency, item.max)
+      // console.log(item.min, frequency, item.max)
       next()
       data.index += 1
       data.list = data.list.slice(i + 1)

+ 6 - 1
src/subpages/colexiu/popups/setting/index.module.less

@@ -83,7 +83,13 @@
   border-radius: 5px;
 }
 
+.columnBox {
+  display: flex;
+  flex-direction: column;
+}
+
 .groupBox {
+  flex: 1;
   padding: 4px 12px;
   overflow: hidden;
   overflow-y: auto;
@@ -110,7 +116,6 @@
   margin: 4px auto;
   margin-bottom: 8px;
   box-sizing: border-box;
-  position: absolute;
   bottom: 0;
   display: flex;
   width: 100%;

+ 3 - 3
src/subpages/colexiu/popups/setting/index.tsx

@@ -17,12 +17,12 @@ export default defineComponent({
     return () => (
       <div class={styles.setting}>
         <Tabs active={props.active}>
-          <Tab title="全局设置" name="1">
+          <Tab title="设置" name="1">
             <Seet />
           </Tab>
-          <Tab title="练习设置" name="2">
+          {/* <Tab title="练习设置" name="2">
             <Practise />
-          </Tab>
+          </Tab> */}
           <Tab title="评测设置" name="3">
             <Evaluat />
           </Tab>

+ 17 - 2
src/subpages/colexiu/popups/setting/sett.tsx

@@ -19,6 +19,7 @@ import { promisefiyPostMessage } from '/src/helpers/native-message'
 import Popups from '..'
 import Feedback from '../feedback'
 import { useReload } from '../../uses'
+
 export const suggestPopup: Ref<any> = ref(null)
 export const confirmShow: Ref<boolean> = ref(false)
 
@@ -132,7 +133,7 @@ export default defineComponent({
     return () => {
       return (
         <>
-          <div>
+          <div class={styles.columnBox}>
             <NoticeBar
               class={styles.noticebar}
               left-icon={InfoIcon}
@@ -169,8 +170,22 @@ export default defineComponent({
                   }
                 </>
               }
-
               <Divider />
+              <Cell center border={false} title="循环播放">
+                <Switch v-model={SettingState.sett.loop} {...switchProps}>
+                  off
+                </Switch>
+              </Cell>
+              <Divider />
+              <Cell center border={false} title="显示指法">
+                <Switch v-model={SettingState.sett.fingering} {...switchProps} onChange={val => {
+                      SettingState.sett.fingering = val
+                      runtime.event.emit('settingFingeringChange')
+                    }
+                  }>
+                  off
+                </Switch>
+              </Cell>
               {/* <Cell center border={false} title="乐谱大小">
                 <div style={{ display: 'flex' }}>
                   <RadioGroup

+ 8 - 8
yarn.lock

@@ -1558,6 +1558,11 @@
   dependencies:
     "@popperjs/core" "^2.9.2"
 
+"@vant/touch-emulator@^1.4.0":
+  "integrity" "sha512-Zt+zISV0+wpOew2S1siOJ3G22y+hapHAKmXM+FhpvWzsRc4qahaYXatCAITuuXt0EcDp7WvEeTO4F7p9AtX/pw=="
+  "resolved" "https://registry.npmmirror.com/@vant/touch-emulator/-/touch-emulator-1.4.0.tgz"
+  "version" "1.4.0"
+
 "@vant/use@^1.1.2", "@vant/use@^1.3.2":
   "integrity" "sha512-XvZkPCjcmEBhD+T3vB68thOG6P9jazld6aBTMenhbAQd4FT/x9AiKIWPJx4MvhYoSIWt7fju6K01XTJldWs1hw=="
   "resolved" "https://registry.npmjs.org/@vant/use/-/use-1.3.4.tgz"
@@ -3179,9 +3184,9 @@
   "resolved" "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz"
   "version" "0.9.3"
 
-"esbuild-darwin-arm64@0.14.54":
-  "integrity" "sha512-OPafJHD2oUPyvJMrsCvDGkRrVCar5aVyHfWGQzY1dWnzErjrDuSETxwA2HSsyg2jORLY8yBfzc1MIpUkXlctmw=="
-  "resolved" "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.54.tgz"
+"esbuild-windows-64@0.14.54":
+  "integrity" "sha512-AoHTRBUuYwXtZhjXZbA1pGfTo8cJo3vZIcWGLiUcTNgHpJJMC1rVA44ZereBHMJtotyN71S8Qw0npiCIkW96cQ=="
+  "resolved" "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.14.54.tgz"
   "version" "0.14.54"
 
 "esbuild@^0.14.27":
@@ -3532,11 +3537,6 @@
   "resolved" "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
   "version" "1.0.0"
 
-"fsevents@~2.3.2":
-  "integrity" "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA=="
-  "resolved" "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz"
-  "version" "2.3.2"
-
 "function-bind@^1.1.1":
   "integrity" "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
   "resolved" "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz"