diff --git a/src/renderer/src/AixPPTist/src/App.vue b/src/renderer/src/AixPPTist/src/App.vue index 7fe9cd8..74c4b73 100644 --- a/src/renderer/src/AixPPTist/src/App.vue +++ b/src/renderer/src/AixPPTist/src/App.vue @@ -74,6 +74,8 @@ const initLoad: Function = () => { !!(opt.ratio??null) && slidesStore.setViewportRatio(opt.ratio)// 有比例配置项 } return PPTApi.getSlideList(resource.id) + // PPTApi.updateWorkList() + // return Promise.resolve() } return Promise.resolve() } diff --git a/src/renderer/src/AixPPTist/src/api/index.ts b/src/renderer/src/AixPPTist/src/api/index.ts index 6d4126a..ccf7909 100644 --- a/src/renderer/src/AixPPTist/src/api/index.ts +++ b/src/renderer/src/AixPPTist/src/api/index.ts @@ -8,6 +8,7 @@ import type { Result } from './types' // 接口类型 import msgUtils from '@/plugins/modal' // 消息工具 import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api import * as API_smarttalk from '@/api/file' // 相关api +import * as API_classwork from '@/api/teaching/classwork' // 相关api import * as useStore from '../store' // pptist-状态管理 import { sessionStore } from '@/utils/store' // electron-store 状态管理 import useUserStore from '@/store/modules/user' // 外部-用户信息 @@ -76,12 +77,14 @@ export class PPTApi { slidesStore.setSlides(slides) // 写入数据 } // 活动列表处理 - const workList = (res.rows || []).map(o => o.activityContent) + // const workList = (res.rows || []).map(o => o.activityContent) const workItem = res.rows ? [...res.rows] : [] // 写入作业列表数据 - slidesStore.setWorkList(workList) + // slidesStore.setWorkList(workList) // 获取所有的pptlist的数据 slidesStore.setWorkItem(workItem) + + this.updateWorkList() resolve(true) } else msgUtils.msgError(res.msg || '获取数据失败');resolve(false) }) @@ -202,6 +205,32 @@ export class PPTApi { else msgUtils.msgError(res.msg || '更新失败');return false }) } + + // 更新-活动列表 + static async updateWorkList(): Promise { + const resolveData = (resolve, data = []) => { + slidesStore.setWorkList(data) + return resolve() + } + return new Promise(async (resolve, reject) => { + const workItem = slidesStore.workItem // 所有的pptlist的数据-原始数据 + const currentSlide = slidesStore.currentSlide // 当前页幻灯片 + const slideId = currentSlide.id // 当前页幻灯片id + if (!slideId) return resolveData(resolve) + // slide详情获取-作业id + // const res = await API_entpcoursefile.getEntpcoursefile(slideId) + // const workIds = res?.data?.activityContent||'' + // workItem-获取作业id + const workIds = workItem.find(o => o.id == slideId)?.activityContent + console.log('更新-活动列表', workItem, currentSlide, slideId, workIds) + if (!workIds) return resolveData(resolve) + // 获取作业列表 + const resW = await API_classwork.homeworklist({ ids: workIds, pageSize: 1000 }) + if (resW && resW.rows) return resolveData(resolve, resW.rows) + else msgUtils.msgError(resW.msg || '更新失败');return resolveData(resolve) + }) + } + // thumbnail-slide thumbnail 缩略图 static getSlideThumUrl(): Promise { return nextTick().then(async() => { diff --git a/src/renderer/src/AixPPTist/src/api/store.ts b/src/renderer/src/AixPPTist/src/api/store.ts index 7ec18ea..37591c4 100644 --- a/src/renderer/src/AixPPTist/src/api/store.ts +++ b/src/renderer/src/AixPPTist/src/api/store.ts @@ -7,13 +7,13 @@ import msgUtils from '@/plugins/modal' // 消息工具 import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api export default class { - // 删除幻灯片 - static delSlide(id: string): Promise { - return new Promise(async (resolve, reject) => { - const res: Result = await API_entpcoursefile.delEntpcoursefile(id) - if (res.code === 200) { - resolve(true) - } else msgUtils.msgError(res.msg || '删除失败');resolve(false) - }) - } + // 删除幻灯片 + static delSlide(id: string): Promise { + return new Promise(async (resolve, reject) => { + const res: Result = await API_entpcoursefile.delEntpcoursefile(id) + if (res.code === 200) { + resolve(true) + } else msgUtils.msgError(res.msg || '删除失败');resolve(false) + }) + } } \ No newline at end of file diff --git a/src/renderer/src/AixPPTist/src/api/watcher.ts b/src/renderer/src/AixPPTist/src/api/watcher.ts index 8189fb5..f5d91cb 100644 --- a/src/renderer/src/AixPPTist/src/api/watcher.ts +++ b/src/renderer/src/AixPPTist/src/api/watcher.ts @@ -35,6 +35,11 @@ export default () => { updatePPT({title: newVal}) }) + // 监听幻灯片下标变化 + watch(() => slidesStore.slideIndex, (newVal, oldVal) => { + PPTApi.updateWorkList() + }) + // 消息监听ws // console.log('监听器已开启', ChatWs) if (!!ChatWs.ws) { 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 de3a244..7bba00e 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 @@ -32,7 +32,7 @@
-