import { computed, defineComponent, nextTick, reactive, ref, toRefs } from "vue"; import styles from "./index.module.less"; import { api_back } from "/src/helpers/communication"; import state from "/src/state"; import iconBack from "./image/icon-back.svg"; import iconShiyi from "./image/icon-shiyi.svg"; import iconhuifang from "./image/icon-huifang.svg"; import { Grid, GridItem, Popup } from "vant"; import videobg from "./image/videobg.png"; import "plyr/dist/plyr.css"; import Plyr from "plyr"; import { browser } from "/src/utils"; import Note from "../note"; import { storeData } from "/src/store"; type IItemType = "intonation" | "cadence" | "integrity"; export default defineComponent({ name: "header-top", props: { scoreData: { type: Object, default: () => ({}), }, }, setup(props, {expose}) { const browserInfo = browser(); const { scoreData } = toRefs(props); const shareData = reactive({ show: false, shiyiShow: false, isInitPlyr: false, _plrl: null as any, }); const level: any = { BEGINNER: "入门级", ADVANCED: "进阶级", PERFORMER: "大师级", }; // console.log("🚀 ~ scoreData:", scoreData.value) const itemType = ref("intonation"); /** 返回 */ const handleBack = () => { api_back(); }; const handleChange = (type: IItemType) => { itemType.value = type; scoreData.value.itemType = type }; // 资源类型 const mediaType = computed((): "audio" | "video" => { const subfix = (scoreData.value.videoFilePath || "").split(".").pop(); if (subfix === "wav" || subfix === "mp3" || subfix === "m4a") { return "audio"; } return "video"; }); const openAudioAndVideo = () => { shareData.show = true; if (shareData.isInitPlyr) return; nextTick(() => { const id = mediaType.value === "audio" ? "#audioSrc" : "#videoSrc"; shareData._plrl = new Plyr(id, { controls: ["play-large", "play", "progress", "current-time"], fullscreen: { enabled: false }, }); shareData.isInitPlyr = true; }); }; return () => (
{level[scoreData.value.heardLevel]}
难度
{scoreData.value.score}分
评测分数
{state.isPercussion ? null : ( <>
handleChange("intonation")} class={[styles.cItem, itemType.value === "intonation" && styles.active]} >
{scoreData.value.intonation}分
音准
handleChange("cadence")} class={[styles.cItem, itemType.value === "cadence" && styles.active]} >
{scoreData.value.cadence}分
节奏
handleChange("integrity")} class={[styles.cItem, itemType.value === "integrity" && styles.active]} >
{scoreData.value.integrity}分
完成度
)}
回放
(shareData.shiyiShow = true)}> 释义
{/*
再来一遍
*/}
{state.isPercussion ? null : (
演奏正确
{itemType.value === "intonation" && ( <>
音高了
音低了
)} {itemType.value === "cadence" && ( <>
节奏过快
节奏慢了
)} {itemType.value === "integrity" && (
完成度不足
)}
未演奏
)} { shareData._plrl?.pause(); }} > {mediaType.value === "audio" && (
)} {mediaType.value === "video" && (
)}
图标释义
绿色音符:演奏正确
红色音符:错音
紫色音符:完成度不足
灰色音符:未演奏
音符重影(红色在前):节奏过快
音符重影(红色在后):节奏慢了
音符重影(黄色在上):音高了
音符重影(黄色在下):音低了
); }, });