This commit is contained in:
30404 2024-06-26 11:24:36 +08:00
commit 50d36e240a
18 changed files with 1317 additions and 1366 deletions

View File

@ -26,7 +26,7 @@ function Marking(){
{class:'课程2:web前端开发与数据库的结合',time:"关闭时间:2024-4-16 11.46",ImgSrc:Test}, {class:'课程2:web前端开发与数据库的结合',time:"关闭时间:2024-4-16 11.46",ImgSrc:Test},
{class:'课程2:web前端开发与数据库的结合',time:"关闭时间:2024-4-16 11.46",ImgSrc:Test}, {class:'课程2:web前端开发与数据库的结合',time:"关闭时间:2024-4-16 11.46",ImgSrc:Test},
].map((item) => ].map((item) =>
<Link style={{color:'#000',textDecoration:'none'}}> <Link style={{color:'#000',textDecoration:'none'}} to={'studentlink'}>
<li key={item.class}> <li key={item.class}>
<img src={item.ImgSrc} alt="" width='35px' height='35px'/> <img src={item.ImgSrc} alt="" width='35px' height='35px'/>
<p> <p>

View File

@ -0,0 +1,10 @@
.body-right-studentlink{
width: 1420px;
height: 830px;
position: absolute;
top: 72px;
left: 220px;
border-radius: 10px;
float: right;
background-color: #f7f8fa;
}

View File

@ -0,0 +1,28 @@
import './StudentLink.css'
function StudentLink(){
return(
<div className='body-right-studentlink'>
<table>
<thead>
<tr>
<th>学生</th>
<th>链接</th>
<th>分数</th>
</tr>
</thead>
<tbody>
<tr>
<td>数据1</td>
<td>数据2</td>
<td>数据3</td>
</tr>
</tbody>
</table>
</div>
)
}
export default StudentLink

View File

@ -1,74 +0,0 @@
.body-trainmanage{
width: 1420px;
height: 830px;
position: absolute;
top: 72px;
left: 220px;
border-radius: 10px;
float: right;
background-color: #f7f8fa;
}
.body-trainmanage p{
font-size: 20px;
position: absolute;
left: 50px;
}
.line{
width: 250px;
height: 2px;
position: absolute;
top: 60px;
background-image: linear-gradient(120deg,#ffffff,rgb(223, 223, 223),#fff);
}
.ul1-trainmanage{
width: 650px;
height: 200px;
position: absolute;
top: 50px;
left: 10px;
}
.ul2-trainmanage{
width: 650px;
height: 200px;
position: absolute;
top: 50px;
left: 700px;
}
.train-list-trainmanage li{
width: 650px;
height: 70px;
list-style-type: none;
margin-top: 10px;
border-radius: 10px;
background-color: #ffffff;
box-shadow: 2px 2px 2px #d8d9d9;
cursor: pointer;
}
.train-list-trainmanage span {
font-size: 20px;
}
.train-list-trainmanage p{
font-size: 15px;
margin-left: 460px;
margin-top: -40px;
}
.train-list-trainmanage li::before {
content: "▶";
color: rgb(132, 213, 209);
padding-right: 20px;
line-height: 65px;
padding-left: 15px;
font-size: 20px;
display: inline-block;
}
.sendtestpage{
padding: 20px 30px;
font-size: 20px;
text-decoration: none;
color: #000;
position: absolute;
bottom: 50px;
right: 100px;
background-color: rgb(186, 237, 237);
}

View File

@ -1,44 +0,0 @@
import './trainmanage.css'
import { Link } from 'react-router-dom';
// import React, { useEffect, useState } from 'react';
// import axios from 'axios';
function TrainManage(){
const teacher_ID=localStorage.getItem('islogin')
if(teacher_ID==null){
alert('登录过期,请重新登录')
window.location.href='http://36.138.114.105:30294/'
}
return(
<div className='body-trainmanage'>
<p>已批改试卷</p>
<div className='line'></div>
<div className='train-list-trainmanage'>
<ul className='ul1-trainmanage'>
<li>
<span>111</span>
<p>关闭时间2024-11-5</p>
</li>
<li>
<span>333</span>
<p>关闭时间2024-11-5</p>
</li>
</ul>
<ul className='ul2-trainmanage'>
<li>
<span>222</span>
<p>关闭时间2024-11-5</p>
</li>
<li>
<span>444</span>
<p>关闭时间2024-11-5</p>
</li>
</ul>
<Link to='/teacher/sendtest' className='sendtestpage'>前往发布试卷</Link>
</div>
</div>
)
}
export default TrainManage

View File

@ -1,116 +1,116 @@
/* 页面右边 */ /* 页面右边 */
.body-right-manage{ .body-right-manage{
width: 1420px; width: 1420px;
height: 820px; height: 820px;
position: absolute; position: absolute;
top: 72px; top: 72px;
left: 220px; left: 220px;
border-radius: 10px; border-radius: 10px;
float: right; float: right;
background-color: #f7f8fa; background-color: #f7f8fa;
} }
#view_history{ #view_history{
margin-left: 100px; margin-left: 100px;
width: 1200px; width: 1200px;
height: 350px; height: 350px;
background-color: aqua; background-color: aqua;
margin-top: 100px; margin-top: 100px;
} }
#view_history_nav{ #view_history_nav{
border-bottom: 1px solid black; border-bottom: 1px solid black;
width: 850px; width: 850px;
text-align: center; text-align: center;
} }
.view_history_content{ .view_history_content{
width: 850px; width: 850px;
text-align: center; text-align: center;
} }
#class_portrait{ #class_portrait{
position: absolute; position: absolute;
width: 330px; width: 330px;
height: 300px; height: 300px;
margin-left: 860px; margin-left: 860px;
margin-top: 10px; margin-top: 10px;
background-color: rgb(112, 80, 227); background-color: rgb(112, 80, 227);
} }
#view_history_box{ #view_history_box{
overflow-y: scroll; overflow-y: scroll;
overflow-x: hidden; overflow-x: hidden;
height: 550px; height: 550px;
width: 850px; width: 850px;
background-color: antiquewhite; background-color: antiquewhite;
} }
#class_list{ #class_list{
position: absolute; position: absolute;
margin-left: 975px; margin-left: 975px;
margin-top: -20px; margin-top: -20px;
} }
#class_list select{ #class_list select{
font-size: 20px; font-size: 20px;
border: none; border: none;
} }
#body_bottom{ #body_bottom{
height: 330px; height: 330px;
width: 850px; width: 850px;
border: 1px solid black; border: 1px solid black;
margin-left: 100px; margin-left: 100px;
margin-top: 20px; margin-top: 20px;
} }
#sendtest_btn{ #sendtest_btn{
font-size: 30px; font-size: 30px;
margin-left: 30px; margin-left: 30px;
margin-top: 100px; margin-top: 100px;
} }
#body_bottom_right{ #body_bottom_right{
width: 350px; width: 350px;
height: 220px; height: 220px;
background-color: darkolivegreen; background-color: darkolivegreen;
position: absolute; position: absolute;
margin-left: 850px; margin-left: 850px;
margin-top:-220px; margin-top:-220px;
} }
#view_history_table td{ #view_history_table td{
border-bottom: 1px solid black; border-bottom: 1px solid black;
} }
#view_history_table tr{ #view_history_table tr{
cursor: pointer; cursor: pointer;
} }
#detailed{ #detailed{
margin-left: 390px; margin-left: 390px;
margin-top: 180px; margin-top: 180px;
width: 600px; width: 600px;
height: 400px; height: 400px;
border: 1px solid black; border: 1px solid black;
position: absolute; position: absolute;
background-color: rgb(175, 25, 234); background-color: rgb(175, 25, 234);
z-index: 2; z-index: 2;
} }
#splitter{ #splitter{
width: 590; width: 590;
border-bottom: 1px solid black; border-bottom: 1px solid black;
text-align: center; text-align: center;
} }
#return{ #return{
position: absolute; position: absolute;
margin-left: 230px; margin-left: 230px;
font-size: 20px; font-size: 20px;
margin-top: -10px; margin-top: -10px;
cursor: pointer; cursor: pointer;
} }
#detailed span{ #detailed span{
text-align: center; text-align: center;
} }
#detailed_box_tr{ #detailed_box_tr{
width: 600px; width: 600px;
text-align: center; text-align: center;
} }
#detailed_box{ #detailed_box{
height: 270px; height: 270px;
width: 600px; width: 600px;
overflow-x: hidden; overflow-x: hidden;
overflow-y: scroll; overflow-y: scroll;
margin-top: -10px; margin-top: -10px;
margin-left: -3px; margin-left: -3px;
} }

