From 2bec33e17b1a65a1758d9a9a80e125ebcd9060e3 Mon Sep 17 00:00:00 2001 From: edana <1813750890@qq.com> Date: Wed, 19 Jun 2024 18:08:43 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/user/record.js | 10 -- src/api/user/resource.js | 9 -- src/views/MyCourseStudy/learningProcess.vue | 20 ++- .../courseResources/componse/resourceAdd.vue | 140 +++++++++++++++++- src/views/courseResources/index.vue | 129 +++++++--------- 5 files changed, 205 insertions(+), 103 deletions(-) delete mode 100644 src/api/user/record.js delete mode 100644 src/api/user/resource.js diff --git a/src/api/user/record.js b/src/api/user/record.js deleted file mode 100644 index edbafc1..0000000 --- a/src/api/user/record.js +++ /dev/null @@ -1,10 +0,0 @@ -import request from '@/utils/request' -//获取浏览记录列表 -export const getRecordListService = (params) => - request.get('http://39.106.16.162:8080/learningrecords/getall', { params }) -//删除浏览记录 -export function DelRecordService(ids) { - return request.delete( - `http://39.106.16.162:8080/learningrecords/delete?ids=${ids}`, - ) -} diff --git a/src/api/user/resource.js b/src/api/user/resource.js deleted file mode 100644 index 0bfb6f8..0000000 --- a/src/api/user/resource.js +++ /dev/null @@ -1,9 +0,0 @@ -import request from '@/utils/request' -//获取ppt资源列表 -export const getpptResourceListService = (params) => - request.get('http://localhost:8080/courses/getall', { params }) -export function DelpptResourceListService(ids) { - return request.delete( - `http://localhost:8080/learningrecords/delete?ids=${ids}`, - ) -} diff --git a/src/views/MyCourseStudy/learningProcess.vue b/src/views/MyCourseStudy/learningProcess.vue index ffd22a7..f1f4aa9 100644 --- a/src/views/MyCourseStudy/learningProcess.vue +++ b/src/views/MyCourseStudy/learningProcess.vue @@ -1,10 +1,10 @@ + diff --git a/src/views/courseResources/index.vue b/src/views/courseResources/index.vue index 6b1c643..c26680f 100644 --- a/src/views/courseResources/index.vue +++ b/src/views/courseResources/index.vue @@ -7,14 +7,14 @@ import pdf from '@/assets/icons/pdf (1).png' import test from '@/assets/icons/文件.png' import audio from '@/assets/icons/音频1.png' +import { ElMessageBox, ElMessage } from 'element-plus' import { ref } from 'vue' -//默认抽屉隐藏 -const visibleDramwer = ref(false) -//定义一个selectedOption属性,用于存储当前选中的值 -const selectedOption = ref('') -import { getpptResourceListService } from '@/api/user/resource.js' -import { DelpptResourceListService } from '@/api/user/resource.js' +import { LearningRecordsControllerService } from '../../../generated/services/LearningRecordsControllerService' +import { CourseResourceControllerService } from '../../../generated/services/CourseResourceControllerService' + +import resourceAdd from './componse/resourceAdd.vue' + const total = ref(0) const pptresourceList = ref([]) const loading = ref(false) @@ -27,7 +27,11 @@ const params = ref({ //获取资源列表 const getpptresourceList = async () => { loading.value = true - const res = await getpptResourceListService(params.value) + const res = await CourseResourceControllerService.getAllUsingGet1( + params.value.pagenum, + params.value.pagesize, + params.value.type, + ) pptresourceList.value = res.data.records console.log(res) //获取资源列表 @@ -59,81 +63,49 @@ const onCurrentChange = (page) => { //删除资源 -通过ID进行删除 const onDeleteResource = async (ids) => { + console.log(111111111111111) await ElMessageBox.confirm('你确认删除该条浏览信息吗?', '温馨提示', { type: 'warning', confirmButtonText: '确认', cancelButtonText: '取消', }) - await DelpptResourceListService(ids) - // console.log(ids) + console.log(ids) + await CourseResourceControllerService.deleteRecordsUsingDelete1(ids) ElMessage({ type: 'success', message: '删除成功' }) getpptresourceList() } -//上传文件 -import tool from '@/utils/oss.js' -const FileList = ref([]) -const upload = async (option) => { - const res = await tool.oss.upload(option.file) - console.log(22, res) - console.log(res.name) - const url = 'https://wenyu132.oss-cn-beijing.aliyuncs.com/' + res.name - console.log(url) + +const param = ref({ + coursesId: '', + userId: '1', + open: '1', + download: '0', + content: '', + address: '/portal', + type: '4', +}) +//点击生成浏览记录 +const generateRecords = async (rescource) => { + param.value.content = rescource.img + param.value.coursesId = rescource.id.toString() + await LearningRecordsControllerService.saveRecordsUsingPost1(param.value) + // console.log(param) +} + +const resourceAddRef = ref() +//添加资源 +const onAddResource = () => { + resourceAddRef.value.open({}) +} +//编辑资源 +const onEditResource = (row) => { + resourceAddRef.value.open(row) } diff --git a/src/views/courseResources/componse/resourceAdd.vue b/src/views/courseResources/componse/resourceAdd.vue index 5ea03cc..815c21a 100644 --- a/src/views/courseResources/componse/resourceAdd.vue +++ b/src/views/courseResources/componse/resourceAdd.vue @@ -1,7 +1,9 @@ - - + diff --git a/src/views/courseResources/index.vue b/src/views/courseResources/index.vue index c26680f..119f6be 100644 --- a/src/views/courseResources/index.vue +++ b/src/views/courseResources/index.vue @@ -171,22 +171,30 @@ const onEditResource = (row) => { :key="resource.id" v-loading="loading" > -
-
- - - - - - -
-
- -
-
-
{{ resource.name }}
-
{{ resource.description }}
-
+
+ + + + + + +
+
+ +
+
+

{{ resource.name }}

+

{{ resource.description }}

@@ -212,6 +220,7 @@ const onEditResource = (row) => { :dafulIndex="params.type" ref="resourceAddRef" > +
@@ -259,7 +268,8 @@ ul { li { transition: filter 0.3s; /* 添加过渡动画 */ flex: 0 0 20%; - + flex-direction: column; + align-items: center; margin-bottom: 10px; padding: 10px; box-sizing: border-box; @@ -283,23 +293,7 @@ li:hover { bottom: 0; margin: 0 auto; } -.icon { - display: flex; - justify-content: space-between; -} -.resource-info { - display: flex; - flex-direction: column; - justify-content: space-between; -} -.zy-name:hover { - color: rgb(138, 201, 243); /* 鼠标经过时将字体颜色设置为蓝色 */ -} -.zy-name { - margin-top: 10px; - font-size: 20px; -} -.zy-info { - margin-top: 20px; +.box p:hover { + font-weight: bold; }