yws_dev #99

Merged
yangws merged 6 commits from yws_dev into main 2024-12-09 17:26:10 +08:00
4 changed files with 219 additions and 131 deletions

View File

@ -143,6 +143,8 @@ export class PPTApi {
static updateSlide(data: object): Promise<Boolean> { static updateSlide(data: object): Promise<Boolean> {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
const res: Result = await API_entpcoursefile.updateEntpcoursefileNew(data) const res: Result = await API_entpcoursefile.updateEntpcoursefileNew(data)
console.log(data,'data');
console.log(res,'dresata');
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

@ -67,8 +67,6 @@
<div class="page-number">幻灯片 {{slideIndex + 1}} / {{slides.length}}</div> <div class="page-number">幻灯片 {{slideIndex + 1}} / {{slides.length}}</div>
<!-- 引入活动的列表页面 -->
<Active ref="activeRef" v-show="false"/>
</div> </div>
</template> </template>
@ -88,7 +86,6 @@ import ThumbnailSlide from '../../../views/components/ThumbnailSlide/index.vue'
import LayoutPool from './LayoutPool.vue' import LayoutPool from './LayoutPool.vue'
import Popover from '../../../components/Popover.vue' import Popover from '../../../components/Popover.vue'
import Draggable from 'vuedraggable' import Draggable from 'vuedraggable'
import Active from '../Toolbar/ElementStylePanel/Active/index.vue'
const mainStore = useMainStore() const mainStore = useMainStore()
const slidesStore = useSlidesStore() const slidesStore = useSlidesStore()
@ -127,7 +124,6 @@ const {
updateSectionTitle, updateSectionTitle,
} = useSectionHandler() } = useSectionHandler()
const activeRef = ref()
// //
const thumbnailsRef = ref<InstanceType<typeof Draggable>>() const thumbnailsRef = ref<InstanceType<typeof Draggable>>()
@ -151,8 +147,6 @@ watch(() => slideIndex.value, () => {
// //
const changeSlideIndex = (index: number) => { const changeSlideIndex = (index: number) => {
console.log(workItem.value[index],'hasSection');
activeRef.value.clickPPTList(workItem.value[index])
mainStore.setActiveElementIdList([]) mainStore.setActiveElementIdList([])

View File

@ -32,12 +32,12 @@
<!-- 作业列表 --> <!-- 作业列表 -->
<div class="c-apt-r"> <div class="c-apt-r">
<!-- 显示-作业内容 --> <!-- 显示-作业内容 -->
<template v-for="(item, index) in workList"> <template v-for="(item, index) in 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>
<el-tooltip :content="item.title||item.uniquekey" placement="top"> <el-tooltip :content="item.evaltitle" placement="top">
<div class="tt">{{item.title||item.uniquekey}}</div> <div class="tt">{{item.evaltitle}}</div>
</el-tooltip> </el-tooltip>
<el-button class="btn-del" type="danger" link @click="handleRemoveDemoActivityClassWork(item)">删除</el-button> <el-button class="btn-del" type="danger" link @click="handleRemoveDemoActivityClassWork(item)">删除</el-button>
</div> </div>
@ -45,8 +45,10 @@
</template> </template>
</div> </div>
<!-- // --> <!-- // -->
<el-dialog v-model="dialogVisible" append-to-body :show-close="false" width="80%"> <el-dialog v-model="dialogVisible" append-to-body :show-close="false" width="80%" height="500">
<NewClassTsakAssign :currentCourse='currentCourse'/> <el-scrollbar height="500">
<NewClassTsakAssign :currentCourse='currentCourse' @getData="getData" />
</el-scrollbar>
</el-dialog> </el-dialog>
<!-- 活动引用 --> <!-- 活动引用 -->
<el-dialog <el-dialog
@ -55,9 +57,9 @@
append-to-body append-to-body
:show-close="false" :show-close="false"
width="40%" width="40%"
@selection-change="handleSelectionChange"> >
<el-table :data="taskList" style="width: 100%" height="500"> <el-table :data="taskList" style="width: 100%" height="500" @selection-change="handleSelectionChange">
<el-table-column type="selection" :selectable="selectable" width="55" /> <el-table-column type="selection" width="55" :selectable="selectable"/>
<el-table-column prop="evaltitle" label="活动名称" width="150" /> <el-table-column prop="evaltitle" label="活动名称" width="150" />
<el-table-column prop="worktype" label="活动类型" width="120" sortable> <el-table-column prop="worktype" label="活动类型" width="120" sortable>
<template #default="scope"> <template #default="scope">
@ -68,78 +70,125 @@
</el-table> </el-table>
<template #footer> <template #footer>
<el-button @click="activeVisible = false"> </el-button> <el-button @click="activeVisible = false"> </el-button>
<el-button type="primary" @click="save"> </el-button> <el-button type="primary" @click="savePPtData"> </el-button>
</template> </template>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script setup> <script setup lang="ts">
import { ref, reactive, onMounted, onBeforeMount, defineExpose } from 'vue' import { ref, reactive, onMounted, nextTick, watch } from 'vue'
import Divider from '../../../../../components/Divider.vue' import Divider from '../../../../../components/Divider.vue'
import {listEntpcoursefile} from '@/api/education/entpcoursefile' import { listEntpcoursefile } from '@/api/education/entpcoursefile'
import {homeworklist} from '@/api/teaching/classwork' import { homeworklist } from '@/api/teaching/classwork'
import { processList } from "@/hooks/useProcessList"; import { processList } from "@/hooks/useProcessList";
import { listEntpcoursework } from "@/api/classTask/index"; import { listEntpcoursework } from "@/api/classTask/index";
import { ElMessageBox } from 'element-plus' import { ElMessageBox,ElMessage } from 'element-plus'
import NewClassTsakAssign from '@/views/classTask/newClassTaskAssign/index.vue' import NewClassTsakAssign from '@/views/classTask/newClassTaskAssign/index.vue'
import { sessionStore } from '@/utils/store' import { sessionStore } from '@/utils/store'
import { useGetHomework } from '@/hooks/useGetHomework' import { useGetHomework } from '@/hooks/useGetHomework'
const currentCourse = reactive({ import { PPTApi } from '../../../../../api/index'
textbookId:0, import { storeToRefs } from 'pinia'
levelFirstId:0, import {useSlidesStore} from '../../../../../store'
levelSecondId:0, const slidesStore = useSlidesStore()
coursetitle:'', const { slides, slideIndex, currentSlide, workItem } = storeToRefs(slidesStore)
node:{},
id:1, interface CourseNode {
worktype:'', rootid: number;
}) parentNode: { id: number };
const dataList = ref([]) id: number;
const dialogVisible = ref(false) itemtitle: string;
const tasklist_loading = ref(false)
//
const taskList = ref([])
//
const activeVisible = ref(false)
const params = reactive({
parentid:14766,
pageSize:500,
orderby:'fileidx'
})
const type = ref([
{
label:'习题训练',
value:'danger'
},
{
label:'课堂展示',
value:'success'
},
{
label:'常规作业',
value:'primary'
},
])
//
const workList = ref([])
const selectable = (row,index) => {
console.log(row,index,'row,index');
return true
} }
const clickPPTList = (item) => { interface CurrentCourse {
console.log(item,'点击了') textbookId: number;
workList.value = [] levelFirstId: number;
let datacontent = item.datacontent; levelSecondId: number;
let pptJson = ""; coursetitle: string;
if(typeof datacontent === 'string') pptJson = JSON.parse(datacontent) node: CourseNode;
if(pptJson&&pptJson[0]&&pptJson[0].classworkList) { id: number;
homeworklist({ids:pptJson[0].classworkList, pageSize: 100}).then( async res => { worktype: string;
await formatClassWorkFile(res.rows)
})
}
} }
const formatClassWorkFile = async (postData) => {
return new Promise(async (resolve, reject)=>{ interface Params {
parentid: number;
pageSize: number;
orderby: string;
}
interface WorkType {
label: string;
value: string;
}
interface WorkItem {
status: string;
activityContent?: string;
worktype: string;
quizlist?: { id: number }[];
workcodes: string;
base64?: string;
prevData?: any;
id: number;
evaltitle?: string; // evaltitle
}
const currentCourse = reactive<CurrentCourse>({
textbookId: 0,
levelFirstId: 0,
levelSecondId: 0,
coursetitle: '',
node: {} as CourseNode,
id: 1,
worktype: '',
})
const dataList = ref<WorkItem[]>([])
const dialogVisible = ref<boolean>(false)
const tasklist_loading = ref<boolean>(false)
//
const taskList = ref<WorkItem[]>([])
//
const activeVisible = ref<boolean>(false)
const params = reactive<Params>({
parentid: 14766,
pageSize: 500,
orderby: 'fileidx'
})
const type = ref<WorkType[]>([
{
label: '习题训练',
value: 'danger'
},
{
label: '课堂展示',
value: 'success'
},
{
label: '常规作业',
value: 'primary'
},
])
const objItem = ref<any>({})
//
const workList = ref<WorkItem[]>([])
//
const selectedWorkList = ref<WorkItem[]>([])
const paramData = ref<{ id: number, activityContent: string }>({} as { id: number, activityContent: string })
const selectable = (row: WorkItem, index: number): boolean => {
return row.status === '10';
};
const formatClassWorkFile = async (postData: WorkItem[]): Promise<void> => {
for (let i = 0; i < postData.length; i++) { for (let i = 0; i < postData.length; i++) {
let item = postData[i]; let item = postData[i];
switch (item.worktype) { switch (item.worktype) {
@ -147,81 +196,120 @@ const formatClassWorkFile = async (postData) => {
} }
break; break;
case '习题训练': { case '习题训练': {
item.entpcourseworklistarray = item.entpcourseworklist?JSON.parse('['+item.entpcourseworklist+']'):[]; console.log(item,'item');
let workIds = item.entpcourseworklistarray.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 });
processList(ress.rows) // const arr = ress.rows.map((item:{id:number}) => {
item.workShowList = ress.rows // return item.id
// })
// processList(ress.rows);
} }
break; break;
case '课堂展示': { case '课堂展示': {
item.base64 = JSON.parse(item.workcodes).base64 // item.base64 = JSON.parse(item.workcodes).base64;
} }
break; break;
case '常规作业': { case '常规作业': {
item.prevData = JSON.parse(item.workcodes) // item.prevData = JSON.parse(item.workcodes);
} }
} }
const arr = paramData.value.activityContent.split(',')
arr.push(item.id.toString())
await PPTApi.updateSlide(paramData.value)
addWorkList(item)
}
await nextTick();
}
//
const addWorkList = (item: WorkItem) => {
workList.value.push(item) workList.value.push(item)
}
resolve()
})
} }
// //
const handleRemoveDemoActivityClassWork = (item) => { const handleRemoveDemoActivityClassWork = (item: WorkItem) => {
ElMessageBox.confirm('是否确认删除?') ElMessageBox.confirm('是否确认删除?')
.then(function () { .then(() => {
workList.value.splice(workList.value.indexOf(item), 1); workList.value.splice(workList.value.indexOf(item), 1);
}) })
.catch(() => {}); .catch(() => { });
} }
// tag // tag
const getTagType = (worktype) => { const getTagType = (worktype: string): string => {
return type.value.find(item => item.label == worktype).value return type.value.find(item => item.label === worktype)!.value
} }
// //
const initHomeWork = async()=> { const initHomeWork = async () => {
tasklist_loading.value = true; tasklist_loading.value = true;
const { res, chapterId } = await useGetHomework(sessionStore.get('subject.curNode')); const { res, chapterId } = await useGetHomework(sessionStore.get('subject.curNode'));
taskList.value = res; taskList.value = res;
tasklist_loading.value = false; tasklist_loading.value = false;
} }
// //
const handleSelectionChange = (val) => { const handleSelectionChange = (val: WorkItem[]) => {
console.log(val,'多选') selectedWorkList.value = [...val]
} }
// //
const showDialog = (item) => { const showDialog = (item: string) => {
currentCourse.worktype = item currentCourse.worktype = item
dialogVisible.value = true dialogVisible.value = true
} }
const openList = () => { const openList = () => {
activeVisible.value = true activeVisible.value = true
initHomeWork() initHomeWork()
} }
// //
const save = () => { const savePPtData = async () => {
console.log('添加了') if (selectedWorkList.value.length === 0) {
ElMessage.warning('请选择活动')
return
}
const arr = selectedWorkList.value.map(item => item.id)
//
paramData.value.activityContent = arr.join(',')
await PPTApi.updateSlide(paramData.value)
activeVisible.value = false activeVisible.value = false
} }
onMounted(() => { onMounted(() => {
// console.log(sessionStore.get('subject.curBook'),'curBook'); const curNode = sessionStore.get('subject.curNode') as CourseNode
// console.log(sessionStore.get('subject.subjectTree'),'subjectTree');
// console.log(sessionStore.get('subject.bookList'),'bookList');
console.log(sessionStore.get('subject.curNode'),'curNode');
const curNode = sessionStore.get('subject.curNode')
currentCourse.textbookId = curNode.rootid currentCourse.textbookId = curNode.rootid
currentCourse.levelFirstId = curNode.parentNode.id currentCourse.levelFirstId = curNode.parentNode.id
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) => { listEntpcoursefile(params).then((res: { rows: WorkItem[] }) => {
dataList.value = [...res.rows] dataList.value = [...res.rows]
}) })
objItem.value = workItem.value[slideIndex.value]
getCurrentPPtData()
}) })
defineExpose({ watch(() => slideIndex.value, () => {
clickPPTList 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{

View File

@ -126,7 +126,7 @@
</div> </div>
</template> </template>
<script setup> <script setup>
import { onMounted, ref, watch, reactive, getCurrentInstance, nextTick } from 'vue' import { onMounted, ref, watch, reactive, getCurrentInstance, nextTick, defineEmits } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { cloneDeep } from 'lodash' import { cloneDeep } from 'lodash'
import { Plus, Delete } from '@element-plus/icons-vue' import { Plus, Delete } from '@element-plus/icons-vue'
@ -156,6 +156,7 @@ const { proxy } = getCurrentInstance()
const props = defineProps({ const props = defineProps({
currentCourse: Object, currentCourse: Object,
}) })
const emits = defineEmits(['getData'])
const isShow = ref(false) const isShow = ref(false)
const propsQueryCourseObj = route.query.courseObj;// const propsQueryCourseObj = route.query.courseObj;//
@ -460,10 +461,8 @@ const handleClassWorkFormQuizRemove = (index) =>{
await nextTick(); // DOM await nextTick(); // DOM
proxy.$refs["classWorkFormRef"].validate(async valid => { proxy.$refs["classWorkFormRef"].validate(async valid => {
if (valid) { if (valid) {
//
// const { chapterId } = await useGetHomework(courseObj.node) // const { chapterId } = await useGetHomework(courseObj.node)
// this.entpcourseid = chapterId // this.entpcourseid = chapterId
const cform = { const cform = {
id: 0, id: 0,
workdate: classWorkForm.workdate, // //web workdate: classWorkForm.workdate, // //web
@ -507,7 +506,7 @@ const handleClassWorkFormQuizRemove = (index) =>{
cform.workcodes = JSON.stringify({json: canvasJson, base64: canvasBase64}); cform.workcodes = JSON.stringify({json: canvasJson, base64: canvasBase64});
cform.entpcourseworklist = JSON.stringify([{'id':-1, 'score': '10'}]); cform.entpcourseworklist = JSON.stringify([{'id':-1, 'score': '10'}]);
try { try {
addClassworkReturnId(cform).then(() => { addClassworkReturnId(cform).then((res) => {
ElMessage({ type: 'success', message: '作业设计成功!'}); ElMessage({ type: 'success', message: '作业设计成功!'});
// //
classWorkForm.worktype = "课堂展示"; classWorkForm.worktype = "课堂展示";
@ -519,7 +518,8 @@ const handleClassWorkFormQuizRemove = (index) =>{
// //
classWorkForm.chooseWorkLists = []; // list classWorkForm.chooseWorkLists = []; // list
classWorkForm.whiteboardObj = ''; // ? // classWorkForm.whiteboardObj = ''; // ? //
classWorkForm.id = res
emits('getData',classWorkForm)
boardLoading.value = false boardLoading.value = false
}) })
} finally { } finally {
@ -531,7 +531,7 @@ const handleClassWorkFormQuizRemove = (index) =>{
cform.workcodes = JSON.stringify(classWorkForm.fileHomeworkList); cform.workcodes = JSON.stringify(classWorkForm.fileHomeworkList);
cform.entpcourseworklist = JSON.stringify([{'id':-2, 'score': '10'}]); cform.entpcourseworklist = JSON.stringify([{'id':-2, 'score': '10'}]);
try { try {
addClassworkReturnId(cform).then(() => { addClassworkReturnId(cform).then((res) => {
ElMessage({ type: 'success', message: '作业设计成功!'}); ElMessage({ type: 'success', message: '作业设计成功!'});
// //
classWorkForm.worktype = "常规作业"; classWorkForm.worktype = "常规作业";
@ -543,7 +543,8 @@ const handleClassWorkFormQuizRemove = (index) =>{
classWorkForm.chooseWorkLists = []; // list classWorkForm.chooseWorkLists = []; // list
classWorkForm.whiteboardObj = ''; // ? // classWorkForm.whiteboardObj = ''; // ? //
classWorkForm.fileHomeworkList = []; // list classWorkForm.fileHomeworkList = []; // list
classWorkForm.id = res
emits('getData',classWorkForm)
fileLoading.value = false fileLoading.value = false
}) })
} finally { } finally {
@ -574,7 +575,7 @@ const handleClassWorkFormQuizRemove = (index) =>{
console.log(cform,'提交的数据'); console.log(cform,'提交的数据');
if(cform.entpcourseworklist == '') return ElMessage({ type: 'warning', message: '请先添加作业资源!'}); if(cform.entpcourseworklist == '') return ElMessage({ type: 'warning', message: '请先添加作业资源!'});
addClassworkReturnId(cform).then(workres => { addClassworkReturnId(cform).then(res => {
ElMessage({ type: 'success', message: '作业设计成功!'}); ElMessage({ type: 'success', message: '作业设计成功!'});
// //
classWorkForm.worktype = "习题训练"; classWorkForm.worktype = "习题训练";
@ -585,6 +586,8 @@ const handleClassWorkFormQuizRemove = (index) =>{
// //
classWorkForm.chooseWorkLists = []; classWorkForm.chooseWorkLists = [];
classWorkForm.whiteboardObj = ''; // ? // classWorkForm.whiteboardObj = ''; // ? //
classWorkForm.id = res
emits('getData',classWorkForm)
// refresh the list // refresh the list
// //
// this.getClassWorkAllList(); // this.getClassWorkAllList();
@ -604,6 +607,7 @@ const handleClassWorkFormQuizRemove = (index) =>{
// // // //
// router.push({ path: '/classTaskAssign' }); // router.push({ path: '/classTaskAssign' });
// } // }
} }
}); });
}; };