Compare commits

..

No commits in common. "045454f023dc7fdf616cb9161c31321cb6b1d383" and "882e8b40879eb814ebf07fc26252af8df6d1b9e6" have entirely different histories.

103 changed files with 96 additions and 142 deletions

0
.gitignore vendored Normal file → Executable file
View File

BIN
README.md Normal file → Executable file

Binary file not shown.

0
app-dm/.dockerignore Normal file → Executable file
View File

2
app-dm/.gitignore vendored Normal file → Executable file
View File

@ -11,8 +11,6 @@
# production
/build
# misc
.DS_Store
.env.local

0
app-dm/Dockerfile Normal file → Executable file
View File

0
app-dm/README.md Normal file → Executable file
View File

0
app-dm/package-lock.json generated Normal file → Executable file
View File

0
app-dm/package.json Normal file → Executable file
View File

0
app-dm/public/favicon.ico Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

0
app-dm/public/index.html Normal file → Executable file
View File

0
app-dm/public/logo192.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

0
app-dm/public/logo512.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

0
app-dm/public/manifest.json Normal file → Executable file
View File

0
app-dm/public/robots.txt Normal file → Executable file
View File

0
app-dm/server/config.js Normal file → Executable file
View File

0
app-dm/server/index.js Normal file → Executable file
View File

0
app-dm/server/router.js Normal file → Executable file
View File

0
app-dm/src/TeacherPages/MarkingPages/Marking.css Normal file → Executable file
View File

0
app-dm/src/TeacherPages/MarkingPages/Marking.jsx Normal file → Executable file
View File

0
app-dm/src/TeacherPages/SendTest/SendTest.css Normal file → Executable file
View File

6
app-dm/src/TeacherPages/SendTest/SendTest.jsx Normal file → Executable file
View File

