| | |
| | | </el-table-column> |
| | | <el-table-column label="文件内容"> |
| | | <template slot-scope="scope"> |
| | | <video v-if="scope.row.contentType === 'video'" :src="'/api/files/' + scope.row.contentUrl.url" |
| | | <video controls v-if="scope.row.contentType === 'video'" :src="'/api/files/' + scope.row.contentUrl.url" |
| | | class="showContent" /> |
| | | <img v-if="scope.row.contentType === 'img'" :src="'/api/files/' + scope.row.contentUrl.url" |
| | | class="showContent" /> |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="文件类型" prop="contentType"> |
| | | <el-select v-model="form.contentType" placeholder="不同类型的文件阅览方式不同,多余文件请以附件形式上传"> |
| | | <el-select v-model="form.contentType" placeholder="不同类型的文件阅览方式不同,多余文件请以附件形式上传" @change="fileChange"> |
| | | <el-option label="视频" value="video"></el-option> |
| | | <el-option label="PDF" value="pdf"></el-option> |
| | | <el-option label="图片" value="img"></el-option> |
| | |
| | | }; |
| | | }, |
| | | methods: { |
| | | fileChange() { |
| | | console.log(1111111) |
| | | this.form.contentUrl = []; |
| | | }, |
| | | handleSelectionChange(val) { |
| | | this.ids = val.map(item => item.id); |
| | | }, |
| | |
| | | this.form.attachment = uploadData; |
| | | }, |
| | | getUploadUrl(uploadData) { |
| | | this.form.contentUrl = uploadData[0]; |
| | | this.form.contentUrl = uploadData; |
| | | }, |
| | | remove(id) { |
| | | OnlineStudyAPI.remove([id]).then(res => { |
| | |
| | | handlerSubmit() { |
| | | this.$refs['form'].validate((valid) => { |
| | | if (valid) { |
| | | this.form.contentUrl = this.form.contentUrl[0] |
| | | if (this.form.id) { |
| | | OnlineStudyAPI.update(this.form).then(res => { |
| | | const temp = JSON.parse(JSON.stringify(this.form)); |
| | | // this.form.contentUrl = this.form.contentUrl[0] |
| | | temp.contentUrl = temp.contentUrl[0]; |
| | | if (temp.id) { |
| | | OnlineStudyAPI.update(temp).then(res => { |
| | | if (res.code === 1) { |
| | | this.$message.success('修改成功'); |
| | | this.open = false; |
| | |
| | | } |
| | | }); |
| | | } else { |
| | | OnlineStudyAPI.add(this.form).then(res => { |
| | | OnlineStudyAPI.add(temp).then(res => { |
| | | if (res.code === 1) { |
| | | this.$message.success('添加成功'); |
| | | this.open = false; |
| | |
| | | } |
| | | }); |
| | | }, |
| | | resetForm() { |
| | | this.form = { |
| | | contentType: 'video', |
| | | subject: '', |
| | | belongType: 2, |
| | | contentUrl: [], |
| | | attachment: [], |
| | | temp: [] |
| | | } |
| | | }, |
| | | handleClose() { |
| | | this.open = false; |
| | | this.form = {}; |
| | | this.resetForm(); |
| | | }, |
| | | handlerAdd() { |
| | | this.form = {}; |
| | | this.resetForm(); |
| | | this.open = true; |
| | | this.dialogTitle = '添加学习内容'; |
| | | }, |