diff --git a/app-dm/src/TeacherPages/MarkingPages/Marking.jsx b/app-dm/src/TeacherPages/MarkingPages/Marking.jsx index 599b298..a62ca65 100644 --- a/app-dm/src/TeacherPages/MarkingPages/Marking.jsx +++ b/app-dm/src/TeacherPages/MarkingPages/Marking.jsx @@ -6,7 +6,12 @@ import Test from '../../pages/Home/img/test.jpg' // 批改 function Marking(){ - + const teacher_ID=localStorage.getItem('islogin') + if(teacher_ID==null){ + alert('登录过期,请重新登录') + window.location.href='http://36.138.114.105:30294/' + } + return(
- {Object.keys(classData).map((key)=>( - - ))} - -
-
- {/* 班级画像 */} - - -
-
- { defaultclass && - - {Object.keys(defaultclass).map((key)=>( - { - settestID(key) - setIsDetailedBoxVisible(true) - }}> - - - - - - - )).reverse()} - -
{key}{defaultclass[key][0][0].slice(0, 10)}{defaultclass[key][0][1].slice(0, 10)}{defaultclass[key][2]}人{defaultclass[key][1]}
} -
-
- -
- - - - ); -} - -export default TeacherPage; diff --git a/app-dm/src/TeacherPages/TestManage/SendTest.jsx b/app-dm/src/TeacherPages/TestManage/SendTest.jsx index 955d440..e69de29 100644 --- a/app-dm/src/TeacherPages/TestManage/SendTest.jsx +++ b/app-dm/src/TeacherPages/TestManage/SendTest.jsx @@ -1,279 +0,0 @@ -import { useParams } from 'react-router-dom'; -import { Link } from 'react-router-dom'; -import './SendTest.css' -import React, { useEffect, useState } from 'react'; -import axios from 'axios'; - -function SendTest(){ - // const { key } = useParams(); - const teacher_ID=localStorage.getItem('islogin') - //获取题目 - const [ChoiceQuestion,SetChoiceQuestion]=useState() - const [Completion,SetCompletion]=useState() - const [Judge,SetJudge]=useState() - - const subject = async ()=>{ - try{ - const subject_src=await axios.post('/api/teacher/return_question',{ - teacher_ID}) - SetChoiceQuestion(subject_src.data['选择']) - SetCompletion(subject_src.data['填空']) - SetJudge(subject_src.data['判断']) - }catch(error){ - console.log(error); - } - } - useEffect(()=>{ - subject() - },[]) - //当选择题目时,自动将题目ID填入题目集当中 - const [ChoiceQuestionSet,SetChoiceQuestionSet]=useState([]) - const [CompletionQuestionSet,SetCompletionQuestionSet]=useState([]) - const [JudgeQuestionSet,SetJudgeQuestionSet]=useState([]) - - - - //下一步的操作 - const body=document.getElementById('body') - const background=document.getElementById('background') - const send_box=document.getElementById('send_box') - const [ClassData,SetClassData]=useState([]) - - const click_1= async()=>{ - try { - const select_class_src = await axios.post('/api/teacher/select_class', { - teacher_ID - }); - background.style.display='block' - body.style.display='none' - send_box.display='none' - SetClassData(select_class_src.data); - } catch (error) { - console.log(error); - } - - } - //下下一步操作 - const click_2=()=>{ - background.style.display='none' - body.style.display='none' - send_box.style.display='block' - } - - //上一步的操作 - const last_1=()=>{ - background.style.display='none' - body.style.display='block' - send_box.display='none' - } - //上上一步操作 - const last_2=()=>{ - background.style.display='block' - body.style.display='none' - send_box.style.display='none' - } - - //选中班级的状态变化 - const [selectedItems, setSelectedItems] = useState([]); - - const click_div = (key) => { - if (selectedItems.includes(key)) { - setSelectedItems(prevItems => prevItems.filter(item => item !== key)); - } else { - setSelectedItems(prevItems => [...prevItems, key]); - } - }; - const getClassNames = (key) => { - if (selectedItems.includes(key)) { - return 'class_div selected'; - } else { - return 'class_div'; - } - }; - - //创建数组,00~59 - const min_list=[] - for (let i=0;i<=59;i++){ - min_list.push(i) - } - //0~12 - const hour_list=[] - for (let i=0;i<=12;i++){ - hour_list.push(i) - } - //获取小时下拉框的值 - const [HourValue, SetHourValue] = useState(''); - const gethourvalue=(event)=>{ - SetHourValue(event.target.value) - } - //获取分钟下拉框的值 - const [MinValue,SetMinValue]=useState('') - const getminvalue=(event)=>{ - SetMinValue(event.target.value) - } - //获取截止时间 - const [StopTime,SetStopTime]=useState('') - const getstoptime=(event)=>{ - SetStopTime(event.target.value) - } - // 发布按钮 - const release= async()=>{ - try{ - const release_src=await axios.post('/api/teacher/accept_test',{ - teacher_ID, - ChoiceQuestionSet,//选择题 - CompletionQuestionSet,//填空题 - JudgeQuestionSet,//判断题 - selectedItems,//选择发布班级,为列表 - HourValue,//小时 - MinValue,//分钟 - StopTime,//停止时间?天 - } - ) - alert('发布成功') - window.location.href='http://36.138.114.105:30294/teacher/managetest' - }catch{ - alert('发布失败') - } - - } - - return( -
-
-

请选择发布班级

- { ClassData &&} - - -
-
-

请填写考试时间

- 小时 - - 分钟 -

请填写截至时间

- 天后 - - -
-
-
-
- 选择题
- 填空
- 判断
-
- -
-
- 选择题 - {ChoiceQuestion && - - {Object.keys(ChoiceQuestion).map((key)=>( - - - - ))} - -
-

问题:{ChoiceQuestion[key][1]}

-

- A:{ChoiceQuestion[key][2]} - B:{ChoiceQuestion[key][3]} - C:{ChoiceQuestion[key][4]} - D:{ChoiceQuestion[key][5]} -

- {/* 获取题目ID */} - { - if (event.target.checked) { - //在选择题目集中添加选择题的ID - SetChoiceQuestionSet(items=>([ - ...items, - ChoiceQuestion[key][7] - ])) - }else{ - SetChoiceQuestionSet((items)=> - items.filter((item)=>item!==ChoiceQuestion[key][7]) - ) - } - }} />是否选择 -
} -
-
- 填空题: - { Completion && - - {Object.keys(Completion).map((key)=>( - - - - ))} - -
-

问题:{Completion[key][1]}

- { - if(event.target.checked){ - SetCompletionQuestionSet(items=>([ - ...items, - Completion[key][3] - ])) - }else{ - SetCompletionQuestionSet((items)=> - items.filter((item)=>item!==Completion[key][3])) - } - }}/>是否选择 -
} -
-
- 判断题: - { Judge && - - {Object.keys(Judge).map((key)=>( - - - - ))} - - -
-

问题:{Judge[key][1]}

- { - if(event.target.checked){ - SetJudgeQuestionSet(items=>([ - ...items, - Judge[key][3] - ])) - }else{ - SetJudgeQuestionSet((items)=> - items.filter((item)=>item!==Judge[key][3])) - } - }}/>是否选择 -
} -
-
-
-
- -
-
-
- ) -} - -export default SendTest \ No newline at end of file diff --git a/app-dm/src/TeacherPages/Trainmanage/SendTrain.jsx b/app-dm/src/TeacherPages/Trainmanage/SendTrain.jsx index 99a443f..e69de29 100644 --- a/app-dm/src/TeacherPages/Trainmanage/SendTrain.jsx +++ b/app-dm/src/TeacherPages/Trainmanage/SendTrain.jsx @@ -1,311 +0,0 @@ -import React,{ useState ,useEffect} from 'react'; -import { Link } from 'react-router-dom'; -import './SendTrain.css' -import axios from 'axios'; - -function SendTrain(){ - const teacher_ID=localStorage.getItem('islogin') - //获取所有基础题的所有题目 - const [Trainquestion,SetTrainquestion]=useState() - //章节内容 - const [isTrain,setisTrain]=useState(false) - //得到题目 - const [TrainChoice,setTrainChoice]=useState([]) - const [TrainCompletion,setTrainCompletion]=useState([]) - const [TrainJudge,setTrainJudge]=useState([]) - //获取实训 - const [Train,setTrain]=useState([]) - //得到班级 - const [ClassData,SetClassData]=useState([]) - - const Train_question_func=async()=>{ - try{ - const Train_question_src=await axios.post('/api/teacher/fetch_train_question') - SetTrainquestion(Train_question_src.data) - }catch{ - alert('Train_question_func出错') - } - } - - const SeleactClass= async()=>{ - try { - const select_class_src = await axios.post('/api/teacher/select_class', { - teacher_ID - }); - SetClassData(select_class_src.data['Class']); - } catch (error) { - console.log(error); - } - - } - - useEffect(()=>{ - Train_question_func() - SeleactClass() - },[]) - - //选中班级的状态变化 - const [selectedItems, setSelectedItems] = useState([]); - - const click_div = (key) => { - if (selectedItems.includes(key)) { - setSelectedItems(prevItems => prevItems.filter(item => item !== key)); - } else { - setSelectedItems(prevItems => [...prevItems, key]); - } - }; - const getClassNames = (key) => { - if (selectedItems.includes(key)) { - return 'Train_class_div Trainselected'; - } else { - return 'Train_class_div'; - } - }; - - - //发送题目 - const SendTrainTest=async ()=>{ - try{ - const SendTrainSrc=await axios.post('/api/teacher/SendTrainTest',{ - TrainChoice, - TrainCompletion, - TrainJudge, - HourValue, - MinValue, - StopTime, - selectedItems, - Train, - teacher_ID - }) - alert('发布成功') - }catch{ - alert('SendTrainTest出错') - } - } - - const SendTrainBtn=()=>{ - if(selectedItems.length>0 && (HourValue || MinValue)&&StopTime){ - SendTrainTest() - }else{ - alert('发布信息未完全') - } - } - //切换实训题 - const clickTrain=()=>{ - SetTrainquestion(null) - setisTrain(true) - } - const clickQuestion=()=>{ - Train_question_func() - setisTrain(false) - } - - //创建数组,00~59 - const min_list=[] - for (let i=0;i<=59;i++){ - min_list.push(i) - } - //0~12 - const hour_list=[] - for (let i=0;i<=12;i++){ - hour_list.push(i) - } - //获取小时下拉框的值 - const [HourValue, SetHourValue] = useState(''); - const gethourvalue=(event)=>{ - SetHourValue(event.target.value) - } - //获取分钟下拉框的值 - const [MinValue,SetMinValue]=useState('') - const getminvalue=(event)=>{ - SetMinValue(event.target.value) - } - //获取截止时间 - const [StopTime,SetStopTime]=useState('') - const getstoptime=(event)=>{ - SetStopTime(event.target.value) - } - - return( -
-
- -
-
-

题目选择

- {/* 实训题 */} - {isTrain&&
-
-
- 设计达梦数据库课程实验实训,按照提供的达梦数据库安装文档,在系统中实现达梦数据库安装、连接及使用 -
-
- - { - if(event.target.checked){ - setTrain(items=>([ - ...items, - event.target.value - ])) - }else{ - setTrain((items)=> - items.filter((item)=>item!==event.target.value)) - } - }}/>是否选择 - -
-
-
-
- 设计和实现一个Web前端开发和DM8数据库后端结合的项目实训。 -
-
- - { - if(event.target.checked){ - setTrain(items=>([ - ...items, - event.target.value - ])) - }else{ - setTrain((items)=> - items.filter((item)=>item!==event.target.value)) - } - }}/>是否选择 - -
-
-
} - - {/* 基础题 */} - {Trainquestion && - 选择题 - - {Object.keys(Trainquestion['choice']).map((key)=>( - - {/* 章节切换⬇ */} - - - - -
-
A:{Trainquestion['choice'][key][2]} - B:{Trainquestion['choice'][key][3]} - C:{Trainquestion['choice'][key][4]} - D:{Trainquestion['choice'][key][5]} - - - { - if (event.target.checked) { - //在选择题目集中添加选择题的ID - setTrainChoice(items=>([ - ...items, - Trainquestion['choice'][key][7] - ])) - }else{ - setTrainChoice((items)=> - items.filter((item)=>item!==Trainquestion['choice'][key][7]) - ) - } - }} />是否选择 - - - ))} - 填空题 - {Object.keys(Trainquestion['completion']).map((key)=>( - - - { - if (event.target.checked) { - //在选择题目集中添加选择题的ID - setTrainCompletion(items=>([ - ...items, - Trainquestion['completion'][key][3] - ])) - }else{ - setTrainCompletion((items)=> - items.filter((item)=>item!==Trainquestion['completion'][key][3]) - ) - } - }} />是否选择 - - - ))} - 判断题 - {Object.keys(Trainquestion['judge']).map((key)=>( - - - { - if (event.target.checked) { - setTrainJudge(items=>([ - ...items, - Trainquestion['judge'][key][3] - ])) - }else{ - setTrainJudge((items)=> - items.filter((item)=>item!==Trainquestion['judge'][key][3]) - ) - } - }} />是否选择 - - - ))} - -
-
{Trainquestion['choice'][key][8]}
-
问.{Trainquestion['choice'][key][1]}
- {Trainquestion['completion'][key][4]} - - 问.{Trainquestion['completion'][key][1]} -
- {Trainquestion['judge'][key][4]} - 问:{Trainquestion['judge'][key][1]}
} - -
- {/* 右边的内容 */} -
-
-
-

请选择发布班级

- { ClassData &&
    - {Object.keys(ClassData).map((key)=>( -
  • -
    click_div(key)}> - {key} -
    -
  • - ))} -
} -
-
-

请填写考试时间

- 小时 - 分钟 -

请填写截至时间

- 天后 -
-
-
-
- ) -} - -export default SendTrain \ No newline at end of file diff --git a/app-dm/src/TeacherPages/classlistpages/classId.jsx b/app-dm/src/TeacherPages/classlistpages/classId.jsx index 0e43f84..33f7a0d 100644 --- a/app-dm/src/TeacherPages/classlistpages/classId.jsx +++ b/app-dm/src/TeacherPages/classlistpages/classId.jsx @@ -8,6 +8,14 @@ import './classid.css' function TeacherPage() { + const click=()=>{ + console.log(TestScore); + } + const teacher_ID=localStorage.getItem('islogin') + if(teacher_ID==null){ + alert('登录过期,请重新登录') + window.location.href='http://36.138.114.105:30294/' + } const { key } = useParams(); const [isclick,setisclick]=useState(false) //学生表格 @@ -26,12 +34,6 @@ function TeacherPage() { class_succeed(); },[]) - - //学生画像 - const student_fig_btn=()=>{ - - } - //柱形图 const [studentScores, setStudentScores] = useState([]); @@ -45,6 +47,30 @@ function TeacherPage() { }); }, [isclick]); + function formatDate(dateString) { + // 将日期字符串转换为 Date 对象 + const date = new Date(dateString); + // 获取年份、月份和日期 + const year = date.getFullYear(); + const monthIndex = date.getMonth(); + const day = date.getDate(); + + // 构建格式化后的日期字符串 + const formattedDate = `${year}-${(monthIndex + 1).toString().padStart(2, '0')}-${day.toString().padStart(2, '0')}`; + return formattedDate; + } + const[TestScore,setTestScore]=useState() + const Find_details=async (ID)=>{ + try{ + const Find_details_Src=await axios.post('api/Find_details',{ + ID + }) + setTestScore(Find_details_Src.data) + }catch{ + alert('Find_details出错') + } + } + return(
@@ -66,13 +92,13 @@ function TeacherPage() { {Object.keys(classdata).map((item)=>( - 班级 + {classdata[item][2]} {classdata[item][0]} {classdata[item][1]} {classdata[item][3]} {classdata[item][5]} - 出生日期 - + {formatDate(classdata[item][4])} + ))} @@ -83,6 +109,8 @@ function TeacherPage() {

成绩

+
名字
+