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