index.tsx 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  1. import { Popup, Skeleton } from "vant";
  2. import { computed, defineComponent, nextTick, onBeforeMount, onBeforeUnmount, onMounted, 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 { recalculateNoteData } from "/src/view/selection";
  30. import ToggleMusicSheet from "/src/view/plugins/toggleMusicSheet";
  31. import { setCustomGradual, setCustomNoteRealValue } from "/src/helpers/customMusicScore";
  32. import { usePageVisibility } from "@vant/use";
  33. import { initMidi } from "/src/helpers/midiPlay";
  34. import TheAudio from "/src/components/the-audio";
  35. import tickWav from "/src/assets/tick.mp3";
  36. import AuthorName from "../component/authorName";
  37. import { initSmoothAnimation } from "./smoothAnimation";
  38. import EmptyMusic, { isEmptyMusicShow } from "./emptyMusic";
  39. import { position } from "html2canvas/dist/types/css/property-descriptors/position";
  40. import Loading from "./loading"
  41. import LoadingCss from "./loadingCss"
  42. // import bgJson from "./images/index.json";
  43. import bg2Left from "./images/bg2_left_zs.png";
  44. import bg2Right from "./images/bg2_right_zs.png";
  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. onBeforeMount(async () => {
  114. // console.time("渲染加载耗时");
  115. api_keepScreenLongLight();
  116. getAPPData();
  117. api_setStatusBarVisibility();
  118. const settting = store.get("musicscoresetting");
  119. if (settting) {
  120. //state.setting = settting;
  121. Object.assign(state.setting, settting);
  122. //state.setting.beatVolume = state.setting.beatVolume || 50
  123. state.setting.beatVolume = 50;
  124. if (state.setting.camera) {
  125. const res = await api_openCamera();
  126. // 没有授权
  127. if (res?.content?.reson) {
  128. state.setting.camera = false;
  129. store.set("musicscoresetting", state.setting);
  130. }
  131. }
  132. }
  133. });
  134. //给app传伴奏
  135. const pushAppMusic = () => {
  136. api_cloudAccompanyMessage(state.accompany);
  137. };
  138. // console.log(route.params, query)
  139. // 动态加载json背景
  140. const bgJsonData: any = ref(null);
  141. const jsonFiles: any = {
  142. data: () => import('./images/index.json'),
  143. };
  144. const loadJson = async (fileKey: any) => {
  145. try {
  146. const data = await jsonFiles[fileKey]();
  147. bgJsonData.value = data.default;
  148. } catch (error) {
  149. console.error('👀~json背景加载失败', error);
  150. }
  151. };
  152. onMounted(async () => {
  153. (window as any).appName = "colexiu";
  154. const id = query.id || "43554";
  155. state.isCbsView = query.isCbs;
  156. // 如果是纯预览模式,0.65倍缩放谱面
  157. state.isPreView = query.isPreView;
  158. if (state.isPreView) {
  159. state.zoom = query.zoom || 0.65
  160. }
  161. if (id == "1814218144844087298" && state.isSingleLine) {
  162. state.zoom = 0.7;
  163. }
  164. // 只有总控平台和预览 默认是多行谱
  165. //(state.isPreView || query.isCbs) && (state.isSingleLine = false)
  166. // Promise.all([sysMusicScoreAccompanimentQueryPage(id)]).then((values) => {
  167. // getMusicInfo(values[0]);
  168. // });
  169. loadJson('data');
  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. /** 渲染完成 */
  197. const handleRendered = (osmd: any) => {
  198. api_cloudLoading();
  199. console.timeEnd("渲染加载耗时");
  200. detailData.skeletonLoading = false;
  201. state.osmd = osmd;
  202. // 没有设置速度使用读取的速度
  203. if (state.originSpeed === 0) {
  204. state.originSpeed = state.speed = (osmd as any).bpm || osmd.Sheet.userStartTempoInBPM || 100;
  205. }
  206. // const saveSpeed = (store.get("speeds") || {})[state.examSongId] || state.speed || (osmd as any).bpm || osmd.Sheet.userStartTempoInBPM;
  207. // // 加载本地缓存的速度
  208. // if (saveSpeed) {
  209. // handleSetSpeed(saveSpeed);
  210. // }
  211. setCustomGradual();
  212. setCustomNoteRealValue();
  213. state.times = formateTimes(osmd);
  214. // state.times = resetFrequency(state.times);
  215. state.times = setNoteHalfTone(state.times);
  216. state.xmlHasLyric = state.times.some((item: any) => item?.formatLyricsEntries?.length);
  217. console.log("🚀 ~ state.times:", state.times, state.subjectId, state);
  218. nextTick(() => {
  219. state.activeMeasureIndex = state.times[0].MeasureNumberXML;
  220. });
  221. // 一行谱
  222. if (state.isSingleLine) {
  223. // 音符添加位置信息bbox
  224. addNoteBBox(state.times);
  225. // 一行谱创建 动画
  226. initSmoothAnimation();
  227. }
  228. // 初始化midi音频信息
  229. const songEndTime = state.times[state.times.length - 1 || 0]?.endtime || 0;
  230. if (state.isAppPlay) {
  231. const durationNum = songEndTime;
  232. initMidi(durationNum, state.midiUrl);
  233. }
  234. state.measureTime = state.times[0]?.measureLength || 0;
  235. try {
  236. metronomeData.metro = new Metronome();
  237. metronomeData.metro.init(state.times);
  238. } catch (error) {}
  239. // 需要向外面(iframe)派发计时器数据的时候触发
  240. if (query.isbeatTimes) {
  241. const { isOpenMetronome, isSingOpenMetronome } = state;
  242. const { xmlMp3BeatFixTime, difftime } = state.times[0];
  243. const singBeatTime: number[][] = [];
  244. const beatTime = metronomeData.metroMeasure.map((metroMeasure) => {
  245. const singBeat: number[] = [];
  246. const beatTimeItem = metroMeasure.map((item: any) => {
  247. let singTime = item.time;
  248. if (isSingOpenMetronome && !isOpenMetronome) {
  249. singTime += xmlMp3BeatFixTime;
  250. } else if (!isSingOpenMetronome && isOpenMetronome) {
  251. singTime -= xmlMp3BeatFixTime;
  252. }
  253. singBeat.push(singTime);
  254. return item.time;
  255. });
  256. singBeatTime.push(singBeat);
  257. return beatTimeItem;
  258. });
  259. //改为唱名
  260. state.fixtime = difftime;
  261. state.times.map((item) => {
  262. item.time = item.xmlNoteTime + difftime;
  263. item.endtime = item.xmlNoteEndTime + difftime;
  264. item.fixtime = difftime;
  265. });
  266. metronomeData.metro.calculation(state.times);
  267. const mingBeatTime: number[][] = metronomeData.metroMeasure.map((metroMeasure) => {
  268. const beatTimeItem = metroMeasure.map((item: any) => {
  269. return item.time;
  270. });
  271. return beatTimeItem;
  272. });
  273. const webApi_beatTimes = { beatTime, singBeatTime, mingBeatTime, isBeatTime:!state.isEvxml, isSingBeatTime:!state.isEvxml, isMingBeatTime:!state.isEvxml }
  274. console.log("webApi_beatTimes", webApi_beatTimes);
  275. window.parent.postMessage(
  276. {
  277. api: "webApi_beatTimes",
  278. data: JSON.stringify(webApi_beatTimes),
  279. },
  280. "*"
  281. );
  282. return
  283. }
  284. // 刷新时值
  285. handlerModeChange("play", "music");
  286. /**
  287. * 2024.1.25
  288. * 设置节拍器,跟练需要播放系统节拍器,所以不需要判断needTick状态
  289. */
  290. // if (state.needTick) {
  291. handleInitTick(osmd?.Sheet?.SheetPlaybackSetting?.Rhythm?.Numerator || 4, osmd?.Sheet?.SheetPlaybackSetting?.Rhythm?.denominator);
  292. // }
  293. // api_cloudLoading();
  294. // state.playBtnDirection = query.imagePos === 'left' ? 'left' : 'right';
  295. // state.isAttendClass = (query.imagePos === 'left' || query.imagePos === 'right') ? true : false;
  296. // if (state.fingeringInfo.direction === "vertical" && state.setting.displayFingering) {
  297. // state.musicScoreBtnDirection = state.playBtnDirection === 'right' ? 'left' : 'right';
  298. // } else {
  299. // state.musicScoreBtnDirection = state.playBtnDirection;
  300. // }
  301. state.musicScoreBtnDirection = state.playBtnDirection;
  302. state.musicRendered = true;
  303. evaluatCreateMusicPlayer();
  304. resetPlaybackToStart();
  305. // 需要重新设置作业选段
  306. if (state.workSectionNeedReset) {
  307. resetSection();
  308. }
  309. // pushAppMusic();
  310. // console.timeEnd("渲染加载耗时");
  311. };
  312. function handleOnRendered(osmd: any) {
  313. try{
  314. handleRendered(osmd)
  315. }catch(err:any){
  316. // 需要向外面(iframe)派发计时器数据的时候触发
  317. if(query.isbeatTimes){
  318. console.log("webApi_beatTimes",err)
  319. window.parent.postMessage(
  320. {
  321. api: "webApi_beatTimes",
  322. data: "节拍器时值错误!!"
  323. },
  324. "*"
  325. );
  326. }
  327. }
  328. }
  329. /** 指法配置 */
  330. const fingerConfig = computed<any>(() => {
  331. if (state.setting.displayFingering && state.fingeringInfo?.name) {
  332. if (state.fingeringInfo.direction === "transverse") {
  333. return {
  334. container: {
  335. //paddingBottom: headerColumnHide.value ? state.fingeringInfo.height : state.fingeringInfo.scaleData?.offset
  336. paddingBottom: state.fingeringInfo.height
  337. },
  338. // 横向指法,跟练&评测模式,默认展示贴底展示
  339. // fingerBox: headerColumnHide.value ? {
  340. // height: state.fingeringInfo.height
  341. // } : {
  342. // height: state.fingeringInfo.height,
  343. // transform: `scale(${state.fingeringInfo.scaleData?.scale})`
  344. // }
  345. fingerBox: {
  346. height: state.fingeringInfo.height
  347. }
  348. };
  349. } else {
  350. console.log("指法", state.playBtnDirection, state.platform);
  351. // 老师端,竖向指法,需要根据功能按钮方向进行设置
  352. if (state.platform === IPlatform.PC) {
  353. return {
  354. container: {
  355. paddingRight: state.playBtnDirection === "right" ? "initial" : state.fingeringInfo.width,
  356. paddingLeft: state.playBtnDirection === "right" ? state.fingeringInfo.width : "initial",
  357. },
  358. fingerBox: {
  359. position: "absolute",
  360. width: state.fingeringInfo.width,
  361. height: state.fingeringInfo.name === "hulusi-flute" ? "86%" : "80%",
  362. right: state.playBtnDirection === "right" ? "initial" : 0,
  363. left: state.playBtnDirection === "right" ? 0 : "initial",
  364. 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" : 0,
  365. },
  366. };
  367. } else {
  368. return {
  369. container: {
  370. paddingLeft: state.fingeringInfo.width,
  371. },
  372. fingerBox: {
  373. position: "absolute",
  374. width: state.fingeringInfo.width,
  375. height: state.fingeringInfo.name === "hulusi-flute" ? "86%" : "80%",
  376. left: 0,
  377. 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" : 0,
  378. },
  379. };
  380. }
  381. }
  382. }
  383. return {
  384. container: {},
  385. fingerBox: {},
  386. };
  387. });
  388. // 监听指法显示
  389. watch(
  390. () => state.setting.displayFingering,
  391. () => {
  392. if (state.fingeringInfo.direction === "vertical") {
  393. // if (state.setting.displayFingering) {
  394. // state.musicScoreBtnDirection = state.playBtnDirection === 'left' ? 'right' : 'left'
  395. // } else {
  396. // state.musicScoreBtnDirection = state.playBtnDirection
  397. // }
  398. state.musicScoreBtnDirection = state.playBtnDirection;
  399. }
  400. }
  401. );
  402. watch(
  403. () => state.setting.soundEffect,
  404. () => {
  405. store.set("musicscoresetting", state.setting);
  406. }
  407. );
  408. /**播放状态改变时,向父页面发送事件 */
  409. const sendParentMessage = (playState: IAudioState) => {
  410. window.parent.postMessage(
  411. {
  412. api: "headerTogge",
  413. playState: playState,
  414. },
  415. "*"
  416. );
  417. };
  418. // 监听播放状态
  419. watch(
  420. () => state.playState,
  421. () => {
  422. // if (state.platform != IPlatform.PC) {
  423. // headerColumnHide.value = state.playState === "play" ? true : false;
  424. // }
  425. headerColumnHide.value = state.playState === "play" ? true : false;
  426. sendParentMessage(state.playState);
  427. }
  428. );
  429. // 监听跟练的开启状态
  430. watch(
  431. () => followData.practiceStart,
  432. () => {
  433. headerColumnHide.value = followData.practiceStart;
  434. }
  435. );
  436. // 监听开始评测状态
  437. watch(
  438. () => evaluatingData.startBegin,
  439. () => {
  440. headerColumnHide.value = evaluatingData.startBegin;
  441. }
  442. );
  443. /** 指法预览切换 */
  444. watch(
  445. () => detailData.fingerPreView,
  446. () => {
  447. console.log(2342);
  448. window.parent.postMessage(
  449. {
  450. api: "api_fingerPreView",
  451. state: detailData.fingerPreView,
  452. },
  453. "*"
  454. );
  455. }
  456. );
  457. const pageVisible = usePageVisibility();
  458. watch(
  459. () => pageVisible.value,
  460. (val) => {
  461. if (val === "hidden") {
  462. // 如果是播放状态,需要暂停播放
  463. // console.log("页面隐藏停止播放");
  464. if (state.playState === "play") {
  465. togglePlay("paused");
  466. }
  467. }
  468. }
  469. );
  470. const handleOpenFignerView = () => {
  471. if (!query.modelType) {
  472. detailData.orientation = state.fingeringInfo.orientation || 0;
  473. api_setRequestedOrientation(detailData.orientation);
  474. }
  475. // const url = `${
  476. // /(192|localhost)/.test(location.origin)
  477. // ? "http://192.168.3.114:3000/instrument.html"
  478. // : location.origin + location.pathname
  479. // }#/view-figner`;
  480. // console.log("🚀 ~ url:", url);
  481. // api_openWebView({
  482. // url: url,
  483. // orientation: state.fingeringInfo.orientation || 0,
  484. // });
  485. if (state.playState === "play") {
  486. togglePlay("paused");
  487. setTimeout(() => {
  488. detailData.fingerPreView = true;
  489. }, 500);
  490. return;
  491. }
  492. detailData.fingerPreView = true;
  493. };
  494. const handleCloseFignerView = () => {
  495. if (!query.modelType && detailData.orientation == 1) {
  496. api_setRequestedOrientation(0);
  497. }
  498. detailData.fingerPreView = false;
  499. detailData.fingerPreViewGuide = false;
  500. };
  501. return () => (
  502. <div
  503. 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]}
  504. style={{
  505. "--detailDataPaddingLeft": detailData.paddingLeft,
  506. paddingLeft: detailData.paddingLeft,
  507. background: state.setting.camera && state.modeType === 'evaluating' ? `rgba(${state.setting.eyeProtection ? "253,244,229" : "255,255,255"} ,${state.setting.cameraOpacity / 100}) !important` : "",
  508. }}
  509. >
  510. {bgJsonData.value ?
  511. <img
  512. style={{opacity: state.setting.camera && state.modeType === 'evaluating' ? state.setting.cameraOpacity / 100 : 1}}
  513. class={styles.pageBg}
  514. src={state.modeType === 'practise' ? bgJsonData.value[1] : state.modeType === 'evaluating' ? bgJsonData.value[2] : state.modeType === 'follow' ? bgJsonData.value[3] : ''}
  515. /> : <div
  516. style={{opacity: state.setting.camera && state.modeType === 'evaluating' ? state.setting.cameraOpacity / 100 : 1}}
  517. class={[styles.pageBg, styles[state.modeType]]} >
  518. </div>
  519. }
  520. {
  521. state.modeType === 'evaluating' ? (<>
  522. <img src={bg2Left} class={styles.bg2Left} />
  523. <img src={bg2Right} class={styles.bg2Right} />
  524. </>
  525. ) : null}
  526. {/* 骨架屏 */}
  527. {/* <Transition name="van-fade">
  528. {detailData.skeletonLoading && (
  529. <div class={styles.skeleton}>
  530. <Skeleton row={8} />
  531. </div>
  532. )}
  533. </Transition> */}
  534. {/* 曲目加载错误的缺省 */}
  535. <EmptyMusic></EmptyMusic>
  536. {/** 功能按钮 */}
  537. {!state.isPreView && <div class={["headHeight", styles.headHeight, headerColumnHide.value && styles.headHide]}>{state.musicRendered && <HeaderTop />}</div>}
  538. <div
  539. id="scrollContainer"
  540. style={{ ...fingerConfig.value.container }}
  541. class={[styles.container, !state.setting.displayCursor && "hideCursor", browsInfo.xiaomi && styles.xiaomi, state.platform === IPlatform.PC && styles.pcContainer]}
  542. onClick={(e: Event) => {
  543. e.stopPropagation();
  544. // if (state.playState === "play" && state.platform != IPlatform.PC) {
  545. // headerColumnHide.value = !headerColumnHide.value;
  546. // }
  547. // 点击谱面跟练也需要切换显示按钮栏
  548. if (state.playState === "play" || followData.start || evaluatingData.startBegin) {
  549. headerColumnHide.value = !headerColumnHide.value;
  550. }
  551. }}
  552. >
  553. {/* 曲谱渲染 */}
  554. {!detailData.isLoading &&
  555. <MusicScore
  556. ref={musicScoreRef}
  557. musicColor={state.isPreView || state.isCbsView ? '#000000' : '#FFFFFF'}
  558. showPartNames={state.isCombineRender}
  559. onRendered={handleOnRendered}
  560. >
  561. {/* 旋律线关闭时候的 标题和作者 */}
  562. <AuthorName></AuthorName>
  563. {/* 节拍器 */}
  564. {!detailData.isLoading && !detailData.skeletonLoading && <Tick />}
  565. </MusicScore>
  566. }
  567. {/* {
  568. state.musicRendered &&
  569. <TestCheck />
  570. } */}
  571. {/* 指法 */}
  572. {state.setting.displayFingering && state.fingeringInfo?.name && !state.isPreView && state.isShowFingering && (
  573. <div style={{ ...fingerConfig.value.fingerBox }} class={styles.fingeringCon}>
  574. <Fingering
  575. ref={fingerRef}
  576. style={{
  577. background: state.setting.camera ? `rgba(${state.setting.eyeProtection ? "253,244,229" : "255,255,255"} ,${state.setting.cameraOpacity / 100})` : "",
  578. }}
  579. onOpen={() => handleOpenFignerView()}
  580. />
  581. </div>
  582. )}
  583. </div>
  584. {/* 曲目渲染完成,再去下载mp3资源 */}
  585. {!detailData.isLoading && !detailData.skeletonLoading && <AudioList />}
  586. {/* {!detailData.isLoading && <TheAudio src={tickWav} />} */}
  587. {/* 预加载延迟检测组建 */}
  588. {/* {!detailData.isLoading && !detailData.skeletonLoading && evaluatingData.preloadJson && !evaluatingData.jsonLoadDone && (
  589. <div class={styles.preJson}>
  590. <DelayCheck isPreLoad={true} />
  591. </div>
  592. )} */}
  593. {/* 评测 */}
  594. {state.modeType === "evaluating" && (
  595. <>
  596. <Evaluating />
  597. {evaluatingData.rendered && <EvaluatModel />}
  598. </>
  599. )}
  600. {/* 跟练模式 */}
  601. {state.modeType === "follow" && (
  602. <>
  603. <FollowPractice />
  604. <FollowModel />
  605. </>
  606. )}
  607. {/* 切换曲谱 */}
  608. {!query.lessonTrainingId && !query.questionId && state.isConcert && <ToggleMusicSheet />}
  609. {state.musicRendered && !state.isPreView && (
  610. <>
  611. {/* 统计训练时长 */}
  612. {storeData.isApp && <RecordingTime />}
  613. {/* 作业 */}
  614. {query.workRecord && <WorkIndex />}
  615. {/* 曲谱列表 */}
  616. {isMusicList.value && <TheMusicList />}
  617. </>
  618. )}
  619. <Loading tipText={state.loadingText} />
  620. <LoadingCss />
  621. <Popup
  622. zIndex={5050}
  623. teleport="body"
  624. v-model:show={detailData.fingerPreView}
  625. position="bottom"
  626. onClosed={() => {
  627. detailData.fingerPreViewAnimation = false;
  628. }}
  629. onOpen={() => {
  630. detailData.fingerPreViewAnimation = true;
  631. }}
  632. onOpened={() => {
  633. detailData.fingerPreViewGuide = true;
  634. }}
  635. >
  636. {detailData.fingerPreViewAnimation && <ViewFigner show={detailData.fingerPreViewGuide} subject={state.fingeringInfo.name} isComponent={true} onClose={handleCloseFignerView} />}
  637. </Popup>
  638. </div>
  639. );
  640. },
  641. });