index.tsx 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686
  1. import { Popup, Skeleton } from "vant";
  2. import { computed, defineComponent, nextTick, onBeforeMount, onBeforeUnmount, onMounted, onUnmounted, reactive, Transition, watch, watchEffect, defineAsyncComponent, ref } from "vue";
  3. import { formateTimes } from "../../helpers/formateMusic";
  4. import Metronome, { metronomeData } from "../../helpers/metronome";
  5. import state, { EnumMusicRenderType, evaluatCreateMusicPlayer, handleSetSpeed, IAudioState, IPlatform, isRhythmicExercises, resetPlaybackToStart, togglePlay, getMusicDetail, addNoteBBox } from "/src/state";
  6. import { browser, setGlobalData } from "../../utils";
  7. import AudioList from "../../view/audio-list";
  8. import MusicScore from "../../view/music-score";
  9. import TestCheck from "/src/view/music-score/testCheck";
  10. import { sysMusicScoreAccompanimentQueryPage } from "../api";
  11. import EvaluatModel from "../evaluat-model";
  12. import HeaderTop, { handlerModeChange } from "../header-top";
  13. import styles from "./index.module.less";
  14. import { api_cloudAccompanyMessage, api_cloudLoading, api_keepScreenLongLight, api_openCamera, api_openWebView, api_setEventTracking, api_setRequestedOrientation, api_setStatusBarVisibility, isSpecialShapedScreen } from "/src/helpers/communication";
  15. import { getQuery } from "/src/utils/queryString";
  16. import Evaluating, { evaluatingData } from "/src/view/evaluating";
  17. import MeasureSpeed from "/src/view/plugins/measure-speed";
  18. import { mappingVoicePart, subjectFingering } from "/src/view/fingering/fingering-config";
  19. import Fingering from "/src/view/fingering";
  20. import store from "store";
  21. import Tick, { handleInitTick } from "/src/view/tick";
  22. import FollowPractice, { followData } from "/src/view/follow-practice";
  23. import FollowModel from "../follow-model";
  24. import RecordingTime from "../custom-plugins/recording-time";
  25. import WorkIndex, { resetSection } from "../custom-plugins/work-index";
  26. import TheMusicList, { isMusicList } from "../component/the-music-list";
  27. import { storeData } from "/src/store";
  28. import ViewFigner from "../view-figner";
  29. import ToggleMusicSheet from "/src/view/plugins/toggleMusicSheet";
  30. import { setCustomGradual, setCustomNoteRealValue } from "/src/helpers/customMusicScore";
  31. import { usePageVisibility } from "@vant/use";
  32. import { initMidi } from "/src/helpers/midiPlay";
  33. import TheAudio from "/src/components/the-audio";
  34. import tickWav from "/src/assets/tick.mp3";
  35. import AuthorName from "../component/authorName";
  36. import { initSmoothAnimation } from "./smoothAnimation";
  37. import EmptyMusic, { isEmptyMusicShow } from "./emptyMusic";
  38. import { position } from "html2canvas/dist/types/css/property-descriptors/position";
  39. import Loading from "./loading"
  40. import ExerciseStatistics from "../custom-plugins/ExerciseStatistics"
  41. import { musicData } from "/src/view/music-score"
  42. import Vip from "/src/page-instrument/component/vip"
  43. import { getSvgPngToSize } from "/src/helpers/svgToPng"
  44. // import bgJson from "./images/index.json";
  45. // const DelayCheck = defineAsyncComponent(() =>
  46. // import('/src/page-instrument/evaluat-model/delay-check')
  47. // )
  48. /**
  49. * 特殊教材分类id
  50. */
  51. export const classids = [1, 2, 6, 7, 8, 9, 3, 10, 11, 12, 13, 4, 14, 15, 16, 17, 30, 31, 35, 36, 46, 108]; // 大雅金唐, 竖笛教程, 声部训练展开的分类ID
  52. const calcCeilFrequency = (frequency: number) => {
  53. if (frequency < 0) return frequency;
  54. if (frequency) return (frequency * 1000 * 2) / 1000;
  55. return 0;
  56. };
  57. /** 需要处理频率的乐器
  58. */
  59. const resetFrequency = (list: any[]) => {
  60. // const instrumentNames = ["ocarina", "pan-flute", "piccolo", "hulusi-flute"];
  61. const instrumentNames = ["ocarina", "pan-flute", "hulusi-flute"];
  62. if (!state.fingeringInfo?.name || !instrumentNames.includes(state.fingeringInfo.name)) return list;
  63. // console.log(state.subjectId, state.fingeringInfo.name, instrumentNames);
  64. for (let i = 0; i < list.length; i++) {
  65. if (list[i].prevFrequency) list[i].prevFrequency = calcCeilFrequency(list[i].prevFrequency);
  66. if (list[i].frequency) list[i].frequency = calcCeilFrequency(list[i].frequency);
  67. if (list[i].nextFrequency) list[i].nextFrequency = calcCeilFrequency(list[i].nextFrequency);
  68. }
  69. return list;
  70. };
  71. /**
  72. * 乐器指法处理
  73. */
  74. const setNoteHalfTone = (list: any[]) => {
  75. const instrumentNames = ["hulusi-flute"]; // ["ocarina", "pan-flute", "piccolo"];
  76. if (!state.fingeringInfo?.name || !instrumentNames.includes(state.fingeringInfo.name)) return list;
  77. for (let i = 0; i < list.length; i++) {
  78. const note = list[i];
  79. if (note.realKey === 0) continue;
  80. note.realKey = note.realKey + 12;
  81. }
  82. return list;
  83. };
  84. export const musicScoreRef = ref();
  85. export const fingerRef = ref();
  86. export const headerColumnHide = ref(false); // 是否隐藏功能按钮,播放时自动隐藏
  87. export default defineComponent({
  88. name: "music-list",
  89. setup() {
  90. const browsInfo = browser();
  91. const query: any = getQuery();
  92. const detailData = reactive({
  93. isLoading: true,
  94. skeletonLoading: true,
  95. paddingLeft: "0px",
  96. headerHide: false,
  97. fingerPreView: false,
  98. fingerPreViewAnimation: false,
  99. orientation: 0,
  100. fingerPreViewGuide: false,
  101. });
  102. const getAPPData = async () => {
  103. const screenData = await isSpecialShapedScreen();
  104. if (screenData?.content) {
  105. // console.log("🚀 ~ screenData:", screenData.content);
  106. const { isSpecialShapedScreen, notchHeight } = screenData.content;
  107. if (isSpecialShapedScreen) {
  108. // 安卓取刘海值
  109. detailData.paddingLeft = 27 + "px";
  110. }
  111. }
  112. };
  113. console.time('加载过程')
  114. onBeforeMount(async () => {
  115. // console.time("渲染加载耗时");
  116. api_keepScreenLongLight();
  117. getAPPData();
  118. api_setStatusBarVisibility();
  119. const settting = store.get("musicscoresetting");
  120. if (settting) {
  121. //state.setting = settting;
  122. Object.assign(state.setting, settting);
  123. //state.setting.beatVolume = state.setting.beatVolume || 50
  124. state.setting.beatVolume = 50;
  125. if (state.setting.camera) {
  126. const res = await api_openCamera();
  127. // 没有授权
  128. if (res?.content?.reson) {
  129. state.setting.camera = false;
  130. store.set("musicscoresetting", state.setting);
  131. }
  132. }
  133. }
  134. });
  135. //给app传伴奏
  136. const pushAppMusic = () => {
  137. api_cloudAccompanyMessage(state.accompany);
  138. };
  139. const changePlay = (res: any) => {
  140. if (res?.data?.api === 'setPlayState') {
  141. console.log('父页面的切换事件关闭播放')
  142. if (state.playState === "play") {
  143. togglePlay("paused")
  144. }
  145. }
  146. };
  147. // console.log(route.params, query)
  148. onMounted(async () => {
  149. (window as any).appName = "colexiu";
  150. const id = query.id || "43554";
  151. state.isCbsView = query.isCbs;
  152. state.isHomeWork = query.workRecord || query.evaluatingRecord;
  153. // 如果是纯预览模式,0.65倍缩放谱面
  154. state.isPreView = query.isPreView;
  155. state.isWeb = query.systemType === 'web';
  156. if (state.isPreView) {
  157. state.zoom = query.zoom || 0.65
  158. }
  159. if (id == "1814218144844087298" && state.isSingleLine) {
  160. state.zoom = 0.7;
  161. }
  162. // 只有总控平台和预览 默认是多行谱
  163. //(state.isPreView || query.isCbs) && (state.isSingleLine = false)
  164. // Promise.all([sysMusicScoreAccompanimentQueryPage(id)]).then((values) => {
  165. // getMusicInfo(values[0]);
  166. // });
  167. window.addEventListener('message', changePlay)
  168. const guideInfoStore = localStorage.getItem('guideInfo') ? JSON.parse(localStorage.getItem('guideInfo')) : {};
  169. state.guideInfo = guideInfoStore
  170. try {
  171. await getMusicDetail(id);
  172. } catch (err) {
  173. console.error(err);
  174. state.isLoading = false;
  175. isEmptyMusicShow.value = true
  176. // 需要向外面(iframe)派发计时器数据的时候触发
  177. if(query.isbeatTimes){
  178. console.log("webApi_beatTimes",err)
  179. window.parent.postMessage(
  180. {
  181. api: "webApi_beatTimes",
  182. data: "节拍器时值错误!!"
  183. },
  184. "*"
  185. );
  186. }
  187. return
  188. }
  189. detailData.isLoading = false;
  190. // 如果后台设置了不显示指法,关闭指法开关 如果默认进来是演奏模式 不显示指法开关
  191. if (!state.isShowFingering || state.playType === "sing") {
  192. state.setting.displayFingering = false;
  193. }
  194. // api_setEventTracking();
  195. });
  196. onUnmounted(() => {
  197. window.removeEventListener('message', changePlay)
  198. });
  199. /** 渲染完成 */
  200. const handleRendered = (osmd: any) => {
  201. api_cloudLoading();
  202. console.timeEnd("渲染加载耗时");
  203. console.timeLog('加载过程','谱面渲染完成')
  204. state.isLoading = false
  205. detailData.skeletonLoading = false;
  206. state.osmd = osmd;
  207. // 没有设置速度使用读取的速度
  208. if (state.originSpeed === 0) {
  209. state.originSpeed = state.speed = (osmd as any).bpm || osmd.Sheet.userStartTempoInBPM || 100;
  210. }
  211. // const saveSpeed = (store.get("speeds") || {})[state.examSongId] || state.speed || (osmd as any).bpm || osmd.Sheet.userStartTempoInBPM;
  212. // // 加载本地缓存的速度
  213. // if (saveSpeed) {
  214. // handleSetSpeed(saveSpeed);
  215. // }
  216. setCustomGradual();
  217. setCustomNoteRealValue();
  218. state.times = formateTimes(osmd);
  219. // state.times = resetFrequency(state.times);
  220. state.times = setNoteHalfTone(state.times);
  221. state.xmlHasLyric = state.times.some((item: any) => item?.formatLyricsEntries?.length);
  222. console.log("🚀 ~ state.times:", state.times, state.subjectId, state);
  223. nextTick(() => {
  224. state.activeMeasureIndex = state.times[0].MeasureNumberXML;
  225. });
  226. // 一行谱
  227. if (state.isSingleLine) {
  228. // 音符添加位置信息bbox
  229. addNoteBBox(state.times);
  230. // 一行谱创建 动画
  231. initSmoothAnimation();
  232. }
  233. // 初始化midi音频信息
  234. const songEndTime = state.times[state.times.length - 1 || 0]?.endtime || 0;
  235. if (state.isAppPlay) {
  236. const durationNum = songEndTime;
  237. initMidi(durationNum, state.midiUrl);
  238. }
  239. state.measureTime = state.times[0]?.measureLength || 0;
  240. try {
  241. metronomeData.metro = new Metronome();
  242. metronomeData.metro.init(state.times);
  243. } catch (error) {
  244. console.log(error, "err")
  245. }
  246. // 需要向外面(iframe)派发计时器数据的时候触发
  247. if (query.isbeatTimes) {
  248. const { isOpenMetronome, isSingOpenMetronome } = state;
  249. const { xmlMp3BeatFixTime, difftime } = state.times[0];
  250. const singBeatTime: number[][] = [];
  251. const beatTime = metronomeData.metroMeasure.map((metroMeasure) => {
  252. const singBeat: number[] = [];
  253. const beatTimeItem = metroMeasure.map((item: any) => {
  254. let singTime = item.time;
  255. if (isSingOpenMetronome && !isOpenMetronome) {
  256. singTime += xmlMp3BeatFixTime;
  257. } else if (!isSingOpenMetronome && isOpenMetronome) {
  258. singTime -= xmlMp3BeatFixTime;
  259. }
  260. singBeat.push(singTime);
  261. return item.time;
  262. });
  263. singBeatTime.push(singBeat);
  264. return beatTimeItem;
  265. });
  266. //改为唱名
  267. state.fixtime = difftime;
  268. state.times.map((item) => {
  269. item.time = item.xmlNoteTime + difftime;
  270. item.endtime = item.xmlNoteEndTime + difftime;
  271. item.fixtime = difftime;
  272. });
  273. metronomeData.metro.calculation(state.times);
  274. const mingBeatTime: number[][] = metronomeData.metroMeasure.map((metroMeasure) => {
  275. const beatTimeItem = metroMeasure.map((item: any) => {
  276. return item.time;
  277. });
  278. return beatTimeItem;
  279. });
  280. const webApi_beatTimes = { beatTime, singBeatTime, mingBeatTime, isBeatTime:!state.isEvxml, isSingBeatTime:!state.isEvxml, isMingBeatTime:!state.isEvxml }
  281. console.log("webApi_beatTimes", webApi_beatTimes);
  282. window.parent.postMessage(
  283. {
  284. api: "webApi_beatTimes",
  285. data: JSON.stringify(webApi_beatTimes),
  286. },
  287. "*"
  288. );
  289. return
  290. }
  291. // 刷新时值
  292. handlerModeChange("play", "music");
  293. /**
  294. * 2024.1.25
  295. * 设置节拍器,跟练需要播放系统节拍器,所以不需要判断needTick状态
  296. */
  297. // if (state.needTick) {
  298. handleInitTick();
  299. // }
  300. // api_cloudLoading();
  301. // state.playBtnDirection = query.imagePos === 'left' ? 'left' : 'right';
  302. // state.isAttendClass = (query.imagePos === 'left' || query.imagePos === 'right') ? true : false;
  303. // if (state.fingeringInfo.direction === "vertical" && state.setting.displayFingering) {
  304. // state.musicScoreBtnDirection = state.playBtnDirection === 'right' ? 'left' : 'right';
  305. // } else {
  306. // state.musicScoreBtnDirection = state.playBtnDirection;
  307. // }
  308. // 管乐迷曲谱详情页,需要下载A4尺寸的图片
  309. setTimeout(() => {
  310. if (query.downPng === 'A4' && state.partIndex != 999) {
  311. const imgList = getSvgPngToSize(state.osmd)
  312. console.log('A4', imgList)
  313. window.parent.postMessage({
  314. api: 'musicStaffRender',
  315. loading: false,
  316. osmdImg: imgList
  317. }, '*');
  318. }
  319. }, 100);
  320. state.musicScoreBtnDirection = state.playBtnDirection;
  321. state.musicRendered = true;
  322. evaluatCreateMusicPlayer();
  323. resetPlaybackToStart();
  324. // 需要重新设置作业选段
  325. if (state.workSectionNeedReset) {
  326. resetSection();
  327. }
  328. // pushAppMusic();
  329. // console.timeEnd("渲染加载耗时");
  330. };
  331. function handleOnRendered(osmd: any) {
  332. try{
  333. handleRendered(osmd)
  334. }catch(err:any){
  335. console.log(err, "err")
  336. // 需要向外面(iframe)派发计时器数据的时候触发
  337. if(query.isbeatTimes){
  338. console.log("webApi_beatTimes",err)
  339. window.parent.postMessage(
  340. {
  341. api: "webApi_beatTimes",
  342. data: "节拍器时值错误!!"
  343. },
  344. "*"
  345. );
  346. }
  347. }
  348. }
  349. /** 指法配置 */
  350. const fingerConfig = computed<any>(() => {
  351. if (state.setting.displayFingering && state.fingeringInfo?.name) {
  352. // 横向指法
  353. console.log("横向指法", state.fingeringInfo.name);
  354. if (state.fingeringInfo.direction === "transverse") {
  355. return {
  356. container: {
  357. //paddingBottom: headerColumnHide.value ? state.fingeringInfo.height : state.fingeringInfo.scaleData?.offset
  358. paddingBottom: state.fingeringInfo.height
  359. },
  360. // 横向指法,跟练&评测模式,默认展示贴底展示
  361. // fingerBox: headerColumnHide.value ? {
  362. // height: state.fingeringInfo.height
  363. // } : {
  364. // height: state.fingeringInfo.height,
  365. // transform: `scale(${state.fingeringInfo.scaleData?.scale})`
  366. // }
  367. fingerBox: {
  368. height: state.fingeringInfo.height
  369. }
  370. };
  371. } else {
  372. console.log("竖向指法", state.fingeringInfo.name, state.playBtnDirection, state.platform);
  373. // 老师端,竖向指法,需要根据功能按钮方向进行设置
  374. if (state.platform === IPlatform.PC) {
  375. return {
  376. container: {
  377. paddingRight: state.playBtnDirection === "right" ? "initial" : state.fingeringInfo.width,
  378. paddingLeft: state.playBtnDirection === "right" ? state.fingeringInfo.width : "initial",
  379. },
  380. fingerBox: {
  381. position: "absolute",
  382. width: state.fingeringInfo.width,
  383. height: state.fingeringInfo.name === "hulusi-flute" ? "86%" : "80%",
  384. right: state.playBtnDirection === "right" ? "initial" : 0,
  385. left: state.playBtnDirection === "right" ? 0 : "initial",
  386. top: (state.fingeringInfo.name === "ocarina" || state.fingeringInfo.name === "whistling") ? "60px" : state.fingeringInfo.name === "hulusi-flute" ? "10px" : (state.fingeringInfo.name === "baroque-recorder" || state.fingeringInfo.name === "piccolo") ? "36px" : "10%",
  387. },
  388. };
  389. } else {
  390. return {
  391. container: {
  392. paddingLeft: state.fingeringInfo.width,
  393. },
  394. fingerBox: {
  395. position: "absolute",
  396. width: state.fingeringInfo.width,
  397. height: state.fingeringInfo.name === "hulusi-flute" ? "86%" : "80%",
  398. left: 0,
  399. top: (state.fingeringInfo.name === "ocarina" || state.fingeringInfo.name === "whistling") ? "60px" : state.fingeringInfo.name === "hulusi-flute" ? "10px" : (state.fingeringInfo.name === "baroque-recorder" || state.fingeringInfo.name === "piccolo") ? "36px" : "10%",
  400. },
  401. };
  402. }
  403. }
  404. }
  405. return {
  406. container: {},
  407. fingerBox: {},
  408. };
  409. });
  410. // 监听指法显示
  411. watch(
  412. () => state.setting.displayFingering,
  413. () => {
  414. if (state.fingeringInfo.direction === "vertical") {
  415. // if (state.setting.displayFingering) {
  416. // state.musicScoreBtnDirection = state.playBtnDirection === 'left' ? 'right' : 'left'
  417. // } else {
  418. // state.musicScoreBtnDirection = state.playBtnDirection
  419. // }
  420. state.musicScoreBtnDirection = state.playBtnDirection;
  421. }
  422. }
  423. );
  424. watch(
  425. () => state.setting.soundEffect,
  426. () => {
  427. store.set("musicscoresetting", state.setting);
  428. }
  429. );
  430. /**播放状态改变时,向父页面发送事件 */
  431. const sendParentMessage = (playState: IAudioState) => {
  432. window.parent.postMessage(
  433. {
  434. api: "headerTogge",
  435. playState: playState,
  436. },
  437. "*"
  438. );
  439. };
  440. // 监听播放状态
  441. watch(
  442. () => state.playState,
  443. () => {
  444. _timeColumnHide && clearTimeout(_timeColumnHide)
  445. headerColumnHide.value = state.playState === "play" ? true : false;
  446. sendParentMessage(state.playState);
  447. }
  448. );
  449. // 监听跟练的开启状态
  450. watch(
  451. () => followData.practiceStart,
  452. () => {
  453. _timeColumnHide && clearTimeout(_timeColumnHide)
  454. headerColumnHide.value = followData.practiceStart;
  455. }
  456. );
  457. // 监听开始评测状态
  458. watch(
  459. () => evaluatingData.startBegin,
  460. () => {
  461. _timeColumnHide && clearTimeout(_timeColumnHide)
  462. headerColumnHide.value = evaluatingData.startBegin;
  463. }
  464. );
  465. /** 指法预览切换 */
  466. watch(
  467. () => detailData.fingerPreView,
  468. () => {
  469. console.log(2342);
  470. window.parent.postMessage(
  471. {
  472. api: "api_fingerPreView",
  473. state: detailData.fingerPreView,
  474. },
  475. "*"
  476. );
  477. }
  478. );
  479. const pageVisible = usePageVisibility();
  480. watch(
  481. () => pageVisible.value,
  482. (val) => {
  483. if (val === "hidden") {
  484. // 如果是播放状态,需要暂停播放
  485. // console.log("页面隐藏停止播放");
  486. if (state.playState === "play") {
  487. togglePlay("paused");
  488. }
  489. }
  490. }
  491. );
  492. const handleOpenFignerView = () => {
  493. if (!query.modelType) {
  494. detailData.orientation = state.fingeringInfo.orientation || 0;
  495. api_setRequestedOrientation(detailData.orientation);
  496. }
  497. // const url = `${
  498. // /(192|localhost)/.test(location.origin)
  499. // ? "http://192.168.3.114:3000/instrument.html"
  500. // : location.origin + location.pathname
  501. // }#/view-figner`;
  502. // console.log("🚀 ~ url:", url);
  503. // api_openWebView({
  504. // url: url,
  505. // orientation: state.fingeringInfo.orientation || 0,
  506. // });
  507. if (state.playState === "play") {
  508. togglePlay("paused");
  509. setTimeout(() => {
  510. detailData.fingerPreView = true;
  511. }, 500);
  512. return;
  513. }
  514. detailData.fingerPreView = true;
  515. };
  516. const handleCloseFignerView = () => {
  517. if (!query.modelType && detailData.orientation == 1) {
  518. api_setRequestedOrientation(0);
  519. }
  520. detailData.fingerPreView = false;
  521. detailData.fingerPreViewGuide = false;
  522. };
  523. let _timeColumnHide: NodeJS.Timeout
  524. return () => (
  525. <div
  526. class={[styles.detail, styles[state.modeType], state.setting.eyeProtection && "eyeProtection", state.platform === IPlatform.PC && state.zoom > 0.8 && styles.PC, state.isPreView && styles.preViewDetail, state.isCbsView && styles.cbsViewDetail]}
  527. style={{
  528. "--detailDataPaddingLeft": detailData.paddingLeft,
  529. paddingLeft: detailData.paddingLeft,
  530. background: state.setting.camera && state.modeType === 'evaluating' ? `rgba(${state.setting.eyeProtection ? "253,244,229" : "255,255,255"} ,${state.setting.cameraOpacity / 100}) !important` : "",
  531. }}
  532. >
  533. <div
  534. style={{opacity: state.setting.camera && state.modeType === 'evaluating' ? state.setting.cameraOpacity / 100 : 1}}
  535. class={[styles.pageBg, styles[state.modeType]]} >
  536. </div>
  537. {/* 骨架屏 */}
  538. {/* <Transition name="van-fade">
  539. {detailData.skeletonLoading && (
  540. <div class={styles.skeleton}>
  541. <Skeleton row={8} />
  542. </div>
  543. )}
  544. </Transition> */}
  545. {/* 曲目加载错误的缺省 */}
  546. <EmptyMusic></EmptyMusic>
  547. {/** 功能按钮 */}
  548. {!state.isPreView && <div class={["headHeight", styles.headHeight, headerColumnHide.value && styles.headHide]}>{state.musicRendered && <HeaderTop />}</div>}
  549. <div
  550. id="scrollContainer"
  551. style={{ ...fingerConfig.value.container }}
  552. class={[styles.container, !state.setting.displayCursor && "hideCursor", browsInfo.xiaomi && styles.xiaomi, state.platform === IPlatform.PC && styles.pcContainer]}
  553. onClick={(e: Event) => {
  554. e.stopPropagation();
  555. // 点击谱面跟练也需要切换显示按钮栏
  556. if (state.playState === "play" || followData.start || evaluatingData.startBegin) {
  557. _timeColumnHide && clearTimeout(_timeColumnHide)
  558. headerColumnHide.value = !headerColumnHide.value;
  559. if(!headerColumnHide.value){
  560. _timeColumnHide = setTimeout(() => {
  561. _timeColumnHide && clearTimeout(_timeColumnHide)
  562. headerColumnHide.value = true
  563. }, 3000);
  564. }
  565. }
  566. }}
  567. >
  568. {/* 曲谱渲染 */}
  569. {!detailData.isLoading &&
  570. <MusicScore
  571. ref={musicScoreRef}
  572. musicColor='#000000'
  573. showPartNames={state.isCombineRender}
  574. onRendered={handleOnRendered}
  575. >
  576. {/* 旋律线关闭时候的 标题和作者 */}
  577. { musicData.showSelection && <AuthorName></AuthorName>}
  578. {/* 节拍器 */}
  579. {!detailData.isLoading && !detailData.skeletonLoading && <Tick />}
  580. </MusicScore>
  581. }
  582. {/* {
  583. state.musicRendered &&
  584. <TestCheck />
  585. } */}
  586. {/* 指法 */}
  587. {state.setting.displayFingering && state.fingeringInfo?.name && !state.isPreView && state.isShowFingering && (
  588. <div style={{ ...fingerConfig.value.fingerBox }} class={styles.fingeringCon}>
  589. <Fingering
  590. ref={fingerRef}
  591. style={{
  592. background: state.setting.camera ? `rgba(${state.setting.eyeProtection ? "253,244,229" : "255,255,255"} ,${state.setting.cameraOpacity / 100})` : "",
  593. }}
  594. onOpen={() => handleOpenFignerView()}
  595. />
  596. </div>
  597. )}
  598. </div>
  599. {/* 曲目渲染完成,再去下载mp3资源 */}
  600. {!detailData.isLoading && <AudioList />}
  601. {/* {!detailData.isLoading && <TheAudio src={tickWav} />} */}
  602. {/* 预加载延迟检测组建 */}
  603. {/* {!detailData.isLoading && !detailData.skeletonLoading && evaluatingData.preloadJson && !evaluatingData.jsonLoadDone && (
  604. <div class={styles.preJson}>
  605. <DelayCheck isPreLoad={true} />
  606. </div>
  607. )} */}
  608. {/* 评测 */}
  609. {state.modeType === "evaluating" && (
  610. <>
  611. <Evaluating />
  612. {evaluatingData.rendered && <EvaluatModel />}
  613. </>
  614. )}
  615. {/* 跟练模式 */}
  616. {state.modeType === "follow" && (
  617. <>
  618. <FollowPractice />
  619. <FollowModel />
  620. </>
  621. )}
  622. {/* 切换曲谱 */}
  623. {!query.lessonTrainingId && !query.questionId && state.isConcert && <ToggleMusicSheet />}
  624. {state.musicRendered && !state.isPreView && (
  625. <>
  626. {/* 统计训练时长 */}
  627. <RecordingTime />
  628. {/* 今日练习统计 */}
  629. {state.systemType === "student" && <ExerciseStatistics />}
  630. {/* 作业 */}
  631. {state.isHomeWork && <WorkIndex />}
  632. {/* 曲谱列表 */}
  633. {isMusicList.value && <TheMusicList />}
  634. </>
  635. )}
  636. {/* vip */}
  637. {
  638. !detailData.isLoading && <Vip></Vip>
  639. }
  640. <Loading tipText={state.loadingText} />
  641. <Popup
  642. zIndex={5050}
  643. teleport="body"
  644. v-model:show={detailData.fingerPreView}
  645. position="bottom"
  646. onClosed={() => {
  647. detailData.fingerPreViewAnimation = false;
  648. }}
  649. onOpen={() => {
  650. detailData.fingerPreViewAnimation = true;
  651. }}
  652. onOpened={() => {
  653. detailData.fingerPreViewGuide = true;
  654. }}
  655. >
  656. {detailData.fingerPreViewAnimation && <ViewFigner show={detailData.fingerPreViewGuide} subject={state.fingeringInfo.name} isComponent={true} onClose={handleCloseFignerView} />}
  657. </Popup>
  658. </div>
  659. );
  660. },
  661. });