View File

@ -1,191 +1,187 @@
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import axios from 'axios'; import axios from 'axios';
// import { useParams } from 'react-router-dom'; // import { useParams } from 'react-router-dom';
import './ManageTest.css' import './ManageTest.css'
function TeacherPage() { function TeacherPage() {
const teacher_ID=localStorage.getItem('islogin') const teacher_ID = localStorage.getItem('islogin')
if(teacher_ID==null){ const [classData, setClassData] = useState({});
alert('登录过期,请重新登录') const [classtest,setClassTest]=useState()
window.location.href='http://36.138.114.105:30294/' const [defaultclass,setDefaultClass]=useState()
} const [selectedValue, setSelectedValue] = useState('');
const [classData, setClassData] = useState({}); const [isChecked,setisChecked]=useState(false)
const [classtest,setClassTest]=useState() const [isDetailedBoxVisible, setIsDetailedBoxVisible] = useState(false);
const [defaultclass,setDefaultClass]=useState()
const [selectedValue, setSelectedValue] = useState('');
const [isChecked,setisChecked]=useState(false)
const [isDetailedBoxVisible, setIsDetailedBoxVisible] = useState(false); const select_class = async () => {
try {
const select_class_src = await axios.post('/api/teacher/select_class',{
teacher_ID
const select_class = async () => { });
try { setClassData(select_class_src.data['Class']);
const select_class_src = await axios.post('/api/teacher/select_class',{ setDefaultClass(select_class_src.data['default'])
teacher_ID const list = Object.keys(select_class_src.data['Class'])
}); setSelectedValue(list[0])
setClassData(select_class_src.data['Class']); setisChecked(true)
setDefaultClass(select_class_src.data['default']) } catch (error) {
const list = Object.keys(select_class_src.data['Class']) alert('获取所有班级出错')
setSelectedValue(list[0]) }
setisChecked(true)
} catch (error) { };
alert('获取所有班级出错')
} useEffect(() => {
if(!isChecked){
}; select_class();
}
useEffect(() => { }, []);
if(!isChecked){ //
select_class();
} const handleChange = (event) => {
}, []); setSelectedValue(event.target.value);
// };
useEffect(()=>{
const handleChange = (event) => { const change_class = async () => {
setSelectedValue(event.target.value); try {
}; const change_class_src = await axios.post('/api/teacher/change_class',{
useEffect(()=>{ teacher_ID,
const change_class = async () => { selectedValue,
try { testID
const change_class_src = await axios.post('/api/teacher/change_class',{ });
teacher_ID, setDefaultClass(change_class_src.data['default'])
selectedValue, } catch (error) {
testID alert('获取默认班级出错')
}); }
setDefaultClass(change_class_src.data['default']) }
} catch (error) { if(isChecked){
alert('获取默认班级出错') change_class()
} }
} //
if(isChecked){ },[selectedValue])
change_class()
} const [testID,settestID]=useState('')
//
},[selectedValue]) const click=()=>{
console.log(isDetailedBoxVisible);
const [testID,settestID]=useState('') console.log(detaileddata);
}
const click=()=>{
console.log(isDetailedBoxVisible); //
console.log(detaileddata); const [detaileddata,setdetaileddata]=useState('')
}
const click_detailed= async()=>{
// //
const [detaileddata,setdetaileddata]=useState('') try{
const detaileddata_src=await axios.post('/api/teacher/detaileddata',{
const click_detailed= async()=>{ testID,
// selectedValue,
try{ teacher_ID
const detaileddata_src=await axios.post('/api/teacher/detaileddata',{ })
testID, setdetaileddata(detaileddata_src.data['data'])
selectedValue, }catch(error){
teacher_ID alert('获取小框信息出错')
}) }
setdetaileddata(detaileddata_src.data['data']) }
}catch(error){
alert('获取小框信息出错') useEffect(()=>{
} click_detailed()
}
},[testID])
useEffect(()=>{
click_detailed()
const return_detailed=()=>{
},[testID]) setIsDetailedBoxVisible(false)
}
const return_detailed=()=>{ //退
setIsDetailedBoxVisible(false) const [numbers] = useState([...Array(61).keys()].map(num => num - 30));
} const getRandomNumber = () => {
const randomIndex = Math.floor(Math.random() * numbers.length);
//退 return numbers[randomIndex];
const [numbers] = useState([...Array(61).keys()].map(num => num - 30)); };
const getRandomNumber = () => {
const randomIndex = Math.floor(Math.random() * numbers.length);
return numbers[randomIndex]; return (
}; <div className='body-right-manage'>
{/* 详细信息 */}
{isDetailedBoxVisible && <div id='detailed'>
return ( <p id='splitter'>试卷ID{testID}<span id='return' onClick={return_detailed}>X</span></p>
<div className='body-right-manage'> <p style={{display:'flex'}}>
{/* 详细信息 */} <span style={{ flex: 1}}>详情</span>
{isDetailedBoxVisible && <div id='detailed'> <span style={{ flex: 1}}>分数</span>
<p id='splitter'>试卷ID{testID}<span id='return' onClick={return_detailed}>X</span></p> <span style={{ flex: 1}}>与上次相比</span>
<p style={{display:'flex'}}> <span style={{ flex: 1}}>总评</span>
<span style={{ flex: 1}}>详情</span> </p>
<span style={{ flex: 1}}>分数</span> <div>
<span style={{ flex: 1}}>与上次相比</span> <p>--------------------------------------------------------------------------------------</p>
<span style={{ flex: 1}}>总评</span> {detaileddata&&<table>
</p> <tbody>
<div> <div id='detailed_box'>
<p>--------------------------------------------------------------------------------------</p> {Object.keys(detaileddata).map((key)=>(
{detaileddata&&<table> <tr style={{display:'flex'}} id='detailed_box_tr'>
<tbody> <td style={{ flex: 1 }}>{detaileddata[key][6]}</td>
<div id='detailed_box'> <td style={{ flex: 1 }}>{detaileddata[key][5] ? detaileddata[key][5] : "未完成"}</td>
{Object.keys(detaileddata).map((key)=>( <td style={{ flex: 1 }}>{detaileddata[key][5] ? `${getRandomNumber()}%` : "未完成"}</td>
<tr style={{display:'flex'}} id='detailed_box_tr'> <td style={{ flex: 1 }}>{detaileddata[key][5] && parseInt(detaileddata[key][5]) >= 60 ? "及格" : (detaileddata[key][5] ? "不及格" : "未完成")}</td>
<td style={{ flex: 1 }}>{detaileddata[key][6]}</td> </tr>
<td style={{ flex: 1 }}>{detaileddata[key][5] ? detaileddata[key][5] : "未完成"}</td> ))}
<td style={{ flex: 1 }}>{detaileddata[key][5] ? `${getRandomNumber()}%` : "未完成"}</td> </div>
<td style={{ flex: 1 }}>{detaileddata[key][5] && parseInt(detaileddata[key][5]) >= 60 ? "及格" : (detaileddata[key][5] ? "不及格" : "未完成")}</td> </tbody>
</tr> </table>}
))} </div>
</div> </div>}
</tbody> {/* 总体信息 */}
</table>} <div id='view_history' style={{display:'block'}}>
</div> <table>
</div>} <tbody>
{/* 总体信息 */} <tr id='view_history_nav' style={{ display: 'flex', justifyContent: 'space-between' }}>
<div id='view_history' style={{display:'block'}}> <td style={{ flex: 1 }}>试卷ID</td>
<table> <td style={{ flex: 1 }}>发布时间</td>
<tbody> <td style={{ flex: 1 }}>截止时间</td>
<tr id='view_history_nav' style={{ display: 'flex', justifyContent: 'space-between' }}> <td style={{ flex: 1 }}>提交人数</td>
<td style={{ flex: 1 }}>试卷ID</td> <td style={{ flex: 1 }}>平均分</td>
<td style={{ flex: 1 }}>发布时间</td> </tr>
<td style={{ flex: 1 }}>截止时间</td> </tbody>
<td style={{ flex: 1 }}>提交人数</td> </table>
<td style={{ flex: 1 }}>平均分</td> <div id='class_list'>
</tr> <select name="class_id" onChange={handleChange}>
</tbody> {Object.keys(classData).map((key)=>(
</table> <option key={key} value={key}>{key}</option>
<div id='class_list'> ))}
<select name="class_id" onChange={handleChange}> </select>
{Object.keys(classData).map((key)=>( </div>
<option key={key} value={key}>{key}</option> <div id='class_portrait'>
))} {/* 班级画像 */}
</select>
</div>
<div id='class_portrait'> </div>
{/* 班级画像 */} <div id='view_history_box'>
{ defaultclass &&<table id='view_history_table'>
<tbody>
</div> {Object.keys(defaultclass).map((key)=>(
<div id='view_history_box'> <tr className='view_history_content' style={{ display: 'flex', justifyContent: 'space-between' }} key={key} onClick={()=>{
{ defaultclass &&<table id='view_history_table'> settestID(key)
<tbody> setIsDetailedBoxVisible(true)
{Object.keys(defaultclass).map((key)=>( }}>
<tr className='view_history_content' style={{ display: 'flex', justifyContent: 'space-between' }} key={key} onClick={()=>{ <td style={{ flex: 1 }}>{key}</td>
settestID(key) <td style={{ flex: 1 }}>{defaultclass[key][0][0].slice(0, 10)}</td>
setIsDetailedBoxVisible(true) <td style={{ flex: 1 }}>{defaultclass[key][0][1].slice(0, 10)}</td>
}}> <td style={{ flex: 1 }}>{defaultclass[key][2]}</td>
<td style={{ flex: 1 }}>{key}</td> <td style={{ flex: 1 }}>{defaultclass[key][1]}</td>
<td style={{ flex: 1 }}>{defaultclass[key][0][0].slice(0, 10)}</td> </tr>
<td style={{ flex: 1 }}>{defaultclass[key][0][1].slice(0, 10)}</td> )).reverse()}
<td style={{ flex: 1 }}>{defaultclass[key][2]}</td> </tbody>
<td style={{ flex: 1 }}>{defaultclass[key][1]}</td> </table>}
</tr> </div>
)).reverse()} <div id='body_bottom_right'>
</tbody> <Link to="/teacher/sendtest"><button id='sendtest_btn'>前往发布新的考试</button></Link>
</table>} </div>
</div> </div>
<div id='body_bottom_right'> <button onClick={click}>测试</button>
<Link to="/teacher/sendtest"><button id='sendtest_btn'>前往发布新的考试</button></Link> </div>
</div> );
</div> }
<button onClick={click}>测试</button>
</div> export default TeacherPage;
);
}
export default TeacherPage;

View File

@ -1,89 +1,89 @@
#body_left{ #body_left{
flex: 20%; flex: 20%;
} }
#body_right{ #body_right{
border-left: 1px solid black; border-left: 1px solid black;
height: 100%; height: 100%;
flex:80% flex:80%
} }
.check_box{ .check_box{
margin-left: 800px; margin-left: 800px;
} }
.single{ .single{
margin-left: 100px; margin-left: 100px;
} }
.choice_answer{ .choice_answer{
display: flex; display: flex;
width: 800px; width: 800px;
background-color: aqua; background-color: aqua;
} }
.choice_answer span{ .choice_answer span{
flex: 1; flex: 1;
} }
.line{ .line{
border-bottom: 1px solid black; border-bottom: 1px solid black;
} }
#body_top{ #body_top{
border-bottom: 1px solid black; border-bottom: 1px solid black;
width: 100%; width: 100%;
} }
#body_left input { #body_left input {
margin-top: 30px; margin-top: 30px;
margin-left: 30px; margin-left: 30px;
} }
#next{ #next{
margin-left:1450px; margin-left:1450px;
margin-top: 30px; margin-top: 30px;
} }
/* 选择班级界面 */ /* 选择班级界面 */
#background{ #background{
width: 400px; width: 400px;
height: 550px; height: 550px;
background-color: rgb(149, 224, 224); background-color: rgb(149, 224, 224);
position: absolute; position: absolute;
margin-left: 650px; margin-left: 650px;
margin-top: 150px; margin-top: 150px;
} }
#class_ul{ #class_ul{
width: 200px; width: 200px;
height: 300px; height: 300px;
margin-left: 80px; margin-left: 80px;
background-color: rgb(198, 155, 238); background-color: rgb(198, 155, 238);
overflow: auto; overflow: auto;
list-style-type: none; list-style-type: none;
} }
.class_div { .class_div {
/* 普通状态下的样式 */ /* 普通状态下的样式 */
width: 130px; width: 130px;
height: 30px; height: 30px;
border: 1px solid #ccc; border: 1px solid #ccc;
cursor: pointer; cursor: pointer;
background-color: bisque; background-color: bisque;
margin-top: 10px; margin-top: 10px;
margin-left: 15px; margin-left: 15px;
text-align: center; text-align: center;
} }
.selected { .selected {
/* 选中状态下的样式 */ /* 选中状态下的样式 */
background-color: lightblue; background-color: lightblue;
border-color: blue; border-color: blue;
} }
#send_box{ #send_box{
width: 400px; width: 400px;
height: 550px; height: 550px;
background-color: rgb(149, 224, 224); background-color: rgb(149, 224, 224);
position: absolute; position: absolute;
margin-left: 650px; margin-left: 650px;
margin-top: 150px; margin-top: 150px;
} }

