Merge remote-tracking branch 'origin/main'

This commit is contained in:
朱浩 2024-12-16 14:24:16 +08:00
commit ed8051d0e0
5 changed files with 51 additions and 15 deletions

View File

@ -74,6 +74,8 @@ const initLoad: Function = () => {
!!(opt.ratio??null) && slidesStore.setViewportRatio(opt.ratio)// !!(opt.ratio??null) && slidesStore.setViewportRatio(opt.ratio)//
} }
return PPTApi.getSlideList(resource.id) return PPTApi.getSlideList(resource.id)
// PPTApi.updateWorkList()
// return Promise.resolve()
} }
return Promise.resolve() return Promise.resolve()
} }

View File

@ -8,6 +8,7 @@ import type { Result } from './types' // 接口类型
import msgUtils from '@/plugins/modal' // 消息工具 import msgUtils from '@/plugins/modal' // 消息工具
import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api
import * as API_smarttalk from '@/api/file' // 相关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 * as useStore from '../store' // pptist-状态管理
import { sessionStore } from '@/utils/store' // electron-store 状态管理 import { sessionStore } from '@/utils/store' // electron-store 状态管理
import useUserStore from '@/store/modules/user' // 外部-用户信息 import useUserStore from '@/store/modules/user' // 外部-用户信息
@ -76,12 +77,14 @@ export class PPTApi {
slidesStore.setSlides(slides) // 写入数据 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] : [] const workItem = res.rows ? [...res.rows] : []
// 写入作业列表数据 // 写入作业列表数据
slidesStore.setWorkList(workList) // slidesStore.setWorkList(workList)
// 获取所有的pptlist的数据 // 获取所有的pptlist的数据
slidesStore.setWorkItem(workItem) slidesStore.setWorkItem(workItem)
this.updateWorkList()
resolve(true) resolve(true)
} else msgUtils.msgError(res.msg || '获取数据失败');resolve(false) } else msgUtils.msgError(res.msg || '获取数据失败');resolve(false)
}) })
@ -202,6 +205,32 @@ export class PPTApi {
else msgUtils.msgError(res.msg || '更新失败');return false else msgUtils.msgError(res.msg || '更新失败');return false
}) })
} }
// 更新-活动列表
static async updateWorkList(): Promise<Boolean> {
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 缩略图 // thumbnail-slide thumbnail 缩略图
static getSlideThumUrl(): Promise<Boolean> { static getSlideThumUrl(): Promise<Boolean> {
return nextTick().then(async() => { return nextTick().then(async() => {

View File

@ -7,13 +7,13 @@ import msgUtils from '@/plugins/modal' // 消息工具
import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api
export default class { export default class {
// 删除幻灯片 // 删除幻灯片
static delSlide(id: string): Promise<Boolean> { static delSlide(id: string): Promise<Boolean> {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
const res: Result = await API_entpcoursefile.delEntpcoursefile(id) const res: Result = await API_entpcoursefile.delEntpcoursefile(id)
if (res.code === 200) { if (res.code === 200) {
resolve(true) resolve(true)
} else msgUtils.msgError(res.msg || '删除失败');resolve(false) } else msgUtils.msgError(res.msg || '删除失败');resolve(false)
}) })
} }
} }

View File

@ -35,6 +35,11 @@ export default () => {
updatePPT({title: newVal}) updatePPT({title: newVal})
}) })
// 监听幻灯片下标变化
watch(() => slidesStore.slideIndex, (newVal, oldVal) => {
PPTApi.updateWorkList()
})
// 消息监听ws // 消息监听ws
// console.log('监听器已开启', ChatWs) // console.log('监听器已开启', ChatWs)
if (!!ChatWs.ws) { if (!!ChatWs.ws) {

View File

@ -32,7 +32,7 @@
<!-- 作业列表 --> <!-- 作业列表 -->
<div class="c-apt-r" v-loading='loadingActive'> <div class="c-apt-r" v-loading='loadingActive'>
<!-- 显示-作业内容 --> <!-- 显示-作业内容 -->
<template v-for="(item, index) in workList" :key="index"> <template v-for="(item, index) in slidesStore.workList" :key="index">
<div class="item"> <div class="item">
<div class="item-title"> <div class="item-title">
<el-tag :type="getTagType(item.worktype) || 'primary'">{{item.worktype}}</el-tag> <el-tag :type="getTagType(item.worktype) || 'primary'">{{item.worktype}}</el-tag>
@ -94,7 +94,7 @@ import {useSlidesStore} from '../../../../../store'
import { updateEntpcoursefileNew } from '@/api/education/entpcoursefile' import { updateEntpcoursefileNew } from '@/api/education/entpcoursefile'
const slidesStore = useSlidesStore() const slidesStore = useSlidesStore()
const { slides, slideIndex, currentSlide, workItem } = storeToRefs(slidesStore) const { slides, slideIndex, currentSlide, workItem } = storeToRefs(slidesStore)
console.log('slidesStore',slidesStore.workList)
interface CourseNode { interface CourseNode {
rootid: number; rootid: number;
parentNode: { id: number }; parentNode: { id: number };
@ -332,8 +332,8 @@ onMounted(() => {
currentCourse.levelSecondId = curNode.id currentCourse.levelSecondId = curNode.id
currentCourse.coursetitle = curNode.itemtitle currentCourse.coursetitle = curNode.itemtitle
currentCourse.node = curNode currentCourse.node = curNode
objItem.value = workItem.value[slideIndex.value] // objItem.value = workItem.value[slideIndex.value]
getCurrentPPtData() // getCurrentPPtData()
}) })
watch(() => [workItem.value.length,workItem.value[slideIndex.value]?.id], (newVal,oldVal) => { watch(() => [workItem.value.length,workItem.value[slideIndex.value]?.id], (newVal,oldVal) => {
if(!objectsAreEqual(newVal,oldVal)) if(!objectsAreEqual(newVal,oldVal))