|
@@ -1,6 +1,7 @@
|
|
|
<template>
|
|
|
<div class="department-management-container">
|
|
|
- <vab-query-form style="display: flex;justify-content: space-between;">
|
|
|
+ <el-page-header @back="goBack" content="章节管理" style="margin-bottom: 20px;"> </el-page-header>
|
|
|
+ <vab-query-form style="display: flex; justify-content: space-between">
|
|
|
<vab-query-form-left-panel :span="12">
|
|
|
<el-button icon="el-icon-plus" type="primary" @click="handleEdit">
|
|
|
添加
|
|
@@ -46,13 +47,6 @@
|
|
|
prop="title"
|
|
|
show-overflow-tooltip
|
|
|
/>
|
|
|
- <el-table-column
|
|
|
- align="center"
|
|
|
- label="课程名称"
|
|
|
- min-width="120"
|
|
|
- prop="course.title"
|
|
|
- show-overflow-tooltip
|
|
|
- />
|
|
|
<!-- 章节排序 -->
|
|
|
<el-table-column
|
|
|
align="center"
|
|
@@ -62,46 +56,33 @@
|
|
|
>
|
|
|
<template #default="{ row }">
|
|
|
<div class="edit">
|
|
|
- <i
|
|
|
- v-if="editForm.id == row.id && editStatus == 1"
|
|
|
- class="el-icon-circle-close"
|
|
|
- @click.stop="cancelSort(row)"
|
|
|
- ></i>
|
|
|
- <span
|
|
|
- v-if="editForm.id !== row.id || editStatus == 0"
|
|
|
- class="sort-num"
|
|
|
- >
|
|
|
- {{ row.sort }}
|
|
|
- </span>
|
|
|
-
|
|
|
- <el-input
|
|
|
- v-if="editForm.id == row.id && editStatus == 1"
|
|
|
- ref="getFocus"
|
|
|
- v-model="row.sort"
|
|
|
- class="input-sort"
|
|
|
- @input="inputSort"
|
|
|
- />
|
|
|
-
|
|
|
- <i
|
|
|
- v-if="editForm.id !== row.id || editStatus == 0"
|
|
|
- class="el-icon-edit"
|
|
|
- @click="changeSort(row)"
|
|
|
- ></i>
|
|
|
- <i
|
|
|
- v-if="editForm.id == row.id && editStatus == 1"
|
|
|
- class="el-icon-circle-check"
|
|
|
- @click.stop="sureChange"
|
|
|
- ></i>
|
|
|
+ {{ row.sort }}
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ align="center"
|
|
|
+ label="状态"
|
|
|
+ min-width="80"
|
|
|
+ prop="status"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-tag v-if="row.status == 1">
|
|
|
+ 正常
|
|
|
+ </el-tag>
|
|
|
+ <el-tag v-if="row.status == 0" type="danger">
|
|
|
+ 禁用
|
|
|
+ </el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<!-- 命名需要再改 -->
|
|
|
<el-table-column
|
|
|
align="center"
|
|
|
fixed="right"
|
|
|
label="创建时间"
|
|
|
min-width="120"
|
|
|
- prop="humans"
|
|
|
+ prop="created_at"
|
|
|
show-overflow-tooltip
|
|
|
/>
|
|
|
<el-table-column
|
|
@@ -111,12 +92,8 @@
|
|
|
min-width="120"
|
|
|
>
|
|
|
<template #default="{ row }">
|
|
|
- <el-button type="text" @click="handleEdit(row)">
|
|
|
- 编辑
|
|
|
- </el-button>
|
|
|
- <el-button type="text" @click="handleDelete(row)">
|
|
|
- 删除
|
|
|
- </el-button>
|
|
|
+ <el-button type="text" @click="handleEdit(row)"> 编辑 </el-button>
|
|
|
+ <el-button type="text" @click="handleDelete(row)"> 删除 </el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<template #empty>
|
|
@@ -131,162 +108,162 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import { chapterList, chapterDelete, chapterEdit } from './api/chapter'
|
|
|
- import Edit from './components/ChapterManage'
|
|
|
+import { chapterList, chapterDelete, chapterEdit } from "./api/chapter";
|
|
|
+import Edit from "./components/ChapterManage";
|
|
|
|
|
|
- export default {
|
|
|
- name: 'ChapterManage',
|
|
|
- components: { Edit },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- //修改排序
|
|
|
- editForm: {},
|
|
|
- oldSort: 0,
|
|
|
- editStatus: 0, //排序编辑状态 0为正常 1显示输入框
|
|
|
- flag: false, //是否自动聚焦
|
|
|
- list: [],
|
|
|
- listLoading: true,
|
|
|
- total: 0,
|
|
|
- queryForm: {
|
|
|
- title: '',
|
|
|
- // courseId: '', //课程id
|
|
|
- },
|
|
|
- videoId: '', //视频id
|
|
|
+export default {
|
|
|
+ name: "ChapterManage",
|
|
|
+ components: { Edit },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ //修改排序
|
|
|
+ editForm: {},
|
|
|
+ oldSort: 0,
|
|
|
+ editStatus: 0, //排序编辑状态 0为正常 1显示输入框
|
|
|
+ flag: false, //是否自动聚焦
|
|
|
+ list: [],
|
|
|
+ listLoading: true,
|
|
|
+ total: 0,
|
|
|
+ queryForm: {
|
|
|
+ title: "",
|
|
|
+ // courseId: '', //课程id
|
|
|
+ },
|
|
|
+ videoId: "", //视频id
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ let route = this.$route;
|
|
|
+ console.log(route.query, "route.query11111");
|
|
|
+ // 章节列表里边接收上个页面的参数没有什么用目前!!!!!!!!!
|
|
|
+ // // 课程id
|
|
|
+ // this.courseId = route.query.courseId
|
|
|
+ // // 视频id
|
|
|
+ // this.queryForm.videoId = route.query.videoId
|
|
|
+ this.queryForm.courseId = route.query.courseId;
|
|
|
+ this.videoId = route.query.videoId;
|
|
|
+ this.getChapterList();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ goBack() {
|
|
|
+ this.$router.push({
|
|
|
+ path: "/video/index",
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 排序这块
|
|
|
+ cancelSort(row) {
|
|
|
+ this.editStatus = 0;
|
|
|
+ row.sort = this.oldSort;
|
|
|
+ },
|
|
|
+ //修改排序事件
|
|
|
+ async changeSort(row) {
|
|
|
+ console.log(row, "1111111111");
|
|
|
+ this.editStatus = 1;
|
|
|
+ this.editForm = row;
|
|
|
+ // 附件修改接口修改时这俩参数要求必填的
|
|
|
+ // this.editForm.course_id = this.queryForm.courseId
|
|
|
+ this.editForm.course_id = row.course.id;
|
|
|
+ // this.editForm.path = row.path_resource.id
|
|
|
+ this.oldSort = row.sort;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs["getFocus"].focus();
|
|
|
+ });
|
|
|
+ //await doEdit(this.editForm)
|
|
|
+ },
|
|
|
+ //修改排序
|
|
|
+ inputSort(e) {
|
|
|
+ console.log(e, "000000000");
|
|
|
+ this.editForm.sort = e;
|
|
|
+ },
|
|
|
+ async sureChange() {
|
|
|
+ this.editStatus = 0;
|
|
|
+ if (this.oldSort !== this.editForm.sort) {
|
|
|
+ console.log(this.editForm, "附件排序的内容");
|
|
|
+ const { message } = await chapterEdit(this.editForm);
|
|
|
+ console.log(message, "message");
|
|
|
+ // location.reload()
|
|
|
+ this.$baseMessage(message, "success", false, "vab-hey-message-success");
|
|
|
+ this.getChapterList();
|
|
|
+ } else {
|
|
|
+ return;
|
|
|
}
|
|
|
},
|
|
|
- created() {
|
|
|
- let route = this.$route
|
|
|
- console.log(route.query, 'route.query11111')
|
|
|
- // 章节列表里边接收上个页面的参数没有什么用目前!!!!!!!!!
|
|
|
- // // 课程id
|
|
|
- // this.courseId = route.query.courseId
|
|
|
- // // 视频id
|
|
|
- // this.queryForm.videoId = route.query.videoId
|
|
|
- this.queryForm.courseId = route.query.courseId
|
|
|
- this.videoId = route.query.videoId
|
|
|
- this.getChapterList()
|
|
|
+ //跳转课程详情
|
|
|
+ courseVideo(row) {
|
|
|
+ this.$router.push({
|
|
|
+ path: "/course/video",
|
|
|
+ query: {
|
|
|
+ id: row.id,
|
|
|
+ },
|
|
|
+ });
|
|
|
},
|
|
|
- methods: {
|
|
|
- // 排序这块
|
|
|
- cancelSort(row) {
|
|
|
- this.editStatus = 0
|
|
|
- row.sort = this.oldSort
|
|
|
- },
|
|
|
- //修改排序事件
|
|
|
- async changeSort(row) {
|
|
|
- console.log(row, '1111111111')
|
|
|
- this.editStatus = 1
|
|
|
- this.editForm = row
|
|
|
- // 附件修改接口修改时这俩参数要求必填的
|
|
|
- // this.editForm.course_id = this.queryForm.courseId
|
|
|
- this.editForm.course_id = row.course.id
|
|
|
- // this.editForm.path = row.path_resource.id
|
|
|
- this.oldSort = row.sort
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs['getFocus'].focus()
|
|
|
- })
|
|
|
- //await doEdit(this.editForm)
|
|
|
- },
|
|
|
- //修改排序
|
|
|
- inputSort(e) {
|
|
|
- console.log(e, '000000000')
|
|
|
- this.editForm.sort = e
|
|
|
- },
|
|
|
- async sureChange() {
|
|
|
- this.editStatus = 0
|
|
|
- if (this.oldSort !== this.editForm.sort) {
|
|
|
- console.log(this.editForm, '附件排序的内容')
|
|
|
- const { message } = await chapterEdit(this.editForm)
|
|
|
- console.log(message, 'message')
|
|
|
- // location.reload()
|
|
|
+ courseDetail(row) {
|
|
|
+ this.$router.push({
|
|
|
+ path: "/course/detail",
|
|
|
+ query: {
|
|
|
+ id: row.id,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleEdit(row) {
|
|
|
+ if (row.id) {
|
|
|
+ this.$refs["edit"].showEdit(row);
|
|
|
+ } else {
|
|
|
+ this.$refs["edit"].showEdit();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleDelete(row) {
|
|
|
+ if (row.id) {
|
|
|
+ this.$baseConfirm("你确定要删除当前项吗", null, async () => {
|
|
|
+ const { message } = await chapterDelete({ id: row.id });
|
|
|
this.$baseMessage(
|
|
|
message,
|
|
|
- 'success',
|
|
|
+ "success",
|
|
|
false,
|
|
|
- 'vab-hey-message-success'
|
|
|
- )
|
|
|
- this.getChapterList()
|
|
|
- } else {
|
|
|
- return
|
|
|
- }
|
|
|
- },
|
|
|
- //跳转课程详情
|
|
|
- courseVideo(row) {
|
|
|
- this.$router.push({
|
|
|
- path: '/course/video',
|
|
|
- query: {
|
|
|
- id: row.id,
|
|
|
- },
|
|
|
- })
|
|
|
- },
|
|
|
- courseDetail(row) {
|
|
|
- this.$router.push({
|
|
|
- path: '/course/detail',
|
|
|
- query: {
|
|
|
- id: row.id,
|
|
|
- },
|
|
|
- })
|
|
|
- },
|
|
|
- handleEdit(row) {
|
|
|
- if (row.id) {
|
|
|
- this.$refs['edit'].showEdit(row)
|
|
|
- } else {
|
|
|
- this.$refs['edit'].showEdit()
|
|
|
- }
|
|
|
- },
|
|
|
- handleDelete(row) {
|
|
|
- if (row.id) {
|
|
|
- this.$baseConfirm('你确定要删除当前项吗', null, async () => {
|
|
|
- const { message } = await chapterDelete({ id: row.id })
|
|
|
- this.$baseMessage(
|
|
|
- message,
|
|
|
- 'success',
|
|
|
- false,
|
|
|
- 'vab-hey-message-success'
|
|
|
- )
|
|
|
- await this.getChapterList()
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
- // handleSizeChange(val) {
|
|
|
- // this.queryForm.pageSize = val
|
|
|
- // this.getChapterList()
|
|
|
- // },
|
|
|
- // handleCurrentChange(val) {
|
|
|
- // this.queryForm.pageNo = val
|
|
|
- // this.getChapterList()
|
|
|
- // },
|
|
|
- queryData() {
|
|
|
- this.getChapterList()
|
|
|
- },
|
|
|
- async getChapterList() {
|
|
|
- this.listLoading = true
|
|
|
- const { data } = await chapterList(this.queryForm)
|
|
|
- console.log(data, '章节列表')
|
|
|
- this.list = data.data
|
|
|
- console.log(this.list, '++++++++++')
|
|
|
- this.listLoading = false
|
|
|
- },
|
|
|
+ "vab-hey-message-success"
|
|
|
+ );
|
|
|
+ await this.getChapterList();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // handleSizeChange(val) {
|
|
|
+ // this.queryForm.pageSize = val
|
|
|
+ // this.getChapterList()
|
|
|
+ // },
|
|
|
+ // handleCurrentChange(val) {
|
|
|
+ // this.queryForm.pageNo = val
|
|
|
+ // this.getChapterList()
|
|
|
+ // },
|
|
|
+ queryData() {
|
|
|
+ this.getChapterList();
|
|
|
+ },
|
|
|
+ async getChapterList() {
|
|
|
+ this.listLoading = true;
|
|
|
+ const { data } = await chapterList(this.queryForm);
|
|
|
+ console.log(data, "章节列表");
|
|
|
+ this.list = data.data;
|
|
|
+ console.log(this.list, "++++++++++");
|
|
|
+ this.listLoading = false;
|
|
|
},
|
|
|
- }
|
|
|
+ },
|
|
|
+};
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
- /* 修改排序样式 */
|
|
|
- .edit {
|
|
|
- display: inline-block;
|
|
|
- width: 110px;
|
|
|
- }
|
|
|
- .input-sort {
|
|
|
- display: inline-block;
|
|
|
- width: 100px;
|
|
|
- margin-left: 10px;
|
|
|
- border: none;
|
|
|
- }
|
|
|
- .sort-num {
|
|
|
- display: inline-block;
|
|
|
- margin-left: 10px;
|
|
|
- }
|
|
|
- .el-icon-edit {
|
|
|
- color: #1890ff;
|
|
|
- }
|
|
|
+/* 修改排序样式 */
|
|
|
+.edit {
|
|
|
+ display: inline-block;
|
|
|
+ width: 110px;
|
|
|
+}
|
|
|
+.input-sort {
|
|
|
+ display: inline-block;
|
|
|
+ width: 100px;
|
|
|
+ margin-left: 10px;
|
|
|
+ border: none;
|
|
|
+}
|
|
|
+.sort-num {
|
|
|
+ display: inline-block;
|
|
|
+ margin-left: 10px;
|
|
|
+}
|
|
|
+.el-icon-edit {
|
|
|
+ color: #1890ff;
|
|
|
+}
|
|
|
</style>
|