diff --git a/app/Http/Home/Views/chapter/catalog.volt b/app/Http/Home/Views/chapter/catalog.volt
index 1f31f6c5..edf3dd3c 100644
--- a/app/Http/Home/Views/chapter/catalog.volt
+++ b/app/Http/Home/Views/chapter/catalog.volt
@@ -1,35 +1,45 @@
+{%- macro model_icon(model) %}
+ {% if model == 1 %}
+
+ {% elseif model == 2 %}
+
+ {% elseif model == 3 %}
+
+ {% elseif model == 4 %}
+
+ {% endif %}
+{%- endmacro %}
+
+
{%- macro show_lesson_list(parent,chapter) %}
{%- endmacro %}
-
diff --git a/app/Http/Home/Views/chapter/live/active.volt b/app/Http/Home/Views/chapter/live/active.volt
index 393d7e69..360f14b5 100644
--- a/app/Http/Home/Views/chapter/live/active.volt
+++ b/app/Http/Home/Views/chapter/live/active.volt
@@ -35,11 +35,7 @@
-
+
+
{{ lesson.title }}
- {% if lesson.free == 1 %}
- 试听
+ {% if lesson.me.owned == 0 %}
+
{% endif %}
- {{ offline_status_info(lesson) }}
-
+ {% 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' %}
- {{ date('m月d日 H:i',lesson.attrs.start_time) }} 直播中
+ 直播中
{% elseif lesson.attrs.start_time > time() %}
- {{ date('m月d日 H:i',lesson.attrs.start_time) }} 倒计时
+ 倒计时
{% elseif lesson.attrs.end_time < time() %}
- {{ date('m月d日 H:i',lesson.attrs.start_time) }} 已结束
+ 已结束
{% endif %}
{%- endmacro %}
{%- macro offline_status_info(lesson) %}
{% if lesson.attrs.start_time < time() and lesson.attrs.end_time > time() %}
- {{ date('m月d日 H:i',lesson.attrs.start_time) }} 授课中
+ 授课中
{% elseif lesson.attrs.start_time > time() %}
- {{ date('m月d日 H:i',lesson.attrs.start_time) }} 未开始
+ 未开始
{% elseif lesson.attrs.end_time < time() %}
- {{ date('m月d日 H:i',lesson.attrs.start_time) }} 已结束
+ 已结束
{% endif %}
{%- endmacro %}
@@ -119,4 +132,4 @@
{% else %}
{{ show_lesson_list(chapters[0]) }}
{% endif %}
-{% endif %}
\ No newline at end of file
+{% endif %}
diff --git a/app/Http/Home/Views/course/sticky.volt b/app/Http/Home/Views/course/sticky.volt
index 8cc9e637..773f1e99 100644
--- a/app/Http/Home/Views/course/sticky.volt
+++ b/app/Http/Home/Views/course/sticky.volt
@@ -26,8 +26,8 @@
{% endif %}
-
\ No newline at end of file
+
diff --git a/app/Services/Logic/Course/ChapterList.php b/app/Services/Logic/Course/ChapterList.php
index 3d23dae9..feee57ac 100644
--- a/app/Services/Logic/Course/ChapterList.php
+++ b/app/Services/Logic/Course/ChapterList.php
@@ -39,10 +39,10 @@ class ChapterList extends LogicService
if (count($chapters) == 0) return [];
- if ($user->id > 0 && $this->courseUser) {
+ if ($user->id > 0) {
$chapters = $this->handleLoginUserChapters($chapters, $course, $user);
} else {
- $chapters = $this->handleGuestUserChapters($chapters);
+ $chapters = $this->handleGuestUserChapters($chapters, $course);
}
return $chapters;
@@ -50,7 +50,11 @@ class ChapterList extends LogicService
protected function handleLoginUserChapters(array $chapters, CourseModel $course, UserModel $user)
{
- $mappings = $this->getLearningMappings($course->id, $user->id, $this->courseUser->plan_id);
+ $mappings = [];
+
+ if ($this->courseUser) {
+ $mappings = $this->getLearningMappings($course->id, $user->id, $this->courseUser->plan_id);
+ }
foreach ($chapters as &$chapter) {
foreach ($chapter['children'] as &$lesson) {
@@ -61,23 +65,30 @@ class ChapterList extends LogicService
'owned' => $owned ? 1 : 0,
'logged' => 1,
];
+ // 如果课程是免费的,但又设置了课时试听,清除试听标识
+ if ($course->market_price == 0 && $lesson['free'] == 1) {
+ $lesson['free'] = 0;
+ }
}
}
return $chapters;
}
- protected function handleGuestUserChapters(array $chapters)
+ protected function handleGuestUserChapters(array $chapters, CourseModel $course)
{
foreach ($chapters as &$chapter) {
foreach ($chapter['children'] as &$lesson) {
- $owned = ($this->ownedCourse || $lesson['free'] == 1) && $lesson['published'] == 1;
$lesson['me'] = [
'progress' => 0,
'duration' => 0,
'logged' => 0,
- 'owned' => $owned ? 1 : 0,
+ 'owned' => 0,
];
+ // 如果课程是免费的,但又设置了课时试听,清除试听标识
+ if ($course->market_price == 0 && $lesson['free'] == 1) {
+ $lesson['free'] = 0;
+ }
}
}
diff --git a/app/Services/Logic/Course/CourseInfo.php b/app/Services/Logic/Course/CourseInfo.php
index 518755fd..5714b7aa 100644
--- a/app/Services/Logic/Course/CourseInfo.php
+++ b/app/Services/Logic/Course/CourseInfo.php
@@ -100,7 +100,7 @@ class CourseInfo extends LogicService
if ($this->courseUser) {
$me['reviewed'] = $this->courseUser->reviewed ? 1 : 0;
- $me['progress'] = $this->courseUser->progress ? 1 : 0;
+ $me['progress'] = $this->courseUser->progress;
$me['plan_id'] = $this->courseUser->plan_id;
}
}
diff --git a/public/static/home/css/common.css b/public/static/home/css/common.css
index 09b01224..224d38fa 100644
--- a/public/static/home/css/common.css
+++ b/public/static/home/css/common.css
@@ -1039,50 +1039,73 @@
font-size: 30px;
}
-.lesson-item {
- position: relative;
- padding: 0 10px;
- line-height: 35px;
+.lesson-list .allow {
+ cursor: pointer;
}
-.lesson-item a {
- display: block;
-}
-
-.lesson-item .deny {
+.lesson-list .deny {
cursor: default;
- color: gray;
}
-.lesson-item .title {
- margin: 0 5px;
-}
-
-.lesson-item .icon-trial {
- color: red;
- font-size: 24px;
- margin-right: 5px;
-}
-
-.lesson-item .duration, .lesson-item .live {
- top: 0;
- right: 10px;
- position: absolute;
- color: #666;
-}
-
-.lesson-item .live .active {
- color: red;
-}
-
-.lesson-item .study-time {
- color: green;
+.lesson-item {
+ display: flex;
+ justify-content: space-between;
+ line-height: 35px;
+ padding: 0 10px;
}
.lesson-item:hover {
background-color: #f2f2f2;
}
+.lesson-item .title {
+ margin-right: 5px;
+}
+
+.lesson-item .model {
+ margin-right: 5px;
+}
+
+.lesson-item .lock {
+ margin-right: 5px;
+}
+
+.lesson-item .study-time {
+ margin-right: 5px;
+ color: green;
+}
+
+.lesson-item .flag {
+ padding: 2px 3px;
+ margin-right: 5px;
+ font-size: 12px;
+}
+
+.lesson-item .flag-free {
+ border: 1px solid red;
+ color: red;
+}
+
+.lesson-item .flag-playback {
+ border: 1px solid orange;
+ color: orange;
+}
+
+.lesson-item .flag-pending {
+ border: 1px solid green;
+ color: green;
+}
+
+.lesson-item .flag-active {
+ border: 1px solid red;
+ color: red;
+}
+
+.lesson-item .flag-finished {
+ border: 1px solid gray;
+ color: gray;
+}
+
.package-item {
display: flex;
margin-bottom: 20px;
@@ -1173,15 +1196,13 @@
white-space: normal;
}
-.review-card,
-.consult-card,
-.answer-card {
+.review-card .info,
+.consult-card .info {
position: relative;
}
.review-card .rating,
-.consult-card .more,
-.answer-card .accepted {
+.consult-card .more {
position: absolute;
top: 0;
right: 0;
@@ -1205,11 +1226,6 @@
font-size: 12px;
}
-.review-card .more {
- color: #666;
- cursor: pointer;
-}
-
.sidebar-card .layui-card-header {
text-align: center;
}
@@ -1305,25 +1321,30 @@
overflow-y: auto;
}
-.sidebar-chapter-list .chapter-title {
+ .sidebar-chapter {
padding-top: 10px;
margin-bottom: 10px;
color: #333;
}
-.sidebar-lesson-list {
- margin-left: 10px;
-}
-
-.sidebar-lesson-list .lesson-title {
+.sidebar-lesson {
+ padding: 0 10px;
line-height: 30px;
}
-.lesson-title .active {
+.sidebar-lesson:hover {
+ background-color: #f2f2f2;
+}
+
+.sidebar-lesson a {
+ display: block;
+}
+
+.sidebar-lesson .active {
color: red;
}
-.lesson-title .deny {
+.sidebar-lesson .deny {
color: gray;
}
diff --git a/public/static/home/js/course.show.js b/public/static/home/js/course.show.js
index 67a0097e..749d4a18 100644
--- a/public/static/home/js/course.show.js
+++ b/public/static/home/js/course.show.js
@@ -62,7 +62,7 @@ layui.use(['jquery', 'layer', 'helper'], function () {
/**
* 浏览章节
*/
- $('body').on('click', '.view-lesson', function () {
+ $('body').on('click', '.lesson-item', function () {
if ($(this).hasClass('deny')) {
return false;
}
@@ -140,4 +140,4 @@ layui.use(['jquery', 'layer', 'helper'], function () {
helper.ajaxLoadHtml($sdRelated.data('url'), $sdRelated.attr('id'));
}
-});
\ No newline at end of file
+});