sc
This commit is contained in:
21
src/api/gds/course.js
Normal file
21
src/api/gds/course.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// 创建
|
||||
export const createCourse = (data) => {
|
||||
return request.post({ url: '/admin-api/applet/sinology/lesson/create', data, isSubmitForm: true })
|
||||
}
|
||||
|
||||
// 修改
|
||||
export const updateCourse = (data) => {
|
||||
return request.put({ url: '/admin-api/applet/sinology/lesson/update', data })
|
||||
}
|
||||
|
||||
// 分页
|
||||
export const getCoursePage = (params) => {
|
||||
return request.get({ url: '/admin-api/applet/sinology/lesson/page', params })
|
||||
}
|
||||
|
||||
// 删除
|
||||
export const deleteCourse = (lessonId) => {
|
||||
return request.delete({ url: '/admin-api/applet/sinology/lesson/delete', params: { lessonId } })
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-form :inline="true" label-width="0" @submit.prevent>
|
||||
<el-form-item>
|
||||
<el-input
|
||||
v-model="queryParams.lessonName"
|
||||
placeholder="请输入课程标题"
|
||||
clearable
|
||||
style="width: 400px"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-input
|
||||
v-model="queryParams.author"
|
||||
placeholder="请输入作者"
|
||||
clearable
|
||||
style="width: 400px"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleQuery" v-hasPermi="['GDS:course:search']">
|
||||
搜索
|
||||
</el-button>
|
||||
<el-button type="primary" @click="handleAdd" v-hasPermi="['GDS:course:add']">
|
||||
新增
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="tableList"
|
||||
highlight-current-row
|
||||
max-height="calc(100vh - 320px)"
|
||||
>
|
||||
<el-table-column type="index" width="55" align="center" />
|
||||
<el-table-column label="课程标题" align="left" prop="lessonName" min-width="140" />
|
||||
<el-table-column label="章节简介" align="center" prop="introduction" width="100" />
|
||||
<el-table-column label="图片" align="center" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-image
|
||||
v-if="row.image"
|
||||
:src="getShowImg(row)"
|
||||
:preview-src-list="[getShowImg(row)]"
|
||||
:lazy="true"
|
||||
style="width: 90px"
|
||||
preview-teleported
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="作者" align="center" prop="author" min-width="100" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" min-width="100" />
|
||||
<el-table-column label="发布时间" align="center" prop="publicTime" min-width="100" />
|
||||
<el-table-column label="浏览数" align="center" prop="chapterName" min-width="100" />
|
||||
<el-table-column label="点赞数" align="center" prop="chapterName" min-width="100" />
|
||||
<el-table-column label="收藏数" align="center" prop="chapterName" min-width="100" />
|
||||
<el-table-column label="操作" align="center" width="140">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
@click="handleEdit(scope.row)"
|
||||
v-hasPermi="['GDS:course:edit']"
|
||||
>
|
||||
修改
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['GDS:course:delete']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
style="margin-bottom: 0"
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import * as CourseApi from '@/api/gds/course'
|
||||
|
||||
const tableList = ref([])
|
||||
const total = ref(0)
|
||||
const loading = ref(false)
|
||||
|
||||
const queryParams = ref({
|
||||
pageNo: 1,
|
||||
pageSize: 20,
|
||||
lessonName: undefined,
|
||||
author: undefined
|
||||
})
|
||||
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
async function getList() {
|
||||
try {
|
||||
loading.value = true
|
||||
const data = await CourseApi.getCoursePage(queryParams.value)
|
||||
tableList.value = data.list
|
||||
total.value = data.total
|
||||
loading.value = false
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function getShowImg(row) {
|
||||
return row.image.includes('http')
|
||||
? row.image
|
||||
: `https://ss-cloud.ahduima.com/sinology/pic/${row.image}`
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
|
||||
Reference in New Issue
Block a user