yws_dev #103

Merged
yangws merged 2 commits from yws_dev into main 2024-12-10 15:35:21 +08:00
3 changed files with 75 additions and 52 deletions

View File

@ -60,7 +60,6 @@ export class PPTApi {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
const params: object = { parentid, orderByColumn: 'fileidx', isAsc: 'asc', pageSize: 9999 } const params: object = { parentid, orderByColumn: 'fileidx', isAsc: 'asc', pageSize: 9999 }
const res: Result = await API_entpcoursefile.listEntpcoursefileNew(params) const res: Result = await API_entpcoursefile.listEntpcoursefileNew(params)
console.log(res.rows,'res.rows');
if (res.code === 200) { if (res.code === 200) {
const slides = (res.rows || []).map(o => { const slides = (res.rows || []).map(o => {
if (!!o.datacontent) { if (!!o.datacontent) {
@ -74,7 +73,8 @@ export class PPTApi {
// 活动列表处理 // 活动列表处理
const workList = (res.rows || []).map(o => o.activityContent) const workList = (res.rows || []).map(o => o.activityContent)
const workItem = [...res.rows] const workItem = [...res.rows]
slidesStore.updateSlideIndex(0) // 下标0 为第一页 // 加入活动后刷新ppt数据内容不跟换为第一页
// slidesStore.updateSlideIndex(0) // 下标0 为第一页
slidesStore.setSlides(slides) // 写入数据 slidesStore.setSlides(slides) // 写入数据
// 写入作业列表数据 // 写入作业列表数据
slidesStore.setWorkList(workList) slidesStore.setWorkList(workList)

View File

@ -30,7 +30,7 @@
<Divider /> <Divider />
<!-- 作业列表 --> <!-- 作业列表 -->
<div class="c-apt-r"> <div class="c-apt-r" v-loading='loadingActive'>
<!-- 显示-作业内容 --> <!-- 显示-作业内容 -->
<template v-for="(item, index) in workList" :key="index"> <template v-for="(item, index) in workList" :key="index">
<div class="item"> <div class="item">
@ -45,9 +45,11 @@
</template> </template>
</div> </div>
<!-- // --> <!-- // -->
<el-dialog v-model="dialogVisible" append-to-body :show-close="false" width="80%" height="500"> <el-dialog v-model="dialogVisible" append-to-body :show-close="false" width="90%" height="500">
<el-scrollbar height="500"> <el-scrollbar height="550">
<NewClassTsakAssign :currentCourse='currentCourse' @getData="getData" /> <div style="height: 550px;">
<NewClassTsakAssign :currentCourse='currentCourse' @getData="getData" />
</div>
</el-scrollbar> </el-scrollbar>
</el-dialog> </el-dialog>
<!-- 活动引用 --> <!-- 活动引用 -->
@ -142,7 +144,6 @@ const currentCourse = reactive<CurrentCourse>({
worktype: '', worktype: '',
}) })
const dataList = ref<WorkItem[]>([])
const dialogVisible = ref<boolean>(false) const dialogVisible = ref<boolean>(false)
const tasklist_loading = ref<boolean>(false) const tasklist_loading = ref<boolean>(false)
@ -152,11 +153,6 @@ const taskList = ref<WorkItem[]>([])
// //
const activeVisible = ref<boolean>(false) const activeVisible = ref<boolean>(false)
const params = reactive<Params>({
parentid: 14766,
pageSize: 500,
orderby: 'fileidx'
})
const type = ref<WorkType[]>([ const type = ref<WorkType[]>([
{ {
@ -179,6 +175,8 @@ const workList = ref<WorkItem[]>([])
// //
const selectedWorkList = ref<WorkItem[]>([]) const selectedWorkList = ref<WorkItem[]>([])
// loading
const loadingActive = ref<boolean>(false)
const paramData = ref<{ id: number, activityContent: string }>({} as { id: number, activityContent: string }) const paramData = ref<{ id: number, activityContent: string }>({} as { id: number, activityContent: string })
@ -196,7 +194,6 @@ const formatClassWorkFile = async (postData: WorkItem[]): Promise<void> => {
} }
break; break;
case '习题训练': { case '习题训练': {
console.log(item,'item');
// let workIds = item.quizlist!.map(items => items.id).join(','); // let workIds = item.quizlist!.map(items => items.id).join(',');
// let ress = await listEntpcoursework({ ids: workIds }); // let ress = await listEntpcoursework({ ids: workIds });
// const arr = ress.rows.map((item:{id:number}) => { // const arr = ress.rows.map((item:{id:number}) => {
@ -213,23 +210,20 @@ const formatClassWorkFile = async (postData: WorkItem[]): Promise<void> => {
case '常规作业': { case '常规作业': {
// item.prevData = JSON.parse(item.workcodes); // item.prevData = JSON.parse(item.workcodes);
} }
} }
const arr = paramData.value.activityContent.split(',') workList.value.push(item)
arr.push(item.id.toString()) loadingActive.value = false
await PPTApi.updateSlide(paramData.value)
addWorkList(item)
} }
await nextTick(); await nextTick();
} }//
//
const addWorkList = (item: WorkItem) => {
workList.value.push(item)
}
//
const handleRemoveDemoActivityClassWork = (item: WorkItem) => { const handleRemoveDemoActivityClassWork = (item: WorkItem) => {
ElMessageBox.confirm('是否确认删除?') ElMessageBox.confirm('是否确认删除?')
.then(() => { .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(() => { }); .catch(() => { });
} }
@ -269,13 +263,52 @@ const savePPtData = async () => {
ElMessage.warning('请选择活动') ElMessage.warning('请选择活动')
return return
} }
workList.value = []
const arr = selectedWorkList.value.map(item => item.id) const arr = selectedWorkList.value.map(item => item.id)
// //
paramData.value.activityContent = arr.join(',') debugger
await PPTApi.updateSlide(paramData.value) const existingIds = paramData.value.activityContent ? paramData.value.activityContent.split(',') : []
paramData.value.activityContent = Array.from(new Set([...existingIds, ...arr])).join(',')
upDateData()
activeVisible.value = false 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(() => { onMounted(() => {
const curNode = sessionStore.get('subject.curNode') as CourseNode const curNode = sessionStore.get('subject.curNode') as CourseNode
currentCourse.textbookId = curNode.rootid currentCourse.textbookId = curNode.rootid
@ -283,33 +316,12 @@ onMounted(() => {
currentCourse.levelSecondId = curNode.id currentCourse.levelSecondId = curNode.id
currentCourse.coursetitle = curNode.itemtitle currentCourse.coursetitle = curNode.itemtitle
currentCourse.node = curNode currentCourse.node = curNode
listEntpcoursefile(params).then((res: { rows: WorkItem[] }) => {
dataList.value = [...res.rows]
})
objItem.value = workItem.value[slideIndex.value] objItem.value = workItem.value[slideIndex.value]
getCurrentPPtData() getCurrentPPtData()
}) })
watch(() => slideIndex.value, () => { watch(() => slideIndex.value, () => {
getCurrentPPtData() 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])
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.buttonDiv{ .buttonDiv{
@ -375,5 +387,8 @@ const getData = async (data: WorkItem) => {
--el-border-color: var(--current-color); --el-border-color: var(--current-color);
} }
} }
.page .page-resource{
height: 500px !important;
}
} }
</style> </style>

View File

@ -157,6 +157,7 @@ const props = defineProps({
currentCourse: Object, currentCourse: Object,
}) })
const emits = defineEmits(['getData']) const emits = defineEmits(['getData'])
// ppt
const isShow = ref(false) const isShow = ref(false)
const propsQueryCourseObj = route.query.courseObj;// const propsQueryCourseObj = route.query.courseObj;//
@ -490,11 +491,13 @@ const handleClassWorkFormQuizRemove = (index) =>{
// [] newWorkSpaceEdit true // [] newWorkSpaceEdit true
if(classWorkForm.id != '' ) {// id if(isShow.value === false){
if(classWorkForm.id != '' ) {// id
editWork(cform); // editWork(cform); //
return; return;
}
} }
if (classWorkForm.worktype === "课堂展示") { if (classWorkForm.worktype === "课堂展示") {
boardLoading.value = true boardLoading.value = true
@ -596,7 +599,12 @@ const handleClassWorkFormQuizRemove = (index) =>{
} }
console.log('该清空左侧列表数据了'); console.log('该清空左侧列表数据了');
// //
currentRow.value = {id:0}; debugger
if(isShow.value){
currentRow.value = {id:1};
}else{
currentRow.value = {id:0};
}
initHomeWork(); initHomeWork();