123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <template>
- <div
- class="cloudCoachPlayer"
- :style="{
- width: width * scale + 'px',
- height: height * scale + 'px',
- transform: `scale(${1 / scale})`
- }"
- >
- <div v-if="loading" class="loading-overlay">
- <div class="loadingBox">
- <div class="loadingItem"></div>
- <div class="loadingItem"></div>
- <div class="loadingItem"></div>
- <div class="loadingItem"></div>
- </div>
- </div>
- <iframe class="musicIframe" frameborder="0" :src="url" @load="handleIframeLoad"></iframe>
- </div>
- </template>
- <script setup lang="ts">
- import { ref, computed } from "vue"
- import { getToken } from "@/libs/auth"
- import { YJL_URL_API } from "@/config/index"
- import queryParams from "@/queryParams"
- const props = withDefaults(
- defineProps<{
- width: number
- height: number
- id: string
- scale?: number
- }>(),
- {
- scale: 1
- }
- )
- const url = computed(() => {
- return `${YJL_URL_API}?v=${Date.now()}&showGuide=true&showWebGuide=false&platform=pc&imagePos=right&zoom=0.8&modelType=practise&instrumentId=${queryParams.instrumentId}&iscurseplay=play&id=${props.id}&Authorization=${getToken()}`
- })
- // 先关闭这个功能
- const loading = ref(true)
- function handleIframeLoad() {
- loading.value = false
- }
- </script>
- <style lang="scss" scoped>
- .cloudCoachPlayer {
- width: 100%;
- height: 100%;
- position: relative;
- overflow: hidden;
- user-select: none;
- line-height: 1;
- transform-origin: 0 0;
- background-color: #213793;
- .musicIframe {
- width: 100%;
- height: 100%;
- }
- .loading-overlay {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
- flex-direction: column;
- z-index: 10;
- color: #fff;
- background: url("../cloudCoachList/imgs/musicBg.png");
- background-size: cover;
- .loadingBox {
- width: 30px;
- height: 30px;
- display: flex;
- justify-content: space-between;
- flex-wrap: wrap;
- align-content: space-between;
- animation: rotate 1.5s linear infinite;
- .loadingItem {
- width: 12px;
- height: 12px;
- border-radius: 50%;
- background: #20bdff;
- opacity: 0.5;
- &:nth-child(2) {
- opacity: 1;
- }
- }
- }
- @keyframes rotate {
- from {
- transform: rotate(0deg);
- }
- to {
- transform: rotate(360deg);
- }
- }
- }
- }
- </style>
|