From 5b2fdcb8337d21e646db916072411c954afec08a Mon Sep 17 00:00:00 2001 From: axlrose2333 <690927457@qq.com> Date: Thu, 2 Feb 2023 15:26:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E8=AF=BE=E7=A8=8B=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=EF=BC=9B=E6=B7=BB=E5=8A=A0=E8=BD=AE=E6=92=AD=E5=9B=BE?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/lbt.js | 33 +++ src/view/course/addCourse/index.vue | 20 +- src/view/course/components/chapter.vue | 6 +- src/view/course/components/mediaPool.vue | 17 +- src/view/course/index.vue | 16 +- src/view/course/viewCourse/index.vue | 90 ++++++- src/view/lbtManage/index.vue | 301 +++++++++++++++++++++++ 7 files changed, 450 insertions(+), 33 deletions(-) create mode 100644 src/api/lbt.js create mode 100644 src/view/lbtManage/index.vue diff --git a/src/api/lbt.js b/src/api/lbt.js new file mode 100644 index 0000000..2ea8b60 --- /dev/null +++ b/src/api/lbt.js @@ -0,0 +1,33 @@ +import service from '@/utils/request' +const api = { + // 轮播图api + getLbtManageList : data => { + return service({ + url: '/sys-index-lbt', + method: 'get', + params:data + }) + }, + addLbtManage : data => { + return service({ + url: '/sys-index-lbt', + method: 'post', + data + }) + }, + editLbtManage : data => { + return service({ + url: '/sys-index-lbt/'+data.ID, + method: 'put', + data + }) + }, + delLbt: data => { + return service({ + url: '/sys-index-lbt', + method: 'delete', + data + }) + }, +} +export default api diff --git a/src/view/course/addCourse/index.vue b/src/view/course/addCourse/index.vue index 76c2eb2..9b18d64 100644 --- a/src/view/course/addCourse/index.vue +++ b/src/view/course/addCourse/index.vue @@ -146,16 +146,16 @@ function handleAvatarSuccess(res) { form.value.cover = res.data.file.url } function beforeAvatarUpload(file) { - const isLt05M = file.size / 1024 / 1024 < 5 - const isJPG = file.type.indexOf('image/') === -1 - if (isJPG) { - ElMessage.error('文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件') - } - if (!isLt05M) { - ElMessage.error('上传头像图片大小不能超过 2M!') - } - return !isJPG && isLt05M - } + const isLt05M = file.size / 1024 / 1024 < 20 + const isJPG = file.type.indexOf('image/') === -1 + if (isJPG) { + ElMessage.error('文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件') + } + if (!isLt05M) { + ElMessage.error('上传头像图片大小不能超过 2M!') + } + return !isJPG && isLt05M +} function onSubmit() { router.push({name:'courseManage'}) } diff --git a/src/view/course/components/chapter.vue b/src/view/course/components/chapter.vue index b1c4aaa..bea8df5 100644 --- a/src/view/course/components/chapter.vue +++ b/src/view/course/components/chapter.vue @@ -156,7 +156,9 @@ async function enterChapterChildDialog() { // 提交小章节 } } function getFilePath(file) { // 获取上传文件之后的地址 - + console.log(file) + chapterChildForm.value.url = file.url + chapterChildForm.value.url_name = file.url_name } function chooseChapterChildExercises() { // 打开选择习题窗口 @@ -278,7 +280,7 @@ function openExercisesWinFunc() { // 打开媒体库 - + diff --git a/src/view/course/components/mediaPool.vue b/src/view/course/components/mediaPool.vue index c8d6ce1..eea154d 100644 --- a/src/view/course/components/mediaPool.vue +++ b/src/view/course/components/mediaPool.vue @@ -12,7 +12,7 @@ const route = useRoute() import { useUserStore } from '@/pinia/modules/user' const userStore = useUserStore() // import chapterCom from '../components/chapter.vue' -const props = defineProps(['course_id','chapter_info']) +const props = defineProps(['url_name']) const emit = defineEmits(['on-success']) import { clients, getNowDate } from '@/utils' import { getToken } from '@/utils/auth' @@ -22,7 +22,8 @@ const drawer = ref(false) const queryParams =ref({ pageIndex:1, pageSize:10, - name:'' + name:'', + subject:'' }) // 生命周期 const subjectList = inject('subjectList') @@ -83,6 +84,12 @@ async function httpUpload(file) { // 上传oss // 上传成功之后添加媒体库 // this.addDepotFun(`${imgUrl}/${fileName}`, file.file.name) // 数据赋值 + const params = { + url:`${imgUrl}/${fileName}`, + url_name:file.file.name + } + // console.log(params) + emit('on-success',params) // this.$set(this.chapterTable.sel, 'url', `${imgUrl}/${fileName}`) // this.$set(this.chapterTable.sel, 'url_name', file.file.name) } @@ -91,6 +98,7 @@ async function httpUpload(file) { // 上传oss