更新音乐播放器

This commit is contained in:
jmal 2020-03-31 22:25:48 +08:00
parent 85950d56b0
commit cd0ee5a70b
4 changed files with 13 additions and 11 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@ -104,7 +104,7 @@ export default {
checkChunkUploadedByResponse: function(chunk, message) {
const objMessage = JSON.parse(message)
const res = objMessage.data
if (res.pass) {
if (res && res.pass) {
// 秒传
return true
}

View File

@ -1,6 +1,6 @@
<template>
<div ref="audioPreview" v-show="show">
<div class="audio-player"
<div class="audio-player"
v-aplayerDrag="{ x: transformX, y: transformY }"
@mouseenter="closeBarShow = true" @mouseleave="closeBarShow = false">
<!-- <div class="audio-player"> -->
@ -12,7 +12,7 @@
order.sync="list"
:mini.sync="mini"
:audio="audio"
:lrctype="3">
:lrc-type="0">
</aplayer>
<div v-show="closeBarShow" class="close-bar" @click="close">
<svg-icon class="audio-player-close" icon-class="close"/>
@ -41,7 +41,7 @@ export default {
closeBarShow: false,
audio: [],
mini: false,
}
}
},
mounted() {
this.onPicClick = this.onPicClick.bind(this);
@ -50,15 +50,17 @@ export default {
Bus.$on('onAddAudio',newFile => {
this.show = true
let url = process.env.VUE_APP_BASE_FILE_API + 'preview/' + newFile.name + '?jmal-token=' + this.$store.state.user.token + '&fileIds=' + newFile.id
let music = newFile.music
let fileName = newFile.name.substring(0,newFile.name.length - newFile.suffix.length-1)
let musicOperation = {
id: newFile.id,
name: newFile.name,
artist: newFile.name,
name: music.songName ? music.songName : fileName,
artist: music.songName ? music.singer : fileName,
url: url,
type: newFile.contentType,
cover: 'https://images.unsplash.com/photo-1495420378468-78588a508652?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2100&q=80',
cover: music.songName ? 'data:image/png;base64,'+music.coverBase64 :'',
}
let musicIndex = this.audio.findIndex(item => item.id===newFile.id)
let musicIndex = this.audio.findIndex(item => item.id===newFile.id)
if(musicIndex < 0){
if(this.audio.length === 1){
let loop = document.querySelector('.aplayer-icon.aplayer-icon-loop');
@ -85,7 +87,7 @@ export default {
},
onPicClick() {
// this.mini = !this.mini
console.log(this.$refs.audioPlayer)
// console.log(this.$refs.audioPlayer)
},
},
destroyed() {
@ -156,4 +158,4 @@ export default {
top: -8px;
right: 13px;
}
</style>
</style>

View File

@ -29,7 +29,7 @@ import Viewer from 'v-viewer'
import APlayer from '@moefe/vue-aplayer';
Vue.use(APlayer, {
defaultCover: 'https://images.unsplash.com/photo-1495420378468-78588a508652?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2100&q=80', // 设置播放器默认封面图片
defaultCover: 'https://images.unsplash.com/photo-1511671782779-c97d3d27a1d4?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=60', // 设置播放器默认封面图片
productionTip: false, // 是否在控制台输出版本信息
});