学生端选课进课闭环
This commit is contained in:
@@ -5,8 +5,8 @@ from ..services.backboard_service import realtime_response
|
||||
|
||||
bp = Blueprint("vscode", __name__)
|
||||
|
||||
@bp.route("/desktop/<user_uuid>/<course_id>/<chapter_id>")
|
||||
def desktop(user_uuid, course_id, chapter_id):
|
||||
@bp.route("/desktop/<user_uuid>/<course_id>/<chapter_name>/<lesson_name>")
|
||||
def desktop(user_uuid, course_id, chapter_name, lesson_name):
|
||||
username2uuid = current_app.extensions["username2uuid"]
|
||||
uuid2username = current_app.extensions["uuid2username"]
|
||||
userid_recorder = current_app.extensions["userid_recorder"]
|
||||
@@ -23,7 +23,7 @@ def desktop(user_uuid, course_id, chapter_id):
|
||||
|
||||
# 按课程/章节创建工作目录
|
||||
base_root = current_app.config["STUDENT_WORKSPACE_ROOT"]
|
||||
path_dir = os.path.join(base_root, user_id, course_id, chapter_id)
|
||||
path_dir = os.path.join(base_root, user_id, course_id, chapter_name)
|
||||
os.makedirs(path_dir, exist_ok=True)
|
||||
|
||||
# 写 .config(并按需要转换为 WSL 路径)
|
||||
@@ -37,7 +37,8 @@ def desktop(user_uuid, course_id, chapter_id):
|
||||
tmpd = {
|
||||
"user_uuid": session["user_uuid"],
|
||||
"course_id": course_id,
|
||||
"chapter_id": chapter_id,
|
||||
"chapter_name": chapter_name,
|
||||
"lesson_name": lesson_name,
|
||||
"path": path_for_vscode
|
||||
}
|
||||
with open(config_path, "w", encoding="utf-8") as f:
|
||||
@@ -48,16 +49,16 @@ def desktop(user_uuid, course_id, chapter_id):
|
||||
return render_template(
|
||||
"desktop.html",
|
||||
vscode_web_url=current_app.config["VSCODE_WEB_URL"],
|
||||
user_uuid=session["user_uuid"], course_id=course_id, chapter_id=chapter_id,
|
||||
workspace_path=path_for_vscode
|
||||
user_uuid=session["user_uuid"], course_id=course_id, chapter_name=chapter_name, lesson_name=lesson_name,
|
||||
workspace_path=path_for_vscode,
|
||||
)
|
||||
|
||||
@bp.route("/desktop_nouser/<course_id>/<chapter_id>")
|
||||
def desktop_nouser(course_id, chapter_id):
|
||||
@bp.route("/desktop_nouser/<course_id>/<chapter_name>/<lesson_name>")
|
||||
def desktop_nouser(course_id, chapter_name, lesson_name):
|
||||
if "user_uuid" not in session:
|
||||
return redirect(url_for("auth.login")) # 如果你有 auth 蓝图
|
||||
user_uuid = session["user_uuid"]
|
||||
return redirect(url_for("vscode.desktop", user_uuid=user_uuid, course_id=course_id, chapter_id=chapter_id))
|
||||
return redirect(url_for("vscode.desktop", user_uuid=user_uuid, course_id=course_id, chapter_name=chapter_name, lesson_name=lesson_name))
|
||||
|
||||
@bp.route("/vscode_data", methods=["POST"])
|
||||
def vscode_data():
|
||||
|
||||
Reference in New Issue
Block a user