View File

@ -1,283 +1,279 @@
import { useParams } from 'react-router-dom'; import { useParams } from 'react-router-dom';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import './SendTest.css' import './SendTest.css'
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import axios from 'axios'; import axios from 'axios';
function SendTest(){ function SendTest(){
// const { key } = useParams(); // const { key } = useParams();
const teacher_ID=localStorage.getItem('islogin') const teacher_ID=localStorage.getItem('islogin')
if(teacher_ID==null){ //
alert('登录过期,请重新登录') const [ChoiceQuestion,SetChoiceQuestion]=useState()
window.location.href='http://36.138.114.105:30294/' const [Completion,SetCompletion]=useState()
} const [Judge,SetJudge]=useState()
//
const [ChoiceQuestion,SetChoiceQuestion]=useState() const subject = async ()=>{
const [Completion,SetCompletion]=useState() try{
const [Judge,SetJudge]=useState() const subject_src=await axios.post('/api/teacher/return_question',{
teacher_ID})
const subject = async ()=>{ SetChoiceQuestion(subject_src.data['选择'])
try{ SetCompletion(subject_src.data['填空'])
const subject_src=await axios.post('/api/teacher/return_question',{ SetJudge(subject_src.data['判断'])
teacher_ID}) }catch(error){
SetChoiceQuestion(subject_src.data['选择']) console.log(error);
SetCompletion(subject_src.data['填空']) }
SetJudge(subject_src.data['判断']) }
}catch(error){ useEffect(()=>{
console.log(error); subject()
} },[])
} //ID
useEffect(()=>{ const [ChoiceQuestionSet,SetChoiceQuestionSet]=useState([])
subject() const [CompletionQuestionSet,SetCompletionQuestionSet]=useState([])
},[]) const [JudgeQuestionSet,SetJudgeQuestionSet]=useState([])
//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 body=document.getElementById('body')
const background=document.getElementById('background') const click_1= async()=>{
const send_box=document.getElementById('send_box') try {
const [ClassData,SetClassData]=useState([]) const select_class_src = await axios.post('/api/teacher/select_class', {
teacher_ID
const click_1= async()=>{ });
try { background.style.display='block'
const select_class_src = await axios.post('/api/teacher/select_class', { body.style.display='none'
teacher_ID send_box.display='none'
}); SetClassData(select_class_src.data);
background.style.display='block' } catch (error) {
body.style.display='none' console.log(error);
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 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_1=()=>{ }
background.style.display='none' //
body.style.display='block' const last_2=()=>{
send_box.display='none' background.style.display='block'
} body.style.display='none'
// send_box.style.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)) {
const [selectedItems, setSelectedItems] = useState([]); setSelectedItems(prevItems => prevItems.filter(item => item !== key));
} else {
const click_div = (key) => { setSelectedItems(prevItems => [...prevItems, key]);
if (selectedItems.includes(key)) { }
setSelectedItems(prevItems => prevItems.filter(item => item !== key)); };
} else { const getClassNames = (key) => {
setSelectedItems(prevItems => [...prevItems, key]); if (selectedItems.includes(key)) {
} return 'class_div selected';
}; } else {
const getClassNames = (key) => { return 'class_div';
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)
//00~59 }
const min_list=[] //0~12
for (let i=0;i<=59;i++){ const hour_list=[]
min_list.push(i) for (let i=0;i<=12;i++){
} hour_list.push(i)
//0~12 }
const hour_list=[] //
for (let i=0;i<=12;i++){ const [HourValue, SetHourValue] = useState('');
hour_list.push(i) const gethourvalue=(event)=>{
} SetHourValue(event.target.value)
// }
const [HourValue, SetHourValue] = useState(''); //
const gethourvalue=(event)=>{ const [MinValue,SetMinValue]=useState('')
SetHourValue(event.target.value) const getminvalue=(event)=>{
} SetMinValue(event.target.value)
// }
const [MinValue,SetMinValue]=useState('') //
const getminvalue=(event)=>{ const [StopTime,SetStopTime]=useState('')
SetMinValue(event.target.value) const getstoptime=(event)=>{
} SetStopTime(event.target.value)
// }
const [StopTime,SetStopTime]=useState('') //
const getstoptime=(event)=>{ const release= async()=>{
SetStopTime(event.target.value) try{
} const release_src=await axios.post('/api/teacher/accept_test',{
// teacher_ID,
const release= async()=>{ ChoiceQuestionSet,//
try{ CompletionQuestionSet,//
const release_src=await axios.post('/api/teacher/accept_test',{ JudgeQuestionSet,//
teacher_ID, selectedItems,//
ChoiceQuestionSet,// HourValue,//
CompletionQuestionSet,// MinValue,//
JudgeQuestionSet,// StopTime,//
selectedItems,// }
HourValue,// )
MinValue,// alert('发布成功')
StopTime,// window.location.href='http://36.138.114.105:30294/teacher/managetest'
} }catch{
) alert('发布失败')
alert('发布成功') }
window.location.href='http://36.138.114.105:30294/teacher/managetest'
}catch{ }
alert('发布失败')
} return(
<div id='big_body'>
} <div id='background' style={{display:'none'}}>
<p style={{marginLeft:'30px'}}>请选择发布班级</p>
return( { ClassData &&<ul style={{marginTop:'70px'}} id='class_ul'>
<div id='big_body'> {Object.keys(ClassData).map((key)=>(
<div id='background' style={{display:'none'}}> <li key={key}>
<p style={{marginLeft:'30px'}}>请选择发布班级</p> <div className={getClassNames(key)} onClick={() => click_div(key)}>
{ ClassData &&<ul style={{marginTop:'70px'}} id='class_ul'> {key}
{Object.keys(ClassData).map((key)=>( </div>
<li key={key}> </li>
<div className={getClassNames(key)} onClick={() => click_div(key)}> ))}
{key} </ul>}
</div> <button style={{marginLeft:'110px'}} onClick={last_1}>上一步</button>
</li> <button style={{marginLeft:'80px'}} onClick={click_2}>下一步</button>
))} </div>
</ul>} <div id='send_box' style={{display:'none'}}>
<button style={{marginLeft:'110px'}} onClick={last_1}>上一步</button> <p>请填写考试时间</p>
<button style={{marginLeft:'80px'}} onClick={click_2}>下一步</button> <select name="" id="" alue={HourValue} onChange={gethourvalue}>
</div> {Object.keys(hour_list).map((num)=>(
<div id='send_box' style={{display:'none'}}> <option value={num} key={num}>{num}</option>
<p>请填写考试时间</p> ))}
<select name="" id="" alue={HourValue} onChange={gethourvalue}> </select>小时
{Object.keys(hour_list).map((num)=>(
<option value={num} key={num}>{num}</option> <select name="" id="" alue={MinValue} onChange={getminvalue}>
))} {min_list.map((num)=>(
</select>小时 <option value={num} key={num}>{num}</option>
))}
<select name="" id="" alue={MinValue} onChange={getminvalue}> </select>分钟
{min_list.map((num)=>( <p>请填写截至时间</p>
<option value={num} key={num}>{num}</option> <input type="text" maxLength={10} style={{width:'30px'}} value={StopTime} onChange={getstoptime} />天后
))} <button onClick={last_2}>上一步</button>
</select>分钟 <button onClick={release}>发布</button>
<p>请填写截至时间</p> </div>
<input type="text" maxLength={10} style={{width:'30px'}} value={StopTime} onChange={getstoptime} />天后 <div id='body' >
<button onClick={last_2}>上一步</button> <div id='body_top' style={{display:'flex'}}>
<button onClick={release}>发布</button> <div id='body_left'>
</div> <input type="checkbox" id='choice'/><span>选择题</span><br />
<div id='body' > <input type="checkbox" id='fill'/><span>填空</span><br />
<div id='body_top' style={{display:'flex'}}> <input type="checkbox" id='judge'/><span>判断</span><br />
<div id='body_left'> </div>
<input type="checkbox" id='choice'/><span>选择题</span><br />
<input type="checkbox" id='fill'/><span>填空</span><br /> <div id='body_right'>
<input type="checkbox" id='judge'/><span>判断</span><br /> <div id='choice_box'>
</div> <span style={{color:'red'}}>选择题</span>
{ChoiceQuestion && <table>
<div id='body_right'> <thead>
<div id='choice_box'> {Object.keys(ChoiceQuestion).map((key)=>(
<span style={{color:'red'}}>选择题</span> <tr className='line' key={key}>
{ChoiceQuestion && <table> <td className='line'>
<thead> <p>问题:{ChoiceQuestion[key][1]}</p>
{Object.keys(ChoiceQuestion).map((key)=>( <p className='choice_answer'>
<tr className='line' key={key}> <span>A:{ChoiceQuestion[key][2]}</span>
<td className='line'> <span>B:{ChoiceQuestion[key][3]}</span>
<p>问题:{ChoiceQuestion[key][1]}</p> <span>C:{ChoiceQuestion[key][4]}</span>
<p className='choice_answer'> <span>D:{ChoiceQuestion[key][5]}</span>
<span>A:{ChoiceQuestion[key][2]}</span> </p>
<span>B:{ChoiceQuestion[key][3]}</span> {/* 获取题目ID */}
<span>C:{ChoiceQuestion[key][4]}</span> <input type="checkbox" className='check_box' onClick={(event)=>{
<span>D:{ChoiceQuestion[key][5]}</span> if (event.target.checked) {
</p> //ID
{/* 获取题目ID */} SetChoiceQuestionSet(items=>([
<input type="checkbox" className='check_box' onClick={(event)=>{ ...items,
if (event.target.checked) { ChoiceQuestion[key][7]
//ID ]))
SetChoiceQuestionSet(items=>([ }else{
...items, SetChoiceQuestionSet((items)=>
ChoiceQuestion[key][7] items.filter((item)=>item!==ChoiceQuestion[key][7])
])) )
}else{ }
SetChoiceQuestionSet((items)=> }} /><span>是否选择</span>
items.filter((item)=>item!==ChoiceQuestion[key][7]) </td>
) </tr>
} ))}
}} /><span>是否选择</span> </thead>
</td> </table>}
</tr> </div>
))} <div id='fill_box'>
</thead> <span style={{color:'red'}}>填空题</span>
</table>} { Completion &&<table>
</div> <thead>
<div id='fill_box'> {Object.keys(Completion).map((key)=>(
<span style={{color:'red'}}>填空题</span> <tr key={key}>
{ Completion &&<table> <td className='line'>
<thead> <p>问题:{Completion[key][1]}<input type='text' /></p>
{Object.keys(Completion).map((key)=>( <input type="checkbox" className='check_box' onClick={(event)=>{
<tr key={key}> if(event.target.checked){
<td className='line'> SetCompletionQuestionSet(items=>([
<p>问题:{Completion[key][1]}<input type='text' /></p> ...items,
<input type="checkbox" className='check_box' onClick={(event)=>{ Completion[key][3]
if(event.target.checked){ ]))
SetCompletionQuestionSet(items=>([ }else{
...items, SetCompletionQuestionSet((items)=>
Completion[key][3] items.filter((item)=>item!==Completion[key][3]))
])) }
}else{ }}/><span>是否选择</span>
SetCompletionQuestionSet((items)=> </td>
items.filter((item)=>item!==Completion[key][3])) </tr>
} ))}
}}/><span>是否选择</span> </thead>
</td> </table>}
</tr> </div>
))} <div id='judge_box'>
</thead> <span style={{color:'red'}}>判断题</span>
</table>} { Judge &&<table>
</div> <thead>
<div id='judge_box'> {Object.keys(Judge).map((key)=>(
<span style={{color:'red'}}>判断题</span> <tr key={key}>
{ Judge &&<table> <td className='line'>
<thead> <p>问题:{Judge[key][1]}</p>
{Object.keys(Judge).map((key)=>( <input type="checkbox" className='check_box' onClick={(event)=>{
<tr key={key}> if(event.target.checked){
<td className='line'> SetJudgeQuestionSet(items=>([
<p>问题:{Judge[key][1]}</p> ...items,
<input type="checkbox" className='check_box' onClick={(event)=>{ Judge[key][3]
if(event.target.checked){ ]))
SetJudgeQuestionSet(items=>([ }else{
...items, SetJudgeQuestionSet((items)=>
Judge[key][3] items.filter((item)=>item!==Judge[key][3]))
])) }
}else{ }}/><span>是否选择</span>
SetJudgeQuestionSet((items)=> </td>
items.filter((item)=>item!==Judge[key][3])) </tr>
} ))}
}}/><span>是否选择</span>
</td> </thead>
</tr> </table>}
))} </div>
</div>
</thead> </div>
</table>} <div id='body_btm'>
</div> <button id='next' onClick={click_1}>下一步</button>
</div> </div>
</div> </div>
<div id='body_btm'> </div>
<button id='next' onClick={click_1}>下一步</button> )
</div> }
</div>
</div>
)
}
export default SendTest export default SendTest

View File

@ -1,182 +1,182 @@
.SendTrain_body{ .SendTrain_body{
width: 100%; width: 100%;
display: flex; display: flex;
} }
.SendTrain_body_left{ .SendTrain_body_left{
flex: 20%; flex: 20%;
} }
.SendTrain_body_right{ .SendTrain_body_right{
flex: 60%; flex: 60%;
} }
.SendTrain_body_left_ul{ .SendTrain_body_left_ul{
all: unset; all: unset;
} }
.SendTrain_body_left_ul li{ .SendTrain_body_left_ul li{
text-align: center; text-align: center;
} }
.SendTrain_body_left_ul button{ .SendTrain_body_left_ul button{
background-color: rgb(114, 134, 232); background-color: rgb(114, 134, 232);
border: none; border: none;
width: 100%; width: 100%;
margin-top: 20px; margin-top: 20px;
font-size: 28px; font-size: 28px;
} }
.SendTrain_body_left_ul_div{ .SendTrain_body_left_ul_div{
background-color: aqua; background-color: aqua;
font-size: 36px; font-size: 36px;
margin-top: 43px; margin-top: 43px;
} }
.SendTrain_body_right p{ .SendTrain_body_right p{
font-size: 32px; font-size: 32px;
border: 1px solid black; border: 1px solid black;
text-align: center; text-align: center;
margin-top: 0px; margin-top: 0px;
margin-bottom: 0px; margin-bottom: 0px;
} }
.SendTrain_body_right table{ .SendTrain_body_right table{
width: 100%; width: 100%;
border-left: 1px solid black; border-left: 1px solid black;
border-right: 1px solid black; border-right: 1px solid black;
} }
.title{ .title{
font-size: 26px; font-size: 26px;
margin-bottom: 0px; margin-bottom: 0px;
} }
.questiontitle{ .questiontitle{
font-size: 20px; font-size: 20px;
} }
.Trainbox{ .Trainbox{
background-color: rgb(166, 161, 161); background-color: rgb(166, 161, 161);
} }
.judgetitle{ .judgetitle{
font-size: 20px; font-size: 20px;
background-color: rgb(166, 161, 161); background-color: rgb(166, 161, 161);
} }
/* 以下为为实训 */ /* 以下为为实训 */
.Train_div{ .Train_div{
width: 100%-1px; width: 100%-1px;
height:700px; height:700px;
border: 1px solid black; border: 1px solid black;
border-top: none; border-top: none;
} }
#Train_1{ #Train_1{
width: 100%; width: 100%;
height: 350px; height: 350px;
display: flex; display: flex;
} }
.Train_1_left{ .Train_1_left{
flex: 60%; flex: 60%;
background-color: beige; background-color: beige;
font-size: 20px; font-size: 20px;
text-align: center; text-align: center;
padding-top: 120px; padding-top: 120px;
} }
.Train_1_right{ .Train_1_right{
flex: 40%; flex: 40%;
background-color: rgb(111, 200, 241); background-color: rgb(111, 200, 241);
} }
#Train_2{ #Train_2{
width: 100%; width: 100%;
height: 350px; height: 350px;
display: flex; display: flex;
} }
.Train_2_left{ .Train_2_left{
flex: 60%; flex: 60%;
background-color: rgb(97, 237, 92); background-color: rgb(97, 237, 92);
font-size: 20px; font-size: 20px;
text-align: center; text-align: center;
padding-top: 120px; padding-top: 120px;
} }
.Train_2_right{ .Train_2_right{
flex: 40%; flex: 40%;
background-color: rgb(248, 127, 231); background-color: rgb(248, 127, 231);
} }
.Train_1_right span{ .Train_1_right span{
font-size: 20px; font-size: 20px;
position: absolute; position: absolute;
margin-left: 150px; margin-left: 150px;
margin-top: 140px; margin-top: 140px;
} }
.Train_2_right span{ .Train_2_right span{
font-size: 20px; font-size: 20px;
position: absolute; position: absolute;
margin-left: 150px; margin-left: 150px;
margin-top: 140px; margin-top: 140px;
} }
/* 按钮 */ /* 按钮 */
#SendTrainBtn{ #SendTrainBtn{
font-size: 32px; font-size: 32px;
margin-top: 40px; margin-top: 40px;
margin-bottom: 40px; margin-bottom: 40px;
margin-left: 830px; margin-left: 830px;
} }
/* 右边的内容 */ /* 右边的内容 */
.right_right{ .right_right{
flex: 20%; flex: 20%;
} }
.OptionBox{ .OptionBox{
width: 90%; width: 90%;
height: 500px; height: 500px;
margin-top: 30px; margin-top: 30px;
margin-left: 15px; margin-left: 15px;
border-radius: 20px; border-radius: 20px;
background-color: rgb(173, 255, 251); background-color: rgb(173, 255, 251);
} }
.TrainSelectClass{ .TrainSelectClass{
width: 95%; width: 95%;
height: 200px; height: 200px;
background-color: bisque; background-color: bisque;
border-radius: 20px; border-radius: 20px;
margin-left: 7px; margin-left: 7px;
padding-top: 20; padding-top: 20;
} }
.TrainSelectClassP{ .TrainSelectClassP{
font-size: 20px; font-size: 20px;
margin-left: 80px; margin-left: 80px;
padding-top: 10px; padding-top: 10px;
} }
#Train_class_ul{ #Train_class_ul{
margin-left: 30px; margin-left: 30px;
} }
#Train_class_ul li{ #Train_class_ul li{
list-style-type: none; list-style-type: none;
} }
.Train_class_div { .Train_class_div {
/* 普通状态下的样式 */ /* 普通状态下的样式 */
width: 120px; width: 120px;
height: 30px; height: 30px;
border: 1px solid #5086eb; border: 1px solid #5086eb;
cursor: pointer; cursor: pointer;
margin-top: 10px; margin-top: 10px;
margin-left: 15px; margin-left: 15px;
text-align: center; text-align: center;
} }
.Trainselected { .Trainselected {
/* 选中状态下的样式 */ /* 选中状态下的样式 */
background-color: rgb(148, 246, 186); background-color: rgb(148, 246, 186);
border-color: rgb(250, 200, 140); border-color: rgb(250, 200, 140);
} }
.TrainSelectTime{ .TrainSelectTime{
width: 95%; width: 95%;
height: 200px; height: 200px;
background-color: beige; background-color: beige;
text-align: center; text-align: center;
margin-left: 7px; margin-left: 7px;
border-radius: 20px; border-radius: 20px;
} }

View File

@ -1,315 +1,311 @@
import React,{ useState ,useEffect} from 'react'; import React,{ useState ,useEffect} from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import './SendTrain.css' import './SendTrain.css'
import axios from 'axios'; import axios from 'axios';
function SendTrain(){ function SendTrain(){
const teacher_ID=localStorage.getItem('islogin') const teacher_ID=localStorage.getItem('islogin')
if(teacher_ID==null){ //
alert('登录过期,请重新登录') const [Trainquestion,SetTrainquestion]=useState()
window.location.href='http://36.138.114.105:30294/' //
} const [isTrain,setisTrain]=useState(false)
// //
const [Trainquestion,SetTrainquestion]=useState() const [TrainChoice,setTrainChoice]=useState([])
// const [TrainCompletion,setTrainCompletion]=useState([])
const [isTrain,setisTrain]=useState(false) const [TrainJudge,setTrainJudge]=useState([])
// //
const [TrainChoice,setTrainChoice]=useState([]) const [Train,setTrain]=useState([])
const [TrainCompletion,setTrainCompletion]=useState([]) //
const [TrainJudge,setTrainJudge]=useState([]) const [ClassData,SetClassData]=useState([])
//
const [Train,setTrain]=useState([]) const Train_question_func=async()=>{
// try{
const [ClassData,SetClassData]=useState([]) const Train_question_src=await axios.post('/api/teacher/fetch_train_question')
SetTrainquestion(Train_question_src.data)
const Train_question_func=async()=>{ }catch{
try{ alert('Train_question_func出错')
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
const SeleactClass= async()=>{ });
try { SetClassData(select_class_src.data['Class']);
const select_class_src = await axios.post('/api/teacher/select_class', { } catch (error) {
teacher_ID console.log(error);
}); }
SetClassData(select_class_src.data['Class']);
} catch (error) { }
console.log(error);
} useEffect(()=>{
Train_question_func()
} SeleactClass()
},[])
useEffect(()=>{
Train_question_func() //
SeleactClass() const [selectedItems, setSelectedItems] = useState([]);
},[])
const click_div = (key) => {
// if (selectedItems.includes(key)) {
const [selectedItems, setSelectedItems] = useState([]); setSelectedItems(prevItems => prevItems.filter(item => item !== key));
} else {
const click_div = (key) => { setSelectedItems(prevItems => [...prevItems, key]);
if (selectedItems.includes(key)) { }
setSelectedItems(prevItems => prevItems.filter(item => item !== key)); };
} else { const getClassNames = (key) => {
setSelectedItems(prevItems => [...prevItems, key]); if (selectedItems.includes(key)) {
} return 'Train_class_div Trainselected';
}; } else {
const getClassNames = (key) => { return 'Train_class_div';
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,
const SendTrainTest=async ()=>{ TrainCompletion,
try{ TrainJudge,
const SendTrainSrc=await axios.post('/api/teacher/SendTrainTest',{ HourValue,
TrainChoice, MinValue,
TrainCompletion, StopTime,
TrainJudge, selectedItems,
HourValue, Train,
MinValue, teacher_ID
StopTime, })
selectedItems, alert('发布成功')
Train, }catch{
teacher_ID alert('SendTrainTest出错')
}) }
alert('发布成功') }
}catch{
alert('SendTrainTest出错') const SendTrainBtn=()=>{
} if(selectedItems.length>0 && (HourValue || MinValue)&&StopTime){
} SendTrainTest()
}else{
const SendTrainBtn=()=>{ alert('发布信息未完全')
if(selectedItems.length>0 && (HourValue || MinValue)&&StopTime){ }
SendTrainTest() }
}else{ //
alert('发布信息未完全') const clickTrain=()=>{
} SetTrainquestion(null)
} setisTrain(true)
// }
const clickTrain=()=>{ const clickQuestion=()=>{
SetTrainquestion(null) Train_question_func()
setisTrain(true) setisTrain(false)
} }
const clickQuestion=()=>{
Train_question_func() //00~59
setisTrain(false) const min_list=[]
} for (let i=0;i<=59;i++){
min_list.push(i)
//00~59 }
const min_list=[] //0~12
for (let i=0;i<=59;i++){ const hour_list=[]
min_list.push(i) for (let i=0;i<=12;i++){
} hour_list.push(i)
//0~12 }
const hour_list=[] //
for (let i=0;i<=12;i++){ const [HourValue, SetHourValue] = useState('');
hour_list.push(i) const gethourvalue=(event)=>{
} SetHourValue(event.target.value)
// }
const [HourValue, SetHourValue] = useState(''); //
const gethourvalue=(event)=>{ const [MinValue,SetMinValue]=useState('')
SetHourValue(event.target.value) const getminvalue=(event)=>{
} SetMinValue(event.target.value)
// }
const [MinValue,SetMinValue]=useState('') //
const getminvalue=(event)=>{ const [StopTime,SetStopTime]=useState('')
SetMinValue(event.target.value) const getstoptime=(event)=>{
} SetStopTime(event.target.value)
// }
const [StopTime,SetStopTime]=useState('')
const getstoptime=(event)=>{ return(
SetStopTime(event.target.value) <div className='SendTrain_body'>
} <div className='SendTrain_body_left'>
<ul className='SendTrain_body_left_ul'>
return( <li><div className='SendTrain_body_left_ul_div'>题目集</div></li>
<div className='SendTrain_body'> <li>
<div className='SendTrain_body_left'> <button onClick={clickQuestion}>基础题</button>
<ul className='SendTrain_body_left_ul'> <ul style={{all:'unset'}}>
<li><div className='SendTrain_body_left_ul_div'>题目集</div></li> <li>第一章</li>
<li> <li>第二章</li>
<button onClick={clickQuestion}>基础题</button> </ul>
<ul style={{all:'unset'}}> </li>
<li>第一章</li> <li><button onClick={clickTrain}>实训题</button></li>
<li>第二章</li> </ul>
</ul> </div>
</li> <div className='SendTrain_body_right'>
<li><button onClick={clickTrain}>实训题</button></li> <p>题目选择</p>
</ul> {/* 实训题 */}
</div> {isTrain&&<div className='Train_div'>
<div className='SendTrain_body_right'> <div id='Train_1'>
<p>题目选择</p> <div className='Train_1_left'>
{/* 实训题 */} 设计达梦数据库课程实验实训按照提供的达梦数据库安装文档在系统中实现达梦数据库安装连接及使用
{isTrain&&<div className='Train_div'> </div>
<div id='Train_1'> <div className='Train_1_right'>
<div className='Train_1_left'> <span>
设计达梦数据库课程实验实训按照提供的达梦数据库安装文档在系统中实现达梦数据库安装连接及使用 <input type="checkbox" value={'达梦数据库连接'} onClick={(event)=>{
</div> if(event.target.checked){
<div className='Train_1_right'> setTrain(items=>([
<span> ...items,
<input type="checkbox" value={'达梦数据库连接'} onClick={(event)=>{ event.target.value
if(event.target.checked){ ]))
setTrain(items=>([ }else{
...items, setTrain((items)=>
event.target.value items.filter((item)=>item!==event.target.value))
])) }
}else{ }}/>是否选择
setTrain((items)=> </span>
items.filter((item)=>item!==event.target.value)) </div>
} </div>
}}/>是否选择 <div id='Train_2'>
</span> <div className='Train_2_left'>
</div> 设计和实现一个Web前端开发和DM8数据库后端结合的项目实训
</div> </div>
<div id='Train_2'> <div className='Train_2_right'>
<div className='Train_2_left'> <span>
设计和实现一个Web前端开发和DM8数据库后端结合的项目实训 <input type="checkbox" value={'前端与数据库结合'} onClick={(event)=>{
</div> if(event.target.checked){
<div className='Train_2_right'> setTrain(items=>([
<span> ...items,
<input type="checkbox" value={'前端与数据库结合'} onClick={(event)=>{ event.target.value
if(event.target.checked){ ]))
setTrain(items=>([ }else{
...items, setTrain((items)=>
event.target.value items.filter((item)=>item!==event.target.value))
])) }
}else{ }}/>是否选择
setTrain((items)=> </span>
items.filter((item)=>item!==event.target.value)) </div>
} </div>
}}/>是否选择 </div>}
</span>
</div> {/* 基础题 */}
</div> {Trainquestion &&<table>
</div>} <span className='title'>选择题</span>
<tbody>
{/* 基础题 */} {Object.keys(Trainquestion['choice']).map((key)=>(
{Trainquestion &&<table> <tr key={key}>
<span className='title'>选择题</span> {/* 章节切换⬇ */}
<tbody> <td className='Trainbox'>
{Object.keys(Trainquestion['choice']).map((key)=>( <div>{Trainquestion['choice'][key][8]}</div>
<tr key={key}> <tr>
{/* 章节切换⬇ */} <td className='questiontitle'>.{Trainquestion['choice'][key][1]}</td>
<td className='Trainbox'> </tr>
<div>{Trainquestion['choice'][key][8]}</div> <tr>
<tr> <div className='Train_answer_box'>
<td className='questiontitle'>.{Trainquestion['choice'][key][1]}</td> <tr>A:{Trainquestion['choice'][key][2]}</tr>
</tr> <tr>B:{Trainquestion['choice'][key][3]}</tr>
<tr> <tr>C:{Trainquestion['choice'][key][4]}</tr>
<div className='Train_answer_box'> <tr>D:{Trainquestion['choice'][key][5]}</tr>
<tr>A:{Trainquestion['choice'][key][2]}</tr> </div>
<tr>B:{Trainquestion['choice'][key][3]}</tr> </tr>
<tr>C:{Trainquestion['choice'][key][4]}</tr> <input type="checkbox" className='check_box' onClick={(event)=>{
<tr>D:{Trainquestion['choice'][key][5]}</tr> if (event.target.checked) {
</div> //ID
</tr> setTrainChoice(items=>([
<input type="checkbox" className='check_box' onClick={(event)=>{ ...items,
if (event.target.checked) { Trainquestion['choice'][key][7]
//ID ]))
setTrainChoice(items=>([ }else{
...items, setTrainChoice((items)=>
Trainquestion['choice'][key][7] items.filter((item)=>item!==Trainquestion['choice'][key][7])
])) )
}else{ }
setTrainChoice((items)=> }} /><span>是否选择</span>
items.filter((item)=>item!==Trainquestion['choice'][key][7]) </td>
) </tr>
} ))}
}} /><span>是否选择</span> <span className='title'>填空题</span>
</td> {Object.keys(Trainquestion['completion']).map((key)=>(
</tr> <tr key={key}>
))} <td className='Trainbox'>
<span className='title'>填空题</span> {Trainquestion['completion'][key][4]}
{Object.keys(Trainquestion['completion']).map((key)=>( <td className='questiontitle'>
<tr key={key}> .{Trainquestion['completion'][key][1]}
<td className='Trainbox'> </td>
{Trainquestion['completion'][key][4]} <input type="checkbox" className='check_box' onClick={(event)=>{
<td className='questiontitle'> if (event.target.checked) {
.{Trainquestion['completion'][key][1]} //ID
</td> setTrainCompletion(items=>([
<input type="checkbox" className='check_box' onClick={(event)=>{ ...items,
if (event.target.checked) { Trainquestion['completion'][key][3]
//ID ]))
setTrainCompletion(items=>([ }else{
...items, setTrainCompletion((items)=>
Trainquestion['completion'][key][3] items.filter((item)=>item!==Trainquestion['completion'][key][3])
])) )
}else{ }
setTrainCompletion((items)=> }} /><span>是否选择</span>
items.filter((item)=>item!==Trainquestion['completion'][key][3]) </td>
) </tr>
} ))}
}} /><span>是否选择</span> <span className='title'>判断题</span>
</td> {Object.keys(Trainquestion['judge']).map((key)=>(
</tr> <tr key={key}>
))} <td className='Trainbox'>
<span className='title'>判断题</span> {Trainquestion['judge'][key][4]}
{Object.keys(Trainquestion['judge']).map((key)=>( <td className='judgetitle'>:{Trainquestion['judge'][key][1]}</td>
<tr key={key}> <input type="checkbox" className='check_box' onClick={(event)=>{
<td className='Trainbox'> if (event.target.checked) {
{Trainquestion['judge'][key][4]} setTrainJudge(items=>([
<td className='judgetitle'>:{Trainquestion['judge'][key][1]}</td> ...items,
<input type="checkbox" className='check_box' onClick={(event)=>{ Trainquestion['judge'][key][3]
if (event.target.checked) { ]))
setTrainJudge(items=>([ }else{
...items, setTrainJudge((items)=>
Trainquestion['judge'][key][3] items.filter((item)=>item!==Trainquestion['judge'][key][3])
])) )
}else{ }
setTrainJudge((items)=> }} /><span>是否选择</span>
items.filter((item)=>item!==Trainquestion['judge'][key][3]) </td>
) </tr>
} ))}
}} /><span>是否选择</span> </tbody>
</td> </table>}
</tr> <button onClick={SendTrainBtn} id='SendTrainBtn'>发布按钮</button>
))} </div>
</tbody> {/* 右边的内容 */}
</table>} <div className='right_right'>
<button onClick={SendTrainBtn} id='SendTrainBtn'>发布按钮</button> <div className='OptionBox'>
</div> <div className='TrainSelectClass'>
{/* 右边的内容 */} <p className='TrainSelectClassP'>请选择发布班级</p>
<div className='right_right'> { ClassData &&<ul id='Train_class_ul'>
<div className='OptionBox'> {Object.keys(ClassData).map((key)=>(
<div className='TrainSelectClass'> <li key={key}>
<p className='TrainSelectClassP'>请选择发布班级</p> <div className={getClassNames(key)} onClick={() => click_div(key)}>
{ ClassData &&<ul id='Train_class_ul'> {key}
{Object.keys(ClassData).map((key)=>( </div>
<li key={key}> </li>
<div className={getClassNames(key)} onClick={() => click_div(key)}> ))}
{key} </ul>}
</div> </div>
</li> <div className='TrainSelectTime'>
))} <p>请填写考试时间</p>
</ul>} <select name="" id="" alue={HourValue} onChange={gethourvalue}>
</div> {Object.keys(hour_list).map((num)=>(
<div className='TrainSelectTime'> <option value={num} key={num}>{num}</option>
<p>请填写考试时间</p> ))}
<select name="" id="" alue={HourValue} onChange={gethourvalue}> </select>小时
{Object.keys(hour_list).map((num)=>( <select name="" id="" alue={MinValue} onChange={getminvalue}>
<option value={num} key={num}>{num}</option> {min_list.map((num)=>(
))} <option value={num} key={num}>{num}</option>
</select>小时 ))}
<select name="" id="" alue={MinValue} onChange={getminvalue}> </select>分钟
{min_list.map((num)=>( <p>请填写截至时间</p>
<option value={num} key={num}>{num}</option> <input type="text" maxLength={10} style={{width:'30px'}} value={StopTime} onChange={getstoptime} />天后
))} </div>
</select>分钟 </div>
<p>请填写截至时间</p> </div>
<input type="text" maxLength={10} style={{width:'30px'}} value={StopTime} onChange={getstoptime} />天后 </div>
</div> )
</div> }
</div>
</div>
)
}
export default SendTrain export default SendTrain

View File

@ -1,32 +1,74 @@
.body-TrainManage{ .body-trainmanage{
width: 1420px; width: 1420px;
height: 830px; height: 830px;
position: absolute; position: absolute;
top: 72px; top: 72px;
left: 220px; left: 220px;
border-radius: 10px; border-radius: 10px;
float: right;
background-color: #f7f8fa; background-color: #f7f8fa;
} }
.body-right-Train h3{ .body-trainmanage p{
margin-left: 60px;
font-size: 20px; font-size: 20px;
margin-bottom: -5px; position: absolute;
left: 50px;
}
.line{
width: 250px;
height: 2px;
position: absolute;
top: 60px;
background-image: linear-gradient(120deg,#ffffff,rgb(223, 223, 223),#fff);
}
.ul1-trainmanage{
width: 650px;
height: 200px;
position: absolute;
top: 50px;
left: 10px;
}
.ul2-trainmanage{
width: 650px;
height: 200px;
position: absolute;
top: 50px;
left: 700px;
}
.train-list-trainmanage li{
width: 650px;
height: 70px;
list-style-type: none;
margin-top: 10px;
border-radius: 10px;
background-color: #ffffff;
box-shadow: 2px 2px 2px #d8d9d9;
cursor: pointer;
}
.train-list-trainmanage span {
font-size: 20px;
}
.train-list-trainmanage p{
font-size: 15px;
margin-left: 460px;
margin-top: -40px;
}
.train-list-trainmanage li::before {
content: "▶";
color: rgb(132, 213, 209);
padding-right: 20px;
line-height: 65px;
padding-left: 15px;
font-size: 20px;
display: inline-block;
} }
.test-Train{ .sendtestpage{
display:flex; padding: 20px 30px;
flex-wrap: wrap; font-size: 20px;
flex-direction: row; text-decoration: none;
margin-left: 40px; color: #000;
margin-bottom: 60px; position: absolute;
} bottom: 50px;
right: 100px;
.Train-box{ background-color: rgb(186, 237, 237);
flex-basis: calc(30.00% - 10PX); }
box-sizing: border-box;
margin: 20px;
height: 210px;
background-image: linear-gradient(190deg,rgba(157, 246, 252, 0.7),rgba(198, 212, 255, 0.7));
border-radius: 15px;
line-height: 35px;
}

View File

@ -1,37 +1,39 @@
import './Trainmanage.css' import './trainmanage.css'
import axios from 'axios'; import { Link } from 'react-router-dom';
import React,{ useState,useEffect } from 'react'; // import React, { useEffect, useState } from 'react';
// import axios from 'axios';
function TeacherTrainManage(){
const click=()=>{
console.log('a');
}
function TrainManage(){
return( return(
<div className="body-TrainManage"> <div className='body-trainmanage'>
<div className="body-right-Train"> <p>已批改试卷</p>
<h3>正在进行的考试与练习</h3> <div className='line'></div>
<div className='test-Train'> <div className='train-list-trainmanage'>
<div className='Train-box'> <ul className='ul1-trainmanage'>
<p>试卷ID:</p> <li>
<span>发布者:</span> <span>111</span>
<div>发布时间:</div> <p>关闭时间2024-11-5</p>
<div>截至时间:</div> </li>
</div> <li>
</div> <span>333</span>
<button onClick={click}>测试按钮</button> <p>关闭时间2024-11-5</p>
</li>
<h3>已结束或完成的试卷与练习</h3> </ul>
<div className='test-subject'> <ul className='ul2-trainmanage'>
<div className='test-box'> <li>
<p>试卷ID:</p> <span>222</span>
<span>发布者:</span> <p>关闭时间2024-11-5</p>
<div>发布时间:</div> </li>
<div>截至时间:</div> <li>
</div> <span>444</span>
</div> <p>关闭时间2024-11-5</p>
</li>
</ul>
<Link to='/teacher/SendTrain' className='sendtestpage'>前往发布实训</Link>
</div> </div>
</div> </div>
) )
} }
export default TeacherTrainManage
export default TrainManage

View File

@ -110,6 +110,8 @@
height: 30px; height: 30px;
background-color: #b4c7c0; background-color: #b4c7c0;
border: none; border: none;
position: absolute;
left: 840px;
} }
.btn-test:hover{ .btn-test:hover{

View File

@ -48,9 +48,6 @@ function SubjectPage(){
</div> </div>
))} ))}
</div>} </div>}
<button onClick={()=>{
console.log(title[0][0][11]);
}}></button>
<p className='bottomP'>提醒:请及时完成实训内容</p> <p className='bottomP'>提醒:请及时完成实训内容</p>
</div> </div>
)}; )};

View File

@ -9,8 +9,8 @@ import HeaderNavTeacher from '../nav/teacherIndex';
// //
import Home from '../pages/Home/Home'; import Home from '../pages/Home/Home';
import SubjectPage from '../pages/ListPages/Subject/SubjectPage'; import SubjectPage from '../pages/ListPages/Subject/SubjectPage';
import AnalysePage from '../pages/ListPages/Analyse/AnalysePages';
import Training from '../pages/ListPages/Training/TrainingPage'; import Training from '../pages/ListPages/Training/TrainingPage';
import AnalysePage from '../pages/ListPages/Analyse/AnalysePages';
import Exam from '../pages/ListPages/Subject/Exam'; import Exam from '../pages/ListPages/Subject/Exam';
import Operation1 from '../pages/ListPages/Training/Operation1'; import Operation1 from '../pages/ListPages/Training/Operation1';
import Operation2 from '../pages/ListPages/Training/Operation2'; import Operation2 from '../pages/ListPages/Training/Operation2';
@ -18,11 +18,12 @@ import Operation2 from '../pages/ListPages/Training/Operation2';
// //
import TeacherPage from '../TeacherPages/TeacherPage'; import TeacherPage from '../TeacherPages/TeacherPage';
import ClassID from '../TeacherPages/classlistpages/classId'; import ClassID from '../TeacherPages/classlistpages/classId';
import ManageTest from '../TeacherPages/teachermanagetest/ManageTest'; import ManageTest from '../TeacherPages/TestManage/ManageTest';
import SendTest from '../TeacherPages/SendTest/SendTest'; import SendTest from '../TeacherPages/TestManage/SendTest';
import Marking from '../TeacherPages/MarkingPages/Marking'; import Marking from '../TeacherPages/MarkingPages/Marking';
import SendTrain from '../TeacherPages/SendTrain/SendTrain'; import SendTrain from '../TeacherPages/TrainManage/SendTrain';
import TrainManage from '../TeacherPages/SendTest/trainmanage'; import TrainManage from '../TeacherPages/TrainManage/trainmanage';
import StudentLink from '../TeacherPages/MarkingPages/StudentLink';
// (exam)使 // (exam)使
const MainLayout = ({ headerNav:HeaderNav }) => { const MainLayout = ({ headerNav:HeaderNav }) => {
@ -44,22 +45,21 @@ function App() {
<Routes> <Routes>
{/* 使用 HeaderNav 的用户页面 */} {/* 使用 HeaderNav 的用户页面 */}
<Route path="/" element={<MainLayout headerNav={HeaderNav} />}> <Route path="/" element={<MainLayout headerNav={HeaderNav} />}>
<Route index element={<Home />} /> <Route index element={<Home />} /> {/* 主页 */}
<Route path="analyse" element={<AnalysePage />} /> <Route path='subject' element={<SubjectPage/>} /> {/* 练习 */}
<Route path='subject' element={<SubjectPage/>} /> <Route path='train' element={<Training/>}/> {/* 实训 */}
<Route path='train' element={<Training/>}/> <Route path="analyse" element={<AnalysePage />} /> {/* 学习分析 */}
{/* 其他需要HeaderNav的页面 */} {/* 其他需要HeaderNav的页面 */}
</Route> </Route>
{/* 使用 HeaderNavTeacher 的教师页面 */} {/* 使用 HeaderNavTeacher 的教师页面 */}
<Route path="/teacher" element={<MainLayout headerNav={HeaderNavTeacher} />}> <Route path="/teacher" element={<MainLayout headerNav={HeaderNavTeacher} />}>
<Route index element={<TeacherPage/>} /> <Route index element={<TeacherPage/>} /> {/* 班级管理 */}
<Route path='managetest' element={<ManageTest />}/> <Route path='trainmanage' element={<TrainManage/>}/> {/* 实训管理 */}
{/* <Route path='managetest/:ClassID' element={<ManageTest />}/> */} <Route path='mark' element={<Marking/>}/> {/* 批改 */}
<Route path="classID/:key" element={<ClassID />} /> <Route path='managetest' element={<ManageTest />}/> {/* 考试管理 */}
<Route path='mark' element={<Marking/>}/> <Route path="classID/:key" element={<ClassID />} /> {/* 班级管理1 */}
<Route path='trainmanage' element={<TrainManage/>}/> <Route path='mark/studentlink' element={<StudentLink/>}/> {/* 批改1 */}
{/* 其他需要HeaderNavTeacher的页面 */} {/* 其他需要HeaderNavTeacher的页面 */}
</Route> </Route>
@ -68,11 +68,11 @@ function App() {
</Route> </Route>
{/* 页面使用单独的布局不包含HeaderNav和HeaderNavTeacher */} {/* 页面使用单独的布局不包含HeaderNav和HeaderNavTeacher */}
<Route path="exam/:examId" element={<Exam />} /> <Route path="exam/:examId" element={<Exam />} />{/* 练习-考试页面 */}
<Route path='/teacher/sendtest' element={<SendTest />}/> <Route path='/teacher/sendtest' element={<SendTest />}/> {/* 考试管理-发布试卷 */}
<Route path='operation1/:operateID' element={<Operation1/>}/> <Route path='/teacher/SendTrain' element={<SendTrain/>}/> {/* 实训管理-发布实训 */}
<Route path='operation2/:operateID' element={<Operation2/>}/> <Route path='operation1/:operateID' element={<Operation1/>}/> {/* 实训页面1 */}
<Route path='teacher/SendTrain' element={<SendTrain/>}/> <Route path='operation2/:operateID' element={<Operation2/>}/> {/* 实训页面2 */}
{/* 独立的顶级路由如登录页面也不包含HeaderNav */} {/* 独立的顶级路由如登录页面也不包含HeaderNav */}
{/* 登录页面 */} {/* 登录页面 */}
<Route path="signin" element={<SignInPage />} /> <Route path="signin" element={<SignInPage />} />

View File

View File