1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-26 20:52:44 +08:00

1.优化章节列表UI

2.优化评价UI
This commit is contained in:
xiaochong0302 2025-04-11 21:33:54 +08:00
parent e5869e1e8f
commit 328aea1e2d
6 changed files with 99 additions and 57 deletions

View File

@ -10,18 +10,17 @@
{% endif %}
{%- endmacro %}
{%- macro show_lesson_list(parent,chapter) %}
<ul class="sidebar-lesson-list">
{% for lesson in parent.children %}
{% set url = url({'for':'home.chapter.show','id':lesson.id}) %}
{% set active = (chapter.id == lesson.id) ? 'active' : 'normal' %}
<li class="sidebar-lesson layui-elip">
{% if lesson.me.owned == 1 %}
<a class="{{ active }}" href="{{ url }}" title="{{ lesson.title }}">{{ model_icon(lesson.model) }} {{ lesson.title }}</a>
{% else %}
<span class="deny" title="{{ lesson.title }}">{{ model_icon(lesson.model) }} {{ lesson.title }}</span>
<i class="iconfont icon-lock"></i>
{% set active = chapter.id == lesson.id ? 'active' : 'normal' %}
{% set priv = lesson.me.owned == 1 ? 'allow' : 'deny' %}
<li class="sidebar-lesson layui-elip {{ priv }} {{ active }}" data-url="{{ url }}">
<span class="model">{{ model_icon(lesson.model) }}</span>
<span class="title" title="{{ lesson.title }}">{{ lesson.title }}</span>
{% if lesson.me.owned == 0 %}
<span class="lock"><i class="iconfont icon-lock"></i></span>
{% endif %}
</li>
{% endfor %}

View File

@ -100,7 +100,7 @@
{% elseif lesson.attrs.start_time > time() %}
<span class="flag flag-pending">倒计时</span>
{% elseif lesson.attrs.end_time < time() %}
<span class="flag flag-finished">已结束</span>
<span class="flag flag-ended">已结束</span>
{% endif %}
{%- endmacro %}
@ -110,7 +110,7 @@
{% elseif lesson.attrs.start_time > time() %}
<span class="flag flag-pending">未开始</span>
{% elseif lesson.attrs.end_time < time() %}
<span class="flag flag-finished">已结束</span>
<span class="flag flag-ended">已结束</span>
{% endif %}
{%- endmacro %}

View File

@ -105,21 +105,21 @@
{{ offline_meta_info(course) }}
{% endif %}
</div>
<div class="rating">
<div class="ratings">
<p class="item">
<span class="name">内容实用</span>
<span class="star">{{ star_info(course.ratings.rating1) }}</span>
<span class="star" id="rating1" data-value="{{ course.ratings.rating1 }}"></span>
<span class="score">{{ "%0.1f"|format(course.ratings.rating1) }} 分</span>
</p>
<p class="item">
<span class="name">简洁易懂</span>
<span class="star">{{ star_info(course.ratings.rating2) }}</span>
<span class="star" id="rating2" data-value="{{ course.ratings.rating2 }}"></span>
<span class="score">{{ "%0.1f"|format(course.ratings.rating2) }} 分</span>
</p>
<p class="item">
<span class="name">逻辑清晰</span>
<span class="star">{{ star_info(course.ratings.rating3) }}</span>
<span class="star" id="rating3" data-value="{{ course.ratings.rating3 }}"></span>
<span class="score">{{ "%0.1f"|format(course.ratings.rating3) }} 分</span>
</p>
</div>
</div>
</div>

View File

