|
@@ -5,7 +5,7 @@ import TheTitle from "@/components/TheTitle";
|
|
|
import TheSong from "@/components/TheSong";
|
|
|
import request from "@/helpers/request";
|
|
|
import { useRoute, useRouter } from "vue-router";
|
|
|
-import { Icon } from "vant";
|
|
|
+import { Icon, Image } from "vant";
|
|
|
import { useEventListener } from "@vant/use";
|
|
|
import icon_teacher from "@/assets/icon_teacher.png";
|
|
|
import Plyr from "plyr";
|
|
@@ -15,6 +15,7 @@ import oStart from "@/assets/icon-xinxin.png";
|
|
|
import printIcon from "@/assets/printIcon.png";
|
|
|
import IconRect from "@/assets/icon-rect.png";
|
|
|
import Iconmusicdetail from "@/assets/icon-music-detail.png";
|
|
|
+import empty from "@/assets/emtpy.png";
|
|
|
import TheDown from "@/components/TheDown";
|
|
|
|
|
|
interface IState {
|
|
@@ -32,6 +33,7 @@ export default defineComponent({
|
|
|
getAlumn();
|
|
|
});
|
|
|
const state = reactive<IState>({});
|
|
|
+ const img = ref("");
|
|
|
const mp3 = reactive({
|
|
|
iframe: "",
|
|
|
audioFileUrl: "",
|
|
@@ -40,23 +42,19 @@ export default defineComponent({
|
|
|
const id = route.query.id;
|
|
|
if (!id) return;
|
|
|
try {
|
|
|
- const { data } = await request.get(
|
|
|
- `/api-website/open/music/sheet/detail/${id}`
|
|
|
- );
|
|
|
+ const { data } = await request.get(`/api-website/open/music/sheet/detail/${id}`);
|
|
|
Object.assign(state, data);
|
|
|
if (Array.isArray(data.background) && data.background.length) {
|
|
|
const item = data.background[0];
|
|
|
mp3.audioFileUrl = item.audioFileUrl;
|
|
|
console.log(route);
|
|
|
- if (
|
|
|
- location.host.includes("dev.colexiu") ||
|
|
|
- location.host.includes("192.168")
|
|
|
- ) {
|
|
|
+ if (location.host.includes("dev.colexiu") || location.host.includes("192.168")) {
|
|
|
mp3.iframe = `https://dev.colexiu.com/accompany/colxiu-website.html?id=${id}&part-index=${item.id}`;
|
|
|
} else {
|
|
|
mp3.iframe = `https://online.colexiu.com/accompany/colxiu-website.html?id=${id}&part-index=${item.id}`;
|
|
|
}
|
|
|
}
|
|
|
+ img.value = state.musicImg ? state.musicImg.split(",") : [];
|
|
|
} catch (error) {}
|
|
|
};
|
|
|
onMounted(() => {
|
|
@@ -76,13 +74,7 @@ export default defineComponent({
|
|
|
|
|
|
const initAudio = () => {
|
|
|
const a = new Plyr("#musicAudio", {
|
|
|
- controls: [
|
|
|
- "play-large",
|
|
|
- "play",
|
|
|
- "progress",
|
|
|
- "current-time",
|
|
|
- "duration",
|
|
|
- ],
|
|
|
+ controls: ["play-large", "play", "progress", "current-time", "duration"],
|
|
|
});
|
|
|
};
|
|
|
|
|
@@ -106,33 +98,19 @@ export default defineComponent({
|
|
|
const downRef = ref();
|
|
|
return () => (
|
|
|
<div class={styles.musicDeatail}>
|
|
|
- <TheHeader
|
|
|
- style={{ background: `rgba(255,255,255,${backgorundColor.value})` }}
|
|
|
- class={styles.header}
|
|
|
- theme={isTop.value ? "dark" : "light"}
|
|
|
- />
|
|
|
- <img
|
|
|
- class={styles.bgImg}
|
|
|
- src={state.teacher?.userAvatar || icon_teacher || state.titleImg}
|
|
|
- />
|
|
|
+ <TheHeader style={{ background: `rgba(255,255,255,${backgorundColor.value})` }} class={styles.header} theme={isTop.value ? "dark" : "light"} />
|
|
|
+ <img class={styles.bgImg} src={state.teacher?.userAvatar || icon_teacher || state.titleImg} />
|
|
|
<div class={styles.musicContent}>
|
|
|
<div class={styles.bg}>
|
|
|
<div class={styles.alumWrap}>
|
|
|
- <div class={[styles.alumTitle, "van-ellipsis"]}>
|
|
|
- {state.musicSheetName}
|
|
|
- </div>
|
|
|
+ <div class={[styles.alumTitle, "van-ellipsis"]}>{state.musicSheetName}</div>
|
|
|
<div class={styles.musicDes}>
|
|
|
<div class={styles.des}>
|
|
|
- <div class={[styles.desItem, "van-multi-ellipsis--l2"]}>
|
|
|
- 作曲:{state.composer}
|
|
|
- </div>
|
|
|
+ <div class={[styles.desItem, "van-multi-ellipsis--l2"]}>作曲:{state.composer}</div>
|
|
|
<div class={styles.desItem}>声部:{state.subjectNames}</div>
|
|
|
</div>
|
|
|
<div class={styles.author}>
|
|
|
- <img
|
|
|
- class={styles.avator}
|
|
|
- src={state.teacher?.userAvatar || icon_teacher}
|
|
|
- />
|
|
|
+ <img class={styles.avator} src={state.teacher?.userAvatar || icon_teacher} />
|
|
|
<div class={styles.authorName}>
|
|
|
<div class="van-ellipsis">{state.teacher?.userName}</div>
|
|
|
<div class={styles.by}>上传者</div>
|
|
@@ -168,7 +146,16 @@ export default defineComponent({
|
|
|
|
|
|
<div class={styles.iframe}>
|
|
|
<div class={styles.sheetName}>{state.musicSheetName}</div>
|
|
|
- <iframe id="musicIframe" src={mp3.iframe}></iframe>
|
|
|
+ <div class={styles.iframeContainer}>
|
|
|
+ {img.value.length <= 0 ? (
|
|
|
+ <Image src={img.value[0]} />
|
|
|
+ ) : (
|
|
|
+ <div class={styles.emptyContainer}>
|
|
|
+ <Image class={styles.emptyImg} src={empty} />
|
|
|
+ <p>暂无乐谱预览图</p>
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
@@ -176,8 +163,7 @@ export default defineComponent({
|
|
|
<div class={styles.btn} onClick={() => downRef.value?.toggle()}>
|
|
|
<img src={oStart} />
|
|
|
<div>
|
|
|
- <span style={{ color: "#EB5E00" }}>{state.favoriteNum}</span>{" "}
|
|
|
- 收藏
|
|
|
+ <span style={{ color: "#EB5E00" }}>{state.favoriteNum}</span> 收藏
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class={styles.btn} onClick={() => downRef.value?.toggle()}>
|