@ -14,7 +14,7 @@ function SendTest(){
const subject = async ()=>{
try{
const subject_src=await axios.post('/api/teacher/return_question',{
const subject_src=await axios.post('http://127.0.0.1:5000/teacher/return_question',{
teacher_ID})
SetChoiceQuestion(subject_src.data['选择'])
SetCompletion(subject_src.data['填空'])
@ -41,7 +41,7 @@ function SendTest(){
const click_1= async()=>{
try {
const select_class_src = await axios.post('/api/teacher/select_class', {
const select_class_src = await axios.post('http://127.0.0.1:5000/teacher/select_class', {
teacher_ID
});
background.style.display='block'
@ -119,7 +119,7 @@ function SendTest(){
//
const release= async()=>{
try{
const release_src=await axios.post('/api/teacher/accept_test',{
const release_src=await axios.post('http://127.0.0.1:5000/teacher/accept_test',{
teacher_ID,
ChoiceQuestionSet,//
CompletionQuestionSet,//

0
app-dm/src/TeacherPages/SendTrain/SendTrain.css Normal file → Executable file
View File

6
app-dm/src/TeacherPages/SendTrain/SendTrain.jsx Normal file → Executable file
View File

@ -20,7 +20,7 @@ function SendTrain(){
const Train_question_func=async()=>{
try{
const Train_question_src=await axios.post('/api/teacher/fetch_train_question')
const Train_question_src=await axios.post('http://127.0.0.1:5000/teacher/fetch_train_question')
SetTrainquestion(Train_question_src.data)
}catch{
alert('Train_question_func出错')
@ -29,7 +29,7 @@ function SendTrain(){
const SeleactClass= async()=>{
try {
const select_class_src = await axios.post('/api/teacher/select_class', {
const select_class_src = await axios.post('http://127.0.0.1:5000/teacher/select_class', {
teacher_ID
});
SetClassData(select_class_src.data['Class']);
@ -66,7 +66,7 @@ function SendTrain(){
//
const SendTrainTest=async ()=>{
try{
const SendTrainSrc=await axios.post('/api/teacher/SendTrainTest',{
const SendTrainSrc=await axios.post('http://127.0.0.1:5000/teacher/SendTrainTest',{
TrainChoice,
TrainCompletion,
TrainJudge,

0
app-dm/src/TeacherPages/TeacherPage.css Normal file → Executable file
View File

2
app-dm/src/TeacherPages/TeacherPage.jsx Normal file → Executable file
View File

@ -35,7 +35,7 @@ function TeacherPage() {
//
const select_class = async () => {
try {
const select_class_src = await axios.post('/api/teacher/select_class', {
const select_class_src = await axios.post('http://127.0.0.1:5000/teacher/select_class', {
teacher_ID
});
setClassData(select_class_src.data['Class']);

0
app-dm/src/TeacherPages/Trainmanage/Trainmanage.css Normal file → Executable file
View File

0
app-dm/src/TeacherPages/Trainmanage/Trainmanage.jsx Normal file → Executable file
View File

2
app-dm/src/TeacherPages/classlistpages/classId.jsx Normal file → Executable file
View File

@ -14,7 +14,7 @@ function TeacherPage() {
const [classdata,setClassData]=useState([])
const class_succeed = async () => {
try{
const class_scr=await axios.post('/api/teacher/find_student',{key})
const class_scr=await axios.post('http://127.0.0.1:5000/teacher/find_student',{key})
const class_data=class_scr.data
setClassData(class_data[1])
setisclick(true)

0
app-dm/src/TeacherPages/classlistpages/classid.css Normal file → Executable file
View File

View File

View File

@ -18,7 +18,7 @@ function TeacherPage() {
const select_class = async () => {
try {
const select_class_src = await axios.post('/api/teacher/select_class',{
const select_class_src = await axios.post('http://127.0.0.1:5000/teacher/select_class',{
teacher_ID
});
setClassData(select_class_src.data['Class']);
@ -45,7 +45,7 @@ function TeacherPage() {
useEffect(()=>{
const change_class = async () => {
try {
const change_class_src = await axios.post('/api/teacher/change_class',{
const change_class_src = await axios.post('http://127.0.0.1:5000/teacher/change_class',{
teacher_ID,
selectedValue,
testID
@ -74,7 +74,7 @@ function TeacherPage() {
const click_detailed= async()=>{
//
try{
const detaileddata_src=await axios.post('/api/teacher/detaileddata',{
const detaileddata_src=await axios.post('http://127.0.0.1:5000/teacher/detaileddata',{
testID,
selectedValue,
teacher_ID

0
app-dm/src/api/index.js Normal file → Executable file
View File

0
app-dm/src/index.js Normal file → Executable file
View File

0
app-dm/src/logo.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

0
app-dm/src/nav/nav.jsx Normal file → Executable file
View File

0
app-dm/src/nav/style.css Normal file → Executable file
View File

0
app-dm/src/nav/teacherIndex.jsx Normal file → Executable file
View File

0
app-dm/src/pages/Home/Home.css Normal file → Executable file
View File

2
app-dm/src/pages/Home/Home.jsx Normal file → Executable file
View File

@ -39,7 +39,7 @@ function Home(){
const student_succeed_func = async () => {
const student_ID=localStorage.getItem('islogin')
try{
const student_succeed_src=await axios.post('/api/student',{
const student_succeed_src=await axios.post('http://127.0.0.1:5000/student',{
student_ID
});
//

0
app-dm/src/pages/Home/img/ad.jpg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 75 KiB

0
app-dm/src/pages/Home/img/logo.jpg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 75 KiB

0
app-dm/src/pages/Home/img/test.jpg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

0
app-dm/src/pages/ListPages/Analyse/AnalysePages.css Normal file → Executable file
View File

0
app-dm/src/pages/ListPages/Analyse/AnalysePages.jsx Normal file → Executable file
View File

0
app-dm/src/pages/ListPages/Subject/Exam.css Normal file → Executable file
View File

4
app-dm/src/pages/ListPages/Subject/Exam.jsx Normal file → Executable file
View File

@ -19,7 +19,7 @@ function Exam(){
const [testdata,settestdata]=useState('')
const test_func= async()=>{
try{
const test_src= await axios.post('/api/student/get_test',{student_ID})
const test_src= await axios.post('http://127.0.0.1:5000/student/get_test',{student_ID})
const test_data=test_src.data['data']
settestdata(test_data)
}catch(error){
@ -132,7 +132,7 @@ function Exam(){
if(isMounted){
const score_func=async()=>{
try{
const score_entry_src=await axios.post('/api/student/score_entry',{
const score_entry_src=await axios.post('http://127.0.0.1:5000/student/score_entry',{
student_ID,
score,
examId

0
app-dm/src/pages/ListPages/Subject/SubjectPage.css Normal file → Executable file
View File

6
app-dm/src/pages/ListPages/Subject/SubjectPage.jsx Normal file → Executable file
View File

@ -17,7 +17,7 @@ function SubjectPage(){
//ID
const test=async()=>{
try{
const test_src= await axios.post('/api/student/get_test',{student_ID})
const test_src= await axios.post('http://127.0.0.1:5000/student/get_test',{student_ID})
settestdata(test_src.data['data'])
}catch(error){
alert(error)
@ -32,7 +32,7 @@ function SubjectPage(){
//
const end_test=async()=>{
try{
const end_test_src=await axios.post('/api/student/get_end_student',{student_ID})
const end_test_src=await axios.post('http://127.0.0.1:5000/student/get_end_student',{student_ID})
const obj=end_test_src.data['result']
setEndTestList(obj)
}catch(error){
@ -67,7 +67,7 @@ function SubjectPage(){
const find_result_func=async()=>{
try{
const find_result=await axios.post('/api/student/fetch_result',{
const find_result=await axios.post('http://127.0.0.1:5000/student/fetch_result',{
student_ID
})
setresult(find_result.data['result'])

0
app-dm/src/pages/ListPages/Training/Operation1.css Normal file → Executable file
View File

0
app-dm/src/pages/ListPages/Training/Operation1.jsx Normal file → Executable file
View File

0
app-dm/src/pages/ListPages/Training/Operation2.css Normal file → Executable file
View File

0
app-dm/src/pages/ListPages/Training/Operation2.jsx Normal file → Executable file
View File

0
app-dm/src/pages/ListPages/Training/TrainingPage.css Normal file → Executable file
View File

0
app-dm/src/pages/ListPages/Training/TrainingPage.jsx Normal file → Executable file
View File

0
app-dm/src/pages/ListPages/img/bottom.jpg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

0
app-dm/src/pages/ListPages/img/right.jpg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

0
app-dm/src/pages/ListPages/img/top.jpg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

0
app-dm/src/pages/SighUp/SignUpForm.css Normal file → Executable file
View File

2
app-dm/src/pages/SighUp/SignUpForm.jsx Normal file → Executable file
View File

@ -62,7 +62,7 @@ import axios from 'axios';
alert('学号错误')
return
}
const register_func=await axios.post('/api/register',{
const register_func=await axios.post('http://127.0.0.1:5000/register',{
name,
ID,
password,

0
app-dm/src/pages/SighUp/SignUpPage.jsx Normal file → Executable file
View File

0
app-dm/src/pages/SighUp/注册页面右.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 205 KiB

After

Width:  |  Height:  |  Size: 205 KiB

0
app-dm/src/pages/SignIn/SignInPage.css Normal file → Executable file
View File

2
app-dm/src/pages/SignIn/SignInPage.jsx Normal file → Executable file
View File

@ -12,7 +12,7 @@ function SignInPage(){
const login = async () => {
try {
const login_data = await axios.post('/api/login', {
const login_data = await axios.post('http://127.0.0.1:5000/login', {
ID,
password
});

0
app-dm/src/pages/SignIn/登录页面左.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 304 KiB

After

Width:  |  Height:  |  Size: 304 KiB

0
app-dm/src/postcss.config.js Normal file → Executable file
View File

0
app-dm/src/reportWebVitals.js Normal file → Executable file
View File

0
app-dm/src/router/index.jsx Normal file → Executable file
View File

View File

@ -1,4 +0,0 @@
const proxy=require("http-proxy-middleware")
module.exports=function(app){
app.use(proxy(['/api'],{target:"http://localhost:5000"}))
}

0
app-dm/src/setupTests.js Normal file → Executable file
View File

0
app-dm/src/utils/request.js Normal file → Executable file
View File

0
app-dm/src/vite.config.js Normal file → Executable file
View File

0
app-dm/tailwind.config.js Normal file → Executable file
View File

54
build.sh Normal file → Executable file
View File

@ -1,51 +1,3 @@
#!/bin/bash
# 获取当前文件夹名字
current_dir=$(basename "$PWD")
# 确保有稳定的网络环境
ensure_network() {
read -p "请确保有稳定的网络环境[Y/N] " confirm
if [[ ! $confirm =~ ^[yY]([eE][sS])?$ ]]; then
exit 1
fi
}
# 打包镜像
build_image() {
local service_name=$1
echo "打包${service_name}镜像"
docker compose build "$service_name"
}
# 推送镜像
push_image() {
read -p "是否要推送到《达梦启元云原生大数据平台》? [Y/N] " confirm
if [[ $confirm =~ ^[yY]([eE][sS])?$ ]]; then
echo "tag"
docker tag "${current_dir}-flask-app" 36.138.114.105:31000/cnsof50011836/flask-app
echo "pushing"
docker push 36.138.114.105:31000/cnsof50011836/flask-app
echo "pushed"
else
echo "用户选择不推送镜像"
fi
}
# 主流程
main() {
echo "打包中"
ensure_network
build_image base
build_image base-dm
build_image build-dmpython
build_image build-frontend
build_image flask-app
push_image
echo "脚本结束"
}
main
docker compose build
docker compose build build-dmpython
docker compose build build-frontend

23
docker-compose.yml Normal file → Executable file
View File

@ -1,14 +1,8 @@
services:
base:
build: ./docker/base
image: base
base-dm:
build: ./docker/base-dm
image: base-dm
depends_on:
- base
build-dmpython:
build: ./docker/build-dmpython
@ -34,3 +28,20 @@ services:
retries: 3
command: gunicorn -w 3 -t 60 -b 0.0.0.0:8000 app:app
nginx-proxy:
build: ./docker/nginx
restart: always
volumes:
- ./docker/nginx/default.conf:/tmp/default.conf
environment:
- FLASK_SERVER_ADDR=flask-app:8000
ports:
- "80:80"
depends_on:
- flask-app
healthcheck:
test: ["CMD-SHELL", "curl --silent --fail localhost:80/health-check || exit 1"]
interval: 10s
timeout: 10s
retries: 3
command: /app/start.sh

31
docker/base-dm/Dockerfile Normal file → Executable file
View File

@ -1,11 +1,31 @@
FROM base
FROM ubuntu
# apt安装时防止卡死在交互界面
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=zh_CN.UTF-8
ENV LC_ALL=zh_CN.UTF-8
# 基础软件安装
RUN sed -i 's@//.*archive.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list \
&& apt-get -y update && apt-get -y upgrade \
&& apt-get install -y python3.10-venv libssl-dev sudo vim python3-pip ssh wget unzip p7zip* language-pack-zh-hans language-selector-common locales locales-all \
# 设置中文环境
&& apt install -y $(check-language-support) \
&& echo "zh_CN.UTF-8 UTF-8" >> /etc/locale.gen \
&& sudo /usr/sbin/update-locale LANG=zh_CN.UTF-8 LC_ALL=zh_CN.UTF-8 \
&& locale-gen \
# 添加用户
RUN useradd -m -s /bin/bash dmdba \
&& useradd -m -s /bin/bash dmdba \
# 修改用户密码
&& echo "dmdba:123456" | chpasswd
WORKDIR /home/dmdba
&& echo "dmdba:123456" | chpasswd \
&& pip config set global.index-url https://mirrors.bfsu.edu.cn/pypi/web/simple \
&& echo "**** clean up ****" && \
apt-get clean && \
rm -rf \
/config/* \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/*
# 传入安装包并解压
WORKDIR /home/dmdba
RUN wget https://download.dameng.com/eco/adapter/DM8/202405/dm8_20240408_x86_rh7_64_ent_8.1.3.140.zip
RUN unzip dm8_20240408_x86_rh7_64_ent_8.1.3.140.zip \
&& chown -R dmdba:dmdba /home/dmdba \
@ -13,4 +33,3 @@ RUN unzip dm8_20240408_x86_rh7_64_ent_8.1.3.140.zip \
&& 7z x dm8_20240408_x86_rh7_64.iso \
&& rm -f dm8_20240408_x86_rh7_64.iso \
&& chmod +x DMInstall.bin
USER dmdba

View File

@ -1,22 +0,0 @@
FROM ubuntu
# apt安装时防止卡死在交互界面
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=zh_CN.UTF-8
ENV LC_ALL=zh_CN.UTF-8
# 基础软件安装
RUN sed -i 's@//.*archive.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list \
&& apt-get -y update && apt-get -y upgrade \
&& apt-get install -y python3.10-venv libssl-dev sudo vim python3-pip ssh wget unzip p7zip* language-pack-zh-hans language-selector-common locales locales-all \
# 设置中文环境
&& apt install -y $(check-language-support) \
&& echo "zh_CN.UTF-8 UTF-8" >> /etc/locale.gen \
&& sudo /usr/sbin/update-locale LANG=zh_CN.UTF-8 LC_ALL=zh_CN.UTF-8 \
&& locale-gen \
&& pip config set global.index-url https://mirrors.bfsu.edu.cn/pypi/web/simple \
&& echo "**** clean up ****" && \
apt-get clean && \
rm -rf \
/config/* \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/*

0
docker/build-dmpython/Dockerfile Normal file → Executable file
View File

2
docker/build-dmpython/auto_install.xml Normal file → Executable file
View File

@ -115,7 +115,7 @@
</DB_PARAMS>
<!--是否创建数据库实例的服务,取值范围: Y/N y/n不允许为空不初始化数据库将忽略此节点。非root用户不能创建数据库服务。 -->
<CREATE_DB_SERVICE>N</CREATE_DB_SERVICE>
<CREATE_DB_SERVICE>Y</CREATE_DB_SERVICE>
<!--是否启动数据库,取值范围: Y/N y/n不允许为空不创建数据库服务将忽略此节点。 -->
<STARTUP_DB_SERVICE>N</STARTUP_DB_SERVICE>

0
docker/code-server/.editorconfig Normal file → Executable file
View File

0
docker/code-server/LICENSE Normal file → Executable file
View File

0
docker/code-server/package_versions.txt Normal file → Executable file
View File

View File

View File

View File

0
docker/nginx/Dockerfile Normal file → Executable file
View File

0
docker/nginx/default.conf Normal file → Executable file
View File

0
docker/nginx/nginx.conf Normal file → Executable file
View File

0
docker/nginx/start.sh Normal file → Executable file
View File

0
docker/ssh-server/Dockerfile Normal file → Executable file
View File

24
python/Dockerfile Normal file → Executable file
View File

@ -1,13 +1,13 @@
FROM base
FROM base-dm
# 升级pip
RUN pip install --upgrade pip
# 创建一个用户运行flask
RUN adduser flask && \
chown -R flask:flask /home/flask && \
mkdir -p /var/log/flask-app && touch /var/log/flask-app/flask-app.err.log && touch /var/log/flask-app/flask-app.out.log && \
chown -R flask:flask /var/log/flask-app
RUN adduser flask
RUN chown -R flask:flask /home/flask
RUN mkdir -p /var/log/flask-app && touch /var/log/flask-app/flask-app.err.log && touch /var/log/flask-app/flask-app.out.log
RUN chown -R flask:flask /var/log/flask-app
WORKDIR /home/flask
USER flask
@ -16,18 +16,18 @@ COPY --chown=flask:flask . .
# venv
ENV VIRTUAL_ENV=/home/flask/venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# 安装包
RUN python3 -m venv "$VIRTUAL_ENV"
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN export FLASK_APP=main.py
COPY --from=build-dmpython --chown=flask:flask /home/dmdba/build_artifacts/dmPython-2.5.5-cp310-cp310-linux_x86_64.whl .
RUN python3 -m venv "$VIRTUAL_ENV" && \
export FLASK_APP=app.py && \
pip3 install dmPython-2.5.5-cp310-cp310-linux_x86_64.whl && rm dmPython-2.5.5-cp310-cp310-linux_x86_64.whl && \
MAKEFLAGS="-j$(nproc)" pip install -r requirements.txt
COPY --from=build-dmpython /home/dmdba/build_artifacts/libdmdpi.so /usr/lib/
COPY --from=build-frontend /usr/src/app/build/ /home/flask/public/
RUN pip3 install dmPython-2.5.5-cp310-cp310-linux_x86_64.whl && rm dmPython-2.5.5-cp310-cp310-linux_x86_64.whl
RUN MAKEFLAGS="-j$(nproc)" pip install -r requirements.txt
USER root
# 暴露端口
EXPOSE 5000
CMD ["gunicorn", "-w", "3", "-t", "60", "-b", "0.0.0.0:8000", "app:app"]
CMD ["python", "main.py"]

36
python/app.py Normal file → Executable file
View File

@ -8,7 +8,7 @@ CORS(app, resources={r"/*": {"origins": "*"}})
app.config['SECRET_KEY'] = '350625'
@app.route('/api/student', methods=['POST']) # 检测历史是否登录过登录则直接进入index反之则进去login界面
@app.route('/student', methods=['POST']) # 检测历史是否登录过登录则直接进入index反之则进去login界面
def student(): # 判断是否已经登录
ID_data = request.json
ID = ID_data['student_ID']
@ -17,7 +17,7 @@ def student(): # 判断是否已经登录
return jsonify({'student_succeed': student_succeed, 'student_lesson': student_lesson})
@app.route('/api/login', methods=['POST']) # 登录功能
@app.route('/login', methods=['POST']) # 登录功能
def login():
login_data = request.json # 获取前端发送过来的数据
ID = login_data['ID'] # 解析数据
@ -65,7 +65,7 @@ def login():
# postman
@app.route('/api/logout', methods=['POST']) # 退出登录功能
@app.route('/logout', methods=['POST']) # 退出登录功能
def logout(): # 退出登录
ID = session['id']
print(ID)
@ -73,7 +73,7 @@ def logout(): # 退出登录
return jsonify({'result': '注销成功'})
@app.route('/api/register', methods=['POST']) # 注册功能实现
@app.route('/register', methods=['POST']) # 注册功能实现
def register():
register_data = request.json # 获取前端发送过来的数据
name = register_data['name']
@ -88,7 +88,7 @@ def register():
return jsonify({'result': '注册成功'})
@app.route('/api/student/get_lesson', methods=['GET'])
@app.route('/student/get_lesson', methods=['GET'])
def get_lesson(): # 获取课程
student_id = session.get('id')
student_lesson = get_lesson_func(student_id)
@ -97,27 +97,27 @@ def get_lesson(): # 获取课程
# 学生获取试卷
@app.route('/api/student/get_test', methods=['POST'])
@app.route('/student/get_test', methods=['POST'])
def get_test(): # 获取试卷以及历史试卷
data = request.json
ID = data['student_ID']
return jsonify({"data": fetch_test_func(ID)})
@app.route('/api/student/fetch_result', methods=['POST']) # 查找成绩
@app.route('/student/fetch_result', methods=['POST']) # 查找成绩
def fetch_result():
data = request.json
ID = data['student_ID']
return jsonify({'result': fetch_result_func(ID)})
@app.route('/api/student/get_end_student', methods=['POST'])
@app.route('/student/get_end_student', methods=['POST'])
def get_end_student():
data = request.json
ID = data['student_ID']
return jsonify({'result': find_end_test(ID)})
@app.route('/api/student/score_entry', methods=['POST'])
@app.route('/student/score_entry', methods=['POST'])
def score_entry():
data = request.json
ID = data['student_ID']
@ -138,7 +138,7 @@ def FetchTrainTitle():
# 以下为教师功能—————————————————————————————————————————————————————————————————————
@app.route('/api/teacher/return_question', methods=['POST'])
@app.route('/teacher/return_question', methods=['POST'])
def return_question():
data = request.json
ID = data['teacher_ID']
@ -148,7 +148,7 @@ def return_question():
return jsonify({'选择': choice_question, '填空': completion_question, '判断': t_or_f_question})
@app.route('/api/teacher/select_class', methods=['POST'])
@app.route('/teacher/select_class', methods=['POST'])
def select_class(): # 查找每个老师管理的班级 以及在考试管理查找默认班级
teacher_id = request.json['teacher_ID']
# testID =request.json['testID']
@ -157,23 +157,23 @@ def select_class(): # 查找每个老师管理的班级 以及在考试管理
# print(testID)
return jsonify({'Class': class_dic,'default': find_default_class_func(default_class, teacher_id)})
@app.route('/api/teacher/change_class', methods=['POST'])
@app.route('/teacher/change_class', methods=['POST'])
def change_class(): # 查找每个老师管理的班级 以及在考试管理查找默认班级
teacher_id = request.json['teacher_ID']
ClassID=request.json['selectedValue']
return jsonify({'default': find_default_class_func(ClassID,teacher_id)})
@app.route('/api/teacher/detaileddata', methods=['POST'])
@app.route('/teacher/detaileddata', methods=['POST'])
def detaileddata():
data=request.json
ClassID=data['selectedValue']
testID=data['testID']
return jsonify({'data':detailed_class(testID,ClassID)})
@app.route('/api/teacher/', methods=['POST'])
@app.route('/teacher/', methods=['POST'])
def find_test():
return
@app.route('/api/teacher/find_student', methods=['POST'])
@app.route('/teacher/find_student', methods=['POST'])
def find_student(): # 获取班级学生的具体信息
student_list = []
Data = request.json
@ -184,7 +184,7 @@ def find_student(): # 获取班级学生的具体信息
return [student_succeed, student_list]
@app.route('/api/teacher/accept_test', methods=['POST']) # 在前端发布成功之后要存入数据库
@app.route('/teacher/accept_test', methods=['POST']) # 在前端发布成功之后要存入数据库
def accept_test():
data = request.json
choice_list = data['ChoiceQuestionSet']
@ -199,11 +199,11 @@ def accept_test():
print('添加成功')
return jsonify({'result': '发布成功'})
@app.route('/api/teacher/fetch_train_question',methods=["POST"])
@app.route('/teacher/fetch_train_question',methods=["POST"])
def fetch_train_question():
return train_question()
@app.route('/api/teacher/SendTrainTest',methods=["POST"])
@app.route('/teacher/SendTrainTest',methods=["POST"])
def SendTrainTest():
data=request.json
TrainChoice=data['TrainChoice']

0
python/requirements.txt Normal file → Executable file
View File

Some files were not shown because too many files have changed in this diff Show More