From 97b604612db0f8ebcfa7360aecc2bd87ffe2c73d Mon Sep 17 00:00:00 2001 From: lichong <18518571399@163.com> Date: Thu, 4 Jul 2024 18:37:13 +0800 Subject: [PATCH] 123 --- api/main.py | 31 +++++++++++++++++++++++++++++++ front/vite.config.js | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/api/main.py b/api/main.py index 0b11773..71c028d 100644 --- a/api/main.py +++ b/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() diff --git a/front/vite.config.js b/front/vite.config.js index 9b3758c..0ad8ed9 100644 --- a/front/vite.config.js +++ b/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/, ""), },