Commit 9eae1314 authored by qzhxx's avatar qzhxx

优化

parent 00b93a3e
......@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>中国国家博物馆建党百年展点播院线服务平台</title>
<title>中国国家博物馆历史图鉴学习教育服务平台</title>
</head>
<body>
<div id="app"></div>
......
<template>
<div>
<!-- {{fileList}} -->
<el-upload
ref="upload"
accept=".mp3,.aac,.wma,.rm,.flac,.ogg,"
......@@ -9,6 +10,7 @@
action
:auto-upload="false"
:before-upload="beforeAvatarUpload"
:on-remove="handleRemove"
>
<i class="el-icon-plus fileUpload"></i>
......@@ -35,9 +37,14 @@ export default {
};
},
mounted(){
console.log("uploadAudio",this.fileList)
// console.log("uploadAudio",this.fileList)
},
methods: {
handleRemove(file, fileList) {
// console.log(fileList,fileList.map(item=>item.id),'1111')
// return this.$confirm(`确定移除 ${ file.name }?`);
this.$emit('audioList',fileList.map(item=>item.id))
},
submitUpload() {
const loading = this.$loading({
lock: true,
......
......@@ -9,6 +9,7 @@
action
:auto-upload="false"
:before-upload="beforeAvatarUpload"
:on-remove="handleRemove"
>
<i class="el-icon-plus fileUpload"></i>
</el-upload>
......@@ -42,6 +43,11 @@ export default {
mounted(){
},
methods: {
handleRemove(file, fileList) {
// console.log(fileList,fileList.map(item=>item.id),'1111')
// return this.$confirm(`确定移除 ${ file.name }?`);
this.$emit('datumList',fileList.map(item=>item.id))
},
submitUpload() {
const loading = this.$loading({
lock: true,
......
<template>
<div>
<el-upload
ref="upload"
accept=".mp4,.flv,.mpeg,.mpg"
:multiple="true"
:http-request="uploadFile"
:file-list="fileList"
action
:auto-upload="false"
:before-upload="beforeAvatarUpload"
>
<i class="el-icon-plus fileUpload"></i>
</el-upload>
<el-button style="margin-left: 10px;" size="small" type="success" v-loading="loading" @click="submitUpload">上传到服务器</el-button>
</div>
</template>
<script>
export default {
props:{
fileList:{
type:Array,
default:[]
},
},
data() {
return {
fullscreenLoading: false,
loading:false,
filedata:[],
fileArr: [],
fileList:[],
// fileList: [{name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}, {name: 'food2.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}]
};
},
methods: {
openFullScreen2() {
const loading = this.$loading({
lock: true,
text: '上传中,请稍候。。。',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
},
submitUpload() { // 导入
// this.openFullScreen2()
const loading = this.$loading({
lock: true,
text: '上传中,请稍候。。。',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
// this.loading = true
let tempData = this.filedata
this.filedata = new FormData() // 用FormData存放上传文件
this.$refs.upload.submit() // 会循环调用uploadFile方法,多个文件调用多次
let _this = this;
_this
.$https(
{
method: "post",
url: "file/video/content/upload",
authType: this.backToken
},
this.filedata
)
.then(res => {
let resData = res.data;
console.log(res)
// this.loading = false
if (resData.resultCode == "200") {
loading.close();
_this.$message.success('上传成功!')
const data = resData.data.fileList;
let newArray = data.map((item) => item.id);
let editArray =[]
if(this.fileList.length){
editArray = this.fileList.map(item=>item.id)
}
this.$emit("videoList", [...newArray,...editArray]);
} else {
_this.$message.error(resData.msg || resData.message);
}
})
.catch(err => {
console.log(err);
_this.$message.error(err.msg || err.message);
});
},
uploadFile(file) {
this.filedata.append('file', file.file)
},
beforeAvatarUpload(file) {
const isLt10G = file.size / 1024 / 1024 / 1024 < 10;
if (!isLt10G) {
this.$message.error("上传文件大小不能超过 10GB!");
}
return isLt10G;
}
}
};
</script>
<style>
.el-upload .fileUpload {
width: 148px;
height: 148px;
line-height: 148px!important;
margin: 0 auto;
border: 1px dashed #c0ccda;
font-size: 24px;
font: #ccc;
}
</style>
......@@ -58,6 +58,8 @@ export default {
const children = this.files;
const index = children.findIndex(d => d.name === data.name);
children.splice(index, 1);
console.log(this.files,'111')
this.$emit("videoList", this.files.map(item=>item.id));
},
getFiles: function(event) {
console.log(event);
......
......@@ -101,11 +101,12 @@
<el-form-item label="展板音频">
<div v-if="contentData.audioList.length">
<span
class="file-box"
class=""
v-for="(s, i) in contentData.audioList"
:key="i"
>
<audio
style="float:left;"
controls
width="100%"
height="100%"
......@@ -113,7 +114,7 @@
>
<source :src="s.fileUrl" />
</audio>
<span>{{ s.fileName }}</span>
<span style="float:left;display:inline-block;margin:10px 0px 20px 20px;">{{ s.fileName }}</span>
</span>
</div>
<div v-else>暂无数据</div>
......
......@@ -272,8 +272,13 @@ export default {
})
.then(
res => {
this.$message({ type: "success", message: "删除成功!" });
if(res.data.resultCode === "200"){
this.$message({ type: "success", message: "删除视频申请已提交,待审核!" });
_this.onSearch();
}else{
this.$message({ type: "error", message: res.data.message });
}
},
error => {
this.$message({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment