|
@@ -0,0 +1,316 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <div class="filter-container margin-bottom">
|
|
|
+ <div style="width:200px; display:inline-block; float:left">
|
|
|
+ <el-input v-model="input" placeholder="请输入内容" clearable />
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <el-select
|
|
|
+ v-model="value2"
|
|
|
+ style="display:inline-block; float:left; margin-left:15px; width:150px"
|
|
|
+ placeholder="格式"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in options2"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ <el-select
|
|
|
+ v-model="value3"
|
|
|
+ style="display:inline-block; float:left; margin-left:15px; width:150px"
|
|
|
+ placeholder="状态"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in options3"
|
|
|
+ :key="item.value1"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ <el-button
|
|
|
+ style="display:inline-block; float:left; margin-left:15px;"
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-search"
|
|
|
+ >搜索</el-button>
|
|
|
+ </div>
|
|
|
+ <el-button
|
|
|
+ class="inline-block pink-btn"
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-folder-add"
|
|
|
+ @click="dialogFormVisible = true;sort=false"
|
|
|
+ >新建资料</el-button>
|
|
|
+ <el-button class="inline-block" type="primary" icon="el-icon-open">批量上架</el-button>
|
|
|
+ </div>
|
|
|
+ <el-table :data="tableData" border style="width: 100%">
|
|
|
+ <el-table-column
|
|
|
+ type="selection"
|
|
|
+ width="55"
|
|
|
+ />
|
|
|
+ <el-table-column label="名称" width="300">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span style="margin-left: 10px">{{ scope.row.name }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="所属分类" width="200">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span style="margin-left: 10px">{{ scope.row.sort }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="播放次数" width="200">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span style="margin-left: 10px">{{ scope.row.time }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="访问量" width="200">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span style="margin-left: 10px">{{ scope.row.traffic }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="格式" width="200">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span style="margin-left: 10px">{{ scope.row.type }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="状态" width="200">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span style="margin-left: 10px">{{ scope.row.status }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button size="mini" type="primary" @click="dialogFormVisible = true,sort=true ;">修改</el-button>
|
|
|
+ <el-button size="mini" type="success" @click="handleModifyStatus(row,'published')">上架</el-button>
|
|
|
+ <el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <el-pagination style="margin-top:50px" background layout="prev, pager, next" :total="1000" />
|
|
|
+
|
|
|
+ <el-dialog title="新建资料" :visible.sync="dialogFormVisible" @close="$refs['addForm'].resetFields()">
|
|
|
+ <el-form :model="form">
|
|
|
+ <el-form-item label="填写名称" :label-width="formLabelWidth">
|
|
|
+ <el-input v-model="form.name" autocomplete="off" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="所属分类" :label-width="formLabelWidth">
|
|
|
+ <template>
|
|
|
+ <el-checkbox-group v-model="checkList">
|
|
|
+ <el-checkbox label="分类1" />
|
|
|
+ <el-checkbox label="分类2" />
|
|
|
+ <el-checkbox label="分类3" />
|
|
|
+ <el-checkbox label="分类4" />
|
|
|
+ <el-checkbox label="分类1" disabled />
|
|
|
+ </el-checkbox-group>
|
|
|
+ </template>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="文件形式" :label-width="formLabelWidth">
|
|
|
+ <el-select v-model="form.type" placeholder="请选择文件形式" :disabled="sort">
|
|
|
+ <el-option label="视频" value="视频" />
|
|
|
+ <el-option label="音频" value="音频" />
|
|
|
+ <el-option label="图片" value="图片" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ v-show="form.type!==''"
|
|
|
+ :label="`${form.type}封面`"
|
|
|
+ :label-width="formLabelWidth"
|
|
|
+ >
|
|
|
+ <el-upload
|
|
|
+ action="https://jsonplaceholder.typicode.com/posts/"
|
|
|
+ :on-preview="handlePictureCardPreview"
|
|
|
+ :on-remove="handleRemove"
|
|
|
+ :before-upload="beforeAvatarUpload"
|
|
|
+ list-type="picture-card"
|
|
|
+ :limit="limitNum"
|
|
|
+ :on-exceed="numberOverflow"
|
|
|
+ :on-success="handleSuccess"
|
|
|
+ :on-error="handleError"
|
|
|
+ >
|
|
|
+ <i class="el-icon-plus" />
|
|
|
+ <div slot="tip" class="el-upload__tip">封面只能上传jpg/png,且不超过2M</div>
|
|
|
+ </el-upload>
|
|
|
+ <el-dialog :visible.sync="dialogVisible">
|
|
|
+ <img width="100%" :src="dialogImageUrl" alt>
|
|
|
+ </el-dialog>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item v-show="form.type!==''" :label="`${form.type}上传`" :label-width="formLabelWidth">
|
|
|
+ <el-upload
|
|
|
+ class="upload-demo"
|
|
|
+ drag
|
|
|
+ action="https://jsonplaceholder.typicode.com/posts/"
|
|
|
+ :limit="limitNum"
|
|
|
+ show-file-list="true"
|
|
|
+ close-on-press-escape="true"
|
|
|
+ destroy-on-close="true"
|
|
|
+ >
|
|
|
+ <i class="el-icon-upload" />
|
|
|
+ <div class="el-upload__text">
|
|
|
+ 将文件拖到此处,或
|
|
|
+ <em>点击上传</em>
|
|
|
+ </div>
|
|
|
+ </el-upload>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="dialogFormVisible = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ sort: true,
|
|
|
+ show: true,
|
|
|
+ dialogImageUrl: '',
|
|
|
+ dialogVisible: false,
|
|
|
+ input: '',
|
|
|
+ tableData: [
|
|
|
+ {
|
|
|
+ sort: '教育',
|
|
|
+ name: '王小虎',
|
|
|
+ time: '2016-05-02',
|
|
|
+ traffic: '54545',
|
|
|
+ type: '视频',
|
|
|
+ status: '下架'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ sort: '教育',
|
|
|
+ name: '王小虎',
|
|
|
+ time: '2016-05-02',
|
|
|
+ traffic: '54545',
|
|
|
+ type: '视频',
|
|
|
+ status: '下架'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ sort: '教育',
|
|
|
+ name: '王小虎',
|
|
|
+ time: '2016-05-02',
|
|
|
+ traffic: '54545',
|
|
|
+ type: '视频',
|
|
|
+ status: '下架'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ sort: '教育',
|
|
|
+ name: '王小虎',
|
|
|
+ time: '2016-05-02',
|
|
|
+ traffic: '54545',
|
|
|
+ type: '视频',
|
|
|
+ status: '下架'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ sort: '教育',
|
|
|
+ name: '王小虎',
|
|
|
+ time: '2016-05-02',
|
|
|
+ traffic: '54545',
|
|
|
+ type: '视频',
|
|
|
+ status: '下架'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ sort: '教育',
|
|
|
+ name: '王小虎',
|
|
|
+ time: '2016-05-02',
|
|
|
+ traffic: '54545',
|
|
|
+ type: '视频',
|
|
|
+ status: '下架'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ options2: [
|
|
|
+ {
|
|
|
+ value: '选项1',
|
|
|
+ label: '图片'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: '选项2',
|
|
|
+ label: '音频'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: '选项3',
|
|
|
+ label: '视频'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: '选项4',
|
|
|
+ label: '文字'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ options3: [
|
|
|
+ {
|
|
|
+ value: '选项1',
|
|
|
+ label: '上架'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: '选项2',
|
|
|
+ label: '下架'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ value2: [],
|
|
|
+ value3: [],
|
|
|
+ vedio: false,
|
|
|
+ dialogFormVisible: false,
|
|
|
+ form: {
|
|
|
+ name: '',
|
|
|
+ region: '',
|
|
|
+ type: '',
|
|
|
+ date1: '',
|
|
|
+ date2: '',
|
|
|
+ delivery: false,
|
|
|
+ resource: '',
|
|
|
+ desc: ''
|
|
|
+ },
|
|
|
+ formLabelWidth: '120px',
|
|
|
+ checkList: ['', ''],
|
|
|
+ limitNum: 1
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ handleEdit(index, row) {
|
|
|
+ console.log(index, row)
|
|
|
+ },
|
|
|
+ handleDelete(index, row) {
|
|
|
+ console.log(index, row)
|
|
|
+ },
|
|
|
+ handleRemove(file, fileList) {
|
|
|
+ console.log(file, fileList)
|
|
|
+ },
|
|
|
+ handlePreview(file) {
|
|
|
+ console.log(file)
|
|
|
+ },
|
|
|
+ handlePictureCardPreview(file) {
|
|
|
+ this.dialogImageUrl = file.url
|
|
|
+ this.dialogVisible = true
|
|
|
+ },
|
|
|
+ beforeAvatarUpload(file) {
|
|
|
+ const istype = file.type === 'image/jpeg' || file.type === 'image/png'
|
|
|
+ const isLt2M = file.size / 1024 / 1024 < 2
|
|
|
+
|
|
|
+ if (!istype) {
|
|
|
+ this.$message.error('上传封面图片只能是 JPG 或者 PNG 格式!')
|
|
|
+ }
|
|
|
+ if (!isLt2M) {
|
|
|
+ this.$message.error('上传封面图片大小不能超过 2MB!')
|
|
|
+ }
|
|
|
+ return istype && isLt2M
|
|
|
+ },
|
|
|
+ // 上传封面超出个数限制时的钩子
|
|
|
+ numberOverflow(files, fileList) {
|
|
|
+ this.$message.error('只能上传1张封面图片')
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.margin-bottom {
|
|
|
+ margin-bottom: 65px;
|
|
|
+}
|
|
|
+.inline-block {
|
|
|
+ // display: inline-block;
|
|
|
+ float: left;
|
|
|
+ margin-left: 15px;
|
|
|
+}
|
|
|
+</style>
|