diff --git a/app-dm/src/pages/Home/Home.jsx b/app-dm/src/pages/Home/Home.jsx
index d1c98cc..73b66e7 100755
--- a/app-dm/src/pages/Home/Home.jsx
+++ b/app-dm/src/pages/Home/Home.jsx
@@ -5,18 +5,12 @@ import React,{ useEffect,useState } from 'react';
import axios from 'axios';
//图表
import { Line } from 'react-chartjs-2';
-import { Chart as ChartJS, CategoryScale, LinearScale, PointElement, LineElement, Tooltip, Legend } from 'chart.js';
+import { Chart as ChartJS, CategoryScale, LinearScale, PointElement, LineElement, Tooltip, Legend, Ticks } from 'chart.js';
+import { max, min } from 'lodash';
// 首页
function Home(){
- const outlog=()=>{
- localStorage.removeItem('islogin')
- // setisChecked(false)
- alert('注销成功')
- window.location.href='http://localhost:3000/signin'
- };
-
const [isChecked,setisChecked]=useState(false)
//判断是否登录
// useEffect(()=>{
@@ -52,7 +46,7 @@ function Home(){
const student_succeed=student_succeed_src.data
const lesson_data=(student_succeed['student_lesson'])
setLesson(lesson_data)
- }catch(error){
+ }catch(error){
if(student_ID.length===6){
window.location.href='http://localhost:3000/teacher'
return
@@ -63,9 +57,10 @@ function Home(){
}
}
}
- // useEffect(()=>{
- // student_succeed_func()
- // },[])
+
+ useEffect(()=>{
+ student_succeed_func()
+ },[])
useEffect(()=>{
if(lesson.length>0){
@@ -83,10 +78,6 @@ function Home(){
}
},[lesson])
- const click=()=>{
- console.log();
- }
-
//折线图
// 创建一个状态来存储图表的数据
const [chartData, setChartData] = useState({
@@ -109,8 +100,7 @@ function Home(){
datasets: [
{
label: '总体成绩分析',
- // data: [10, 20, 30, 40, 50,60,70,80,90,100],
- data:data,
+ data: [62, 79, 71, 49, 70],
fill: false,
backgroundColor:'#fff',
borderColor: 'rgb(75, 192, 192)',
@@ -125,6 +115,11 @@ function Home(){
scales: {
y: {
beginAtZero: true,
+ min:0,
+ max:100,
+ ticks:{
+ stepSize:10
+ }
}
},
plugins: {
diff --git a/app-dm/src/pages/ListPages/Subject/SubjectPage.jsx b/app-dm/src/pages/ListPages/Subject/SubjectPage.jsx
index 3314d02..8b2e40e 100755
--- a/app-dm/src/pages/ListPages/Subject/SubjectPage.jsx
+++ b/app-dm/src/pages/ListPages/Subject/SubjectPage.jsx
@@ -46,10 +46,6 @@ function SubjectPage(){
//过期试卷
const [outtest,setouttest]=useState({})
- //测试按钮
- const click = () => {
- console.log(testdata);
- };
//分过期试卷⬇
useEffect(()=>{
let test_list= []
@@ -97,8 +93,6 @@ function SubjectPage(){
))}
}
-
-
已结束或完成的试卷与练习
{ outtest&& result&&
{Object.keys(outtest).map((key)=>{
diff --git a/app-dm/src/pages/ListPages/Training/TrainingPage.css b/app-dm/src/pages/ListPages/Training/TrainingPage.css
index 9d50ea2..201b1f0 100755
--- a/app-dm/src/pages/ListPages/Training/TrainingPage.css
+++ b/app-dm/src/pages/ListPages/Training/TrainingPage.css
@@ -48,16 +48,16 @@
}
.exam-btn-training{
- position: relative;
- margin-top: 50px;
- margin-left: 250px;
+ position: absolute;
+ margin-left: 260px;
border-radius: 15px;
+ margin-top: -10px;
font-size: 17px;
border: none;
display: inline-block;
- padding: 3px 32px;
+ padding: 3px 26px;
background-color: rgba(175, 235, 230, 0.929);
- color: #000;
+ color: #000;
text-decoration: none;
box-shadow: 3px 3px 5px rgba(127, 170, 166, 0.929);
}
@@ -69,6 +69,13 @@
.exam-btn-training:active{
color:rgba(86, 117, 114, 0.929);
}
+.bottomP{
+ color: red;
+ font-size: 20px;
+ margin-top: 350px;
+ margin-left: 50px;
+ letter-spacing: 20px;
+}
diff --git a/app-dm/src/pages/ListPages/Training/TrainingPage.jsx b/app-dm/src/pages/ListPages/Training/TrainingPage.jsx
index f9320a7..aa21fc9 100755
--- a/app-dm/src/pages/ListPages/Training/TrainingPage.jsx
+++ b/app-dm/src/pages/ListPages/Training/TrainingPage.jsx
@@ -1,44 +1,53 @@
-import React,{ useState } from 'react';
+import React,{ useState , useEffect} from 'react';
import { Link } from 'react-router-dom';
import '../Training/TrainingPage.css'
+import axios from 'axios';
-const list3=[
- {'train':'实训一:数据库的安装',id:'1'},
- {'train':'实训二:web前端开发和数据库的结合',id:'2'}
-]
-
const list4=[
{'train':'实训3:待定',id:'3'},
{'train':'实训4:待定',id:'4'}
]
// 首页 学习分析
function SubjectPage(){
+ const student_ID=localStorage.getItem('islogin')
+ const [title,setTitle]=useState()
+ // 获取实训标题
+ const FetchTrainFunc=async()=>{
+ try{
+ const FetchTrainSrc=await axios.post('http://127.0.0.1:5000/student/FetchTrainTitle',{
+ student_ID
+ })
+ setTitle(FetchTrainSrc.data['title'])
+ }catch{
+ alert('FetchTrainFunc出错')
+ }
+ }
+
+ useEffect(()=>{
+ FetchTrainFunc()
+ },[])
return(
-
未完成练习
-
- {list3.map((item) =>(
-
-
{item.train}
-
发布者:陈老师
-
-
+
未完成实训项目
+ {title&&
+ {Object.keys(title).map((key)=>(
+
+
实训:{eval(title[key][0][11])}
+
发布者:陈老师
+
发布时间:{title[key][0][5]}
+
截至时间:{title[key][0][6]}
+
开始实训
-
))}
-
-
已完成练习
-
- {list4.map((item) => (
-
-
{item.train}
-
- {item.title}
-
-
))}
-
+
+ ))}
+
}
+
+
提醒:请及时完成实训内容!!!
)};
diff --git a/app-dm/src/router/index.jsx b/app-dm/src/router/index.jsx
index 3d14c99..6b633f1 100755
--- a/app-dm/src/router/index.jsx
+++ b/app-dm/src/router/index.jsx
@@ -21,6 +21,7 @@ import ClassID from '../TeacherPages/classlistpages/classId';
import ManageTest from '../TeacherPages/teachermanagetest/ManageTest';
import SendTest from '../TeacherPages/SendTest/SendTest';
import Marking from '../TeacherPages/MarkingPages/Marking';
+import SendTrain from '../TeacherPages/SendTrain/SendTrain';
// 定义一个组件来包裹除了特定页面(exam)外的所有页面使其有导航
const MainLayout = ({ headerNav:HeaderNav }) => {
@@ -53,9 +54,10 @@ function App() {
}>
} />
}/>
- }/>
+ {/* }/> */}
} />
}/>
+
{/* 其他需要HeaderNavTeacher的页面 */}
@@ -68,8 +70,7 @@ function App() {
}/>
}/>
}/>
-
-
+ }/>
{/* 独立的顶级路由,如登录页面,也不包含HeaderNav */}
{/* 登录页面 */}
} />
diff --git a/python/app.py b/python/app.py
index df6673a..db471ab 100755
--- a/python/app.py
+++ b/python/app.py
@@ -128,6 +128,15 @@ def score_entry():
return jsonify({'result': '成功'})
+@app.route('/student/FetchTrainTitle',methods=['POST'])
+def FetchTrainTitle():
+ data = request.json
+ ID = data['student_ID']
+ title=FetchTrainTitleFunc(ID)
+ return jsonify({'title': title})
+
+
+
# 以下为教师功能—————————————————————————————————————————————————————————————————————
@app.route('/teacher/return_question', methods=['POST'])
def return_question():
diff --git a/python/student_func.py b/python/student_func.py
index 5cc7bcf..2b2ebce 100755
--- a/python/student_func.py
+++ b/python/student_func.py
@@ -203,6 +203,24 @@ def score_entry_func(score,testID,ID):
return '修改成功'
+def FetchTrainTitleFunc(ID):
+ cursor = db.cursor()
+ cursor.execute('SELECT * FROM TRAINSCORE WHERE STUDENT_ID=?',(ID))
+ train_title = cursor.fetchall()
+ titles = []
+ title = []
+ for i in train_title:
+ titles.append(i[2])
+ print(titles)
+
+ for i in titles:
+ cursor.execute('select * from TRAINTEST WHERE ID=?',(i))
+ title.append(cursor.fetchall())
+
+ cursor.close()
+ return title
+
+
diff --git a/python/teacher_func.py b/python/teacher_func.py
index acd83c4..21ef154 100755
--- a/python/teacher_func.py
+++ b/python/teacher_func.py
@@ -5,7 +5,6 @@ from Crypto.Random import get_random_bytes
import base64
import datetime
-
db = dmPython.connect(user='SYSDBA', password='dameng!!', host="36.138.114.105", port="32522")
#获取题目