lichong 9 months ago
parent
commit
97b604612d
  1. 31
      api/main.py
  2. 2
      front/vite.config.js

31
api/main.py

@ -7,6 +7,36 @@ db = client["back"]
collection = db["users"]
# 初始化数据
def initData():
isAdmin = collection.find_one({"isAdmin": 1, "isExit": 1})
if isAdmin is None:
# 学校名称、学校代号、专业名称、专业代号、年级、班级、学生姓名、学号、成绩、作弊情况(作弊类型、作弊时间、作弊图片)、考试类型、考试科目、考试时间段、是否是管理员、是否删除、创建时间、更新时间
# xuexiaomingcheng、xuexiaodaihao、zhuanyemingcheng、zhuanyedaihao、nianji、banji、xueshengxingming、xuehao、chengji、zuobiqingkuang(zuobileixing、zuobishijian、zuobitupian)、kaoshileixing、kaoshikemu、kaoshishijianduan、isAdmin、isExit、chuangjianshijian、gengxinshijian
user = {
"xuexiaomingcheng": "",
"xuexiaodaihao": "",
"zhuanyemingcheng": "",
"zhuanyedaihao": "",
"nianji": "",
"banji": "",
"xueshengxingming": "老师",
"xuehao": "0000",
"chengji": "",
"zuobiqingkuang": [],
"kaoshileixing": "",
"kaoshikemu": "",
"kaoshishijianduan": "",
"isAdmin": 1,
"isExit": 1,
"chuangjianshijian": "",
"gengxinshijian": "",
}
collection.insert_one(user)
else:
print(888, isAdmin)
# 测试
@app.route("/")
def hello():
@ -49,4 +79,5 @@ def delete_data():
if __name__ == "__main__":
initData()
app.run()

2
front/vite.config.js

@ -30,7 +30,7 @@ export default defineConfig({
port: 3000,
proxy: {
"/v1": {
target: "http://127.0.0.1:7001/v1",
target: "http://127.0.0.1:5000/v1",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/v1/, ""),
},

Loading…
Cancel
Save