Ver código fonte

feat: 切换音源逻辑补充

TIANYONG 9 meses atrás
pai
commit
ca25f30263

+ 5 - 0
src/pages/detail/runtime.ts

@@ -237,6 +237,7 @@ export const getActiveMidiId = () => {
  * @param val IMode
  */
 export const changeMode = async (val: IMode, type?: string | undefined) => {
+  // console.log('切换音源',val,state.songs)
   const cm: IMode = val === 'background' ? 'music' : 'background'
   // console.log(!state.songs[val], val, cm)
   if (detailState.activeDetail.isAppPlay) {
@@ -272,6 +273,10 @@ export const changeMode = async (val: IMode, type?: string | undefined) => {
   //   return
   // }
   state.mode = val
+  // 如果没有伴奏,音源切换按钮文案重置为原音
+  if (!state.songs.background) {
+    state.mode = 'music'
+  }
   if (type === 'all') {
     state.audiosInstance?.setMute(true, state.songs[cm])
     state.audiosInstance?.setMute(true, state.songs[val])

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

@@ -443,6 +443,7 @@ const formatTimes = () => {
     datas.push(data)
   }
   starTime = 0;
+  // console.log(JSON.stringify(datas),'评测数据')
   return {
     datas,
     firstNoteTime