链接更改

This commit is contained in:
30404 2024-06-20 15:30:16 +08:00
parent 045454f023
commit eacc60ea86
11 changed files with 14 additions and 18 deletions

View File

@ -131,7 +131,7 @@ function SendTest(){
} }
) )
alert('发布成功') alert('发布成功')
window.location.href='http://localhost:3000/teacher/managetest' window.location.href='http://36.138.114.105:30294/teacher/managetest'
}catch{ }catch{
alert('发布失败') alert('发布失败')
} }

View File

@ -15,10 +15,10 @@ function TeacherPage() {
// const is_login = localStorage.getItem('islogin'); // const is_login = localStorage.getItem('islogin');
// if (!is_login) { // if (!is_login) {
// alert(''); // alert('');
// window.location.href = 'http://localhost:3000/signin'; // window.location.href = 'http://36.138.114.105:30294/signin';
// } else { // } else {
// if(teacher_ID.length===8){ // if(teacher_ID.length===8){
// window.location.href='http://localhost:3000' // window.location.href='http://36.138.114.105:30294'
// return // return
// }else{ // }else{
// console.log(teacher_ID); // console.log(teacher_ID);

View File

@ -15,7 +15,7 @@ function HeaderNav() {
localStorage.removeItem('islogin') localStorage.removeItem('islogin')
// setisChecked(false) // setisChecked(false)
alert('注销成功') alert('注销成功')
window.location.href='http://localhost:3000/signin' window.location.href='http://36.138.114.105:30294/signin'
}; };
const [isChecked,setisChecked]=useState(false) const [isChecked,setisChecked]=useState(false)

View File

@ -15,7 +15,7 @@ function HeaderNavTeacher() {
localStorage.removeItem('islogin') localStorage.removeItem('islogin')
// setisChecked(false) // setisChecked(false)
alert('注销成功') alert('注销成功')
window.location.href='http://localhost:3000/signin' window.location.href='http://36.138.114.105:30294/signin'
}; };
const [isChecked,setisChecked]=useState(false) const [isChecked,setisChecked]=useState(false)

View File

@ -137,11 +137,10 @@ function Exam(){
score, score,
examId examId
}) })
console.log('能不能发送');
}catch(error){ }catch(error){
alert(error) alert(error)
} }
window.location.href='http://localhost:3000/subject' window.location.href='http://36.138.114.105:30294/subject'
} }
score_func() score_func()
}else{ }else{

View File

@ -20,7 +20,7 @@ function SubjectPage(){
const test_src= await axios.post('/api/student/get_test',{student_ID}) const test_src= await axios.post('/api/student/get_test',{student_ID})
settestdata(test_src.data['data']) settestdata(test_src.data['data'])
}catch(error){ }catch(error){
alert(error) alert('test出错')
} }
} }
useEffect(()=>{ useEffect(()=>{

View File

@ -73,7 +73,7 @@
color: red; color: red;
font-size: 20px; font-size: 20px;
margin-top: 350px; margin-top: 350px;
margin-left: 50px; margin-left: 70px;
letter-spacing: 20px; letter-spacing: 20px;
} }

View File

@ -15,7 +15,7 @@ function SubjectPage(){
// //
const FetchTrainFunc=async()=>{ const FetchTrainFunc=async()=>{
try{ try{
const FetchTrainSrc=await axios.post('http://127.0.0.1:5000/student/FetchTrainTitle',{ const FetchTrainSrc=await axios.post('api/student/FetchTrainTitle',{
student_ID student_ID
}) })
setTitle(FetchTrainSrc.data['title']) setTitle(FetchTrainSrc.data['title'])

View File

@ -21,11 +21,11 @@ function SignInPage(){
if (data.result === '登录成功' && data.user==='user'){ if (data.result === '登录成功' && data.user==='user'){
localStorage.setItem('islogin',ID) localStorage.setItem('islogin',ID)
alert('用户登录成功') alert('用户登录成功')
window.location.href='http://localhost:3000'// window.location.href='http://36.138.114.105:30294'//
}else if(data.result==='登录成功'&&data.user==='teacher'){ }else if(data.result==='登录成功'&&data.user==='teacher'){
localStorage.setItem('islogin',ID) localStorage.setItem('islogin',ID)
alert('教师登录成功') alert('教师登录成功')
window.location.href='http://localhost:3000/teacher'// window.location.href='http://36.138.114.105:30294/teacher'//
}else{ }else{
alert('账号或密码错误') alert('账号或密码错误')
setID('') setID('')

View File

@ -22,8 +22,6 @@ def login():
login_data = request.json # 获取前端发送过来的数据 login_data = request.json # 获取前端发送过来的数据
ID = login_data['ID'] # 解析数据 ID = login_data['ID'] # 解析数据
password = login_data['password'] password = login_data['password']
print(ID)
print(password)
if len(ID) == 8: # 根据长度判断,长度为十则是学生 if len(ID) == 8: # 根据长度判断,长度为十则是学生
try: try:
en_password, password = student_login_func(ID, password) en_password, password = student_login_func(ID, password)
@ -128,7 +126,7 @@ def score_entry():
return jsonify({'result': '成功'}) return jsonify({'result': '成功'})
@app.route('/student/FetchTrainTitle',methods=['POST']) @app.route('/api/student/FetchTrainTitle',methods=['POST'])
def FetchTrainTitle(): def FetchTrainTitle():
data = request.json data = request.json
ID = data['student_ID'] ID = data['student_ID']

View File

@ -205,16 +205,15 @@ def score_entry_func(score,testID,ID):
def FetchTrainTitleFunc(ID): def FetchTrainTitleFunc(ID):
cursor = db.cursor() cursor = db.cursor()
cursor.execute('SELECT * FROM TRAINSCORE WHERE STUDENT_ID=?',(ID)) cursor.execute("SELECT * FROM TRAINSCORE WHERE STUDENT_ID=? and TF='false'",(ID))
train_title = cursor.fetchall() train_title = cursor.fetchall()
titles = [] titles = []
title = [] title = []
for i in train_title: for i in train_title:
titles.append(i[2]) titles.append(i[2])
print(titles)
for i in titles: for i in titles:
cursor.execute('select * from TRAINTEST WHERE ID=?',(i)) cursor.execute('SELECT * FROM TRAINTEST WHERE ID=? ',(i))
title.append(cursor.fetchall()) title.append(cursor.fetchall())
cursor.close() cursor.close()