2025-06-24 20:27:14 +08:00
|
|
|
|
<template>
|
|
|
|
|
<!-- 搜索框 -->
|
|
|
|
|
<div class="search-box">
|
|
|
|
|
<a-form layout="inline">
|
|
|
|
|
<a-space>
|
|
|
|
|
<a-form-item label="课程名称">
|
|
|
|
|
<a-input-search
|
2025-06-25 13:16:06 +08:00
|
|
|
|
style="width: 200px"
|
2025-06-24 20:27:14 +08:00
|
|
|
|
placeholder="请输入课程名称"
|
|
|
|
|
enter-button
|
|
|
|
|
@search="handleCourseSearch"
|
|
|
|
|
v-model:value="searchCourseName"
|
|
|
|
|
class="custom-search"
|
|
|
|
|
/>
|
|
|
|
|
</a-form-item>
|
2025-06-25 13:16:06 +08:00
|
|
|
|
|
|
|
|
|
<a-form-item label="课程类别">
|
|
|
|
|
<a-select
|
|
|
|
|
style="width: 120px"
|
|
|
|
|
placeholder="请选择"
|
|
|
|
|
v-model:value="searchCourseType"
|
|
|
|
|
@change="handleCourseSearch"
|
|
|
|
|
>
|
|
|
|
|
<a-select-option value="">全部</a-select-option>
|
|
|
|
|
<a-select-option value="考公考研">考公考研</a-select-option>
|
|
|
|
|
<a-select-option value="自媒体">自媒体</a-select-option>
|
|
|
|
|
<a-select-option value="财经">财经</a-select-option>
|
|
|
|
|
</a-select>
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
|
|
|
|
<a-form-item label="上架状态">
|
|
|
|
|
<a-select
|
|
|
|
|
style="width: 120px"
|
|
|
|
|
placeholder="请选择"
|
|
|
|
|
v-model:value="searchIsShelves"
|
|
|
|
|
@change="handleCourseSearch"
|
|
|
|
|
>
|
|
|
|
|
<a-select-option value="">全部</a-select-option>
|
|
|
|
|
<a-select-option value="true">已上架</a-select-option>
|
|
|
|
|
<a-select-option value="false">已下架</a-select-option>
|
|
|
|
|
</a-select>
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
2025-06-24 20:27:14 +08:00
|
|
|
|
<a-button class="custom-button" @click="goAddCourse">新增课程</a-button>
|
|
|
|
|
<a-button class="custom-button" @click="reset">重置搜索</a-button>
|
|
|
|
|
<a-button
|
|
|
|
|
class="custom-button danger"
|
|
|
|
|
:disabled="selectedRowKeys.length === 0"
|
|
|
|
|
@click="showDeleteConfirm"
|
|
|
|
|
>
|
|
|
|
|
批量删除
|
|
|
|
|
</a-button>
|
|
|
|
|
</a-space>
|
|
|
|
|
</a-form>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 数据-->
|
|
|
|
|
<a-table
|
|
|
|
|
:columns="columns"
|
|
|
|
|
:data-source="tableData"
|
2025-06-25 13:16:06 +08:00
|
|
|
|
:scroll="{ x: 1600, y: 550 }"
|
2025-06-24 20:27:14 +08:00
|
|
|
|
:loading="loading"
|
|
|
|
|
:pagination="pagination"
|
|
|
|
|
:row-selection="rowSelection"
|
|
|
|
|
bordered
|
|
|
|
|
rowKey="id"
|
|
|
|
|
@change="handleTableChange"
|
|
|
|
|
>
|
|
|
|
|
<template #bodyCell="{ column, record }">
|
|
|
|
|
<!-- 课程图片 -->
|
|
|
|
|
<template v-if="column.key === 'image'">
|
|
|
|
|
<a-avatar :src="downLoadImage+record.image" shape="square" :size="64"/>
|
|
|
|
|
</template>
|
2025-06-25 13:16:06 +08:00
|
|
|
|
|
2025-06-24 20:27:14 +08:00
|
|
|
|
<template v-if="column.key === 'originPrice'">
|
2025-06-25 13:16:06 +08:00
|
|
|
|
{{ record.originPrice }}¥
|
2025-06-24 20:27:14 +08:00
|
|
|
|
</template>
|
2025-06-25 13:16:06 +08:00
|
|
|
|
|
2025-06-24 20:27:14 +08:00
|
|
|
|
<template v-if="column.key === 'discountPrice'">
|
2025-06-25 13:16:06 +08:00
|
|
|
|
{{ record.discountPrice }}¥
|
2025-06-24 20:27:14 +08:00
|
|
|
|
</template>
|
2025-06-25 13:16:06 +08:00
|
|
|
|
|
2025-06-24 20:27:14 +08:00
|
|
|
|
<template v-if="column.key === 'orderCount'">
|
2025-06-25 13:16:06 +08:00
|
|
|
|
{{ record.orderCount }}人
|
2025-06-24 20:27:14 +08:00
|
|
|
|
</template>
|
2025-06-25 13:16:06 +08:00
|
|
|
|
|
2025-06-24 20:27:14 +08:00
|
|
|
|
<template v-if="column.key === 'firstLevelRate'">
|
2025-06-25 13:16:06 +08:00
|
|
|
|
{{ record.firstLevelRate }}%
|
2025-06-24 20:27:14 +08:00
|
|
|
|
</template>
|
2025-06-25 13:16:06 +08:00
|
|
|
|
|
2025-06-24 20:27:14 +08:00
|
|
|
|
<template v-if="column.key === 'secondLevelRate'">
|
2025-06-25 13:16:06 +08:00
|
|
|
|
{{ record.secondLevelRate }}%
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<template v-if="column.key === 'isShelves'">
|
|
|
|
|
<a-tag :color="record.isShelves ? 'green' : 'red'">
|
|
|
|
|
{{ record.isShelves ? '已上架' : '已下架' }}
|
|
|
|
|
</a-tag>
|
2025-06-24 20:27:14 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<!-- 操作列 -->
|
|
|
|
|
<template v-if="column.key === 'action'">
|
|
|
|
|
<a-space :size="8">
|
|
|
|
|
<a-button
|
|
|
|
|
size="small"
|
|
|
|
|
danger
|
|
|
|
|
@click="deleteCourse(record.id)"
|
|
|
|
|
>
|
|
|
|
|
删除
|
|
|
|
|
</a-button>
|
|
|
|
|
<a-button
|
|
|
|
|
size="small"
|
|
|
|
|
type="link"
|
|
|
|
|
@click="showDetails(record.id)"
|
|
|
|
|
>
|
|
|
|
|
详情
|
|
|
|
|
</a-button>
|
|
|
|
|
<a-button
|
|
|
|
|
size="small"
|
|
|
|
|
type="link"
|
|
|
|
|
@click="chapterDetails(record.id)"
|
|
|
|
|
>
|
|
|
|
|
章节
|
|
|
|
|
</a-button>
|
|
|
|
|
</a-space>
|
|
|
|
|
</template>
|
|
|
|
|
</template>
|
|
|
|
|
</a-table>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
import { onMounted, ref } from "vue";
|
|
|
|
|
import myAxios from "../../api/myAxios.ts";
|
|
|
|
|
import { message, Modal } from "ant-design-vue";
|
|
|
|
|
import {downLoadImage} from "../../api/ImageUrl.ts";
|
|
|
|
|
import router from "../../router";
|
|
|
|
|
|
|
|
|
|
const loading = ref(false);
|
|
|
|
|
const selectedRowKeys = ref<number[]>([]); // 存储选中的行ID
|
|
|
|
|
|
2025-06-25 13:16:06 +08:00
|
|
|
|
// 搜索参数
|
|
|
|
|
const searchCourseName = ref("");
|
|
|
|
|
const searchCourseType = ref("");
|
|
|
|
|
const searchIsShelves = ref("");
|
|
|
|
|
|
|
|
|
|
// 分页查询参数
|
2025-06-24 20:27:14 +08:00
|
|
|
|
const searchParams = ref({
|
|
|
|
|
current: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
sortField: "id",
|
|
|
|
|
sortOrder: "ascend",
|
|
|
|
|
name: "",
|
2025-06-25 13:16:06 +08:00
|
|
|
|
type: "",
|
|
|
|
|
isShelves: ""
|
2025-06-24 20:27:14 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 行选择配置
|
|
|
|
|
const rowSelection = ref({
|
|
|
|
|
selectedRowKeys: selectedRowKeys,
|
|
|
|
|
onChange: (selectedKeys: number[]) => {
|
|
|
|
|
selectedRowKeys.value = selectedKeys;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2025-06-25 13:16:06 +08:00
|
|
|
|
// 课程表格列定义
|
2025-06-24 20:27:14 +08:00
|
|
|
|
const columns = [
|
|
|
|
|
{
|
|
|
|
|
title: '课程ID',
|
|
|
|
|
dataIndex: 'id',
|
|
|
|
|
width: 45,
|
|
|
|
|
key: 'id',
|
|
|
|
|
fixed: 'left',
|
|
|
|
|
align: 'center',
|
2025-06-25 13:16:06 +08:00
|
|
|
|
sorter: true,
|
|
|
|
|
sortDirections: ['ascend', 'descend']
|
2025-06-24 20:27:14 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '课程图片',
|
|
|
|
|
dataIndex: 'image',
|
|
|
|
|
key: 'image',
|
|
|
|
|
width: 45,
|
|
|
|
|
fixed: 'left',
|
|
|
|
|
align: 'center'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '课程名称',
|
|
|
|
|
dataIndex: 'name',
|
|
|
|
|
width: 65,
|
|
|
|
|
key: 'name',
|
|
|
|
|
fixed: 'left',
|
|
|
|
|
align: 'center'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '课程类别',
|
|
|
|
|
dataIndex: 'type',
|
|
|
|
|
width: 55,
|
|
|
|
|
key: 'type',
|
|
|
|
|
align: 'center'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '课程原价',
|
|
|
|
|
dataIndex: 'originPrice',
|
|
|
|
|
width: 55,
|
|
|
|
|
key: 'originPrice',
|
|
|
|
|
align: 'center',
|
2025-06-25 13:16:06 +08:00
|
|
|
|
sorter: true,
|
|
|
|
|
sortDirections: ['ascend', 'descend']
|
2025-06-24 20:27:14 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '折扣价格',
|
|
|
|
|
dataIndex: 'discountPrice',
|
|
|
|
|
key: 'discountPrice',
|
|
|
|
|
width: 55,
|
|
|
|
|
align: 'center',
|
2025-06-25 13:16:06 +08:00
|
|
|
|
sorter: true,
|
|
|
|
|
sortDirections: ['ascend', 'descend']
|
2025-06-24 20:27:14 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '已下单人数',
|
|
|
|
|
dataIndex: 'orderCount',
|
|
|
|
|
key: 'orderCount',
|
|
|
|
|
width: 55,
|
|
|
|
|
align: 'center',
|
2025-06-25 13:16:06 +08:00
|
|
|
|
sorter: true,
|
|
|
|
|
sortDirections: ['ascend', 'descend']
|
2025-06-24 20:27:14 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '一级佣金比例',
|
|
|
|
|
dataIndex: 'firstLevelRate',
|
|
|
|
|
key: 'firstLevelRate',
|
|
|
|
|
width: 65,
|
|
|
|
|
align: 'center',
|
2025-06-25 13:16:06 +08:00
|
|
|
|
sorter: true,
|
|
|
|
|
sortDirections: ['ascend', 'descend']
|
2025-06-24 20:27:14 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '二级佣金比例',
|
|
|
|
|
dataIndex: 'secondLevelRate',
|
|
|
|
|
key: 'secondLevelRate',
|
|
|
|
|
width: 65,
|
|
|
|
|
align: 'center',
|
2025-06-25 13:16:06 +08:00
|
|
|
|
sorter: true,
|
|
|
|
|
sortDirections: ['ascend', 'descend']
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '是否上架',
|
|
|
|
|
dataIndex: 'isShelves',
|
|
|
|
|
key: 'isShelves',
|
|
|
|
|
width: 65,
|
|
|
|
|
align: 'center'
|
2025-06-24 20:27:14 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '操作',
|
|
|
|
|
key: 'action',
|
|
|
|
|
fixed: 'right',
|
|
|
|
|
width: 75,
|
|
|
|
|
align: 'center'
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|
2025-06-25 13:16:06 +08:00
|
|
|
|
// 课程名称搜索方法
|
2025-06-24 20:27:14 +08:00
|
|
|
|
const handleCourseSearch = async () => {
|
|
|
|
|
searchParams.value.name = searchCourseName.value;
|
2025-06-25 13:16:06 +08:00
|
|
|
|
searchParams.value.type = searchCourseType.value;
|
|
|
|
|
searchParams.value.isShelves = searchIsShelves.value;
|
2025-06-24 20:27:14 +08:00
|
|
|
|
searchParams.value.current = 1; // 重置到第一页
|
|
|
|
|
await getCourseList();
|
|
|
|
|
};
|
2025-06-25 13:16:06 +08:00
|
|
|
|
|
|
|
|
|
// 课程分页查询
|
2025-06-24 20:27:14 +08:00
|
|
|
|
const getCourseList = async () => {
|
|
|
|
|
loading.value = true;
|
|
|
|
|
try {
|
|
|
|
|
const storedToken = localStorage.getItem('token');
|
|
|
|
|
if (!storedToken) throw new Error('未找到登录信息');
|
|
|
|
|
|
2025-06-25 13:16:06 +08:00
|
|
|
|
const res: any = await myAxios.post("/course/page", searchParams.value,
|
2025-06-24 20:27:14 +08:00
|
|
|
|
{ headers: { Authorization: storedToken } }
|
|
|
|
|
);
|
2025-06-25 13:16:06 +08:00
|
|
|
|
|
2025-06-24 20:27:14 +08:00
|
|
|
|
if (res.code === 1 && res.data && Array.isArray(res.data.records)) {
|
2025-06-25 13:16:06 +08:00
|
|
|
|
tableData.value = res.data.records;
|
2025-06-24 20:27:14 +08:00
|
|
|
|
// 同步总条数到分页组件
|
2025-06-25 13:16:06 +08:00
|
|
|
|
pagination.value.total = res.data.total;
|
2025-06-24 20:27:14 +08:00
|
|
|
|
} else {
|
|
|
|
|
message.error(res.message || '请求失败');
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error("请求失败:", error);
|
|
|
|
|
message.error('获取数据失败');
|
|
|
|
|
} finally {
|
|
|
|
|
loading.value = false;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onMounted(getCourseList);
|
|
|
|
|
|
|
|
|
|
// 分页配置
|
|
|
|
|
const pagination = ref({
|
|
|
|
|
current: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
total: 0,
|
|
|
|
|
showSizeChanger: true,
|
|
|
|
|
showQuickJumper: true,
|
|
|
|
|
showTotal: (total: number) => `共 ${total} 条`,
|
|
|
|
|
pageSizeOptions: ['10', '20', '50', '100']
|
|
|
|
|
});
|
2025-06-25 13:16:06 +08:00
|
|
|
|
|
|
|
|
|
// 处理分页和排序变化
|
|
|
|
|
const handleTableChange = (pag: any, _filters: any, sorter: any) => {
|
|
|
|
|
searchParams.value.current = pag.current;
|
|
|
|
|
searchParams.value.pageSize = pag.pageSize;
|
|
|
|
|
|
|
|
|
|
// 处理排序
|
|
|
|
|
if (sorter && sorter.field) {
|
|
|
|
|
// 获取排序字段(使用列的key而不是dataIndex)
|
|
|
|
|
const sortField = sorter.field;
|
|
|
|
|
|
|
|
|
|
// 获取排序方向(ascend/descend)
|
|
|
|
|
const sortOrder = sorter.order ? sorter.order : '';
|
|
|
|
|
|
|
|
|
|
// 更新搜索参数中的排序字段和排序方向
|
|
|
|
|
searchParams.value.sortField = sortField;
|
|
|
|
|
searchParams.value.sortOrder = sortOrder;
|
|
|
|
|
} else {
|
|
|
|
|
// 如果没有排序信息,重置为默认排序
|
|
|
|
|
searchParams.value.sortField = "id";
|
|
|
|
|
searchParams.value.sortOrder = "ascend";
|
2025-06-24 20:27:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 同步到分页组件
|
2025-06-25 13:16:06 +08:00
|
|
|
|
pagination.value.current = pag.current;
|
|
|
|
|
pagination.value.pageSize = pag.pageSize;
|
2025-06-24 20:27:14 +08:00
|
|
|
|
|
|
|
|
|
getCourseList();
|
|
|
|
|
};
|
|
|
|
|
|
2025-06-25 13:16:06 +08:00
|
|
|
|
// 课程接口定义
|
|
|
|
|
interface Course {
|
2025-06-24 20:27:14 +08:00
|
|
|
|
id: number;
|
2025-06-25 13:16:06 +08:00
|
|
|
|
name: string;
|
|
|
|
|
type: string;
|
|
|
|
|
detail: string;
|
|
|
|
|
promoCodeDesc: string;
|
|
|
|
|
image: string;
|
|
|
|
|
originPrice: number;
|
|
|
|
|
discountPrice: number;
|
|
|
|
|
orderCount: number;
|
|
|
|
|
firstLevelRate: number;
|
|
|
|
|
secondLevelRate: number;
|
|
|
|
|
isShelves: boolean;
|
2025-06-24 20:27:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
2025-06-25 13:16:06 +08:00
|
|
|
|
const tableData = ref<Course[]>([]);
|
2025-06-24 20:27:14 +08:00
|
|
|
|
|
2025-06-25 13:16:06 +08:00
|
|
|
|
// 删除课程
|
2025-06-24 20:27:14 +08:00
|
|
|
|
const deleteCourse = (id: number) => {
|
|
|
|
|
Modal.confirm({
|
|
|
|
|
title: '确认删除',
|
|
|
|
|
content: '确定要删除该课程吗?删除后数据将无法恢复!',
|
|
|
|
|
okText: '确认',
|
|
|
|
|
cancelText: '取消',
|
|
|
|
|
onOk: async () => {
|
|
|
|
|
try {
|
|
|
|
|
const storedToken = localStorage.getItem('token');
|
2025-06-25 13:16:06 +08:00
|
|
|
|
const res: any = await myAxios.post(
|
2025-06-24 20:27:14 +08:00
|
|
|
|
"/course/delete",
|
|
|
|
|
{ id },
|
2025-06-25 13:16:06 +08:00
|
|
|
|
{ headers: { Authorization: storedToken } }
|
2025-06-24 20:27:14 +08:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (res.code === 1) {
|
|
|
|
|
message.success('删除成功');
|
|
|
|
|
await getCourseList();
|
|
|
|
|
} else {
|
|
|
|
|
message.error(res.message || '删除失败');
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('删除失败:', error);
|
|
|
|
|
message.error('删除操作失败');
|
|
|
|
|
}
|
2025-06-25 13:16:06 +08:00
|
|
|
|
}
|
2025-06-24 20:27:14 +08:00
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 批量删除确认弹窗
|
|
|
|
|
const showDeleteConfirm = () => {
|
|
|
|
|
if (selectedRowKeys.value.length === 0) {
|
|
|
|
|
message.warning('请至少选择一门课程');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Modal.confirm({
|
|
|
|
|
title: '确认批量删除',
|
|
|
|
|
content: `确定要删除选中的 ${selectedRowKeys.value.length} 门课程吗?删除后数据将无法恢复!`,
|
|
|
|
|
okText: '确认',
|
|
|
|
|
cancelText: '取消',
|
2025-06-25 13:16:06 +08:00
|
|
|
|
onOk: deleteBatchCourses
|
2025-06-24 20:27:14 +08:00
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 批量删除方法
|
|
|
|
|
const deleteBatchCourses = async () => {
|
|
|
|
|
try {
|
|
|
|
|
const storedToken = localStorage.getItem('token');
|
|
|
|
|
const res: any = await myAxios.post(
|
|
|
|
|
"/course/delBatch",
|
|
|
|
|
{ ids: selectedRowKeys.value },
|
2025-06-25 13:16:06 +08:00
|
|
|
|
{ headers: { Authorization: storedToken } }
|
2025-06-24 20:27:14 +08:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (res.code === 1) {
|
|
|
|
|
message.success(`成功删除 ${selectedRowKeys.value.length} 门课程`);
|
|
|
|
|
selectedRowKeys.value = []; // 清空选择
|
|
|
|
|
await getCourseList(); // 刷新列表
|
|
|
|
|
} else {
|
|
|
|
|
message.error(res.message || '批量删除失败');
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('批量删除失败:', error);
|
|
|
|
|
message.error('批量删除操作失败');
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-06-25 13:16:06 +08:00
|
|
|
|
// 重置搜索条件
|
2025-06-24 20:27:14 +08:00
|
|
|
|
const reset = () => {
|
|
|
|
|
searchCourseName.value = "";
|
2025-06-25 13:16:06 +08:00
|
|
|
|
searchCourseType.value = "";
|
|
|
|
|
searchIsShelves.value = "";
|
2025-06-24 20:27:14 +08:00
|
|
|
|
selectedRowKeys.value = [];
|
2025-06-25 13:16:06 +08:00
|
|
|
|
|
2025-06-24 20:27:14 +08:00
|
|
|
|
searchParams.value = {
|
|
|
|
|
current: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
sortField: "id",
|
|
|
|
|
sortOrder: "ascend",
|
|
|
|
|
name: "",
|
2025-06-25 13:16:06 +08:00
|
|
|
|
type: "",
|
|
|
|
|
isShelves: ""
|
2025-06-24 20:27:14 +08:00
|
|
|
|
};
|
2025-06-25 13:16:06 +08:00
|
|
|
|
|
2025-06-24 20:27:14 +08:00
|
|
|
|
getCourseList();
|
|
|
|
|
};
|
|
|
|
|
|
2025-06-25 13:16:06 +08:00
|
|
|
|
// 跳转到新增课程页面
|
|
|
|
|
const goAddCourse = () => {
|
2025-06-24 20:27:14 +08:00
|
|
|
|
router.push('/addcourse')
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-25 13:16:06 +08:00
|
|
|
|
// 查看课程详情
|
|
|
|
|
const showDetails = (id: string) => {
|
2025-06-24 20:27:14 +08:00
|
|
|
|
router.push({
|
2025-06-25 13:16:06 +08:00
|
|
|
|
path: '/courseDetail',
|
|
|
|
|
query: { id: String(id) }
|
2025-06-24 20:27:14 +08:00
|
|
|
|
})
|
|
|
|
|
}
|
2025-06-25 13:16:06 +08:00
|
|
|
|
|
|
|
|
|
// 查看章节详情
|
|
|
|
|
const chapterDetails = (id: string) => {
|
2025-06-24 20:27:14 +08:00
|
|
|
|
router.push({
|
2025-06-25 13:16:06 +08:00
|
|
|
|
path: '/chapterDetail',
|
|
|
|
|
query: { id: String(id) }
|
2025-06-24 20:27:14 +08:00
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
2025-06-25 13:16:06 +08:00
|
|
|
|
/* 原有样式保持不变 */
|
2025-06-24 20:27:14 +08:00
|
|
|
|
.search-box {
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.custom-button {
|
|
|
|
|
background-color: #ffa940;
|
|
|
|
|
border-color: #ffa940;
|
|
|
|
|
color: #fff;
|
2025-06-25 13:16:06 +08:00
|
|
|
|
font-weight: 500;
|
2025-06-24 20:27:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.custom-button:hover,
|
|
|
|
|
.custom-button:focus {
|
2025-06-25 13:16:06 +08:00
|
|
|
|
background-color: #fa8c16;
|
|
|
|
|
border-color: #fa8c16;
|
2025-06-24 20:27:14 +08:00
|
|
|
|
color: #fff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.custom-button[disabled] {
|
|
|
|
|
background-color: #ffa940;
|
|
|
|
|
border-color: #ffa940;
|
|
|
|
|
opacity: 0.6;
|
|
|
|
|
color: #fff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.custom-button.ant-btn-dangerous {
|
|
|
|
|
background-color: #ff4d4f;
|
|
|
|
|
border-color: #ff4d4f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.custom-button.ant-btn-dangerous:hover,
|
|
|
|
|
.custom-button.ant-btn-dangerous:focus {
|
|
|
|
|
background-color: #ff7875;
|
|
|
|
|
border-color: #ff7875;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.custom-search :deep(.ant-input-search-button) {
|
|
|
|
|
background-color: #ffa940;
|
|
|
|
|
border-color: #ffa940;
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-25 13:16:06 +08:00
|
|
|
|
.danger {
|
|
|
|
|
background-color: #ff4d4f !important;
|
|
|
|
|
border-color: #ff4d4f !important;
|
2025-06-24 20:27:14 +08:00
|
|
|
|
}
|
|
|
|
|
</style>
|