|
|
@ -15,7 +15,7 @@ const courseId = ref() |
|
|
|
// const courseId = '719f91586a64413898253c5b7d046fd8' |
|
|
|
// const courseId = '719f91586a64413898253c5b7d046fd8' |
|
|
|
onMounted(() => { |
|
|
|
onMounted(() => { |
|
|
|
courseId.value = route.query.id |
|
|
|
courseId.value = route.query.id |
|
|
|
console.log(courseId.value, 'route.query.id'); |
|
|
|
console.log(courseId.value, 'route.query.id') |
|
|
|
|
|
|
|
|
|
|
|
// courseId.value = '719f91586a64413898253c5b7d046fd8' |
|
|
|
// courseId.value = '719f91586a64413898253c5b7d046fd8' |
|
|
|
getChaptersList() |
|
|
|
getChaptersList() |
|
|
@ -24,7 +24,7 @@ onMounted(() => { |
|
|
|
// console.log(courseId.value, 'courseId.value') |
|
|
|
// console.log(courseId.value, 'courseId.value') |
|
|
|
const getChaptersList = async () => { |
|
|
|
const getChaptersList = async () => { |
|
|
|
console.log(courseId, 'courseId.value') |
|
|
|
console.log(courseId, 'courseId.value') |
|
|
|
const res = await getChaptersListApi({ id: courseId }) |
|
|
|
const res = await getChaptersListApi({ id: courseId.value }) |
|
|
|
console.log(res, 'get') |
|
|
|
console.log(res, 'get') |
|
|
|
const transformedData: Tree[] = res.data.map((item: any) => ({ |
|
|
|
const transformedData: Tree[] = res.data.map((item: any) => ({ |
|
|
|
id: item.id, |
|
|
|
id: item.id, |
|
|
@ -107,7 +107,7 @@ const remove = async (node: Node, data: Tree) => { |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
// 获取章节详情 |
|
|
|
// 获取章节详情 |
|
|
|
const getDetails = (id: any) => { } |
|
|
|
const getDetails = (id: any) => {} |
|
|
|
const dataSource = ref<Tree[]>([ |
|
|
|
const dataSource = ref<Tree[]>([ |
|
|
|
{ |
|
|
|
{ |
|
|
|
id, |
|
|
|
id, |
|
|
@ -135,18 +135,36 @@ const dataSource = ref<Tree[]>([ |
|
|
|
<h1>课程章节</h1> |
|
|
|
<h1>课程章节</h1> |
|
|
|
<!-- <button @click="getChaptersList">获取</button> --> |
|
|
|
<!-- <button @click="getChaptersList">获取</button> --> |
|
|
|
<div class="custom-tree-container"> |
|
|
|
<div class="custom-tree-container"> |
|
|
|
<el-tree style="max-width: 600px" :data="dataSource" node-key="id" default-expand-all |
|
|
|
<el-tree |
|
|
|
:expand-on-click-node="false" empty-text="暂无章节"> |
|
|
|
style="max-width: 600px" |
|
|
|
|
|
|
|
:data="dataSource" |
|
|
|
|
|
|
|
node-key="id" |
|
|
|
|
|
|
|
default-expand-all |
|
|
|
|
|
|
|
:expand-on-click-node="false" |
|
|
|
|
|
|
|
empty-text="暂无章节" |
|
|
|
|
|
|
|
> |
|
|
|
<template #default="{ node, data }"> |
|
|
|
<template #default="{ node, data }"> |
|
|
|
<span class="custom-tree-node"> |
|
|
|
<span class="custom-tree-node"> |
|
|
|
<span @click="getDetails(data.id)">{{ data.name }}</span> |
|
|
|
<span @click="getDetails(data.id)">{{ data.name }}</span> |
|
|
|
<span> |
|
|
|
<span> |
|
|
|
<el-button @click="append(data)" circle size="small" type="primary" plain> |
|
|
|
<el-button |
|
|
|
|
|
|
|
@click="append(data)" |
|
|
|
|
|
|
|
circle |
|
|
|
|
|
|
|
size="small" |
|
|
|
|
|
|
|
type="primary" |
|
|
|
|
|
|
|
plain |
|
|
|
|
|
|
|
> |
|
|
|
<el-icon :size="15"> |
|
|
|
<el-icon :size="15"> |
|
|
|
<Plus /> |
|
|
|
<Plus /> |
|
|
|
</el-icon> |
|
|
|
</el-icon> |
|
|
|
</el-button> |
|
|
|
</el-button> |
|
|
|
<el-button @click="remove(node, data)" circle size="small" type="danger" plain> |
|
|
|
<el-button |
|
|
|
|
|
|
|
@click="remove(node, data)" |
|
|
|
|
|
|
|
circle |
|
|
|
|
|
|
|
size="small" |
|
|
|
|
|
|
|
type="danger" |
|
|
|
|
|
|
|
plain |
|
|
|
|
|
|
|
> |
|
|
|
<el-icon :size="15"> |
|
|
|
<el-icon :size="15"> |
|
|
|
<Delete /> |
|
|
|
<Delete /> |
|
|
|
</el-icon> |
|
|
|
</el-icon> |
|
|
|