6.20/z
This commit is contained in:
parent
02ba73619e
commit
882e8b4087
|
@ -5,18 +5,12 @@ import React,{ useEffect,useState } from 'react';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
//图表
|
//图表
|
||||||
import { Line } from 'react-chartjs-2';
|
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(){
|
function Home(){
|
||||||
const outlog=()=>{
|
|
||||||
localStorage.removeItem('islogin')
|
|
||||||
// setisChecked(false)
|
|
||||||
alert('注销成功')
|
|
||||||
window.location.href='http://localhost:3000/signin'
|
|
||||||
};
|
|
||||||
|
|
||||||
const [isChecked,setisChecked]=useState(false)
|
const [isChecked,setisChecked]=useState(false)
|
||||||
//判断是否登录
|
//判断是否登录
|
||||||
// useEffect(()=>{
|
// useEffect(()=>{
|
||||||
|
@ -63,9 +57,10 @@ function Home(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// useEffect(()=>{
|
|
||||||
// student_succeed_func()
|
useEffect(()=>{
|
||||||
// },[])
|
student_succeed_func()
|
||||||
|
},[])
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
if(lesson.length>0){
|
if(lesson.length>0){
|
||||||
|
@ -83,10 +78,6 @@ function Home(){
|
||||||
}
|
}
|
||||||
},[lesson])
|
},[lesson])
|
||||||
|
|
||||||
const click=()=>{
|
|
||||||
console.log();
|
|
||||||
}
|
|
||||||
|
|
||||||
//折线图
|
//折线图
|
||||||
// 创建一个状态来存储图表的数据
|
// 创建一个状态来存储图表的数据
|
||||||
const [chartData, setChartData] = useState({
|
const [chartData, setChartData] = useState({
|
||||||
|
@ -109,8 +100,7 @@ function Home(){
|
||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
label: '总体成绩分析',
|
label: '总体成绩分析',
|
||||||
// data: [10, 20, 30, 40, 50,60,70,80,90,100],
|
data: [62, 79, 71, 49, 70],
|
||||||
data:data,
|
|
||||||
fill: false,
|
fill: false,
|
||||||
backgroundColor:'#fff',
|
backgroundColor:'#fff',
|
||||||
borderColor: 'rgb(75, 192, 192)',
|
borderColor: 'rgb(75, 192, 192)',
|
||||||
|
@ -125,6 +115,11 @@ function Home(){
|
||||||
scales: {
|
scales: {
|
||||||
y: {
|
y: {
|
||||||
beginAtZero: true,
|
beginAtZero: true,
|
||||||
|
min:0,
|
||||||
|
max:100,
|
||||||
|
ticks:{
|
||||||
|
stepSize:10
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
plugins: {
|
plugins: {
|
||||||
|
|
|
@ -46,10 +46,6 @@ function SubjectPage(){
|
||||||
|
|
||||||
//过期试卷
|
//过期试卷
|
||||||
const [outtest,setouttest]=useState({})
|
const [outtest,setouttest]=useState({})
|
||||||
//测试按钮
|
|
||||||
const click = () => {
|
|
||||||
console.log(testdata);
|
|
||||||
};
|
|
||||||
//分过期试卷⬇
|
//分过期试卷⬇
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
let test_list= []
|
let test_list= []
|
||||||
|
@ -97,8 +93,6 @@ function SubjectPage(){
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>}
|
</div>}
|
||||||
<button onClick={click}>测试按钮</button>
|
|
||||||
|
|
||||||
<h3>已结束或完成的试卷与练习</h3>
|
<h3>已结束或完成的试卷与练习</h3>
|
||||||
{ outtest&& result&&<div className='test-subject'>
|
{ outtest&& result&&<div className='test-subject'>
|
||||||
{Object.keys(outtest).map((key)=>{
|
{Object.keys(outtest).map((key)=>{
|
||||||
|
|
|
@ -48,14 +48,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.exam-btn-training{
|
.exam-btn-training{
|
||||||
position: relative;
|
position: absolute;
|
||||||
margin-top: 50px;
|
margin-left: 260px;
|
||||||
margin-left: 250px;
|
|
||||||
border-radius: 15px;
|
border-radius: 15px;
|
||||||
|
margin-top: -10px;
|
||||||
font-size: 17px;
|
font-size: 17px;
|
||||||
border: none;
|
border: none;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 3px 32px;
|
padding: 3px 26px;
|
||||||
background-color: rgba(175, 235, 230, 0.929);
|
background-color: rgba(175, 235, 230, 0.929);
|
||||||
color: #000;
|
color: #000;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
@ -69,6 +69,13 @@
|
||||||
.exam-btn-training:active{
|
.exam-btn-training:active{
|
||||||
color:rgba(86, 117, 114, 0.929);
|
color:rgba(86, 117, 114, 0.929);
|
||||||
}
|
}
|
||||||
|
.bottomP{
|
||||||
|
color: red;
|
||||||
|
font-size: 20px;
|
||||||
|
margin-top: 350px;
|
||||||
|
margin-left: 50px;
|
||||||
|
letter-spacing: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,44 +1,53 @@
|
||||||
import React,{ useState } from 'react';
|
import React,{ useState , useEffect} from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import '../Training/TrainingPage.css'
|
import '../Training/TrainingPage.css'
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
|
||||||
const list3=[
|
|
||||||
{'train':'实训一:数据库的安装',id:'1'},
|
|
||||||
{'train':'实训二:web前端开发和数据库的结合',id:'2'}
|
|
||||||
]
|
|
||||||
|
|
||||||
const list4=[
|
const list4=[
|
||||||
{'train':'实训3:待定',id:'3'},
|
{'train':'实训3:待定',id:'3'},
|
||||||
{'train':'实训4:待定',id:'4'}
|
{'train':'实训4:待定',id:'4'}
|
||||||
]
|
]
|
||||||
// 首页 学习分析
|
// 首页 学习分析
|
||||||
function SubjectPage(){
|
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(
|
return(
|
||||||
<div className="body-right-training">
|
<div className="body-right-training">
|
||||||
<h3>未完成练习</h3>
|
<h3>未完成实训项目</h3>
|
||||||
<div className='test-training'>
|
{title&&<div className='test-training'>
|
||||||
{list3.map((item) =>(
|
{Object.keys(title).map((key)=>(
|
||||||
<div className='test-box-training'key={item.id}>
|
<div className='test-box-training' key={key}>
|
||||||
<p>{item.train}</p>
|
<p>实训:{eval(title[key][0][11])}</p>
|
||||||
<span>发布者:陈老师</span>
|
<span>发布者:陈老师</span>
|
||||||
<div dangerouslySetInnerHTML={{ __html: item.title }} />
|
<div>发布时间:{title[key][0][5]}</div>
|
||||||
<Link to={`/operation1/${item.train}`} className="exam-btn-training">
|
<div>截至时间:{title[key][0][6]}</div>
|
||||||
|
<Link to={`/operation1/${title[key][0][10]}`} className="exam-btn-training">
|
||||||
开始实训
|
开始实训
|
||||||
</Link>
|
</Link>
|
||||||
</div>))}
|
|
||||||
</div>
|
|
||||||
<h3>已完成练习</h3>
|
|
||||||
<div className='test-training'>
|
|
||||||
{list4.map((item) => (
|
|
||||||
<div className='test-box-training'key={item.id}>
|
|
||||||
<p>{item.train}</p>
|
|
||||||
<div>
|
|
||||||
{item.title}
|
|
||||||
</div>
|
|
||||||
</div>))}
|
|
||||||
</div>
|
</div>
|
||||||
|
))}
|
||||||
|
</div>}
|
||||||
|
<button onClick={()=>{
|
||||||
|
console.log(title[0][0][11]);
|
||||||
|
}}></button>
|
||||||
|
<p className='bottomP'>提醒:请及时完成实训内容!!!</p>
|
||||||
</div>
|
</div>
|
||||||
)};
|
)};
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ import ClassID from '../TeacherPages/classlistpages/classId';
|
||||||
import ManageTest from '../TeacherPages/teachermanagetest/ManageTest';
|
import ManageTest from '../TeacherPages/teachermanagetest/ManageTest';
|
||||||
import SendTest from '../TeacherPages/SendTest/SendTest';
|
import SendTest from '../TeacherPages/SendTest/SendTest';
|
||||||
import Marking from '../TeacherPages/MarkingPages/Marking';
|
import Marking from '../TeacherPages/MarkingPages/Marking';
|
||||||
|
import SendTrain from '../TeacherPages/SendTrain/SendTrain';
|
||||||
|
|
||||||
// 定义一个组件来包裹除了特定页面(exam)外的所有页面使其有导航
|
// 定义一个组件来包裹除了特定页面(exam)外的所有页面使其有导航
|
||||||
const MainLayout = ({ headerNav:HeaderNav }) => {
|
const MainLayout = ({ headerNav:HeaderNav }) => {
|
||||||
|
@ -53,9 +54,10 @@ function App() {
|
||||||
<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='managetest' element={<ManageTest />}/>
|
||||||
<Route path='managetest/:ClassID' element={<ManageTest />}/>
|
{/* <Route path='managetest/:ClassID' element={<ManageTest />}/> */}
|
||||||
<Route path="classID/:key" element={<ClassID />} />
|
<Route path="classID/:key" element={<ClassID />} />
|
||||||
<Route path='mark' element={<Marking/>}/>
|
<Route path='mark' element={<Marking/>}/>
|
||||||
|
|
||||||
{/* 其他需要HeaderNavTeacher的页面 */}
|
{/* 其他需要HeaderNavTeacher的页面 */}
|
||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
|
@ -68,8 +70,7 @@ function App() {
|
||||||
<Route path='/teacher/sendtest' element={<SendTest />}/>
|
<Route path='/teacher/sendtest' element={<SendTest />}/>
|
||||||
<Route path='operation1/:operateID' element={<Operation1/>}/>
|
<Route path='operation1/:operateID' element={<Operation1/>}/>
|
||||||
<Route path='operation2/:operateID' element={<Operation2/>}/>
|
<Route path='operation2/:operateID' element={<Operation2/>}/>
|
||||||
|
<Route path='teacher/SendTrain' element={<SendTrain/>}/>
|
||||||
|
|
||||||
{/* 独立的顶级路由,如登录页面,也不包含HeaderNav */}
|
{/* 独立的顶级路由,如登录页面,也不包含HeaderNav */}
|
||||||
{/* 登录页面 */}
|
{/* 登录页面 */}
|
||||||
<Route path="signin" element={<SignInPage />} />
|
<Route path="signin" element={<SignInPage />} />
|
||||||
|
|
|
@ -128,6 +128,15 @@ def score_entry():
|
||||||
return jsonify({'result': '成功'})
|
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'])
|
@app.route('/teacher/return_question', methods=['POST'])
|
||||||
def return_question():
|
def return_question():
|
||||||
|
|
|
@ -203,6 +203,24 @@ def score_entry_func(score,testID,ID):
|
||||||
return '修改成功'
|
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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ from Crypto.Random import get_random_bytes
|
||||||
import base64
|
import base64
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
|
|
||||||
db = dmPython.connect(user='SYSDBA', password='dameng!!', host="36.138.114.105", port="32522")
|
db = dmPython.connect(user='SYSDBA', password='dameng!!', host="36.138.114.105", port="32522")
|
||||||
|
|
||||||
#获取题目
|
#获取题目
|
||||||
|
|
Loading…
Reference in New Issue