// 获取视频
getVideo(event) {
this.media = event.target.files[0]
let file = new FormData();
file.append(‘file‘, this.media)
this.$axios.post(‘storage/upload‘, file).then(res => {
console.log(res)
this.logoimgUrl = res.data.data.images;
console.log(this.logoimgUrl)
this.videoUrl = res.data.data.storage.url;
console.log(this.videoUrl)
this.videoUrl_size = res.data.data.size;
if (this.videoUrl_size > 52428800) {
this.$toast({
message: "文件超过50M",
position: ‘center‘,
duration: 2000
});
} else {
let player = document.querySelector(‘#myVideo‘)
player.src = this.videoUrl;
console.log(player.src)
player.play()
}
if (res.data.errno == 0) {
const toast = this.$toast.loading({
duration: 0, // 持续展示 toast
forbidClick: true,
message: ‘加载视频封面倒计时 12 秒‘,
});
let second = 12;
const timer = setInterval(() => {
second--;
if (second) {
toast.message = `视频封面倒计时 ${second} 秒`;
} else {
clearInterval(timer);
// 手动清除 Toast
this.$toast.clear();
}
}, 1000);
this.rel = false;
this.no_rel = true;
setTimeout(() => {
let _this = this;
_this.aboc = _this.logoimgUrl[_this.imgIndex]
_this.no_logo = true;
}, 12000)
} else {
this.rel = true;
this.no_rel = false;
}
})
},