{%- macro show_lesson_list(chapter) %} {%- endmacro %} {%- macro vod_lesson_info(lesson) %}
{{ lesson.title }} {% if lesson.me.duration > 0 %} {% endif %} {% if lesson.me.owned == 0 %} {% endif %} {% if lesson.free == 1 %} 试听 {% endif %}
{{ lesson.attrs.duration|duration }}
{%- endmacro %} {%- macro live_lesson_info(lesson) %}
{{ lesson.title }} {% if lesson.me.duration > 0 %} {% endif %} {% if lesson.me.owned == 0 %} {% endif %} {% if lesson.attrs.playback.ready == 1 %} 回放 {% endif %} {% if lesson.free == 1 %} 试听 {% endif %}
{{ live_status_info(lesson) }} {{ date('Y-m-d H:i',lesson.attrs.start_time) }}
{%- endmacro %} {%- macro read_lesson_info(lesson) %}
{{ lesson.title }} {% if lesson.me.duration > 0 %} {% endif %} {% if lesson.me.owned == 0 %} {% endif %} {% if lesson.free == 1 %} 试读 {% endif %}
{%- endmacro %} {%- macro offline_lesson_info(lesson) %}
{{ lesson.title }} {% if lesson.me.owned == 0 %} {% endif %} {% if lesson.free == 1 %} 试听 {% endif %}
{{ offline_status_info(lesson) }} {{ date('Y-m-d H:i',lesson.attrs.start_time) }}
{%- endmacro %} {%- macro live_status_info(lesson) %} {% if lesson.attrs.stream.status == 'active' %} 直播中 {% elseif lesson.attrs.start_time > time() %} 倒计时 {% elseif lesson.attrs.end_time < time() %} 已结束 {% elseif lesson.attrs.stream.status == 'inactive' %} 未推流 {% endif %} {%- endmacro %} {%- macro offline_status_info(lesson) %} {% if lesson.attrs.start_time < time() and lesson.attrs.end_time > time() %} 授课中 {% elseif lesson.attrs.start_time > time() %} 未开始 {% elseif lesson.attrs.end_time < time() %} 已结束 {% endif %} {%- endmacro %} {% set show_all = course.lesson_count < 30 %} {% if chapters|length > 0 %} {% if chapters|length > 1 %}
{% for chapter in chapters %} {% set show_class = (show_all or loop.first) ? 'layui-show' : '' %}

{{ chapter.title }}

{{ show_lesson_list(chapter) }}
{% endfor %}
{% else %} {{ show_lesson_list(chapters[0]) }} {% endif %} {% endif %}