推荐使用uv工具 运行 uv sync 或者直接用pip install Requests BeautifulSoup4 PyExecJS FastAPI uvicorn
Requests 发送http请求 BeautifulSoup4 解析html,方便获取页面内容 PyExecJS 运行js FastAPI 框架搭建后端服务器服务 uvicorn 运行FastAPI服务器
Node.js 环境 // 运行encry.js,(post)login 发送加密后的密码需要
测试: 运行 main.py
curl -i -X POST http://127.0.0.1:8000/api/login
-H "Content-Type: application/json"
-d '{"username":"","password":""}'
替换username,password字段(教务系统的帐号密码),发送登录请求
如果登录成功,测试/api/schedule 无参时返回当前周的课表 curl -i -X GET http://127.0.0.1:8000/api/schedule 有参时写法 curl -i -X GET http://127.0.0.1:8000/api/schedule?monday=2025-12-08&sunday=2025-12-14
前端点击登录按钮,通过wx.request向后端http://127.0.0.1:8000/api/login发送post请求,带json数据{username="",password=""} 对接收的js信息进行判断 if success wx.navigateTo({url: '/pages/index/index'}) else wx.showToast({title: '登录失败'})
schedule页面加载时向后端发送请求
页面效果
- 登录 随便做
- 课程表 参考微信学工系统的效果,可照抄https://bsdt.qust.edu.cn/personal-center页面实现
- 作息表 不用后端,数据写死,加个下拉菜单选夏、冬季
- 我的: 姓名