Browse Source

Merge branch 'iteration-classroom' into jenkins

lex 1 year ago
parent
commit
84c739fab5

+ 2 - 11
dev-dist/sw.js

@@ -69,7 +69,7 @@ if (!self.define) {
   };
 }
 define(['./workbox-5357ef54'], function (workbox) {
-  ('use strict');
+  'use strict';
 
   self.skipWaiting();
   workbox.clientsClaim();
@@ -102,15 +102,6 @@ define(['./workbox-5357ef54'], function (workbox) {
   workbox.registerRoute(
     new workbox.NavigationRoute(workbox.createHandlerBoundToURL('index.html'), {
       allowlist: [/^\/$/]
-    }),
-    workbox.strategies.networkOnly()
-  );
-  workbox.routing.registerRoute(
-    new RegExp('.*.html|css'),
-    workbox.strategies.networkFirst()
-  );
-  workbox.routing.registerRoute(
-    new RegExp('.*.html|css|js'),
-    workbox.strategies.networkOnly()
+    })
   );
 });

+ 19 - 1
src/views/xiaoku-music/component/play-item/index.tsx

@@ -56,6 +56,11 @@ export default defineComponent({
       if (props.playState === 'play') {
         audioRef.value.play();
       }
+
+      // 判断是否有链接
+      if (!props.item.audioFileUrl && !props.item.metronomeUrl) {
+        emit('change', 'pause');
+      }
     };
     /** 改变时间 */
     const handleChangeTime = (val: number) => {
@@ -80,13 +85,26 @@ export default defineComponent({
       () => props.playState,
       val => {
         if (val === 'play') {
-          audioRef.value.play();
+          audioRef.value.play().catch((err: any) => {
+            console.log(err, '22');
+            audioRef.value.play();
+          });
         } else {
           audioRef.value.pause();
         }
       }
     );
 
+    watch(
+      () => props.item,
+      () => {
+        // 判断是否有链接
+        if (!props.item.audioFileUrl && !props.item.metronomeUrl) {
+          emit('change', 'pause');
+        }
+      }
+    );
+
     return () => (
       <div
         class={[

+ 1 - 1
src/views/xiaoku-music/index.module.less

@@ -404,7 +404,7 @@
 
 .musicName {
   padding-top: 30px;
-  font-size: 24px;
+  font-size: 26px;
   font-weight: 500;
   color: #333;
   line-height: 24px;

+ 26 - 2
src/views/xiaoku-music/index.tsx

@@ -126,7 +126,7 @@ export default defineComponent({
         console.log(error);
       }
 
-      console.log(res, 'data', data.reshing, 'musicSubject');
+      // console.log(res, 'data', data.reshing, 'musicSubject');
       if (data.reshing) {
         data.list = [];
         data.reshing = false;
@@ -471,6 +471,15 @@ export default defineComponent({
         musicIframeLoad();
       }
     );
+    // 合奏曲谱转换时,更新曲谱信息
+    watch(
+      () => data.showMusicImg,
+      () => {
+        if (isEnsemble.value) {
+          musicIframeLoad();
+        }
+      }
+    );
 
     const musicImg = computed(() => {
       let imgs: any = [];
@@ -651,6 +660,13 @@ export default defineComponent({
                               onClick={(e: Event) => {
                                 e.stopPropagation();
                                 handlePlay(item);
+                                if (
+                                  data.listActive === index &&
+                                  data.playState === 'play' &&
+                                  isEnsemble.value
+                                ) {
+                                  musicIframeLoad();
+                                }
                               }}>
                               试听
                               <img
@@ -672,6 +688,13 @@ export default defineComponent({
                               onClick={(e: Event) => {
                                 e.stopPropagation();
                                 handlePlay(item);
+                                if (
+                                  data.listActive === index &&
+                                  data.playState === 'play' &&
+                                  isEnsemble.value
+                                ) {
+                                  musicIframeLoad();
+                                }
                               }}>
                               试听
                               <img
@@ -806,7 +829,8 @@ export default defineComponent({
                       id="staffIframeRef"
                       style={{
                         width: '100%',
-                        height: '100%'
+                        height: '100%',
+                        paddingTop: '20px'
                         // opacity: loading.value ? 0 : 1
                       }}
                       src={data.iframeSrc}