From 85d06f306a5f4307710725f46254121eab8ca434 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=B0=8F=E6=9D=A8?= <666>
Date: Tue, 10 Dec 2024 15:34:46 +0800
Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9Appt=E6=B4=BB=E5=8A=A8=E6=B7=BB?=
=?UTF-8?q?=E5=8A=A0;?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/renderer/src/AixPPTist/src/api/index.ts | 4 +-
.../ElementStylePanel/Active/index.vue | 107 ++++++++++--------
.../classTask/newClassTaskAssign/index.vue | 16 ++-
3 files changed, 75 insertions(+), 52 deletions(-)
diff --git a/src/renderer/src/AixPPTist/src/api/index.ts b/src/renderer/src/AixPPTist/src/api/index.ts
index c893a00..c27f0d8 100644
--- a/src/renderer/src/AixPPTist/src/api/index.ts
+++ b/src/renderer/src/AixPPTist/src/api/index.ts
@@ -55,7 +55,6 @@ export class PPTApi {
return new Promise(async (resolve, reject) => {
const params: object = { parentid, orderByColumn: 'fileidx', isAsc: 'asc', pageSize: 9999 }
const res: Result = await API_entpcoursefile.listEntpcoursefileNew(params)
- console.log(res.rows,'res.rows');
if (res.code === 200) {
const slides = (res.rows || []).map(o => {
if (!!o.datacontent) {
@@ -69,7 +68,8 @@ export class PPTApi {
// 活动列表处理
const workList = (res.rows || []).map(o => o.activityContent)
const workItem = [...res.rows]
- slidesStore.updateSlideIndex(0) // 下标0 为第一页
+ // 加入活动后刷新ppt数据内容,不跟换为第一页
+ // slidesStore.updateSlideIndex(0) // 下标0 为第一页
slidesStore.setSlides(slides) // 写入数据
// 写入作业列表数据
slidesStore.setWorkList(workList)
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 c5f5c31..c4bc362 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
@@ -30,7 +30,7 @@
-
+
@@ -45,9 +45,11 @@
-
-
-
+
+
+
+
+
@@ -142,7 +144,6 @@ const currentCourse = reactive({
worktype: '',
})
-const dataList = ref([])
const dialogVisible = ref(false)
const tasklist_loading = ref(false)
@@ -152,11 +153,6 @@ const taskList = ref([])
// 活动引用的弹窗
const activeVisible = ref(false)
-const params = reactive({
- parentid: 14766,
- pageSize: 500,
- orderby: 'fileidx'
-})
const type = ref([
{
@@ -179,6 +175,8 @@ const workList = ref([])
// 获取所选择的作业列表
const selectedWorkList = ref([])
+// 活动页面的loading框
+const loadingActive = ref(false)
const paramData = ref<{ id: number, activityContent: string }>({} as { id: number, activityContent: string })
@@ -196,7 +194,6 @@ const formatClassWorkFile = async (postData: WorkItem[]): Promise => {
}
break;
case '习题训练': {
- console.log(item,'item');
// let workIds = item.quizlist!.map(items => items.id).join(',');
// let ress = await listEntpcoursework({ ids: workIds });
// const arr = ress.rows.map((item:{id:number}) => {
@@ -213,23 +210,20 @@ const formatClassWorkFile = async (postData: WorkItem[]): Promise => {
case '常规作业': {
// item.prevData = JSON.parse(item.workcodes);
}
- }
- const arr = paramData.value.activityContent.split(',')
- arr.push(item.id.toString())
- await PPTApi.updateSlide(paramData.value)
- addWorkList(item)
+ }
+ workList.value.push(item)
+ loadingActive.value = false
}
await nextTick();
-}
-// 添加的活动回显到页面上面去
-const addWorkList = (item: WorkItem) => {
- workList.value.push(item)
-}
-// 删除作业
+}// 删除作业
const handleRemoveDemoActivityClassWork = (item: WorkItem) => {
ElMessageBox.confirm('是否确认删除?')
.then(() => {
- workList.value.splice(workList.value.indexOf(item), 1);
+ workList.value = []
+ const arr = paramData.value.activityContent.split(',')
+ const filterArr = arr.filter(itemId => itemId!== item.id.toString())
+ paramData.value.activityContent = filterArr.join(',')
+ upDateData()
})
.catch(() => { });
}
@@ -269,13 +263,52 @@ const savePPtData = async () => {
ElMessage.warning('请选择活动')
return
}
+ workList.value = []
const arr = selectedWorkList.value.map(item => item.id)
// 应该是新加而不是覆盖
- paramData.value.activityContent = arr.join(',')
- await PPTApi.updateSlide(paramData.value)
+ debugger
+ const existingIds = paramData.value.activityContent ? paramData.value.activityContent.split(',') : []
+ paramData.value.activityContent = Array.from(new Set([...existingIds, ...arr])).join(',')
+ upDateData()
activeVisible.value = false
}
+// 获取当前ppt页的数据
+const getCurrentPPtData = async () => {
+ workList.value = []
+ objItem.value = workItem.value[slideIndex.value]
+ paramData.value.id = objItem.value.id
+ paramData.value.activityContent = objItem.value?.activityContent
+ if (objItem.value?.activityContent) {
+ loadingActive.value = true
+ const res = await homeworklist({ ids: objItem.value?.activityContent, pageSize: 100 })
+ await formatClassWorkFile(res.rows)
+ }
+}
+
+// 接收习题训练的值
+const getData = async (data: WorkItem) => {
+ workList.value = []
+ if(paramData.value.activityContent){
+ const arr = paramData.value.activityContent.split(',')
+ arr.push(data.id.toString())
+ const unitArr = Array.from(new Set(arr))
+ paramData.value.activityContent = unitArr.join(',')
+ }else{
+ paramData.value.activityContent = data.id.toString()
+ }
+ upDateData()
+ dialogVisible.value = false
+}
+const upDateData = async () => {
+ await PPTApi.updateSlide(paramData.value)
+ loadingActive.value = true
+ 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)
+}
+
onMounted(() => {
const curNode = sessionStore.get('subject.curNode') as CourseNode
currentCourse.textbookId = curNode.rootid
@@ -283,33 +316,12 @@ onMounted(() => {
currentCourse.levelSecondId = curNode.id
currentCourse.coursetitle = curNode.itemtitle
currentCourse.node = curNode
- listEntpcoursefile(params).then((res: { rows: WorkItem[] }) => {
- dataList.value = [...res.rows]
- })
objItem.value = workItem.value[slideIndex.value]
getCurrentPPtData()
})
watch(() => slideIndex.value, () => {
getCurrentPPtData()
})
-// 获取当前ppt页的数据
-const getCurrentPPtData = async () => {
- workList.value = []
- objItem.value = workItem.value[slideIndex.value]
- paramData.value.id = objItem.value.id
- if (objItem.value?.activityContent) {
- paramData.value.activityContent = objItem.value?.activityContent
- const res = await homeworklist({ ids: objItem.value?.activityContent, pageSize: 100 })
- await formatClassWorkFile(res.rows)
- }
-}
-
-// 接收习题训练的值
-const getData = async (data: WorkItem) => {
- console.log(data, 'data')
- await formatClassWorkFile([data])
-}
-
\ No newline at end of file
diff --git a/src/renderer/src/views/classTask/newClassTaskAssign/index.vue b/src/renderer/src/views/classTask/newClassTaskAssign/index.vue
index 577a881..21d239f 100644
--- a/src/renderer/src/views/classTask/newClassTaskAssign/index.vue
+++ b/src/renderer/src/views/classTask/newClassTaskAssign/index.vue
@@ -157,6 +157,7 @@ const props = defineProps({
currentCourse: Object,
})
const emits = defineEmits(['getData'])
+// 这个代表的是是否从ppt里面添加的作业
const isShow = ref(false)
const propsQueryCourseObj = route.query.courseObj;//作业布置的内容对象
@@ -490,11 +491,13 @@ const handleClassWorkFormQuizRemove = (index) =>{
// 当前为[编辑]状态下点进来得处理 newWorkSpaceEdit true 为编辑状态
- if(classWorkForm.id != '' ) {// 编辑状态 有id
-
- editWork(cform); // 编辑作业
+ if(isShow.value === false){
+ if(classWorkForm.id != '' ) {// 编辑状态 有id
+ editWork(cform); // 编辑作业
return;
+ }
}
+
if (classWorkForm.worktype === "课堂展示") {
boardLoading.value = true
@@ -596,7 +599,12 @@ const handleClassWorkFormQuizRemove = (index) =>{
}
console.log('该清空左侧列表数据了');
// 清空左侧 选中的布置列表 并刷新列表
- currentRow.value = {id:0};
+ debugger
+ if(isShow.value){
+ currentRow.value = {id:1};
+ }else{
+ currentRow.value = {id:0};
+ }
initHomeWork();