This commit is contained in:
parent
9d08bddb45
commit
e6ecf80799
|
@ -8,6 +8,9 @@ import './classid.css'
|
||||||
|
|
||||||
|
|
||||||
function TeacherPage() {
|
function TeacherPage() {
|
||||||
|
const click=()=>{
|
||||||
|
console.log(classdata);
|
||||||
|
}
|
||||||
const teacher_ID=localStorage.getItem('islogin')
|
const teacher_ID=localStorage.getItem('islogin')
|
||||||
if(teacher_ID==null){
|
if(teacher_ID==null){
|
||||||
alert('登录过期,请重新登录')
|
alert('登录过期,请重新登录')
|
||||||
|
@ -31,12 +34,6 @@ function TeacherPage() {
|
||||||
class_succeed();
|
class_succeed();
|
||||||
},[])
|
},[])
|
||||||
|
|
||||||
|
|
||||||
//学生画像
|
|
||||||
const student_fig_btn=()=>{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//柱形图
|
//柱形图
|
||||||
const [studentScores, setStudentScores] = useState([]);
|
const [studentScores, setStudentScores] = useState([]);
|
||||||
|
|
||||||
|
@ -50,6 +47,28 @@ function TeacherPage() {
|
||||||
});
|
});
|
||||||
}, [isclick]);
|
}, [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 Find_details=async (ID)=>{
|
||||||
|
try{
|
||||||
|
const Find_details=await axios.post('api/Find_details',{
|
||||||
|
ID
|
||||||
|
})
|
||||||
|
}catch{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<div className='body-right-classId'>
|
<div className='body-right-classId'>
|
||||||
<div id='body-right-bottom'>
|
<div id='body-right-bottom'>
|
||||||
|
@ -71,13 +90,13 @@ function TeacherPage() {
|
||||||
<tbody>
|
<tbody>
|
||||||
{Object.keys(classdata).map((item)=>(
|
{Object.keys(classdata).map((item)=>(
|
||||||
<tr key={item}>
|
<tr key={item}>
|
||||||
<td className='box-content'>班级</td>
|
<td className='box-content'>{classdata[item][2]}</td>
|
||||||
<td className='box-content'>{classdata[item][0]}</td>
|
<td className='box-content'>{classdata[item][0]}</td>
|
||||||
<td className='box-content'>{classdata[item][1]}</td>
|
<td className='box-content'>{classdata[item][1]}</td>
|
||||||
<td className='box-content'>{classdata[item][3]}</td>
|
<td className='box-content'>{classdata[item][3]}</td>
|
||||||
<td className='box-content'>{classdata[item][5]}</td>
|
<td className='box-content'>{classdata[item][5]}</td>
|
||||||
<td className='box-content'>出生日期</td>
|
<td className='box-content'>{formatDate(classdata[item][4])}</td>
|
||||||
<td className='box-content'><button onClick={student_fig_btn}>查看详情</button></td>
|
<td className='box-content'><button onClick={()=>Find_details(classdata[item][1])} style={{border:'none'}}>查看详情</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -88,6 +107,8 @@ function TeacherPage() {
|
||||||
<div className='body-test-score'>
|
<div className='body-test-score'>
|
||||||
<h3>成绩</h3>
|
<h3>成绩</h3>
|
||||||
<div className='body-test-score-bar'>
|
<div className='body-test-score-bar'>
|
||||||
|
<div className='studentName'>名字</div>
|
||||||
|
<button onClick={click}>测试</button>
|
||||||
<select>
|
<select>
|
||||||
<option value="">请选择科目</option>
|
<option value="">请选择科目</option>
|
||||||
<option value="china">语文</option>
|
<option value="china">语文</option>
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
}
|
}
|
||||||
#body-right-student-box td {
|
#body-right-student-box td {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
border: 1px solid #ccc;
|
border-bottom: 1px solid #ccc;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
.box-content {
|
.box-content {
|
||||||
|
@ -98,4 +98,11 @@
|
||||||
.bar{
|
.bar{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 10px;
|
top: 10px;
|
||||||
|
}
|
||||||
|
.studentName{
|
||||||
|
margin-top: 20px;
|
||||||
|
font-size: 18px;
|
||||||
|
width: 72px;
|
||||||
|
margin-left: 50px;
|
||||||
|
border: 1px solid black;
|
||||||
}
|
}
|
|
@ -12,7 +12,7 @@ import Computer from '../pages/Home/img/training.jpg';
|
||||||
function HeaderNav() {
|
function HeaderNav() {
|
||||||
|
|
||||||
const outlog=()=>{
|
const outlog=()=>{
|
||||||
localStorage.removeItem('islogin')
|
localStorage.clear()
|
||||||
// setisChecked(false)
|
// setisChecked(false)
|
||||||
alert('注销成功')
|
alert('注销成功')
|
||||||
window.location.href='http://36.138.114.105:30294/signin'
|
window.location.href='http://36.138.114.105:30294/signin'
|
||||||
|
|
|
@ -12,7 +12,7 @@ import Logo from '../pages/Home/img/logo.jpg'
|
||||||
function HeaderNavTeacher() {
|
function HeaderNavTeacher() {
|
||||||
|
|
||||||
const outlog=()=>{
|
const outlog=()=>{
|
||||||
localStorage.removeItem('islogin')
|
localStorage.clear()
|
||||||
// setisChecked(false)
|
// setisChecked(false)
|
||||||
alert('注销成功')
|
alert('注销成功')
|
||||||
window.location.href='http://36.138.114.105:30294/signin'
|
window.location.href='http://36.138.114.105:30294/signin'
|
||||||
|
|
|
@ -14,17 +14,17 @@ function Operation1() {
|
||||||
console.log(answeredJudge);
|
console.log(answeredJudge);
|
||||||
}
|
}
|
||||||
const clear=()=>{
|
const clear=()=>{
|
||||||
localStorage.clear('choice_answers');
|
localStorage.removeItem('choice_answers');
|
||||||
setchoice_answer({})
|
setchoice_answer({})
|
||||||
localStorage.clear('completion_answer')
|
localStorage.removeItem('completion_answer')
|
||||||
setcompletion_answer({})
|
setcompletion_answer({})
|
||||||
localStorage.clear('judge_answer')
|
localStorage.removeItem('judge_answer')
|
||||||
setjudge_answer({})
|
setjudge_answer({})
|
||||||
localStorage.clear('answeredChoice')
|
localStorage.removeItem('answeredChoice')
|
||||||
setAnsweredChoice([])
|
setAnsweredChoice([])
|
||||||
localStorage.clear('answeredComple')
|
localStorage.removeItem('answeredComple')
|
||||||
setAnsweredComple([])
|
setAnsweredComple([])
|
||||||
localStorage.clear('answeredJudge')
|
localStorage.removeItem('answeredJudge')
|
||||||
setAnsweredJudge([])
|
setAnsweredJudge([])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ module.exports = function(app) {
|
||||||
app.use(
|
app.use(
|
||||||
'/api', // 如果请求路径匹配'/api',则进行代理
|
'/api', // 如果请求路径匹配'/api',则进行代理
|
||||||
createProxyMiddleware({
|
createProxyMiddleware({
|
||||||
target: 'http://localhost:5000', // 目标后端服务地址
|
target: 'http://36.138.114.105:32087/', // 目标后端服务地址
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
@ -232,6 +232,9 @@ def SendTrainTest():
|
||||||
return '发布成功'
|
return '发布成功'
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/api/Find_details',methods=["POST"])
|
||||||
|
def Find_details():
|
||||||
|
return 'a'
|
||||||
|
|
||||||
@app.route('/api/student-test',methods=["POST"])
|
@app.route('/api/student-test',methods=["POST"])
|
||||||
def student_test():
|
def student_test():
|
||||||
|
|
|
@ -190,7 +190,6 @@ def find_end_test(ID):
|
||||||
TEST_ID = cursor.fetchall()
|
TEST_ID = cursor.fetchall()
|
||||||
for i in TEST_ID:
|
for i in TEST_ID:
|
||||||
testID.append(i[0])
|
testID.append(i[0])
|
||||||
print(i)
|
|
||||||
return testID
|
return testID
|
||||||
|
|
||||||
# find_end_test('20240101')
|
# find_end_test('20240101')
|
||||||
|
|
|
@ -254,3 +254,32 @@ def SendTrainTestFunc(TrainChoice,TrainCompletion,TrainJudge,Hour,Min,StopTime,C
|
||||||
db.commit()
|
db.commit()
|
||||||
cursor.close()
|
cursor.close()
|
||||||
return '发布成功'
|
return '发布成功'
|
||||||
|
|
||||||
|
|
||||||
|
def Find_dic(dic):
|
||||||
|
# 获取字典的键,并按照从大到小的顺序排序
|
||||||
|
keys_sorted = sorted(dic.keys(), reverse=True)
|
||||||
|
|
||||||
|
# 取最后三个键
|
||||||
|
last_three_keys = keys_sorted[:3]
|
||||||
|
|
||||||
|
# 输出对应的值或进行进一步处理
|
||||||
|
for key in last_three_keys:
|
||||||
|
print(dic[key]) # 这里假设你想打印每个键对应的值,可以根据需求进行处理
|
||||||
|
print(dic)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def Find_details(ID,teacher_ID):
|
||||||
|
dic={}
|
||||||
|
subject=fetch_subject(teacher_ID)
|
||||||
|
cursor = db.cursor()
|
||||||
|
cursor.execute(f"SELECT * FROM STUDENT_TEST WHERE STUDENT_ID=? AND TF='true' AND SUBJECT=? ",(ID,subject))
|
||||||
|
data=cursor.fetchall()
|
||||||
|
for i in data:
|
||||||
|
dic[i[3]]=i
|
||||||
|
cursor.close()
|
||||||
|
|
||||||
|
Find_dic(dic)
|
||||||
|
return dic
|
||||||
|
Find_details('20240101','111111')
|
||||||
|
|
Loading…
Reference in New Issue