|
@@ -10,6 +10,7 @@ import {
|
|
|
import classes from './index.module.less'
|
|
|
import { ElButton, ElOption, ElSelect, ElScrollbar } from 'element-plus'
|
|
|
import printIcon from './images/printIcon.png'
|
|
|
+import noMore from './images/noMore.png'
|
|
|
import banner from './images/banner.png'
|
|
|
import colVideo from '@/components/col-video/index'
|
|
|
import iconClose from '@/views/login/images/icon_close.png'
|
|
@@ -25,6 +26,9 @@ import { useRoute, useRouter } from 'vue-router'
|
|
|
import { getUserType, vaildTeachingUrl } from '@/helpers/utils'
|
|
|
import { imgToCanvas, addWatermark, convasToImg } from '@/helpers/imageFunction'
|
|
|
import arrow from '@/components/musicLIstItem/images/arrow.png'
|
|
|
+import { Vue3Lottie } from 'vue3-lottie'
|
|
|
+import 'vue3-lottie/dist/style.css'
|
|
|
+import AstronautJSON from '@/common/animate/bigLoad.json'
|
|
|
import printJS from 'print-js'
|
|
|
|
|
|
export default defineComponent({
|
|
@@ -38,7 +42,8 @@ export default defineComponent({
|
|
|
components: {
|
|
|
colVideo,
|
|
|
tagItem,
|
|
|
- musicItem
|
|
|
+ musicItem,
|
|
|
+ Vue3Lottie
|
|
|
},
|
|
|
setup(props, conent) {
|
|
|
const route = useRoute()
|
|
@@ -58,8 +63,26 @@ export default defineComponent({
|
|
|
userType: '',
|
|
|
accompanyUrl: '',
|
|
|
imgData: '',
|
|
|
- imgUrl: ''
|
|
|
+ imgUrl: '',
|
|
|
+ showImg: ''
|
|
|
})
|
|
|
+ nextTick(() => {
|
|
|
+ // 禁用右键
|
|
|
+ document.oncontextmenu = new Function('event.returnValue=false')
|
|
|
+ // 禁用选择
|
|
|
+ document.onselectstart = new Function('event.returnValue=false')
|
|
|
+ //禁止f12
|
|
|
+ document.οnkeydοwn = new Function('event.returnValue=false')
|
|
|
+ })
|
|
|
+
|
|
|
+ // 上面的禁止f12那段代码没有生效,但是加了下面这段就能生效。
|
|
|
+ document.onkeydown = function (e) {
|
|
|
+ if (e && e.keyCode === 123) {
|
|
|
+ e.returnValue = false
|
|
|
+ // e.keyCode = 0 //去掉也可以的,倘若要写,则需要setter 以及 getter配合使用,不配合,会报错
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
const print = ref()
|
|
|
const getMusicList = async () => {
|
|
|
try {
|
|
@@ -106,6 +129,7 @@ export default defineComponent({
|
|
|
router.push({
|
|
|
query: { ...route.query, id: state.id }
|
|
|
})
|
|
|
+ state.showImg = ''
|
|
|
getMusicList()
|
|
|
}
|
|
|
watch(
|
|
@@ -130,21 +154,28 @@ export default defineComponent({
|
|
|
// }
|
|
|
window.addEventListener(
|
|
|
'message',
|
|
|
- e => {
|
|
|
+ async e => {
|
|
|
console.log(e)
|
|
|
state.imgData = e.data
|
|
|
// printHander()
|
|
|
// alert(e.data);
|
|
|
+ const tempCanvas = await imgToCanvas(state.imgData)
|
|
|
+ const showImg = convasToImg(tempCanvas)
|
|
|
+ state.showImg = showImg
|
|
|
},
|
|
|
false
|
|
|
)
|
|
|
state.userType = getUserType()
|
|
|
- state.showCode = state.userType == 'STUDENT' ? true : false
|
|
|
+ state.showCode =
|
|
|
+ state.userType == 'STUDENT' || !state.userType ? true : false
|
|
|
// 拼链接
|
|
|
getMusicList()
|
|
|
})
|
|
|
const printHander = async () => {
|
|
|
const tempCanvas = await imgToCanvas(state.imgData)
|
|
|
+ const showImg = convasToImg(tempCanvas)
|
|
|
+ state.showImg = showImg
|
|
|
+ console.log(state.showImg)
|
|
|
const canvas = addWatermark(tempCanvas, '酷乐秀')
|
|
|
const imgUrl = convasToImg(canvas)
|
|
|
const link = document.createElement('a')
|
|
@@ -194,17 +225,29 @@ export default defineComponent({
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <div class={classes.musicContent}>
|
|
|
- {/* id="iframe" ref="iframe"*/}
|
|
|
- <iframe
|
|
|
- id="containerPrint"
|
|
|
- ref="print"
|
|
|
- style="width: 100%;page-break-after:always; "
|
|
|
- src={state.accompanyUrl}
|
|
|
- class={classes.iframe}
|
|
|
- />
|
|
|
+ <div class={classes.musicContent}>
|
|
|
+ {/* id="iframe" ref="iframe"*/}
|
|
|
+ <iframe
|
|
|
+ id="containerPrint"
|
|
|
+ ref="print"
|
|
|
+ style="width: 100%;page-break-after:always; "
|
|
|
+ src={state.accompanyUrl}
|
|
|
+ class={classes.iframe}
|
|
|
+ />
|
|
|
|
|
|
- </div>
|
|
|
+ {state.showImg ? (
|
|
|
+ <img src={state.showImg} alt="" />
|
|
|
+ ) : (
|
|
|
+ <div>
|
|
|
+ <Vue3Lottie
|
|
|
+ animationData={AstronautJSON}
|
|
|
+ class={classes.finch}
|
|
|
+ ></Vue3Lottie>
|
|
|
+ <p class={classes.finchLoad}>加载中...</p>
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+ {}
|
|
|
+ </div>
|
|
|
|
|
|
{state.showCode ? (
|
|
|
<div class={classes.showCode}>
|
|
@@ -239,7 +282,12 @@ export default defineComponent({
|
|
|
settings={['captions', 'quality', 'speed', 'loop']}
|
|
|
class={classes.audios}
|
|
|
></colVideo>
|
|
|
- ) : null}
|
|
|
+ ) : <>
|
|
|
+ <div class={classes.noMoreWrap}>
|
|
|
+ <img src={noMore} alt="" />
|
|
|
+ <p>温馨提示:该曲目暂不支持播放喔~</p>
|
|
|
+ </div>
|
|
|
+ </>}
|
|
|
</div>
|
|
|
<div class={classes.right}>
|
|
|
<div class={classes.musicInfo}>
|