index.tsx 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752
  1. import {
  2. defineComponent,
  3. nextTick,
  4. onMounted,
  5. onUnmounted,
  6. reactive,
  7. watch,
  8. ref
  9. } from 'vue';
  10. // import WaveSurfer from 'wavesurfer.js';
  11. import styles from './index.module.less';
  12. import MSticky from '@/components/m-sticky';
  13. import MHeader from '@/components/m-header';
  14. import {
  15. Button,
  16. Cell,
  17. Image,
  18. List,
  19. Popup,
  20. Slider,
  21. showDialog,
  22. showToast,
  23. Sticky,
  24. TextEllipsis
  25. } from 'vant';
  26. import iconDownload from './images/icon-download.png';
  27. import iconShare from './images/icon-share.png';
  28. import iconDelete from './images/icon-delete.png';
  29. import iconEdit from './images/edit.png';
  30. import iconUpward from './images/upward.png';
  31. import iconMember from './images/icon-member.png';
  32. import iconZan from './images/icon-zan.png';
  33. import promptImg from './images/prompt.png';
  34. import confirmImg from './images/confirm.png';
  35. import canceImg from './images/cance.png';
  36. import iconZanActive from './images/icon-zan-active.png';
  37. import iconPlay from './images/icon-play.png';
  38. import iconPause from './images/icon-pause.png';
  39. import { postMessage, promisefiyPostMessage } from '@/helpers/native-message';
  40. import { browser, getGradeCh, getSecondRPM, vaildMusicScoreUrl } from '@/helpers/utils';
  41. import { useRoute, useRouter, onBeforeRouteLeave } from 'vue-router';
  42. import {
  43. api_userMusicDetail,
  44. api_userMusicRemove,
  45. api_userMusicStarPage
  46. } from './api';
  47. import MEmpty from '@/components/m-empty';
  48. import dayjs from 'dayjs';
  49. import MVideo from '@/components/m-video';
  50. import ShareModel from './share-model';
  51. import { usePageVisibility, useEventListener } from '@vant/use';
  52. import "plyr/dist/plyr.css";
  53. import Plyr from "plyr";
  54. import { Vue3Lottie } from "vue3-lottie";
  55. import audioBga from "./images/audioBga.json";
  56. import audioBga1 from "./images/leftCloud.json";
  57. import audioBga2 from "./images/rightCloud.json";
  58. import videobg from "./images/videobg.png";
  59. import playProgressData from "./playCreation/playProgress"
  60. import Loading from './loading';
  61. export default defineComponent({
  62. name: 'creation-detail',
  63. setup() {
  64. const route = useRoute();
  65. const router = useRouter();
  66. const isScreenScroll = ref(false)
  67. const lottieDom = ref()
  68. const lottieDom1 = ref()
  69. const lottieDom2 = ref()
  70. const mStickyBottom = ref()
  71. const mStickyUpward = ref()
  72. const state = reactive({
  73. id: route.query.id,
  74. deleteStatus: false,
  75. shareStatus: false,
  76. playType: '' as 'Audio' | 'Video' | '', // 播放类型
  77. musicDetail: {} as any,
  78. isClick: false,
  79. list: [] as any,
  80. listState: {
  81. dataShow: true, // 判断是否有数据
  82. loading: false,
  83. finished: false
  84. },
  85. params: {
  86. page: 1,
  87. rows: 20
  88. },
  89. _plrl: null as any,
  90. heightV:0,
  91. heightB:0
  92. });
  93. const plyrState = reactive({
  94. duration: 0,
  95. currentTime: 0,
  96. mediaTimeShow: false,
  97. playIngShow: true
  98. })
  99. // 谱面
  100. const staffState = reactive({
  101. staffSrc: "",
  102. isShow: false,
  103. height:"initial",
  104. speedRate:1,
  105. musicRenderType:"staff",
  106. partIndex: 0
  107. })
  108. const staffDom= ref<HTMLIFrameElement>()
  109. const {playStaff, pauseStaff, updateProgressStaff} = staffMoveInstance()
  110. // 获取列表
  111. const getStarList = async () => {
  112. try {
  113. if (state.isClick) return;
  114. state.isClick = true;
  115. const res = await api_userMusicStarPage({
  116. userMusicId: state.id,
  117. ...state.params
  118. });
  119. state.listState.loading = false;
  120. const result = res.data || {};
  121. // 处理重复请求数据
  122. if (state.list.length > 0 && result.current === 1) {
  123. return;
  124. }
  125. state.list = state.list.concat(result.rows || []);
  126. state.listState.finished = result.current >= result.pages;
  127. state.params.page = result.current + 1;
  128. state.listState.dataShow = state.list.length > 0;
  129. state.isClick = false;
  130. } catch {
  131. state.listState.dataShow = false;
  132. state.listState.finished = true;
  133. state.isClick = false;
  134. }
  135. };
  136. // 删除作品
  137. const onDelete = async () => {
  138. try {
  139. await api_userMusicRemove({ id: state.id });
  140. setTimeout(() => {
  141. state.deleteStatus = false;
  142. showToast('删除成功');
  143. }, 100);
  144. setTimeout(() => {
  145. if (browser().isApp) {
  146. postMessage({
  147. api: 'goBack'
  148. });
  149. } else {
  150. router.back();
  151. }
  152. }, 1200);
  153. } catch {
  154. //
  155. }
  156. };
  157. // 下载
  158. const onDownload = async () => {
  159. await promisefiyPostMessage({
  160. api: 'saveFile',
  161. content: {
  162. url: state.musicDetail.videoUrl
  163. }
  164. });
  165. };
  166. // 滚动事件
  167. const cleanScrollEvent = useEventListener('scroll', () => {
  168. const height =
  169. window.scrollY ||
  170. document.documentElement.scrollTop
  171. // 防止多次调用
  172. if(height > 0 && isScreenScroll.value === false){
  173. isScreenScroll.value = true
  174. setStatusBarTextColor(false)
  175. }
  176. if(height <= 0){
  177. isScreenScroll.value = false
  178. setStatusBarTextColor(true)
  179. }
  180. })
  181. // 设置导航栏颜色
  182. function setStatusBarTextColor(isWhite:boolean){
  183. postMessage({
  184. api: 'setStatusBarTextColor',
  185. content: { statusBarTextColor: isWhite }
  186. })
  187. }
  188. // 初始化 媒体播放
  189. function initMediaPlay(){
  190. const id = state.playType === "Audio" ? "#audioMediaSrc" : "#videoMediaSrc";
  191. state._plrl = new Plyr(id, {
  192. controls: ["progress"],
  193. fullscreen: { enabled: false },
  194. });
  195. const player = state._plrl
  196. // 创建音波数据
  197. if(state.playType === "Audio"){
  198. const audioDom = document.querySelector("#audioMediaSrc") as HTMLAudioElement
  199. const canvasDom = document.querySelector("#audioVisualizer") as HTMLCanvasElement
  200. const { pauseVisualDraw, playVisualDraw } = audioVisualDraw(audioDom, canvasDom)
  201. player.on('play', () => {
  202. lottieDom.value?.play()
  203. lottieDom1.value?.play()
  204. lottieDom2.value?.play()
  205. playVisualDraw()
  206. });
  207. player.on('pause', () => {
  208. lottieDom.value?.pause()
  209. lottieDom1.value?.pause()
  210. lottieDom2.value?.pause()
  211. pauseVisualDraw()
  212. });
  213. }
  214. player.on('loadedmetadata', () => {
  215. player.currentTime = playProgressData.playProgress
  216. });
  217. player.on("timeupdate", ()=>{
  218. plyrState.currentTime = player.currentTime
  219. })
  220. player.on('play', () => {
  221. plyrState.playIngShow = false
  222. playStaff()
  223. });
  224. player.on('pause', () => {
  225. plyrState.playIngShow = true
  226. pauseStaff()
  227. });
  228. // 处理按压事件
  229. const handleStart = () => {
  230. plyrState.duration = player.duration
  231. plyrState.mediaTimeShow = true
  232. };
  233. // 处理松开事件
  234. const handleEnd = () => {
  235. plyrState.mediaTimeShow = false
  236. // 暂停的时候调用
  237. if(!player.playing){
  238. updateProgressStaff(player.currentTime)
  239. }
  240. };
  241. const progressDom = document.querySelector("#playMediaSection .plyr__controls .plyr__progress__container") as HTMLElement
  242. progressDom.addEventListener('mousedown', handleStart);
  243. progressDom.addEventListener('touchstart', handleStart);
  244. progressDom.addEventListener('mouseup', handleEnd);
  245. progressDom.addEventListener('touchend', handleEnd);
  246. }
  247. //点击改变播放状态
  248. function handlerClickPlay(){
  249. if (state._plrl.playing) {
  250. state._plrl.pause();
  251. } else {
  252. state._plrl.play();
  253. }
  254. }
  255. /**
  256. * 音频可视化
  257. * @param audioDom
  258. * @param canvasDom
  259. * @param fftSize 2的幂数,最小为32
  260. */
  261. function audioVisualDraw(audioDom: HTMLAudioElement, canvasDom: HTMLCanvasElement, fftSize = 128) {
  262. type propsType = { canvWidth: number; canvHeight: number; canvFillColor: string; lineColor: string; lineGap: number }
  263. // canvas
  264. const canvasCtx = canvasDom.getContext("2d")!
  265. const { width, height } = canvasDom.getBoundingClientRect()
  266. canvasDom.width = width
  267. canvasDom.height = height
  268. // audio
  269. let audioCtx : AudioContext | null = null
  270. let analyser : AnalyserNode | null = null
  271. let source : MediaElementAudioSourceNode | null = null
  272. const dataArray = new Uint8Array(fftSize / 2)
  273. const draw = (data: Uint8Array, ctx: CanvasRenderingContext2D, { lineGap, canvWidth, canvHeight, canvFillColor, lineColor }: propsType) => {
  274. if (!ctx) return
  275. const w = canvWidth
  276. const h = canvHeight
  277. fillCanvasBackground(ctx, w, h, canvFillColor)
  278. // 可视化
  279. const dataLen = data.length
  280. let step = (w / 2 - lineGap * dataLen) / dataLen
  281. step < 1 && (step = 1)
  282. const midX = w / 2
  283. const midY = h / 2
  284. let xLeft = midX
  285. for (let i = 0; i < dataLen; i++) {
  286. const value = data[i]
  287. const percent = value / 255 // 最大值为255
  288. const barHeight = percent * midY
  289. canvasCtx.fillStyle = lineColor
  290. // 中间加间隙
  291. if (i === 0) {
  292. xLeft -= lineGap / 2
  293. }
  294. canvasCtx.fillRect(xLeft - step, midY - barHeight, step, barHeight)
  295. canvasCtx.fillRect(xLeft - step, midY, step, barHeight)
  296. xLeft -= step + lineGap
  297. }
  298. let xRight = midX
  299. for (let i = 0; i < dataLen; i++) {
  300. const value = data[i]
  301. const percent = value / 255 // 最大值为255
  302. const barHeight = percent * midY
  303. canvasCtx.fillStyle = lineColor
  304. if (i === 0) {
  305. xRight += lineGap / 2
  306. }
  307. canvasCtx.fillRect(xRight, midY - barHeight, step, barHeight)
  308. canvasCtx.fillRect(xRight, midY, step, barHeight)
  309. xRight += step + lineGap
  310. }
  311. }
  312. const fillCanvasBackground = (ctx: CanvasRenderingContext2D, w: number, h: number, colors: string) => {
  313. ctx.clearRect(0, 0, w, h)
  314. ctx.fillStyle = colors
  315. ctx.fillRect(0, 0, w, h)
  316. }
  317. const requestAnimationFrameFun = () => {
  318. requestAnimationFrame(() => {
  319. analyser?.getByteFrequencyData(dataArray)
  320. draw(dataArray, canvasCtx, {
  321. lineGap: 2,
  322. canvWidth: width,
  323. canvHeight: height,
  324. canvFillColor: "transparent",
  325. lineColor: "rgba(255, 255, 255, 0.7)"
  326. })
  327. if (!isPause) {
  328. requestAnimationFrameFun()
  329. }
  330. })
  331. }
  332. let isPause = true
  333. const playVisualDraw = () => {
  334. if (!audioCtx) {
  335. audioCtx = new AudioContext()
  336. source = audioCtx.createMediaElementSource(audioDom)
  337. analyser = audioCtx.createAnalyser()
  338. analyser.fftSize = fftSize
  339. source?.connect(analyser)
  340. analyser.connect(audioCtx.destination)
  341. }
  342. //audioCtx.resume() // 重新更新状态 加了暂停和恢复音频音质发生了变化 所以这里取消了
  343. isPause = false
  344. requestAnimationFrameFun()
  345. }
  346. const pauseVisualDraw = () => {
  347. isPause = true
  348. //audioCtx?.suspend() // 暂停 加了暂停和恢复音频音质发生了变化 所以这里取消了
  349. // source?.disconnect()
  350. // analyser?.disconnect()
  351. }
  352. return {
  353. playVisualDraw,
  354. pauseVisualDraw
  355. }
  356. }
  357. function handlerLandscapeScreen(event:any){
  358. event.stopPropagation()
  359. playProgressData.playState = !!state._plrl?.playing
  360. playProgressData.playProgress = state._plrl?.currentTime || 0
  361. router.push({
  362. path:"/playCreation",
  363. query:{
  364. resourceUrl:encodeURIComponent(state.musicDetail?.videoUrl),
  365. videoBgUrl:encodeURIComponent(state.musicDetail?.videoImg || ""),
  366. musicSheetName:encodeURIComponent(state.musicDetail?.musicSheetName),
  367. username:encodeURIComponent(state.musicDetail?.username),
  368. musicSheetId:encodeURIComponent(state.musicDetail?.musicSheetId),
  369. speedRate:encodeURIComponent(staffState.speedRate),
  370. musicRenderType:encodeURIComponent(staffState.musicRenderType),
  371. partIndex:encodeURIComponent(staffState.partIndex),
  372. }
  373. })
  374. }
  375. // 初始化五线谱
  376. function initStaff(){
  377. const src = `${vaildMusicScoreUrl()}/instrument/#/simple-detail?id=${state.musicDetail.musicSheetId}&musicRenderType=${staffState.musicRenderType}&part-index=${staffState.partIndex}`;
  378. //const src = `http://192.168.3.122:3000/instrument.html#/simple-detail?id=${state.musicDetail.musicSheetId}&musicRenderType=${staffState.musicRenderType}&part-index=${staffState.partIndex}`;
  379. staffState.staffSrc = src
  380. window.addEventListener('message', (event) => {
  381. const { api, height } = event.data;
  382. if (api === 'api_musicPage') {
  383. staffState.isShow = true
  384. staffState.height = height + "px"
  385. // 如果是播放中自动开始播放 不是播放 自动跳转到当前位置
  386. if(playProgressData.playState){
  387. handlerClickPlay()
  388. }else{
  389. updateProgressStaff(state._plrl.currentTime)
  390. }
  391. }
  392. });
  393. }
  394. function staffMoveInstance(){
  395. let isPause = true
  396. const requestAnimationFrameFun = () => {
  397. requestAnimationFrame(() => {
  398. staffDom.value?.contentWindow?.postMessage(
  399. {
  400. api: 'api_playProgress',
  401. content: {
  402. currentTime: state._plrl.currentTime * staffState.speedRate
  403. }
  404. },
  405. "*"
  406. )
  407. if (!isPause) {
  408. requestAnimationFrameFun()
  409. }
  410. })
  411. }
  412. const playStaff = () => {
  413. // 没渲染不执行
  414. if(!staffState.isShow) return
  415. isPause = false
  416. staffDom.value?.contentWindow?.postMessage(
  417. {
  418. api: 'api_play'
  419. },
  420. "*"
  421. )
  422. requestAnimationFrameFun()
  423. }
  424. const pauseStaff = () => {
  425. // 没渲染不执行
  426. if(!staffState.isShow) return
  427. isPause = true
  428. staffDom.value?.contentWindow?.postMessage(
  429. {
  430. api: 'api_paused'
  431. },
  432. "*"
  433. )
  434. }
  435. const updateProgressStaff = (currentTime: number) => {
  436. // 没渲染不执行
  437. if(!staffState.isShow) return
  438. staffDom.value?.contentWindow?.postMessage(
  439. {
  440. api: 'api_updateProgress',
  441. content: {
  442. currentTime: currentTime * staffState.speedRate
  443. }
  444. },
  445. "*"
  446. )
  447. }
  448. return {
  449. playStaff,
  450. pauseStaff,
  451. updateProgressStaff
  452. }
  453. }
  454. onMounted(async () => {
  455. setStatusBarTextColor(true)
  456. try {
  457. const res = await api_userMusicDetail(state.id);
  458. // console.log(res);
  459. if (res.code === 999) {
  460. showDialog({
  461. message: res.message,
  462. theme: 'round-button',
  463. confirmButtonColor:
  464. 'linear-gradient(73deg, #5BECFF 0%, #259CFE 100%)'
  465. }).then(() => {
  466. if (browser().isApp) {
  467. postMessage({
  468. api: 'goBack'
  469. });
  470. } else {
  471. router.back();
  472. }
  473. });
  474. return;
  475. }
  476. state.musicDetail = res.data || {};
  477. try{
  478. const jsonConfig = JSON.parse(res.data.jsonConfig)
  479. jsonConfig.speedRate && (staffState.speedRate = jsonConfig.speedRate)
  480. jsonConfig.musicRenderType && (staffState.musicRenderType = jsonConfig.musicRenderType)
  481. jsonConfig.partIndex && (staffState.partIndex = jsonConfig.partIndex)
  482. }catch{
  483. }
  484. // 五线谱
  485. initStaff()
  486. getStarList();
  487. // 判断是视频还是音频
  488. if (res.data.videoUrl.lastIndexOf('mp4') !== -1) {
  489. state.playType = 'Video';
  490. } else {
  491. state.playType = 'Audio';
  492. }
  493. nextTick(()=>{
  494. initMediaPlay()
  495. })
  496. } catch {
  497. //
  498. }
  499. requestAnimationFrame(()=>{
  500. mStickyBottom.value?.onChnageHeight()
  501. mStickyBottom.value?.onChnageHeight()
  502. })
  503. });
  504. onUnmounted(() => {
  505. setStatusBarTextColor(false)
  506. cleanScrollEvent()
  507. });
  508. onBeforeRouteLeave((to, from, next)=>{
  509. if(to.path !== "/playCreation"){
  510. playProgressData.playProgress = 0
  511. playProgressData.playState = false
  512. }
  513. next()
  514. })
  515. return () => (
  516. <div
  517. style={
  518. {
  519. '--barheight':state.heightV + "px"
  520. }
  521. }
  522. class={[
  523. styles.creation,
  524. browser().isTablet && styles.creationTablet,
  525. isScreenScroll.value && styles.isScreenScroll
  526. ]}>
  527. <div class={styles.creationBg}></div>
  528. <MSticky position="top"
  529. onBarHeight={(height: any) => {
  530. console.log(height, 'height', height)
  531. state.heightV = height
  532. }}
  533. >
  534. <MHeader
  535. color={isScreenScroll.value ? "#333333" : "#ffffff"}
  536. background={isScreenScroll.value ? `rgb(255,255,255` : "transparent"}
  537. title={state.musicDetail?.musicSheetName}
  538. border={false}
  539. isBack={route.query.platformType != 'ANALYSIS'}
  540. />
  541. </MSticky>
  542. <div class={styles.singer}>
  543. 演奏:{state.musicDetail?.username}
  544. </div>
  545. <Sticky offsetTop={state.heightV - 1 + "px"}>
  546. <div class={[styles.playSection, plyrState.mediaTimeShow && styles.mediaTimeShow]} id="playMediaSection" onClick={handlerClickPlay}>
  547. {
  548. state.playType === 'Audio' &&
  549. <div class={styles.audioBox}>
  550. <canvas class={styles.audioVisualizer} id="audioVisualizer"></canvas>
  551. <Vue3Lottie ref={lottieDom} class={styles.audioBga} animationData={audioBga} autoPlay={false} loop={true}></Vue3Lottie>
  552. <Vue3Lottie ref={lottieDom1} class={styles.audioBga1} animationData={audioBga1} autoPlay={false} loop={true}></Vue3Lottie>
  553. <Vue3Lottie ref={lottieDom2} class={styles.audioBga2} animationData={audioBga2} autoPlay={false} loop={true}></Vue3Lottie>
  554. <audio
  555. crossorigin="anonymous"
  556. id="audioMediaSrc"
  557. src={state.musicDetail?.videoUrl}
  558. controls="false"
  559. preload="metadata"
  560. playsinline
  561. />
  562. </div>
  563. }
  564. {
  565. state.playType === 'Video' &&
  566. <video
  567. id="videoMediaSrc"
  568. class={styles.videoBox}
  569. src={state.musicDetail?.videoUrl}
  570. data-poster={ state.musicDetail?.videoImg || videobg}
  571. preload="metadata"
  572. playsinline
  573. />
  574. }
  575. <div class={[styles.playLarge, plyrState.playIngShow && styles.playIngShow]}></div>
  576. <div class={styles.mediaTime}>
  577. <div>
  578. {getSecondRPM(plyrState.currentTime)}
  579. </div>
  580. <div class={styles.note}>/</div>
  581. <div class={styles.duration}>
  582. {getSecondRPM(plyrState.duration)}
  583. </div>
  584. </div>
  585. <div class={styles.landscapeScreen} onClick={handlerLandscapeScreen}></div>
  586. {/* 谱面 */}
  587. {
  588. staffState.staffSrc &&
  589. <div
  590. class={[styles.staffBox, staffState.isShow && styles.staffBoxShow]}
  591. style={
  592. {
  593. '--staffBoxHeight':staffState.height
  594. }
  595. }
  596. >
  597. <div class={styles.mask}></div>
  598. <iframe
  599. ref={staffDom}
  600. class={styles.staff}
  601. frameborder="0"
  602. src={staffState.staffSrc}>
  603. </iframe>
  604. </div>
  605. }
  606. </div>
  607. </Sticky>
  608. <div class={styles.musicSection}>
  609. <div class={styles.avatarInfoBox}>
  610. <div class={styles.avatar}>
  611. <Image class={styles.userLogo} src={state.musicDetail.avatar} />
  612. <div class={styles.infoCon}>
  613. <div class={styles.info}>
  614. <span class={styles.userName}>{state.musicDetail?.username}</span>
  615. {state.musicDetail.vipFlag && (
  616. <img src={iconMember} class={styles.iconMember} />
  617. )}
  618. </div>
  619. <div class={styles.sub}>
  620. {state.musicDetail.subjectName}{' '}
  621. {getGradeCh(state.musicDetail.currentGradeNum - 1)}
  622. </div>
  623. </div>
  624. </div>
  625. <div class={styles.linkes}>
  626. <img src={iconZan} class={styles.iconZan} />
  627. <span>{state.musicDetail.likeNum}</span>
  628. </div>
  629. </div>
  630. <TextEllipsis class={styles.textEllipsis} rows={2} content={state.musicDetail?.desc} expand-text="展开" collapse-text="收起" />
  631. </div>
  632. <div class={styles.likeSection}>
  633. <div class={styles.likeTitle}>点赞记录</div>
  634. {state.listState.dataShow ? (
  635. <List
  636. finished={state.listState.finished}
  637. finishedText=" "
  638. onLoad={getStarList}
  639. immediateCheck={false}>
  640. {state.list.map((item: any, index: number) => (
  641. <Cell
  642. class={[styles.likeItem, index===state.list.length-1&&styles.likeItemLast]}
  643. border={false}
  644. >
  645. {{
  646. icon: () => (
  647. <Image src={item.userAvatar} class={styles.userLogo} />
  648. ),
  649. title: () => (
  650. <div class={styles.userInfo}>
  651. <p class={styles.name}>{item.userName}</p>
  652. <p class={styles.sub}>
  653. {item.subjectName}{' '}
  654. {getGradeCh(item.currentGradeNum - 1)}
  655. </p>
  656. </div>
  657. ),
  658. value: () => (
  659. <div class={styles.time}>
  660. {dayjs(item.createTime).format('YYYY-MM-DD HH:mm')}
  661. </div>
  662. )
  663. }}
  664. </Cell>
  665. ))}
  666. </List>
  667. ) : (
  668. <MEmpty class={styles.mEmpty} image={"empty2"} description="暂无点赞记录" />
  669. )}
  670. </div>
  671. {
  672. !isScreenScroll.value &&
  673. <MSticky ref={mStickyUpward} position="bottom" offsetBottom={state.heightB - 1 + "px"} >
  674. <div class={styles.upward}>
  675. <img src={iconUpward} />
  676. </div>
  677. </MSticky>
  678. }
  679. <MSticky ref={mStickyBottom} position="bottom" onBarHeight={(height: any) => {
  680. console.log(height, 'height', height)
  681. state.heightB = height
  682. }}>
  683. <div class={styles.bottomSection}>
  684. <div class={styles.bottomShare}>
  685. <p onClick={onDownload}>
  686. <img src={iconDownload} />
  687. <span>下载</span>
  688. </p>
  689. <p onClick={() => (state.shareStatus = true)}>
  690. <img src={iconShare} />
  691. <span>分享</span>
  692. </p>
  693. <p onClick={() => (state.deleteStatus = true)}>
  694. <img src={iconDelete} />
  695. <span>删除</span>
  696. </p>
  697. </div>
  698. <img src={iconEdit}
  699. class={styles.btnEdit}
  700. onClick={() => {
  701. router.push({
  702. path: '/creation-edit',
  703. query: {
  704. id: state.id
  705. }
  706. });
  707. }}
  708. />
  709. </div>
  710. </MSticky>
  711. <Popup
  712. v-model:show={state.deleteStatus}
  713. overlay-style={
  714. {
  715. backgroundColor:"rgba(0,0,0,.5)"
  716. }
  717. }
  718. round
  719. class={styles.popupContainer}>
  720. <img class={styles.prompt} src={promptImg} />
  721. <div class={styles.deleteBox}>
  722. <p class={styles.popupContent}>确定删除吗?</p>
  723. <div class={styles.popupBtnGroup}>
  724. <img src={canceImg} onClick={() => (state.deleteStatus = false)} />
  725. <img src={confirmImg} onClick={onDelete} />
  726. </div>
  727. </div>
  728. </Popup>
  729. <Popup
  730. position="bottom"
  731. v-model:show={state.shareStatus}
  732. style={{ background: 'transparent' }}>
  733. <ShareModel
  734. playType={state.playType}
  735. musicDetail={state.musicDetail}
  736. onClose={() => (state.shareStatus = false)}
  737. />
  738. </Popup>
  739. {
  740. !staffState.isShow && <Loading></Loading>
  741. }
  742. </div>
  743. );
  744. }
  745. });