From 78cc5edd399030ce6b49be060551ae35290f651e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=9D=A8?= <666> Date: Thu, 12 Dec 2024 11:26:26 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E6=94=B9pptlist=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=B4=BB=E5=8A=A8=E7=9A=84bug=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/src/AixPPTist/src/api/index.ts | 5 +-- .../src/AixPPTist/src/store/slides.ts | 35 +++---------------- .../ElementStylePanel/Active/index.vue | 9 ++--- 3 files changed, 12 insertions(+), 37 deletions(-) diff --git a/src/renderer/src/AixPPTist/src/api/index.ts b/src/renderer/src/AixPPTist/src/api/index.ts index aa255d2..f54a141 100644 --- a/src/renderer/src/AixPPTist/src/api/index.ts +++ b/src/renderer/src/AixPPTist/src/api/index.ts @@ -110,6 +110,9 @@ export class PPTApi { const rid = await API_entpcoursefile.addEntpcoursefileReturnId(params) if (!!rid) { data.id = rid + params.id = rid + params.activityContent = null + slidesStore.addWorkItem(params) slidesStore.updateSlide(data) // msgUtils.msgSuccess('新增成功') this.isUpdate = false // 新增后会触发监听,不再更新数据 @@ -148,8 +151,6 @@ export class PPTApi { static updateSlide(data: object): Promise { return new Promise(async (resolve, reject) => { const res: Result = await API_entpcoursefile.updateEntpcoursefileNew(data) - console.log(data,'data'); - console.log(res,'dresata'); if (res.code === 200) { resolve(true) } else msgUtils.msgError(res.msg || '更新失败');resolve(false) diff --git a/src/renderer/src/AixPPTist/src/store/slides.ts b/src/renderer/src/AixPPTist/src/store/slides.ts index 79f1e66..37ba6b2 100644 --- a/src/renderer/src/AixPPTist/src/store/slides.ts +++ b/src/renderer/src/AixPPTist/src/store/slides.ts @@ -146,45 +146,18 @@ export const useSlidesStore = defineStore('slides', { this.workItem = list }, addWorkItem(data: any) { - const id = data?.parentid + const id = data?.id if (!id) return - this.workItem.splice(this.slideIndex, 0, data) + this.workItem.splice(this.slideIndex + 1, 0, data) + this.slideIndex += 1 }, addSlide(slide: Slide | Slide[]) { - const resource = sessionStore.get('curr.resource')||{} - const enpt = sessionStore.get('curr.entp')||{} - const {id, ...content} = slide - const params = { - parentid: resource.id, - activityContent:null, - entpid: userStore.user.deptId, - entpcourseid: enpt.id, - ppttype: 'file', - title: '', - fileurl: '', - filetype: 'slide', - datacontent: JSON.stringify(content), - filekey: '', - filetag: '', - fileidx: 0, - dflag: 0, - status: '', - edituserid: userStore.id, - } const slides = Array.isArray(slide) ? slide : [slide] for (const slide of slides) { if (slide.sectionTag) delete slide.sectionTag } - API_entpcoursefile.addEntpcoursefileReturnId(params).then((rid:number) => { - if(!!rid){ - params.id = rid - this.addWorkItem(params) - const addIndex = this.slideIndex + 1 - this.slides.splice(addIndex, 0, ...slides) - this.slideIndex = addIndex - } - }) + this.slides.splice(this.slideIndex, 0, ...slides) }, updateSlide(props: Partial, slideId?: string) { diff --git a/src/renderer/src/AixPPTist/src/views/Editor/Toolbar/ElementStylePanel/Active/index.vue b/src/renderer/src/AixPPTist/src/views/Editor/Toolbar/ElementStylePanel/Active/index.vue index a2e20b9..d55e688 100644 --- a/src/renderer/src/AixPPTist/src/views/Editor/Toolbar/ElementStylePanel/Active/index.vue +++ b/src/renderer/src/AixPPTist/src/views/Editor/Toolbar/ElementStylePanel/Active/index.vue @@ -90,7 +90,8 @@ import { sessionStore } from '@/utils/store' import { useGetHomework } from '@/hooks/useGetHomework' import { PPTApi } from '../../../../../api/index' import { storeToRefs } from 'pinia' -import {useSlidesStore} from '../../../../../store' +import {useSlidesStore} from '../../../../../store' +import { updateEntpcoursefileNew } from '@/api/education/entpcoursefile' const slidesStore = useSlidesStore() const { slides, slideIndex, currentSlide, workItem } = storeToRefs(slidesStore) @@ -277,7 +278,6 @@ const getCurrentPPtData = async () => { workList.value = [] objItem.value = workItem.value[slideIndex.value] paramData.value.id = objItem.value.id - console.log(paramData.value.id,'paramData.value.id'); paramData.value.activityContent = objItem.value?.activityContent if (objItem.value?.activityContent) { @@ -302,15 +302,16 @@ const getData = async (data: WorkItem) => { dialogVisible.value = false } const upDateData = async () => { - await PPTApi.updateSlide(paramData.value) + // await PPTApi.updateSlide(paramData.value) loadingActive.value = true + await updateEntpcoursefileNew(paramData.value) const res = await homeworklist({ ids: paramData.value.activityContent, pageSize: 100 }) await formatClassWorkFile(res.rows) const resource = sessionStore.get('curr.resource') await PPTApi.getSlideList(resource.id) } // 判断是否做操作 -const objectsAreEqual = (obj1: any[], obj2: any[]) => { +const objectsAreEqual = (obj1: Record, obj2: Record) => { const keys1 = Object.keys(obj1); const keys2 = Object.keys(obj2); if (keys1.length !== keys2.length) return false; -- 2.44.0.windows.1