{% extends "base.html" %} {% block title %}Canvas · 西湖生存手册{% endblock %} {% block content %}

Canvas

{% if error %}
Canvas 数据不可用:{{ error }}(令牌或统一凭据,及校园网)
{% endif %} {# —— 概览数字条 —— #}
在修课程
{{ courses | length }}
{% set scored = grades | selectattr('current_score', 'ne', none) | list if grades is defined else [] %} {% set avg = (scored | map(attribute='current_score') | list | sum / scored | length) | round(1) if scored else none %} {% if avg is not none %}
当前均分
{{ avg }}
{% endif %}
未来截止
{{ deadlines | length }}
考试
{{ exams | length }}
测验
{{ quizzes | length }}
最新公告
{{ announcements | length if announcements is defined else 0 }} 条
待办
{{ todo | length if todo is defined else 0 }}
{# 旧锚点导航已由全局自动目录替代(2026-10-25) #}
{% if grades is defined and grades %}

课程成绩({{ grades | length }} 门)

当前分随老师发布评分实时更新;未发布的课程显示「未发布」。
{% for g in grades %}{% endfor %}
课程当前分当前等级最终分
{{ g.name | replace('|', ' · ') }}{% if g.term_name %} {{ g.term_name }}{% endif %} {% if g.current_score is not none %}{{ g.current_score }}{% else %}未发布{% endif %} {{ g.current_grade or '—' }} {% if g.final_score is not none %}{{ g.final_score }}{% else %}—{% endif %}
{% elif not error %}

课程成绩

成绩数据不可用或全部未发布。
{% endif %}

未来截止({{ deadlines | length }})

{% if deadlines %} {% for d in deadlines %}{% endfor %}
作业课程截止链接
{{ d.title }}{{ d.course }}{{ d.due }}打开
{% elif not error %}
暂无未来截止。
{% endif %}

考试({{ exams | length }})

{% if exams %} {% for e in exams %}{% endfor %}
考试开始链接
{{ e.title }}{{ e.start }}打开
{% elif not error %}
暂无已排期考试。
{% endif %}

测验({{ quizzes | length }})

{% if quizzes %} {% for q in quizzes %}{% endfor %}
测验课程截止链接
{{ q.title }}{{ q.course }}{{ q.due }}打开
{% elif not error %}
暂无测验。
{% endif %}

最新公告

{% if announcements is defined and announcements %} {% for a in announcements %}{% endfor %}
课程公告发布链接
{{ a.course }}{{ a.title }}{{ a.posted }}打开
{% elif not error %}
近 6 门课程暂无公告。
{% endif %}

待办({{ todo | length if todo is defined else 0 }})

{% if todo is defined and todo %} {% for t in todo %}{% endfor %}
课程类型事项截止链接
{{ t.course }}{{ t.type }}{{ t.title }} {{ t.due or '—' }} {% if t.url %}打开{% else %}—{% endif %}
{% elif not error %}
暂无待办。
{% endif %}

课程内容(模块 / 文件 / 讨论)

{% if course_content is defined and course_content %} {% for c in course_content %}
{{ c.name }}{{ c.modules | length }} 模块 · {{ c.files | length }} 文件{% if c.discussions %} · {{ c.discussions | length }} 讨论{% endif %}
{% for m in c.modules %}
模块 {{ loop.index }}:{{ m.name }}({{ m.count }} 项)
{% if m['items'] %} {% for it in m['items'] %}{% endfor %}
条目类型链接
{{ it.title }}{{ it.type }}{% if it.url %}打开{% else %}—{% endif %}
{% endif %} {% endfor %} {% if c.files %} {% for f in c.files %}{% endfor %}
文件大小下载
{{ f.name }}{{ (f.size / 1024) | round(0) | int }} KB{% if f.url %}下载{% else %}—{% endif %}
{% endif %} {% if c.discussions %} {% for d in c.discussions %}{% endfor %}
讨论未读回复链接
{{ d.title }}{{ d.unread }}{{ d.replies }}打开
{% endif %}
{% endfor %} {% elif not error %}
未获取到课程内容。
{% endif %}

在修课程({{ courses | length }})

{% if courses %}
{% for c in courses %}
{{ c.name | replace('|', ' · ') }}
{{ c.code }}
{% endfor %}
{% elif not error %}
未获取到在修课程。
{% endif %}
{% endblock %} {% block scripts %} {% endblock %}