|
@@ -36,7 +36,7 @@ import { browser } from '/src/helpers/utils'
|
|
|
import { postMessage } from '/src/helpers/native-message'
|
|
|
import { svgtopng } from './helpers'
|
|
|
import { restPromptMain } from '/src/helpers/restPrompt'
|
|
|
-import ProductJson from './popups/productJson'
|
|
|
+import ProductJson, { getHasCache } from './popups/productJson'
|
|
|
import { useRoute } from 'vue-router'
|
|
|
import styles from './index.module.less'
|
|
|
import Tips from './tips'
|
|
@@ -45,6 +45,7 @@ import ModelWraper from './buttons/model-wraper'
|
|
|
import Follow from './popups/follow'
|
|
|
import UnitTest from './unitTest'
|
|
|
import { renderError } from './App'
|
|
|
+import { musicInfo } from './state'
|
|
|
|
|
|
// json化曲谱的note信息和svg
|
|
|
export const musicJSON = reactive({
|
|
@@ -131,7 +132,6 @@ export default defineComponent({
|
|
|
}
|
|
|
|
|
|
const settingFingeringChange = throttle(() => {
|
|
|
- // console.log('settingFingeringChange')
|
|
|
const { direction } = fingeringDetail.value as ITypeContentItem
|
|
|
if (direction === 'vertical') {
|
|
|
// Toast('加载中,请稍后...')
|
|
@@ -147,10 +147,6 @@ export default defineComponent({
|
|
|
|
|
|
useSuspendPlay()
|
|
|
|
|
|
- //需要生成缓存数据的条件
|
|
|
- const isProductJson = ref(false)
|
|
|
- const productRef = ref()
|
|
|
-
|
|
|
/**结束全屏动画 */
|
|
|
const endFullLoading = () => {
|
|
|
// @ts-ignore
|
|
@@ -164,6 +160,8 @@ export default defineComponent({
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+ const productRef = ref()
|
|
|
+
|
|
|
/** 当渲染完成后的回调 */
|
|
|
const onRerender = async (osmd: OpenSheetMusicDisplay) => {
|
|
|
endFullLoading()
|
|
@@ -174,7 +172,7 @@ export default defineComponent({
|
|
|
//@ts-ignore
|
|
|
const saveSpeed = (store.get('speeds') || {})[search.id]
|
|
|
const bpm = (osmd as any).bpm || osmd.Sheet.userStartTempoInBPM
|
|
|
-
|
|
|
+
|
|
|
detailState.activeSpeed = saveSpeed || detail.value.playSpeed || bpm || 100
|
|
|
detailState.baseSpeed = detail.value.playSpeed || bpm || 100
|
|
|
detailState.code = detail.value?.code || ''
|
|
@@ -182,16 +180,11 @@ export default defineComponent({
|
|
|
if (detailState.renderType === 'native') {
|
|
|
detailState.times = getAllNodes(osmd)
|
|
|
}
|
|
|
- isProductJson.value =
|
|
|
- search.modeType === 'json' ||
|
|
|
- !detailState.activeDetail?.musicSvg ||
|
|
|
- !detailState.activeDetail?.musicJianSvg ||
|
|
|
- !detailState.activeDetail?.musicFirstSvg
|
|
|
- if (isProductJson.value) {
|
|
|
+ if (search.modeType === 'json' || getHasCache()) {
|
|
|
const { numerator, denominator } = getDuration(osmd)
|
|
|
try {
|
|
|
musicJSON.json = JSON.stringify({
|
|
|
- musicId: detailState.activeDetail.id,
|
|
|
+ musicId: musicInfo.musicId,
|
|
|
musicSheetName: encodeURIComponent(detailState.activeDetail.musicSheetName),
|
|
|
osmd: {
|
|
|
product: true,
|
|
@@ -202,14 +195,13 @@ export default defineComponent({
|
|
|
},
|
|
|
times: detailState.times,
|
|
|
})
|
|
|
- // console.log('生成缓存数据', musicJSON)
|
|
|
+ console.log('生成缓存数据', musicJSON)
|
|
|
musicJSON.svg = document.getElementById('osmdSvgPage1')?.outerHTML || ''
|
|
|
nextTick(() => {
|
|
|
musicJSON.svg = document.getElementById('osmdSvgPage1')?.outerHTML || ''
|
|
|
musicJSON.rended = true
|
|
|
productRef.value?.autoProduct()
|
|
|
})
|
|
|
- // console.log("🚀 ~ detailState.times", document.getElementById('osmdSvgPage1'))
|
|
|
} catch (error) {
|
|
|
console.log(error)
|
|
|
}
|
|
@@ -273,6 +265,16 @@ export default defineComponent({
|
|
|
renderLoading.value = false
|
|
|
}
|
|
|
|
|
|
+ /** 是否评测模式,并且有指法监听变化 */
|
|
|
+ watch(() => runtime.evaluatingStatus, () => {
|
|
|
+ // 指法开启的时候
|
|
|
+ if (SettingState.sett.fingering) {
|
|
|
+ nextTick(() => {
|
|
|
+ MusicSheetRef.value.reRender()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
return () => {
|
|
|
const loading = renderLoading.value || detailStatus.value === 'loading'
|
|
|
const error = renderError.value || detailStatus.value === 'error'
|
|
@@ -286,7 +288,7 @@ export default defineComponent({
|
|
|
const calcLeft = paddingLeft || '0px'
|
|
|
const isVertical = direction === 'vertical'
|
|
|
const calcRightWidth = direction === 'vertical' ? '20px' : '0px'
|
|
|
- const needFingering = fingeringStatus.value === 'show' && SettingState.sett.fingering //&& !runtime.evaluatingStatus
|
|
|
+ const needFingering = fingeringStatus.value === 'show' && SettingState.sett.fingering && !runtime.evaluatingStatus
|
|
|
const needFingeringWidth = direction === 'vertical' && needFingering
|
|
|
const musicSheetStyle = {
|
|
|
...(isVertical && { margin: 'auto', marginRight: 0 }),
|