@ -958,11 +958,7 @@
padding-top: 5px;
}
.course-meta .rating {
padding-top: 20px;
}
.course-meta p {
.course-meta .info .meta {
line-height: 35px;
}
@ -977,6 +973,10 @@
right: 15px;
}
.course-meta .info .item {
line-height: 35px;
}
.course-meta .info .key {
margin-right: 5px;
}
@ -990,23 +990,32 @@
color: red;
}
.course-meta .info .origin-price {
text-decoration: line-through;
}
.course-meta .info .free {
color: green;
}
.course-meta .rating span {
.course-meta .ratings {
padding-top: 5px;
}
.course-meta .ratings .item {
line-height: 40px;
}
.course-meta .ratings .name {
margin-right: 5px;
}
.course-meta .rating .layui-icon {
color: orange;
.course-meta .ratings .layui-rate {
padding: 0;
margin-top: -8px;
}
.course-meta .rating .score {
.course-meta .ratings .layui-icon {
font-size: 16px;
}
.course-meta .ratings .score {
color: #666;
}
@ -1101,7 +1110,7 @@
color: red;
}
.lesson-item .flag-finished {
.lesson-item .flag-ended {
border: 1px solid gray;
color: gray;
}
@ -1321,9 +1330,23 @@
overflow-y: auto;
}
.sidebar-chapter {
.sidebar-lesson-list .active {
color: red;
}
.sidebar-lesson-list .allow {
cursor: pointer;
}
.sidebar-lesson-list .deny {
cursor: default;
color: gray;
}
.sidebar-chapter {
padding-top: 10px;
margin-bottom: 10px;
font-weight: 600;
color: #333;
}
@ -1336,18 +1359,6 @@
background-color: #f2f2f2;
}
.sidebar-lesson a {
display: block;
}
.sidebar-lesson .active {
color: red;
}
.sidebar-lesson .deny {
color: gray;
}
.share .layui-icon {
margin-right: 5px;
cursor: pointer;

View File

@ -3,12 +3,6 @@ layui.use(['jquery', 'helper'], function () {
var $ = layui.jquery;
var helper = layui.helper;
var $commentList = $('#comment-list');
if ($commentList.length > 0) {
helper.ajaxLoadHtml($commentList.data('url'), $commentList.attr('id'));
}
$('.icon-praise').on('click', function () {
var $this = $(this);
var $parent = $this.parent();
@ -34,8 +28,24 @@ layui.use(['jquery', 'helper'], function () {
});
});
$('.sidebar-lesson').on('click', function () {
if ($(this).hasClass('deny')) {
return false;
}
var url = $(this).data('url');
helper.checkLogin(function () {
window.location.href = url;
});
});
$('.icon-reply').on('click', function () {
$('html').scrollTop($('#comment-anchor').offset().top);
});
});
var $commentList = $('#comment-list');
if ($commentList.length > 0) {
helper.ajaxLoadHtml($commentList.data('url'), $commentList.attr('id'));
}
});

View File

@ -1,9 +1,31 @@
layui.use(['jquery', 'layer', 'helper'], function () {
layui.use(['jquery', 'layer', 'rate', 'helper'], function () {
var $ = layui.jquery;
var layer = layui.layer;
var rate = layui.rate;
var helper = layui.helper;
rate.render({
elem: '#rating1',
value: $('#rating1').data('value'),
readonly: true,
half: true,
});
rate.render({
elem: '#rating2',
value: $('#rating2').data('value'),
readonly: true,
half: true,
});
rate.render({
elem: '#rating3',
value: $('#rating3').data('value'),
readonly: true,
half: true,
});
/**
* 收藏
*/
@ -50,9 +72,12 @@ layui.use(['jquery', 'layer', 'helper'], function () {
});
/**
* 购买课程|套餐)
* 浏览章节
*/
$('body').on('click', '.btn-buy', function () {
$('.lesson-item').on('click', function () {
if ($(this).hasClass('deny')) {
return false;
}
var url = $(this).data('url');
helper.checkLogin(function () {
window.location.href = url;
@ -60,12 +85,9 @@ layui.use(['jquery', 'layer', 'helper'], function () {
});
/**
* 浏览章节
* 购买课程|套餐)
*/
$('body').on('click', '.lesson-item', function () {
if ($(this).hasClass('deny')) {
return false;
}
$('body').on('click', '.btn-buy', function () {
var url = $(this).data('url');
helper.checkLogin(function () {
window.location.href = url;