diff --git a/src/renderer/src/api/classTask/index.js b/src/renderer/src/api/classTask/index.js index a01867e..8a95531 100644 --- a/src/renderer/src/api/classTask/index.js +++ b/src/renderer/src/api/classTask/index.js @@ -89,6 +89,13 @@ export function updateClassworkdata(data) { data: data }) } +export function updateClassWorkDataAutoFinish(data) { + return request({ + url: '/education/classworkdata/updAutoFinish', + method: 'put', + data: data + }) +} // 修改classwork export function updateClasswork(data) { @@ -118,90 +125,90 @@ export function addClassworkeval(data) { // 查询evaluationclue列表 export function listEvaluationclue(query) { return request({ - url: '/education/evaluationclue/list', - method: 'get', - params: query + url: '/education/evaluationclue/list', + method: 'get', + params: query }) } // 查询evaluationclue详细 export function getEvaluationclue(id) { return request({ - url: '/education/evaluationclue/' + id, - method: 'get' + url: '/education/evaluationclue/' + id, + method: 'get' }) } // 新增evaluationclue export function addEvaluationclueReturnId(data) { return request({ - url: '/education/evaluationclue/addReturnId', - method: 'post', - data: data + url: '/education/evaluationclue/addReturnId', + method: 'post', + data: data }) } // 新增evaluationclue export function addEvaluationclue(data) { return request({ - url: '/education/evaluationclue', - method: 'post', - data: data + url: '/education/evaluationclue', + method: 'post', + data: data }) } // 修改evaluationclue export function updateEvaluationclue(data) { return request({ - url: '/education/evaluationclue', - method: 'put', - data: data + url: '/education/evaluationclue', + method: 'put', + data: data }) } // 删除evaluationclue export function delEvaluationclue(id) { return request({ - url: '/education/evaluationclue/' + id, - method: 'delete' + url: '/education/evaluationclue/' + id, + method: 'delete' }) } // 新增evaluationclue,保存base64图片 export function saveBase64File(data) { return request({ - url: '/education/evaluationclue/saveBase64File', - method: 'post', - data: data + url: '/education/evaluationclue/saveBase64File', + method: 'post', + data: data }) } // 新增evaluationclue,上传 export function saveEvaluationClueUploadFile(data) { return request({ - url: '/education/evaluationclue/saveUploadFile', - method: 'post', - data: data + url: '/education/evaluationclue/saveUploadFile', + method: 'post', + data: data }) } // 读取文件内容 export function readFile(data) { return fetch(import.meta.env.VITE_APP_RES_FILE_PATH + data.cluelink, { - method: "get", - headers: { - 'Content-Type': 'text/plain', // 请求头设置为纯文本 - 'Accept': 'text/plain' // 接受头设置为纯文本 - }, + method: "get", + headers: { + 'Content-Type': 'text/plain', // 请求头设置为纯文本 + 'Accept': 'text/plain' // 接受头设置为纯文本 + }, }) - .then(response => response.text()) - .then(text => { - return Promise.resolve(text); - }) - .catch(error => { - console.error('读取文件出错:', error); - return Promise.reject(); - }); + .then(response => response.text()) + .then(text => { + return Promise.resolve(text); + }) + .catch(error => { + console.error('读取文件出错:', error); + return Promise.reject(); + }); /*return request({ url: '/education/evaluationclue/readFile', method: 'post', diff --git a/src/renderer/src/utils/date.js b/src/renderer/src/utils/date.js index d967f24..b66f892 100644 --- a/src/renderer/src/utils/date.js +++ b/src/renderer/src/utils/date.js @@ -167,3 +167,19 @@ export function getTomorrow() { return tomorrow; } + +/** + * date() z转为日期格式 + * @param {*} format + * @returns + */ +export const getDateFormatDate = (newDate)=> { + const now = newDate; // new Date(); + const year = now.getFullYear(); + const month = (now.getMonth() + 1).toString().padStart(2, '0'); + const day = now.getDate().toString().padStart(2, '0'); + // const hours = now.getHours().toString().padStart(2, '0'); + // const minutes = now.getMinutes().toString().padStart(2, '0'); + + return `${year}-${month}-${day}`; +} diff --git a/src/renderer/src/views/classTask/classTask.vue b/src/renderer/src/views/classTask/classTask.vue index e034d45..736450b 100644 --- a/src/renderer/src/views/classTask/classTask.vue +++ b/src/renderer/src/views/classTask/classTask.vue @@ -19,6 +19,16 @@ /> +
+ +
@@ -63,7 +73,7 @@ import { listByDeadDate, listClassworkdata } from '@/api/classTask' import TaskItem from '@/views/classTask/container/classTask/task-item.vue' // import ItemDialog from '@/views/classTask/container/item-dialog.vue' import { useToolState } from '@/store/modules/tool' -import { getCurrentTime } from '@/utils/date' +import { getCurrentTime, getDateFormatDate } from '@/utils/date' import useUserStore from '@/store/modules/user' import useClassTaskStore from "@/store/modules/classTask"; import {createWindow} from '@/utils/tool' @@ -81,6 +91,16 @@ const tabActive = ref('待批改') const dataList = ref([]) const EndDate = ref(getCurrentTime('YYYY-MM-DD')) +const startEndDate = ref([ + new Date(2024, 9, 1, 0, 0, 0), + new Date(2024, 11, 1, 23, 59, 59), +]) +const defaultTime = ref<[Date, Date]>([ + new Date(2024, 9, 1, 0, 0, 0), + new Date(2024, 11, 1, 23, 59, 59), +]) +console.log(new Date(2000, 1, 1, 0, 0, 0),'-------------------' ) + // 所有班级作业列表 const classWorkList = ref([]) const total = ref(0) @@ -110,6 +130,14 @@ const changeEndDate = (val) => { console.log('截止日期改变', val) getData() // 加载数据 } +const changeStartEndDate = (val) => { + console.log('启止日期改变', val) + console.log('startEndDate', startEndDate.value) + console.log('startEndDate-0', getDateFormatDate(startEndDate.value[0])) + console.log('startEndDate-1', getDateFormatDate(startEndDate.value[1])) + + getData() // 加载数据 +} // 获取数据 const getData = async () => { @@ -145,8 +173,9 @@ const getClassWorkList = async () => { edustage: userStore.edustage, // 学段 edusubject: userStore.edusubject,//学科 // deaddate: tabActive.value === '待批改'? getTomorrow() : EndDate.value,// 待批改:明天,已批改:选择的日期 弃用 - deaddate: EndDate.value,// 待批改:明天,已批改:选择的日期 - status: '1', // 作业状态:1-已发布 + startdate: tabActive.value === '待批改'? '' : getDateFormatDate(startEndDate.value[0]), + deaddate: tabActive.value === '待批改'? '' : getDateFormatDate(startEndDate.value[1]),// 待批改:明天,已批改:选择的日期 + status: tabActive.value === '待批改'? '1' : '2', // 作业状态:1-已发布 orderby: 'deaddate DESC', pageSize: 100, }) @@ -156,15 +185,15 @@ const getClassWorkList = async () => { * 1、待批改、以前是以明天判断。现改为传当天的日期,并根据当前日期的时分与截止日期进行判断, * 2、已批改、以前默认是以明天判断。现依然以明天为判断,并根据当前日期时分大于截止日期时分判断。 */ - let list = []; - if(tabActive.value === '待批改'){ - // 待批改 当前日期时间 小于 截止 日期时间 - list = response.rows&&response.rows.filter(item => item.deaddate && getCurrentTime('YYYY-MM-DD HH:mm') < item.deaddate); // 待批改 - }else{ - list = response.rows&&response.rows.filter(item => item.deaddate && getCurrentTime('YYYY-MM-DD HH:mm') > item.deaddate); // 已批改 - } - + // let list = []; + // if(tabActive.value === '待批改'){ + // // 待批改 当前日期时间 小于 截止 日期时间 + // list = response.rows&&response.rows.filter(item => item.deaddate && getCurrentTime('YYYY-MM-DD HH:mm') < item.deaddate); // 待批改 + // }else{ + // list = response.rows&&response.rows.filter(item => item.deaddate && getCurrentTime('YYYY-MM-DD HH:mm') > item.deaddate); // 已批改 + // } + let list = response.rows || []; for (var i = 0; i < list.length; i++) { // 初始化部分新增字段值 list[i].workdatalist = [] @@ -226,7 +255,9 @@ const getStudentClassWorkData = async() => { // edusubject: userStore.edusubject,//学科 // deaddate: tabActive.value === '待批改'? getTomorrow() : EndDate.value,// 待批改:明天,已批改:选择的日期 // deaddate: EndDate.value,// 待批改:明天,已批改:选择的日期 - // //status: '1', // 作业状态:1-已发布 + // startdate: tabActive.value === '待批改'? '' : getDateFormatDate(startEndDate.value[0]), + // deaddate:tabActive.value === '待批改'? '' : getDateFormatDate(startEndDate.value[1]), + // //status: tabActive.value === '待批改'? '1' : '2', // 作业状态:1-已发布 // orderby: "deaddate DESC",// // pageSize: 1000, // }) @@ -426,8 +457,10 @@ const getStudentVisible = async () => { edustage: userStore.edustage,// 学段 edusubject: userStore.edusubject,//学科 // deaddate: tabActive.value === '待批改'? getTomorrow() : EndDate.value,// 待批改:明天,已批改:选择的日期 - deaddate: EndDate.value,// 待批改:明天,已批改:选择的日期 - status: '1', // 作业状态:1-已发布 + // deaddate: EndDate.value,// 待批改:明天,已批改:选择的日期 + startdate: tabActive.value === '待批改'? '' : getDateFormatDate(startEndDate.value[0]), + deaddate: tabActive.value === '待批改'? '' : getDateFormatDate(startEndDate.value[1]), + status: tabActive.value === '待批改'? '1' : '2', // 作业状态:1-已发布 // orderby: 'concat(deaddate,uniquekey) DESC', orderby: 'deaddate DESC', pageSize: 100 diff --git a/src/renderer/src/views/classTask/container/classTask/item-dialog-score.vue b/src/renderer/src/views/classTask/container/classTask/item-dialog-score.vue index e00d892..66b2890 100644 --- a/src/renderer/src/views/classTask/container/classTask/item-dialog-score.vue +++ b/src/renderer/src/views/classTask/container/classTask/item-dialog-score.vue @@ -427,7 +427,7 @@ import useUserStore from '@/store/modules/user' import { ref, reactive } from 'vue' // import { Plus } from '@element-plus/icons-vue' import { ElMessageBox, ElMessage } from 'element-plus' -import { updateClassworkeval, updateClassworkdata, getClassworkdata, updateClassworkevalList } from '@/api/classTask' +import { updateClassworkeval,updateClasswork, updateClassWorkDataAutoFinish, getClassworkdata, updateClassworkevalList } from '@/api/classTask' import { getTimeDate } from '@/utils/date' import ReFilePreview from '@/components/refile-preview/index.vue' import { quizStrToList } from '@/utils/comm'; @@ -871,6 +871,13 @@ const onSubmit = () => { }) return } + /** 1、 更新当前作业是否已经批阅完成 */ + // TODO updateClasswork + + + + + /** 2、 更新每个学生的批阅 */ var formd = { id: dialogProps.value.studentObj.id, // this.activeClassWork.id; @@ -878,7 +885,7 @@ const onSubmit = () => { updatedate: getTimeDate(),// = year+'-'+month+'-'+day+' '+hh+':'+mm; }; // 更新作业批改状态 - updateClassworkdata(formd).then(res => { + updateClassWorkDataAutoFinish(formd).then(res => { }) // 更新题目批改 diff --git a/src/renderer/src/views/classTask/container/classTask/task-item.vue b/src/renderer/src/views/classTask/container/classTask/task-item.vue index f5625f6..484a703 100644 --- a/src/renderer/src/views/classTask/container/classTask/task-item.vue +++ b/src/renderer/src/views/classTask/container/classTask/task-item.vue @@ -35,7 +35,7 @@
- +
{{ item.workdataresultsum }} 练习次数