|
@@ -9,32 +9,32 @@
|
|
|
<el-table-column
|
|
|
label="序号"
|
|
|
width="60"
|
|
|
- prop="sort"
|
|
|
+ prop="categoryRelation.sort"
|
|
|
/>
|
|
|
<el-table-column
|
|
|
label="id"
|
|
|
width="160"
|
|
|
- prop="id"
|
|
|
+ prop="course.id"
|
|
|
/>
|
|
|
<el-table-column
|
|
|
label="专区名称"
|
|
|
width="200"
|
|
|
- prop="title"
|
|
|
+ prop="course.title"
|
|
|
/>
|
|
|
<el-table-column
|
|
|
- label="专区类型"
|
|
|
+ label="播放状态"
|
|
|
width="180"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
- <span>{{ targetCode(scope.row.code) }}</span>
|
|
|
+ <span>{{ scope.row.course.continuity === 'CONTINUOUS_PLAY' ? '连续' : ( scope.row.course.continuity === 'DISCONTINUOUS_PLAY' ? '不连续' : '循环') }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- label="专题类型"
|
|
|
- width="180"
|
|
|
+ label="icon"
|
|
|
+ width="100"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
- <span>{{ scope.row.courseType === 'KNOWLEDGE' ? '知识付费' : '图书馆' }}</span>
|
|
|
+ <img :src="scope.row.course.iconImg" width="65">
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
@@ -42,7 +42,7 @@
|
|
|
width="80"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
- <span>{{ scope.row.status === 'ABNORMAL' ? '不正常' : '正常' }}</span>
|
|
|
+ <span>{{ scope.row.categoryRelation.status === 'ABNORMAL' ? '不正常' : '正常' }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
@@ -50,7 +50,7 @@
|
|
|
width="180"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
- <span>{{ newDate(scope.row.gmtCreated) }}</span>
|
|
|
+ <span>{{ newDate(scope.row.categoryRelation.gmtCreated) }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
@@ -58,7 +58,7 @@
|
|
|
width="180"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
- <span>{{ newDate(scope.row.gmtModified) }}</span>
|
|
|
+ <span>{{ newDate(scope.row.categoryRelation.gmtModified) }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="操作">
|
|
@@ -70,28 +70,14 @@
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
@click="handleUp(scope.$index, scope.row)"
|
|
|
- >{{ scope.row.status === 'ABNORMAL' ? '正常' : '不正常' }}</el-button>
|
|
|
+ >{{ scope.row.categoryRelation.status === 'ABNORMAL' ? '正常' : '不正常' }}</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
- <el-dialog title="专区" :visible.sync="dialogFormVisible">
|
|
|
+ <el-dialog title="专区课程" :visible.sync="dialogFormVisible">
|
|
|
<el-form ref="ruleForm" :model="form" :rules="rules">
|
|
|
- <el-form-item label="专区类型" :label-width="formLabelWidth" prop="code">
|
|
|
- <el-select v-model="form.code" placeholder="请选择">
|
|
|
- <el-option value="PAY" label="知识付费" />
|
|
|
- <el-option value="PRESCHOOL" label="学前" />
|
|
|
- <el-option value="PRIMARY" label="小学" />
|
|
|
- <el-option value="MIDDLE" label="中学" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="标题" :label-width="formLabelWidth" prop="title">
|
|
|
- <el-input v-model="form.title" autocomplete="off" clearable />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="专题类型" :label-width="formLabelWidth" prop="courseType">
|
|
|
- <el-select v-model="form.courseType" placeholder="请选择">
|
|
|
- <el-option value="KNOWLEDGE" label="知识付费" />
|
|
|
- <el-option value="LIBRARY" label="图书馆" />
|
|
|
- </el-select>
|
|
|
+ <el-form-item v-if="type === 'add'" label="courseId" :label-width="formLabelWidth" prop="courseId">
|
|
|
+ <el-input v-model="form.courseId" autocomplete="off" clearable />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="排序" :label-width="formLabelWidth" prop="sort">
|
|
|
<el-input v-model="form.sort" autocomplete="off" clearable />
|
|
@@ -124,14 +110,8 @@ export default {
|
|
|
formLabelWidth: '120px',
|
|
|
type: '',
|
|
|
rules: {
|
|
|
- code: [
|
|
|
- { required: true, message: '请选择专区类型', trigger: 'change' }
|
|
|
- ],
|
|
|
- title: [
|
|
|
- { required: true, message: '请输入排序', trigger: 'blur' }
|
|
|
- ],
|
|
|
- courseType: [
|
|
|
- { required: true, message: '请选择专题', trigger: 'change' }
|
|
|
+ courseId: [
|
|
|
+ { required: true, message: '请输入courseId', trigger: 'blur' }
|
|
|
],
|
|
|
status: [
|
|
|
{ required: true, message: '请选择状态', trigger: 'change' }
|
|
@@ -157,34 +137,15 @@ export default {
|
|
|
newDate(date) {
|
|
|
return new Date(date).toLocaleString()
|
|
|
},
|
|
|
- targetCode(type) {
|
|
|
- let target = ''
|
|
|
- switch (type) {
|
|
|
- case 'PRESCHOOL':
|
|
|
- target = '学前'
|
|
|
- break
|
|
|
- case 'PAY':
|
|
|
- target = '知识付费课程'
|
|
|
- break
|
|
|
- case 'PRIMARY':
|
|
|
- target = '小学'
|
|
|
- break
|
|
|
- case 'MIDDLE':
|
|
|
- target = '中学'
|
|
|
- break
|
|
|
- }
|
|
|
- return target
|
|
|
- },
|
|
|
handleEdit(index, row) {
|
|
|
console.log(index, row)
|
|
|
this.dialogFormVisible = true
|
|
|
this.type = 'set'
|
|
|
this.form = {
|
|
|
id: '',
|
|
|
- code: '',
|
|
|
- title: '',
|
|
|
+ categoryId: '',
|
|
|
+ courseId: '',
|
|
|
status: '',
|
|
|
- courseType: '',
|
|
|
sort: ''
|
|
|
}
|
|
|
this.setForm(row)
|
|
@@ -192,12 +153,10 @@ export default {
|
|
|
handleUp(index, row) {
|
|
|
console.log(index, row)
|
|
|
this.setForm(row)
|
|
|
- this.form.status = row.status === 'NORMAL' ? 'ABNORMAL' : 'NORMAL'
|
|
|
- this.$store.dispatch('categoryList/setBlockList', this.form).then(() => {
|
|
|
- this.dialogFormVisible = false
|
|
|
- this.$store.dispatch('categoryList/getBlockList', {
|
|
|
- blockType: '',
|
|
|
- page: this.page
|
|
|
+ this.form.status = row.categoryRelation.status === 'NORMAL' ? 'ABNORMAL' : 'NORMAL'
|
|
|
+ this.$store.dispatch('categoryList/setRelationList', this.form).then(() => {
|
|
|
+ this.$store.dispatch('categoryList/getRelationList', {
|
|
|
+ categoryId: this.$route.query.categoryId
|
|
|
})
|
|
|
})
|
|
|
},
|
|
@@ -206,19 +165,17 @@ export default {
|
|
|
if (valid) {
|
|
|
if (this.type === 'set') {
|
|
|
console.log(this.form)
|
|
|
- this.$store.dispatch('categoryList/setBlockList', this.form).then(() => {
|
|
|
+ this.$store.dispatch('categoryList/setRelationList', this.form).then(() => {
|
|
|
this.dialogFormVisible = false
|
|
|
- this.$store.dispatch('categoryList/getBlockList', {
|
|
|
- blockType: '',
|
|
|
- page: this.page
|
|
|
+ this.$store.dispatch('categoryList/getRelationList', {
|
|
|
+ categoryId: this.$route.query.categoryId
|
|
|
})
|
|
|
})
|
|
|
} else {
|
|
|
- this.$store.dispatch('categoryList/addBlockList', this.form).then(() => {
|
|
|
+ this.$store.dispatch('categoryList/addRelationList', this.form).then(() => {
|
|
|
this.dialogFormVisible = false
|
|
|
- this.$store.dispatch('categoryList/getBlockList', {
|
|
|
- blockType: '',
|
|
|
- page: this.page
|
|
|
+ this.$store.dispatch('categoryList/getRelationList', {
|
|
|
+ categoryId: this.$route.query.categoryId
|
|
|
})
|
|
|
})
|
|
|
}
|
|
@@ -232,28 +189,18 @@ export default {
|
|
|
this.dialogFormVisible = true
|
|
|
this.type = 'add'
|
|
|
this.form = {
|
|
|
- code: '',
|
|
|
- title: '',
|
|
|
- status: '',
|
|
|
- courseType: '',
|
|
|
+ categoryId: this.$route.query.categoryId,
|
|
|
+ courseId: '',
|
|
|
sort: ''
|
|
|
}
|
|
|
},
|
|
|
- handleCurrentChange(val) {
|
|
|
- console.log(val)
|
|
|
- this.page = val
|
|
|
- this.$store.dispatch('categoryList/getBlockList', {
|
|
|
- blockType: '',
|
|
|
- page: this.page
|
|
|
- })
|
|
|
- },
|
|
|
setForm(data) {
|
|
|
- this.form.id = data.id
|
|
|
- this.form.courseType = data.courseType
|
|
|
- this.form.title = data.title
|
|
|
- this.form.code = data.code
|
|
|
- this.form.sort = data.sort
|
|
|
- this.form.status = data.status
|
|
|
+ console.log(data.course)
|
|
|
+ this.form.id = data.categoryRelation.id
|
|
|
+ this.form.categoryId = this.$route.query.categoryId
|
|
|
+ this.form.courseId = data.course.id
|
|
|
+ this.form.sort = data.categoryRelation.sort
|
|
|
+ this.form.status = data.categoryRelation.status
|
|
|
}
|
|
|
}
|
|
|
}
|