evaluating.tsx 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. import { Button, Toast } from 'vant'
  2. import { defineComponent, onBeforeUnmount, onMounted, Ref, ref, Teleport, Transition } from 'vue'
  3. import '@dotlottie/player-component'
  4. import detailState from '/src/pages/detail/state'
  5. import SettingState from '/src/pages/detail/setting-state'
  6. import {
  7. IPostMessage,
  8. listenerMessage,
  9. postMessage,
  10. promisefiyPostMessage,
  11. removeListenerMessage,
  12. CallBack
  13. } from '/src/helpers/native-message'
  14. import { browser } from '/src/helpers/utils'
  15. import runtime, * as RuntimeUtils from '/src/pages/detail/runtime'
  16. import { getBoundingBoxByverticalNote, getNoteByMeasuresSlursStart, getParentNote } from '/src/pages/detail/helpers'
  17. import { handleCheckEvaluatStatus, useClientType, useOriginSearch } from '../uses'
  18. import { startButtonShow } from './index'
  19. import { getLeveByScoreMeasure } from '/src/pages/detail/evaluating/helper'
  20. import Evaluating, { evaluatingShow } from '../popups/evaluating'
  21. // @ts-ignore
  22. import styles from './index.module.less'
  23. import { Vue3Lottie } from 'vue3-lottie'
  24. import startData from './data/start.json'
  25. import startingData from './data/starting.json'
  26. import { unitTestData } from '../unitTest'
  27. import iconEvaluatingStart from './icons/icon-evaluatingStart.png'
  28. /**
  29. * 节拍器时长
  30. * 评测模式时,应该传节拍器时长
  31. * 阶段评测时,判断是否从第一小节开始,并且曲子本身含有节拍器,需要传节拍器时长,否则传0
  32. */
  33. let actualBeatLength = 0
  34. let backtime = 0
  35. const initBehaviorId = '' + new Date().valueOf()
  36. const evaluating = ref(false)
  37. const playStatus: Ref<'connecting' | 'play' | 'stop'> = ref('stop')
  38. const endloading = ref(false)
  39. const connentLoading = ref(false)
  40. const playUrl: Ref<string> = ref('')
  41. const endResult = ref(null)
  42. const browserInfo = browser()
  43. /**
  44. * 默认按照442计算的音符频率,此处转化为按照设置进行调整
  45. * @param num 频率
  46. * @returns 转化后频率
  47. */
  48. const formatPitch = (num?: number): number => {
  49. if (!num) {
  50. return -1
  51. }
  52. if (SettingState.sett.hertz && SettingState.sett.hertz !== 442) {
  53. return (num / 442) * SettingState.sett.hertz
  54. }
  55. return num
  56. }
  57. let starTime = 0
  58. const formatTimes = () => {
  59. const rate = runtime.speed / detailState.baseSpeed //1
  60. actualBeatLength = Math.round(detailState.times[0].fixtime * 1000 / rate)
  61. const difftime = detailState.times?.[0]?.difftime || 0
  62. let ListenMode = false
  63. let dontEvaluatingMode = false
  64. let skip = false
  65. const datas = []
  66. let times = detailState.times
  67. // 阶段评测前一个节拍的标示
  68. let preLyricsContent = ''
  69. let preTimes = []
  70. if (unitTestData.isSelectMeasureMode) {
  71. const startIndex = detailState.times.findIndex(
  72. (n: any) => n.NoteToGraphicalNoteObjectId == detailState.section[0].NoteToGraphicalNoteObjectId
  73. )
  74. const endIndex = detailState.times.findIndex(
  75. (n: any) => n.NoteToGraphicalNoteObjectId == detailState.section[1].NoteToGraphicalNoteObjectId
  76. )
  77. times = detailState.times.filter((n: any, index: number) => {
  78. return index >= startIndex && index <= endIndex
  79. })
  80. preTimes = detailState.times.filter((n: any, index: number) => {
  81. return index < startIndex
  82. })
  83. starTime = times[0].sourceRelativeTime || times[0].relativeTime
  84. actualBeatLength = startIndex == 0 && !detailState.needTick ? actualBeatLength : 0
  85. // console.log("🚀 ~ times", times, '开始小节', startIndex, actualBeatLength)
  86. }
  87. // 找到阶段评测,开始小节前面最近的是play或者listen的小节
  88. if (preTimes.length) {
  89. for (let index = preTimes.length-1; index >= 0; index--) {
  90. const item = preTimes[index]
  91. const note = getNoteByMeasuresSlursStart(item)
  92. if (note.formatLyricsEntries.contains('Play') || note.formatLyricsEntries.contains('Play...')) {
  93. preLyricsContent = 'Play'
  94. break
  95. }
  96. if (note.formatLyricsEntries.contains('Listen')) {
  97. preLyricsContent = 'Listen'
  98. break
  99. }
  100. }
  101. preLyricsContent = preLyricsContent ? preLyricsContent : 'Play'
  102. }
  103. let measureIndex = -1
  104. let recordMeasure = -1
  105. for (let index = 0; index < times.length; index++) {
  106. const item = times[index]
  107. const note = getNoteByMeasuresSlursStart(item)
  108. const rate = runtime.speed / detailState.baseSpeed //1
  109. const start = difftime + (item.sourceRelativeTime || item.relativeTime) - starTime
  110. const end = difftime + (item.sourceRelaEndtime || item.relaEndtime) - starTime
  111. // console.log(start, end, starTime)
  112. const isStaccato =
  113. typeof note.voiceEntry.isStaccato === 'function' ? note.voiceEntry.isStaccato() : note.voiceEntry.isStaccato
  114. const noteRate = isStaccato ? 0.5 : 1
  115. // console.log('注脚', note.formatLyricsEntries)
  116. // 如果阶段评测,开始小节没有注脚,则取前面最近的小节的注脚
  117. if (index == 0 && !note.formatLyricsEntries.length) {
  118. ListenMode = preLyricsContent === 'Play' ? false : preLyricsContent === 'Listen' ? true : false
  119. }
  120. if (note.formatLyricsEntries.contains('Play') || note.formatLyricsEntries.contains('Play...')) {
  121. ListenMode = false
  122. }
  123. if (note.formatLyricsEntries.contains('Listen')) {
  124. ListenMode = true
  125. }
  126. if (note.formatLyricsEntries.contains('纯律结束')) {
  127. dontEvaluatingMode = false
  128. }
  129. if (note.formatLyricsEntries.contains('纯律')) {
  130. dontEvaluatingMode = true
  131. }
  132. const nextNote = detailState.times[index + 1]
  133. if (skip && (note.stave || !note.noteElement.isRestFlag || (nextNote && !nextNote.noteElement.isRestFlag))) {
  134. skip = false
  135. }
  136. if (note.noteElement.isRestFlag && !!note.stave && !!nextNote && nextNote.noteElement.isRestFlag) {
  137. skip = true
  138. }
  139. if (note.measureOpenIndex != recordMeasure) {
  140. measureIndex++
  141. recordMeasure = note.measureOpenIndex
  142. }
  143. // console.log(note.measureOpenIndex , measureIndex, note.noteElement.sourceMeasure.measureListIndex)
  144. const data = {
  145. timeStamp: (start * 1000) / rate,
  146. duration: ((end * 1000) / rate - (start * 1000) / rate) * noteRate,
  147. frequency: formatPitch(item.noteElement?.pitch?.frequency),
  148. nextFrequency: formatPitch(item.noteElement?.pitch?.nextFrequency),
  149. prevFrequency: formatPitch(item.noteElement?.pitch?.prevFrequency),
  150. measureIndex: measureIndex, //note.measureOpenIndex,
  151. measureRenderIndex: note.noteElement.sourceMeasure.measureListIndex,
  152. dontEvaluating: ListenMode || dontEvaluatingMode || item.skipMode,
  153. musicalNotesIndex: index, //item.i,
  154. denominator: note.noteElement?.Length.denominator,
  155. isOrnament: !!note?.voiceEntry?.ornamentContainer,
  156. }
  157. datas.push(data)
  158. }
  159. return datas
  160. }
  161. const connect = async () => {
  162. const search = useOriginSearch()
  163. connentLoading.value = true
  164. const behaviorId = sessionStorage.getItem('behaviorId') || search.behaviorId || initBehaviorId
  165. const rate = runtime.speed / detailState.baseSpeed //1
  166. const content = {
  167. musicXmlInfos: formatTimes(),
  168. subjectId: detailState.subjectId,
  169. detailId: detailState.activeDetail?.id,
  170. examSongId: search.id,
  171. xmlUrl: detailState?.activeDetail?.xmlUrl,
  172. partIndex: detailState.partIndex,
  173. behaviorId,
  174. platform: 'WEB',
  175. clientId: 'STUDENT',
  176. hertz: SettingState.sett.hertz,
  177. feature: 'EVALUATION',
  178. practiceSource: search.unitId ? 'UNIT_TEST' : 'PRACTICE',
  179. // 这里定义的是数字但是因为是通过input输入所以强制转化一次
  180. reactionTimeMs: parseFloat('' + SettingState.eva.reactionTimeMs) || 0,
  181. speed: runtime.speed,
  182. heardLevel: SettingState.eva.difficulty,
  183. // beatLength: Math.round((RuntimeUtils.getFixTime(detailState.times[0].beatSpeed) * 1000) / rate),
  184. beatLength: actualBeatLength,
  185. }
  186. // console.log("🚀 ~ content:", content, rate)
  187. const clientType = useClientType()
  188. if (clientType === 'student') {
  189. content.clientId = 'STUDENT'
  190. } else if (clientType === 'teacher') {
  191. content.clientId = 'TEACHER'
  192. } else {
  193. content.clientId = 'BACKEND'
  194. }
  195. if (browserInfo.android) {
  196. content.platform = 'ANDROID'
  197. }
  198. if (browserInfo.ios) {
  199. content.platform = 'IOS'
  200. }
  201. const evt = await promisefiyPostMessage({
  202. api: 'startEvaluating',
  203. content: content,
  204. })
  205. if (evt?.content?.reson) {
  206. Toast.fail({
  207. message: evt?.content?.reson,
  208. })
  209. connentLoading.value = false
  210. throw evt
  211. }
  212. connentLoading.value = false
  213. }
  214. const sendOffsetTime = (offsetTime: number) => {
  215. postMessage(
  216. {
  217. api: 'proxyServiceMessage',
  218. content: {
  219. header: {
  220. commond: 'audioPlayStart',
  221. type: 'SOUND_COMPARE',
  222. },
  223. body: {
  224. offsetTime,
  225. },
  226. },
  227. },
  228. () => {
  229. backtime = 0
  230. }
  231. )
  232. }
  233. const cancelTheEvaluation = () => {
  234. const search = useOriginSearch()
  235. postMessage({ api: 'endEvaluating', content: { musicScoreId: search.id } })
  236. playStatus.value = 'stop'
  237. RuntimeUtils.pause()
  238. RuntimeUtils.resetPlayStatus()
  239. RuntimeUtils.clearIntervalTimeline()
  240. RuntimeUtils.setCurrentTime(0)
  241. Toast.clear()
  242. }
  243. const stopPlay = () => {
  244. console.log('调用stopPlay')
  245. if (!connentLoading.value) {
  246. cancelTheEvaluation()
  247. }
  248. startButtonShow.value = true
  249. connentLoading.value = false
  250. evaluating.value = false
  251. }
  252. export const evaluatStopPlay = stopPlay
  253. const startPlay = () => {
  254. console.log('连接服务成功,开始播放', new Date().getTime() - runtime.clickTime)
  255. if (!SettingState.eva.mute) {
  256. RuntimeUtils.changeAllMode()
  257. } else {
  258. RuntimeUtils.changeMode('background')
  259. }
  260. startButtonShow.value = false
  261. RuntimeUtils.setPlayState()
  262. }
  263. const setPlayer = async () => {
  264. // 连接中,禁止重复连接
  265. if (connentLoading.value) return
  266. runtime.clickTime = new Date().getTime()
  267. RuntimeUtils.resetPlayStatus()
  268. if (detailState.isPauseRecording) {
  269. evaluating.value = false
  270. startPlay()
  271. return
  272. }
  273. detailState.evaluatings = {}
  274. const hint = Toast({
  275. duration: 0,
  276. message: '服务连接中...',
  277. type: 'loading',
  278. })
  279. try {
  280. await connect()
  281. startPlay()
  282. setTimeout(() => {
  283. console.log('关闭弹窗')
  284. Toast.clear()
  285. hint.close()
  286. }, 100)
  287. } catch (error) {
  288. runtime.evaluatingStatus = false
  289. Toast.clear()
  290. }
  291. }
  292. const togglePlay = () => {
  293. if (detailState.isPauseRecording) {
  294. evaluating.value = false
  295. startPlay()
  296. return
  297. }
  298. if (evaluating.value) {
  299. stopPlay()
  300. } else {
  301. setPlayer()
  302. }
  303. }
  304. const timeupdate = () => {
  305. console.log('播放事件被触发', playUrl.value, evaluating.value)
  306. if (playUrl.value) {
  307. const nowTime = new Date().getTime()
  308. // console.log('播放开始的时间', nowTime)
  309. // synced = true
  310. let time = runtime.audiosInstance?.audios[playUrl.value].currentTime
  311. // 只有选段模式,并且开始小节非第一小节时,才执行以下计算
  312. const sectionIdx = detailState.section.length ? detailState.section[0].i : 0
  313. if (unitTestData.isSelectMeasureMode && sectionIdx > 0 ) {
  314. time = time - detailState.section[0].time
  315. }
  316. console.log('已播放时长: ', time * 1000)
  317. console.log('不减掉已播放时间: ', nowTime - backtime)
  318. const delayTime = nowTime - backtime - time * 1000
  319. console.log('真正播放延迟', delayTime, time, unitTestData.isSelectMeasureMode, sectionIdx)
  320. // 蓝牙耳机延迟一点发送消息确保在录音后面
  321. setTimeout(() => {
  322. sendOffsetTime(delayTime)
  323. }, 220)
  324. }
  325. }
  326. /**
  327. * 播放器停止事件
  328. */
  329. const playerStop = () => {
  330. // alert('stop' + this.endloading)
  331. console.log('playerStop播放器停止事件', endloading.value)
  332. if (endloading.value) {
  333. return
  334. }
  335. playStatus.value = 'stop'
  336. endloading.value = true
  337. startButtonShow.value = true
  338. RuntimeUtils.resetPlayStatus()
  339. RuntimeUtils.clearIntervalTimeline()
  340. RuntimeUtils.setCurrentTime(0)
  341. Toast({
  342. duration: 0,
  343. message: '评分中...',
  344. type: 'loading',
  345. })
  346. postMessage(
  347. {
  348. api: 'endEvaluating',
  349. content: {
  350. musicScoreId: useOriginSearch().id,
  351. },
  352. },
  353. (evt) => {
  354. console.log('调用endEvaluating结束', evt)
  355. endloading.value = false
  356. evaluating.value = false
  357. // RuntimeUtils.setCaptureMode()
  358. }
  359. )
  360. RuntimeUtils.endCapture()
  361. }
  362. export const evaluatPlayerStop = playerStop
  363. const endevent = (evt: Event) => {
  364. // 如果是单元测验和课后训练 播放结束
  365. if (unitTestData.isSelectMeasureMode && playStatus.value === 'play') {
  366. playerStop()
  367. canSubmit.value = true
  368. return
  369. }
  370. if ((evt.target as HTMLAudioElement)?.src === playUrl.value && playStatus.value === 'play') {
  371. playerStop()
  372. canSubmit.value = true
  373. }
  374. if (detailState.isAppPlay) {
  375. playerStop()
  376. canSubmit.value = true
  377. }
  378. }
  379. /**正式开始评测 */
  380. const evaluatStart = () => {
  381. playStatus.value = 'play'
  382. if (detailState.isPauseRecording) {
  383. postMessage(
  384. {
  385. api: 'resumeRecording',
  386. },
  387. () => {
  388. evaluating.value = true
  389. detailState.isPauseRecording = false
  390. RuntimeUtils.setCaptureMode()
  391. }
  392. )
  393. return
  394. }
  395. console.log('开始录音', new Date().getTime())
  396. postMessage(
  397. {
  398. api: 'startRecording',
  399. },
  400. () => {
  401. // console.log('开始录音app回调时间', Date.now())
  402. backtime = Date.now()
  403. evaluating.value = true
  404. if (detailState.activeDetail?.midiUrl) {
  405. console.log('midiUrl', detailState.activeDetail?.midiUrl)
  406. setTimeout(() => {
  407. sendOffsetTime(0)
  408. }, 220)
  409. }
  410. }
  411. )
  412. RuntimeUtils.startCapture()
  413. }
  414. /**
  415. * 酷乐秀活动接口,Url中有设置并且仅在学生端提评分交数据
  416. * 管乐团单元测验, url中有单元测验ID仅在学生端提评分交数据
  417. */
  418. const submitEvaluationScore = async (data: any) => {
  419. const search = useOriginSearch()
  420. if (search.unitId) {
  421. if (!canSubmit.value) {
  422. Toast('完整演奏结束才算测验分数!')
  423. return
  424. }
  425. /** 有单元测验时,存储分数缓存 */
  426. postMessage({
  427. api: 'setCache',
  428. content: {
  429. key: 'h5-orchestra-unit',
  430. value: JSON.stringify({
  431. musicId: search.id || '',
  432. unitId: search.unitId || '',
  433. questionId: search.questionId || '',
  434. score: canSubmit.value ? (endResult.value as any)?.score || 0 : 0,
  435. }),
  436. },
  437. })
  438. canSubmit.value = false
  439. }
  440. }
  441. /** 活动使用,只有在全部评测完成后才能提交,避免只是一小节就高分的情况 */
  442. const canSubmit = ref(false)
  443. /**接受websocket返回的信息 */
  444. const sendResult = (evt?: IPostMessage) => {
  445. const { body, header } = evt?.content || {}
  446. console.log('评测返回', body)
  447. if (body && header) {
  448. const data = evt?.content?.body
  449. if (evt?.content.header.commond === 'overall') {
  450. // console.log(evt)
  451. detailState.isHideEvaluatReportSaveBtn = false;
  452. Toast.clear()
  453. endResult.value = data
  454. evaluatingShow.value = true
  455. submitEvaluationScore(data)
  456. } else if (evt?.content.header.commond === 'checkDone') {
  457. // 此处已经在校音中单独监听不做处理
  458. } else if (evt?.content.header.commond === 'checking') {
  459. // 此处已经在校音中单独监听不做处理
  460. } else {
  461. const getBeforeNote = (index: number) => {
  462. while (index >= 0) {
  463. const item = detailState.times[index]
  464. if (item.stave) {
  465. return item
  466. }
  467. index--
  468. }
  469. }
  470. const setEvaluatings = (note: any, data: any, dontTransition = false) => {
  471. const startNote = getBoundingBoxByverticalNote(note)
  472. // console.log(detailState.evaluatings, startNote)
  473. detailState.evaluatings = {
  474. ...detailState.evaluatings,
  475. [startNote.measureIndex]: {
  476. ...startNote,
  477. ...getLeveByScoreMeasure(data.score),
  478. score: data.score,
  479. dontTransition,
  480. },
  481. }
  482. }
  483. for (let index = 0; index < detailState.times.length; index++) {
  484. let time = detailState.times[index]
  485. if (data.measureRenderIndex == time.noteElement.sourceMeasure.measureListIndex) {
  486. if (!time.stave) {
  487. const ntime = getBeforeNote(index)
  488. // console.log('ntime', ntime)
  489. if (ntime) {
  490. time = ntime
  491. }
  492. }
  493. if (!time.noteElement.tie) {
  494. setEvaluatings(time, data)
  495. } else {
  496. for (const item of time.noteElement.tie.notes) {
  497. const note = getParentNote(item)
  498. if (!note) continue
  499. setEvaluatings(
  500. note,
  501. data,
  502. item.NoteToGraphicalNoteObjectId !== time.noteElement.tie.StartNote?.NoteToGraphicalNoteObjectId
  503. )
  504. }
  505. }
  506. break
  507. }
  508. }
  509. }
  510. }
  511. }
  512. const onProgress = () => {
  513. // console.log(runtime.currentTimeNum, detailState.times[detailState.times.length - 1]?.time - 2, detailState.times)
  514. if (runtime.currentTimeNum >= detailState.times[detailState.times.length - 1]?.time - 2) {
  515. canSubmit.value = true
  516. }
  517. }
  518. const cloudMetronome = (evt: any) => {
  519. startButtonShow.value = true
  520. }
  521. /** 监听评测弹窗是否隐藏保存演奏按钮 */
  522. const hideComplexButton = (callback: CallBack, listen?: boolean) => {
  523. if (listen) {
  524. listenerMessage("hideComplexButton", callback);
  525. } else {
  526. removeListenerMessage("hideComplexButton", callback);
  527. }
  528. };
  529. // 隐藏存演奏按钮
  530. const handleComplexButton = (res?: IPostMessage) => {
  531. console.log('监听是否隐藏保存按钮', res)
  532. if (res?.content) {
  533. const { header, body } = res.content;
  534. detailState.isHideEvaluatReportSaveBtn = true
  535. }
  536. };
  537. export default defineComponent({
  538. name: 'ColexiuButtonEvaluating',
  539. setup(props, { expose }) {
  540. onMounted(async () => {
  541. console.log('进入评测模块')
  542. handleCheckEvaluatStatus()
  543. // 如果为单元测验和课后训练,不清楚选段数据
  544. if (!unitTestData.isSelectMeasureMode) {
  545. detailState.section = []
  546. detailState.sectionStatus = false
  547. }
  548. RuntimeUtils.changeAllMode()
  549. playUrl.value = runtime.songs.background || (runtime.songs.music as string)
  550. runtime.audiosInstance?.audios[playUrl.value]?.addEventListener('play', timeupdate)
  551. runtime.audiosInstance?.audios[playUrl.value]?.addEventListener('timeupdate', onProgress)
  552. // RuntimeUtils.event.on('next-click', playerStop)
  553. RuntimeUtils.event.on('ended', endevent)
  554. listenerMessage('sendResult', sendResult)
  555. // listenerMessage('cancelEvaluating', cancelTheEvaluation)
  556. listenerMessage('cloudTimeUpdae', onProgress)
  557. RuntimeUtils.event.on('tickDestroy', cloudMetronome)
  558. RuntimeUtils.event.on('tickEnd', evaluatStart)
  559. hideComplexButton(handleComplexButton, true);
  560. })
  561. onBeforeUnmount(() => {
  562. runtime.audiosInstance?.audios[playUrl.value]?.removeEventListener('play', timeupdate)
  563. runtime.audiosInstance?.audios[playUrl.value]?.removeEventListener('timeupdate', onProgress)
  564. // RuntimeUtils.event.off('next-click', playerStop)
  565. RuntimeUtils.event.off('ended', endevent)
  566. RuntimeUtils.event.off('tickDestroy', cloudMetronome)
  567. removeListenerMessage('sendResult', sendResult)
  568. // removeListenerMessage('cancelEvaluating', cancelTheEvaluation)
  569. removeListenerMessage('cloudTimeUpdae', onProgress)
  570. hideComplexButton(() => {}, false);
  571. RuntimeUtils.event.off('tickEnd', evaluatStart)
  572. })
  573. expose({
  574. setPlayer,
  575. startPlay,
  576. stopPlay,
  577. togglePlay,
  578. playerStop,
  579. evaluating,
  580. connentLoading,
  581. playStatus,
  582. cancelTheEvaluation,
  583. })
  584. return () => {
  585. return (
  586. <Teleport to="body" key="StartEvaluating">
  587. {/* 评测完成结果显示 */}
  588. <Evaluating data={endResult.value} />
  589. <Transition name="finish">
  590. {startButtonShow.value && (
  591. <div
  592. style={{
  593. backgroundImage: `url(${iconEvaluatingStart})`,
  594. 'transform': detailState.isSpecialShapedScreen ? `translateX(${detailState.notchHeight / 4}px)` : '',
  595. }}
  596. class={[styles.evaluatStartBtn]}
  597. onClick={() => {
  598. setPlayer()
  599. }}
  600. ></div>
  601. )}
  602. </Transition>
  603. {!evaluating.value ? (
  604. <div class={styles.dialogueBox} key="start">
  605. <div class={styles.dialogue}>
  606. <div>
  607. 演奏前请调整好乐器,保证最佳演奏状态。<span class={styles.triangle}></span>
  608. </div>
  609. </div>
  610. <Vue3Lottie class={styles.dialogueIcon} animationData={startData}></Vue3Lottie>
  611. </div>
  612. ) : (
  613. <div class={styles.dialogueBox} key="starting">
  614. <div class={styles.inRadio}>收音中...</div>
  615. <Vue3Lottie class={styles.inRadioIcon} animationData={startingData}></Vue3Lottie>
  616. </div>
  617. )}
  618. </Teleport>
  619. )
  620. }
  621. },
  622. })