Selaa lähdekoodia

feat: 保存作品逻辑修改

TIANYONG 8 kuukautta sitten
vanhempi
commit
e96560b89a

+ 2 - 1
src/pages/detail/runtime.ts

@@ -400,7 +400,7 @@ export const refreshIndexBase = (index: number) => {
 
 // 练习模式下,开始播放时,记录mp3的播放倍率
 export const initSetPlayRate = () => {
-  const item: any = detailState.times[state.activeIndex];
+  const item: any = (detailState.sectionStatus && detailState.section.length === 2) ? detailState.section[0] : detailState.times[state.activeIndex];
   if (item && modelType.value === "practice" && item.measureSpeed) {
     const ratio = state.speed / item.measureSpeed
     // state.audiosInstance?.setSpeed(ratio)
@@ -749,6 +749,7 @@ export const sectionChange = () => {
   if (!detailState.sectionStatus) {
     setCurrentTime(0)
     detailState.fixedKey = 0
+   resetBaseRate();
   }
   if (detailState.sectionStatus && detailState.section.length != 2) {
     resetCursor()

+ 1 - 1
src/pages/detail/section-box/index.tsx

@@ -104,7 +104,7 @@ export default defineComponent({
       if (state.section.length === 2) {
         // 选段状态需要重置播放倍率为1
         runtime.basePlayRate = 1;
-        const currentItem: any = state.times[runtime.activeIndex];
+        const currentItem: any = state.section[0];
         const currentSpeed = currentItem?.measureSpeed ? currentItem.measureSpeed : state.activeSpeed;
         changeSpeed(currentSpeed)
         

+ 1 - 1
src/subpages/colexiu/buttons/evaluating.tsx

@@ -1020,7 +1020,7 @@ export default defineComponent({
           {/* 评测完成结果显示 */}
           <Evaluating data={endResult.value} />
           {/** 调速或者选段后,评测给出提示 */}
-          { showNotSaveTip.value && <div class={styles.noSaveTip}>调整速度或选段后评测暂不支持保存演奏哦~<i onClick={() => runtime.initShow = false}></i></div> }
+          {/* { showNotSaveTip.value && <div class={styles.noSaveTip}>调整速度或选段后评测暂不支持保存演奏哦~<i onClick={() => runtime.initShow = false}></i></div> } */}
 
           <Transition name="finish">
             {startButtonShow.value && !delayData.open && modelType.value !== 'init' && (

+ 28 - 4
src/subpages/colexiu/popups/evaluating/content.tsx

@@ -1,5 +1,5 @@
 import { Button, Dialog, Grid, GridItem, Popup, Toast } from 'vant'
-import { defineComponent, ref, toRefs } from 'vue'
+import { defineComponent, ref, toRefs, computed } from 'vue'
 import qs from 'query-string'
 import appState from '/src/state'
 import detailState from '/src/pages/detail/state'
@@ -70,6 +70,7 @@ export default defineComponent({
     /** 是否是单元测试 */
     const isUnitTest = search.unitId ? true : false
     const shareShow = ref(false)
+    const noSaveTipShow = ref(true)
     const shareLoadedPngData = ref('')
     const { data } = toRefs(props)
     const pathname = location.pathname
@@ -140,6 +141,17 @@ export default defineComponent({
         },
       })
     }
+
+    // 播放倍率不等于1,或者是选段评测,APP暂时不支持保存演奏,需要给出提示
+    const noSaveTips = computed(() => {
+      console.log('提示123',noSaveTipShow.value)
+      let tipContent = '';
+      if (isUnitTest || detailState.section.length === 2 || runtime.basePlayRate != 1 || !runtime.songs.background) {
+        tipContent = isUnitTest ? '单元测验暂不支持保存作品噢~' : !runtime.songs.background ? '该曲目暂不支持保存作品噢~' : detailState.section.length === 2 ? '选段后暂不支持保存作品噢~' : runtime.basePlayRate != 1 ? '调速后暂不支持保存作品噢~' : '';
+      }
+      return tipContent
+    })
+
     return () => {
       const info = getLeveByScoreId(data.value?.score)
       return (
@@ -250,7 +262,7 @@ export default defineComponent({
                 </div>
               </div>
 
-              {(isUnitTest || detailState.section.length === 2 || runtime.basePlayRate != 1) ? null : !detailState.isHideEvaluatReportSaveBtn ? (
+              { !detailState.isHideEvaluatReportSaveBtn ? (
                 // <div class={styles.rigthBtns}>
                 //   <div class={styles.skepBtn} onClick={() => emit('upload')}>
                 //     <img src={iconUpload} />
@@ -262,9 +274,21 @@ export default defineComponent({
                 // </div> */}
                 // </div>
                 <div class={styles.headerButton}>
-                  <div class={[styles.headBtn]} onClick={() => emit('upload')}>
-                    保存演奏
+                  <div class={[styles.headBtn, noSaveTips.value ? styles.headBtnDisable : '']} onClick={() => {
+                    if (!noSaveTips.value) {
+                      emit('upload')
+                    }
+                  }}>
+                    保存作品
                   </div>
+                  {
+                    noSaveTips.value && noSaveTipShow.value ? 
+                    <div class={[styles.noSaveTip]}>
+                      <span class={styles.arrowIcon}></span>
+                      {noSaveTips.value}
+                      <i onClick={() => noSaveTipShow.value = false}></i>
+                    </div> : null                   
+                  }
                 </div>                
               ) : null}
             </div>

BIN
src/subpages/colexiu/popups/evaluating/icons/close_icon.png


+ 43 - 0
src/subpages/colexiu/popups/evaluating/index.module.less

@@ -275,4 +275,47 @@
           opacity: .8;
       }
   }
+
+  .headBtnDisable {
+    background: #C4C0BD;
+    color: #656565;
+  }
+
+  .noSaveTip {
+    background: rgba(0,0,0,0.7);
+    font-size: 13Px;
+    border-radius: 8Px;
+    display: flex;
+    align-items: center;
+    padding: 8Px 12Px;
+    position: absolute;
+    left: 50%;
+    top: 42Px;
+    transform: translateX(-60%);
+    z-index: 1;
+    color: #fff;
+    width: max-content;
+    > i {
+      width: 12Px;
+      height: 12Px;
+      background-image: url('./icons/close_icon.png');
+      background-size: 100% 100%;
+      background-position: center center;
+      background-repeat: no-repeat;
+      margin-left: 16Px;
+      cursor: pointer;
+    }
+    .arrowIcon {
+      position: absolute;
+      left: 50%;
+      top: -8PX;
+      transform: translateX(16PX);
+      width: 0;
+      height: 0;
+      border-bottom: 8PX solid rgba(0,0,0,0.7);
+      border-right: 8PX solid transparent;
+      border-left: 8PX solid transparent;  
+      z-index: 2;      
+    }
+  }
 }

+ 1 - 1
src/subpages/colexiu/uses/use-app.ts

@@ -83,7 +83,7 @@ export const useMp3s = async (detail: MusicSheelDetail) => {
   const backgroundSong = isEncoded(detail.metronomeUrl || '') ? detail.metronomeUrl || '' : encodeURI(detail.metronomeUrl || '')
   // 原音
   const musicSong = isEncoded(activebg?.audioFileUrl|| '') ? activebg?.audioFileUrl || '' : encodeURI(activebg?.audioFileUrl|| '')
-  
+  console.log('伴奏:',backgroundSong,'原音:',musicSong)
   // 兼容未修改之前
   runtime.songs = {
     background: backgroundSong ? backgroundSong + '?t=background' : '',