From 6205c3fa39b90ab687482776769808c9434a8106 Mon Sep 17 00:00:00 2001 From: significative <163999932+significative@users.noreply.github.com> Date: Mon, 22 Jul 2024 08:52:16 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=88=A0=E9=99=A4loading?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../KnowledgeGraphUi/foldInfoUi.vue | 30 +++++++++++++------ src/views/course/courseChapters.vue | 10 +++---- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/views/course/components/KnowledgeGraphUi/foldInfoUi.vue b/src/views/course/components/KnowledgeGraphUi/foldInfoUi.vue index 4fc2666..b45d81c 100644 --- a/src/views/course/components/KnowledgeGraphUi/foldInfoUi.vue +++ b/src/views/course/components/KnowledgeGraphUi/foldInfoUi.vue @@ -17,7 +17,7 @@
本章资源
- 删除 + 删除 diff --git a/src/views/course/courseChapters.vue b/src/views/course/courseChapters.vue index 507cbf2..7018416 100644 --- a/src/views/course/courseChapters.vue +++ b/src/views/course/courseChapters.vue @@ -16,8 +16,7 @@
- + @@ -91,9 +90,8 @@ function foldAddSubmit(data: any, updLoading: Function) { }).finally(() => updLoading(false)) } //删除章节 -const foldDelLoading = ref(false) -function flodDel(id: string) { - foldDelLoading.value = true +function flodDel(id: string,setLoading:Function) { + setLoading(true) deleteSectionApi(id).then(() => { ElMessage({ message: `删除成功`, @@ -105,7 +103,7 @@ function flodDel(id: string) { message: `删除失败`, type: 'error' }) - }).finally(() => foldDelLoading.value = false) + }).finally(() =>setLoading(false)) } // 更新章节 const showHide1 = ref(false) From efc569df5dcaa0a473e7d75d75a5abe7e5d030d5 Mon Sep 17 00:00:00 2001 From: wenyu441069198 <14186472+wenyu441069198@user.noreply.gitee.com> Date: Tue, 23 Jul 2024 15:33:48 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courseResources/componse/resourceAdd.vue | 28 ++++++++++++++----- src/views/courseResources/index.vue | 2 +- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/views/courseResources/componse/resourceAdd.vue b/src/views/courseResources/componse/resourceAdd.vue index c2e4b2a..4d2e952 100644 --- a/src/views/courseResources/componse/resourceAdd.vue +++ b/src/views/courseResources/componse/resourceAdd.vue @@ -3,23 +3,37 @@ import { ref } from 'vue' const visibilerDrawer = ref(false) import { ElMessage } from 'element-plus' import { CourseResourceControllerService } from '../../../../generated/services/CourseResourceControllerService' +import tool from '@/utils/oss.js' +import { id } from 'element-plus/es/locales.mjs'; //默认数据 const defaultForm = { description: '', - id: '', + id:'', img: '', //封面 name: '', type: '', //资源类型 path: '', } const imageUrl = ref('') -const onSelectFile = (uploadFile) => { - // console.log(uploadFile) +//上传阿里云oss +const upload = async (option) =>{ //预览图片 - imageUrl.value = URL.createObjectURL(uploadFile.raw) - //将图片存入 - formModel.value.img = uploadFile.raw + imageUrl.value = URL.createObjectURL(option.raw) + const res = await tool.oss.upload(option.raw);//将图片存入阿里云 + const url = "https://wenyu132.oss-cn-beijing.aliyuncs.com/" + res.name;//获取到存入阿里云后的url + console.log(url); + //将url赋值给要上传后端的参数里 + formModel.value.img = url } + + +// const onSelectFile = (uploadFile) => { +// // console.log(uploadFile) +// //预览图片 +// imageUrl.value = URL.createObjectURL(uploadFile.raw) +// //将图片存入 +// formModel.value.img = uploadFile.raw +// } //准备数据 const formModel = ref({ @@ -184,7 +198,7 @@ defineExpose({ :show-file-list="false" :auto-upload="false" :before-upload="beforeAvatarUpload" - :on-change="onSelectFile" + :on-change="upload" > diff --git a/src/views/courseResources/index.vue b/src/views/courseResources/index.vue index 66f7d52..b0614b5 100644 --- a/src/views/courseResources/index.vue +++ b/src/views/courseResources/index.vue @@ -85,7 +85,7 @@ const param = ref({ download: '0', content: '', address: '/portal', - type: '1', + type: '4', }) //点击生成浏览记录 const generateRecords = async (rescource) => {