add:添加活动页面;

This commit is contained in:
小杨 2024-12-05 14:47:23 +08:00
parent 8d03c927b9
commit 399c4b5461
4 changed files with 67 additions and 33 deletions

View File

@ -142,6 +142,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

@ -32,21 +32,24 @@
<!-- 作业列表 --> <!-- 作业列表 -->
<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>
</div> </div>
</template> </template>
{{workList.length}}
</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 +58,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">
@ -74,7 +77,7 @@
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref, reactive, onMounted, onBeforeMount, defineExpose } from 'vue' import { ref, reactive, onMounted, onBeforeMount, defineExpose,nextTick } 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'
@ -84,6 +87,7 @@ import { ElMessageBox } 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'
import { updateSlide } from '@/AixPPTist/src/api/index'
const currentCourse = reactive({ const currentCourse = reactive({
textbookId:0, textbookId:0,
levelFirstId:0, levelFirstId:0,
@ -121,51 +125,58 @@ const type = ref([
]) ])
// //
const workList = ref([]) const workList = ref([])
const selectable = (row,index) => { //
console.log(row,index,'row,index'); const selectedWorkList = ref([])
return true // ppt
} const currentPPT = ref({})
const selectable=(row, index)=>{
return row.status == '10';
};
const clickPPTList = (item) => { const clickPPTList = (item) => {
console.log(item,'点击了') console.log(item,'点击了')
console.log(item.id,'item');
return
workList.value = [] workList.value = []
let datacontent = item.datacontent; let datacontent = item.datacontent;
let pptJson = ""; let pptJson = "";
if(typeof datacontent === 'string') pptJson = JSON.parse(datacontent) if(typeof datacontent === 'string') pptJson = JSON.parse(datacontent)
if(pptJson&&pptJson[0]&&pptJson[0].classworkList) { if(pptJson&&pptJson.activityContent) {
homeworklist({ids:pptJson[0].classworkList, pageSize: 100}).then( async res => { homeworklist({ids:pptJson.activityContent, pageSize: 100}).then( async res => {
await formatClassWorkFile(res.rows) // await formatClassWorkFile(res.rows)
await nextTick();
workList.value = [...res.rows]
console.log(workList.value,'workList.value');
}) })
} }
} }
const formatClassWorkFile = async (postData) => { const formatClassWorkFile = async (postData) => {
return new Promise(async (resolve, reject)=>{ return new Promise(async (resolve, reject) => {
for (let i = 0; i < postData.length; i++) { for (let i = 0; i < postData.length; i++) {
let item = postData[i]; let item = postData[i];
console.log("当前处理的元素:", item); //
switch (item.worktype) { switch (item.worktype) {
case '框架梳理': { case '框架梳理': {
} }
break; break;
case '习题训练': { case '习题训练': {
item.entpcourseworklistarray = item.entpcourseworklist?JSON.parse('['+item.entpcourseworklist+']'):[]; let workIds = item.quizlist.map(items => items.id).join(',');
let workIds = item.entpcourseworklistarray.map(items=>items.id).join(',') let ress = await listEntpcoursework({ ids: workIds });
let ress = await listEntpcoursework({ids:workIds}) processList(ress.rows);
processList(ress.rows)
item.workShowList = 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);
} }
} }
workList.value.push(item) // console.log(workList.value, 'workList.value');
} }
resolve() await nextTick();
}) resolve();
});
} }
// //
const handleRemoveDemoActivityClassWork = (item) => { const handleRemoveDemoActivityClassWork = (item) => {
@ -183,12 +194,15 @@ const getTagType = (worktype) => {
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'));
console.log(res,'res');
taskList.value = res; taskList.value = res;
tasklist_loading.value = false; tasklist_loading.value = false;
} }
// //
const handleSelectionChange = (val) => { const handleSelectionChange = (val) => {
console.log(val,'多选') console.log(val,'多选')
selectedWorkList.value = [...val]
} }
// //
const showDialog = (item) => { const showDialog = (item) => {
@ -200,8 +214,15 @@ const openList = () => {
initHomeWork() initHomeWork()
} }
// //
const save = () => { const save = async () => {
console.log('添加了') console.log('添加了')
if(!currentPPT.classWorkList){
currentPPT.classWorkList = [];
}
const arr = selectedWorkList.value.map(item=>item.id)
const classworkList = arr.join(',')
// await formatClassWorkFile(selectedWorkList.value)
updateSlide({activityContent:classworkList})
activeVisible.value = false activeVisible.value = false
} }
onMounted(() => { onMounted(() => {
@ -219,6 +240,11 @@ onMounted(() => {
dataList.value = [...res.rows] dataList.value = [...res.rows]
}) })
}) })
//
const getData = async (data) => {
console.log(data,'data')
await formatClassWorkFile([data])
}
defineExpose({ defineExpose({
clickPPTList clickPPTList
}) })

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,11 @@ 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) {
// if(!isShow.value){
//
// const { chapterId } = await useGetHomework(courseObj.node) // const { chapterId } = await useGetHomework(courseObj.node)
// this.entpcourseid = chapterId // this.entpcourseid = chapterId
debugger
const cform = { const cform = {
id: 0, id: 0,
workdate: classWorkForm.workdate, // //web workdate: classWorkForm.workdate, // //web
@ -604,6 +606,10 @@ const handleClassWorkFormQuizRemove = (index) =>{
// // // //
// router.push({ path: '/classTaskAssign' }); // router.push({ path: '/classTaskAssign' });
// } // }
}else{
console.log(11111);
emits('getData',classWorkForm)
}
} }
}); });
}; };

View File

@ -52,7 +52,7 @@ import { useRouter } from 'vue-router'
import { Plus, Refresh, Upload, Files, UploadFilled } from '@element-plus/icons-vue' import { Plus, Refresh, Upload, Files, UploadFilled } from '@element-plus/icons-vue'
import useUserStore from '@/store/modules/user' // import useUserStore from '@/store/modules/user' //
import msgUtils from '@/plugins/modal' // import msgUtils from '@/plugins/modal' //
import { createWindow, sessionStore } from '@/utils/tool' // import { createWindow } from '@/utils/tool' //
import * as API_smarttalk from '@/api/file' // api import * as API_smarttalk from '@/api/file' // api
import * as API_entpcourse from '@/api/education/entpcourse' // api import * as API_entpcourse from '@/api/education/entpcourse' // api
import * as API_entpcoursefile from '@/api/education/entpcoursefile' // api import * as API_entpcoursefile from '@/api/education/entpcoursefile' // api