|
|
@ -1,6 +1,25 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<div class="app-container"> |
|
|
|
<div class="app-container"> |
|
|
|
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px"> |
|
|
|
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px"> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label="标题"> |
|
|
|
|
|
|
|
<el-input v-model="form.title" style="width: 370px;" /> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="作者"> |
|
|
|
|
|
|
|
<el-input v-model="form.author" style="width: 370px;" /> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="封面"> |
|
|
|
|
|
|
|
<MaterialList v-model="form.imageArr" style="width: 370px" type="image" :num="1" :width="150" :height="150" /> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="文章分类"> |
|
|
|
|
|
|
|
<el-cascader |
|
|
|
|
|
|
|
v-model="form.categoryId" |
|
|
|
|
|
|
|
:options="categoryList" |
|
|
|
|
|
|
|
:show-all-levels="false" |
|
|
|
|
|
|
|
:props="{ checkStrictly: true }" |
|
|
|
|
|
|
|
@change="handleChange"> |
|
|
|
|
|
|
|
</el-cascader> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="收费类型" prop="chargeType"> |
|
|
|
<el-form-item label="收费类型" prop="chargeType"> |
|
|
|
<el-radio-group v-model="form.chargeType"> |
|
|
|
<el-radio-group v-model="form.chargeType"> |
|
|
|
<el-radio :label="0">免费</el-radio> |
|
|
|
<el-radio :label="0">免费</el-radio> |
|
|
@ -14,14 +33,11 @@ |
|
|
|
<el-form-item label="文章等级"> |
|
|
|
<el-form-item label="文章等级"> |
|
|
|
<el-input-number v-model="form.level" :min="1" label="文章等级"></el-input-number> |
|
|
|
<el-input-number v-model="form.level" :min="1" label="文章等级"></el-input-number> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="标题"> |
|
|
|
<el-form-item label="音频"> |
|
|
|
<el-input v-model="form.title" style="width: 370px;" /> |
|
|
|
<fileUpload v-model="form.audio" @input="audioInput" @change="audioChange"></fileUpload> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="作者"> |
|
|
|
<el-form-item label="视频"> |
|
|
|
<el-input v-model="form.author" style="width: 370px;" /> |
|
|
|
<fileUpload v-model="form.video" @input="videoInput" @change="videoChange"></fileUpload> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="封面"> |
|
|
|
|
|
|
|
<MaterialList v-model="form.imageArr" style="width: 370px" type="image" :num="1" :width="150" :height="150" /> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="简介"> |
|
|
|
<el-form-item label="简介"> |
|
|
|
<el-input v-model="form.synopsis" style="width: 370px;" rows="5" type="textarea" /> |
|
|
|
<el-input v-model="form.synopsis" style="width: 370px;" rows="5" type="textarea" /> |
|
|
@ -49,8 +65,10 @@ import editor from '../../components/Editor' |
|
|
|
import yamedit from '@/components/YamlEdit' |
|
|
|
import yamedit from '@/components/YamlEdit' |
|
|
|
import MaterialList from '@/components/material' |
|
|
|
import MaterialList from '@/components/material' |
|
|
|
import UeditorWrap from 'vue-ueditor-wrap'; |
|
|
|
import UeditorWrap from 'vue-ueditor-wrap'; |
|
|
|
|
|
|
|
import fileUpload from '@/components/file-upload'; |
|
|
|
|
|
|
|
import { initData } from '@/api/data' |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
components: { editor, picUpload, yamedit, MaterialList, UeditorWrap }, |
|
|
|
components: { editor, picUpload, yamedit, MaterialList, UeditorWrap,fileUpload }, |
|
|
|
// props: { |
|
|
|
// props: { |
|
|
|
// isAdd: { |
|
|
|
// isAdd: { |
|
|
|
// type: Boolean, |
|
|
|
// type: Boolean, |
|
|
@ -63,6 +81,7 @@ export default { |
|
|
|
form: { |
|
|
|
form: { |
|
|
|
id: '', |
|
|
|
id: '', |
|
|
|
cid: '', |
|
|
|
cid: '', |
|
|
|
|
|
|
|
categoryId:'', |
|
|
|
chargeType:0, |
|
|
|
chargeType:0, |
|
|
|
articleCharge:'', |
|
|
|
articleCharge:'', |
|
|
|
level:'', |
|
|
|
level:'', |
|
|
@ -93,12 +112,14 @@ export default { |
|
|
|
initialFrameWidth: '100%', // 初始容器宽度 |
|
|
|
initialFrameWidth: '100%', // 初始容器宽度 |
|
|
|
UEDITOR_HOME_URL: '/UEditor/', |
|
|
|
UEDITOR_HOME_URL: '/UEditor/', |
|
|
|
serverUrl: '' |
|
|
|
serverUrl: '' |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
categoryList:[] |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
watch: { |
|
|
|
}, |
|
|
|
}, |
|
|
|
created() { |
|
|
|
created() { |
|
|
|
|
|
|
|
this.getCategory(); |
|
|
|
this.form.id = this.$route.params.id |
|
|
|
this.form.id = this.$route.params.id |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$nextTick(() => { |
|
|
|
//this.init() |
|
|
|
//this.init() |
|
|
@ -112,6 +133,50 @@ export default { |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
|
|
|
|
audioInput(file){ |
|
|
|
|
|
|
|
this.form.audio = file; |
|
|
|
|
|
|
|
// console.log('file',file) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
audioChange(file){ |
|
|
|
|
|
|
|
this.form.audio = ''; |
|
|
|
|
|
|
|
// console.log('remove',file) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
videoInput(file){ |
|
|
|
|
|
|
|
this.form.video = file; |
|
|
|
|
|
|
|
// console.log('file',file) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
videoChange(file){ |
|
|
|
|
|
|
|
this.form.video = ''; |
|
|
|
|
|
|
|
// console.log('remove',file) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
getCategory(){ |
|
|
|
|
|
|
|
initData('/api/CourseCategory',this.getQueryParams()).then((res)=>{ |
|
|
|
|
|
|
|
// console.log(res) |
|
|
|
|
|
|
|
res.content.forEach((item)=>{ |
|
|
|
|
|
|
|
item.label = item.categoryName |
|
|
|
|
|
|
|
item.value = item.id |
|
|
|
|
|
|
|
item.children = item.categoryList |
|
|
|
|
|
|
|
item.categoryList.forEach((child)=>{ |
|
|
|
|
|
|
|
child.label = child.categoryName |
|
|
|
|
|
|
|
child.value = child.id |
|
|
|
|
|
|
|
child.children = child.categoryList |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
this.categoryList = res.content |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
getQueryParams: function() { |
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
page: 1, |
|
|
|
|
|
|
|
size: 10, |
|
|
|
|
|
|
|
sort: ['id,desc'], |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
handleChange(value){ |
|
|
|
|
|
|
|
console.log(value) |
|
|
|
|
|
|
|
this.form.categoryId = value[value.length-1]; |
|
|
|
|
|
|
|
this.form.cid = value[value.length-1]; |
|
|
|
|
|
|
|
}, |
|
|
|
addCustomDialog () { |
|
|
|
addCustomDialog () { |
|
|
|
window.UE.registerUI('yshop', function (editor, uiName) { |
|
|
|
window.UE.registerUI('yshop', function (editor, uiName) { |
|
|
|
let dialog = new window.UE.ui.Dialog({ |
|
|
|
let dialog = new window.UE.ui.Dialog({ |
|
|
@ -194,6 +259,7 @@ export default { |
|
|
|
id: '', |
|
|
|
id: '', |
|
|
|
cid: '', |
|
|
|
cid: '', |
|
|
|
chargeType:0, |
|
|
|
chargeType:0, |
|
|
|
|
|
|
|
categoryId:'', |
|
|
|
articleCharge:'', |
|
|
|
articleCharge:'', |
|
|
|
level:'', |
|
|
|
level:'', |
|
|
|
title: '', |
|
|
|
title: '', |
|
|
|