Compare commits

..

No commits in common. "3d8f7c2a3a09cfbe325f97a761a8671cbd1e45b2" and "9f4e232d6f36205f8695e818ce9a3fb8d801b6b6" have entirely different histories.

3 changed files with 37 additions and 12 deletions

View File

@ -110,9 +110,6 @@ 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 // 新增后会触发监听,不再更新数据
@ -151,6 +148,8 @@ export class PPTApi {
static updateSlide(data: object): Promise<Boolean> {
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)

View File

@ -146,18 +146,45 @@ export const useSlidesStore = defineStore('slides', {
this.workItem = list
},
addWorkItem(data: any) {
const id = data?.id
const id = data?.parentid
if (!id) return
this.workItem.splice(this.slideIndex + 1, 0, data)
this.slideIndex += 1
this.workItem.splice(this.slideIndex, 0, data)
},
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
}
this.slides.splice(this.slideIndex, 0, ...slides)
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
}
})
},
updateSlide(props: Partial<Slide>, slideId?: string) {

View File

@ -90,8 +90,7 @@ import { sessionStore } from '@/utils/store'
import { useGetHomework } from '@/hooks/useGetHomework'
import { PPTApi } from '../../../../../api/index'
import { storeToRefs } from 'pinia'
import {useSlidesStore} from '../../../../../store'
import { updateEntpcoursefileNew } from '@/api/education/entpcoursefile'
import {useSlidesStore} from '../../../../../store'
const slidesStore = useSlidesStore()
const { slides, slideIndex, currentSlide, workItem } = storeToRefs(slidesStore)
@ -278,6 +277,7 @@ 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,16 +302,15 @@ 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: Record<string, any>, obj2: Record<string, any>) => {
const objectsAreEqual = (obj1: any[], obj2: any[]) => {
const keys1 = Object.keys(obj1);
const keys2 = Object.keys(obj2);
if (keys1.length !== keys2.length) return false;