上传视频

This commit is contained in:
yanwenlong
2024-01-08 21:28:48 +08:00
parent 04ed3f3c72
commit bc2cffe4e3
2 changed files with 60 additions and 6 deletions

View File

@@ -36,8 +36,8 @@
<img :src="scope.row.img" alt="" style="width:70px;height:100px" /> <img :src="scope.row.img" alt="" style="width:70px;height:100px" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="内容" align="center" prop="content"> <!-- <el-table-column label="内容" align="center" prop="content">
</el-table-column> </el-table-column> -->
<el-table-column label="分类" align="center" prop="type"> <el-table-column label="分类" align="center" prop="type">
<template slot-scope="scope"> <template slot-scope="scope">
{{ filterAA(scope.row.type) }} {{ filterAA(scope.row.type) }}
@@ -93,7 +93,7 @@
</el-row> </el-row>
<el-row type="flex" justify="center"> <el-row type="flex" justify="center">
<el-form-item label="内容" prop="content" label-width="48px"> <el-form-item label="内容" prop="content" label-width="48px">
<el-input style="width:500px" v-model="addForm.content"></el-input> <el-input style="width:500px" v-model="addForm.content" :rows="5" type="textarea"></el-input>
</el-form-item> </el-form-item>
</el-row> </el-row>
<el-row type="flex" justify="center"> <el-row type="flex" justify="center">
@@ -112,7 +112,7 @@
</el-form-item> </el-form-item>
</el-row> </el-row>
<el-row type="flex" justify="center"> <el-row type="flex" justify="center">
<el-form-item label="图片" prop="img"> <el-form-item label="图片" prop="img" label-width="48px">
<el-upload :limit="1" class="el-uploadfeng " <el-upload :limit="1" class="el-uploadfeng "
ref="files" ref="files"
:class="{ uoloadSty: dataForm.showBtnDealImg, disUoloadSty: dataForm.noneBtnImg }" :class="{ uoloadSty: dataForm.showBtnDealImg, disUoloadSty: dataForm.noneBtnImg }"

View File

@@ -82,6 +82,23 @@
<el-input style="width:500px" v-model="addForm.url"></el-input> <el-input style="width:500px" v-model="addForm.url"></el-input>
</el-form-item> </el-form-item>
</el-row> </el-row>
<el-row type="flex" justify="center">
<el-form-item label="资源文件" prop="img" label-width="100px">
<el-upload :limit="1" class="el-uploadfeng "
ref="files"
:class="{ uoloadSty: dataForm.showBtnDealImg, disUoloadSty: dataForm.noneBtnImg }"
:action="baseUrl + '/oss/fileoss'" list-type="picture-card" :on-preview="handlePictureCardPreview"
:file-list="fileList" :on-success="handlePicSuccess" accept=".mp3,.mp4,.gif,.mpeg,.mpg" :on-remove="handleRemove">
<i class="el-icon-plus"></i>
</el-upload>
<!-- <el-dialog :visible.sync="dialogVisible" :append-to-body="true">
<video width="100%" :src="addForm.url" alt="">
<video controls width="250" v-if="dataForm.video != ''">
<source :src="dataForm.video" type="video/mp4" />
</video>
</el-dialog> -->
</el-form-item>
</el-row>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="cancleClose"> </el-button> <el-button @click="cancleClose"> </el-button>
@@ -93,9 +110,11 @@
</div> </div>
</template> </template>
<script> <script>
import global from '../../common/common.vue' //引入共用组间
export default { export default {
data () { data () {
return { return {
baseUrl: global.baseUrl,
typeList: [ typeList: [
{ {
dictValue:'吴门之歌', dictValue:'吴门之歌',
@@ -132,7 +151,8 @@ export default {
dataListSelections: [], dataListSelections: [],
addOrUpdateVisible: false, addOrUpdateVisible: false,
bookIds:[], bookIds:[],
titlesub: '新增' titlesub: '新增',
fileList: [],
} }
}, },
components: { components: {
@@ -223,6 +243,15 @@ export default {
this.addForm.name = row.name this.addForm.name = row.name
this.addForm.type = row.type.toString() this.addForm.type = row.type.toString()
this.addForm.url = row.url this.addForm.url = row.url
this.fileList = []
var img = {
name: '',
url: row.img
}
var attr = []
attr.push(img)
this.fileList = attr
console.log('this.fileList', this.fileList);
this.addOrUpdateVisible = true this.addOrUpdateVisible = true
}, },
@@ -241,6 +270,8 @@ export default {
"type": '', "type": '',
"url": '' "url": ''
} }
this.fileList = []
}, },
// 删除 // 删除
deleteHandle (id) { deleteHandle (id) {
@@ -291,7 +322,30 @@ export default {
}) })
} }
}) })
} },
handlePictureCardPreview(file) {
this.addForm.url = file.url;
this.dialogVisible = true;
},
handlePicSuccess(res, file) {
// console.log(res,'res')
if (res.msg == "success") {
this.addForm.url = res.url;
this.fileList.push({
name: file.name,
url: res.url
})
console.log(this.dataForm.url,'url')
this.$message.success("上传成功");
} else {
this.$message.error("上传失败");
}
},
handleRemove(file, fileList) {
this.addForm.url = '';
this.fileList = fileList
// this.addForm.noneBtnImg = fileList.length >= this.addForm.limitCountImg;
},
} }
} }
</script> </script>