1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-07-01 22:54:56 +08:00

完善图文部分

This commit is contained in:
xiaochong0302 2020-07-08 20:28:49 +08:00
parent 680089e06f
commit f2e862e9ae
14 changed files with 180 additions and 160 deletions

View File

@ -2,7 +2,7 @@
namespace App\Http\Web\Controllers;
use App\Services\Frontend\Page\HelpInfo as PageInfoService;
use App\Services\Frontend\Page\PageInfo as PageInfoService;
/**
* @RoutePrefix("/page")

View File

@ -17,9 +17,7 @@
<div class="layout-main">
<div class="layout-content">
<div class="live-player container">
<div id="player"></div>
</div>
<div id="player" class="player container"></div>
</div>
<div class="layout-sidebar">
<div class="chat-container">

View File

@ -0,0 +1,35 @@
{% extends 'templates/full.volt' %}
{% block content %}
{% set learning_url = url({'for':'web.chapter.learning','id':chapter.id}) %}
<div class="breadcrumb">
<span class="layui-breadcrumb">
<a><cite>{{ chapter.course.title }}</cite></a>
<a><cite>{{ chapter.title }}</cite></a>
</span>
</div>
<div class="layout-main clearfix">
<div class="layout-content">
<div class="read-info container">{{ chapter.content }}</div>
</div>
<div class="layout-sidebar">
{{ partial('chapter/menu') }}
</div>
</div>
<div class="layui-hide">
<input type="hidden" name="chapter.id" value="{{ chapter.id }}">
<input type="hidden" name="chapter.plan_id" value="{{ chapter.me.plan_id }}">
<input type="hidden" name="chapter.learning_url" value="{{ learning_url }}">
</div>
{% endblock %}
{% block include_js %}
{{ js_include('web/js/read.js') }}
{% endblock %}

View File

@ -2,7 +2,6 @@
{% block content %}
{% set course_url = url({'for':'web.course.show','id':chapter.course.id}) %}
{% set learning_url = url({'for':'web.chapter.learning','id':chapter.id}) %}
<div class="breadcrumb">
@ -14,8 +13,7 @@
<div class="layout-main clearfix">
<div class="layout-content">
<div id="player" class="container"></div>
<div class="comment-list container"></div>
<div id="player" class="player container"></div>
</div>
<div class="layout-sidebar">
{{ partial('chapter/menu') }}

View File

@ -2,13 +2,20 @@
{% block content %}
<div class="layui-collapse">
{% for help in helps %}
<div class="layui-colla-item">
<h2 class="layui-colla-title">{{ help.title }}</h2>
<div class="layui-colla-content layui-show">{{ help.content }}</div>
<div class="page-info container">
<fieldset class="layui-elem-field layui-field-title">
<legend>帮助中心</legend>
<div class="layui-field-box">
<div class="layui-collapse" lay-accordion="true">
{% for help in helps %}
<div class="layui-colla-item">
<h2 class="layui-colla-title">{{ help.title }}</h2>
<div class="layui-colla-content help-content">{{ help.content }}</div>
</div>
{% endfor %}
</div>
</div>
{% endfor %}
</fieldset>
</div>
{% endblock %}

View File

@ -0,0 +1,14 @@
{% extends 'templates/full.volt' %}
{% block content %}
<div class="page-info container">
<fieldset class="layui-elem-field layui-field-title">
<legend>{{ help.title }}</legend>
<div class="layui-field-box page-content">
{{ help.content }}
</div>
</fieldset>
</div>
{% endblock %}

View File

@ -2,8 +2,13 @@
{% block content %}
<h3 class="page-title">{{ page.title }}</h3>
<div class="page-content container">{{ page.content }}</div>
<div class="page-info container">
<fieldset class="layui-elem-field layui-field-title">
<legend>{{ page.title }}</legend>
<div class="layui-field-box page-content">
{{ page.content }}
</div>
</fieldset>
</div>
{% endblock %}

View File

@ -4,8 +4,10 @@
{% set courses_url = url({'for':'web.topic.courses','id':topic.id}) %}
<div class="topic-info container">
<h3 class="title" title="{{ topic.summary|e }}">{{ topic.title }}</h3>
<div class="topic-info">
<fieldset class="layui-elem-field layui-field-title">
<legend>{{ topic.title }}</legend>
</fieldset>
</div>
<div id="course-list" data-url="{{ courses_url }}"></div>

View File

@ -68,6 +68,13 @@ class ChapterRead extends Model
public function beforeCreate()
{
$this->create_time = time();
/**
* text类型不能填充默认值
*/
if (empty($this->content)) {
$this->content = '';
}
}
public function beforeUpdate()

View File

@ -2,7 +2,6 @@
namespace App\Repos;
use App\Library\Paginator\Adapter\QueryBuilder as PagerQueryBuilder;
use App\Models\Help as HelpModel;
use Phalcon\Mvc\Model;
use Phalcon\Mvc\Model\Resultset;
@ -11,43 +10,6 @@ use Phalcon\Mvc\Model\ResultsetInterface;
class Help extends Repository
{
public function paginate($where = [], $sort = 'latest', $page = 1, $limit = 15)
{
$builder = $this->modelsManager->createBuilder();
$builder->from(HelpModel::class);
$builder->where('1 = 1');
if (!empty($where['title'])) {
$builder->andWhere('title LIKE :title:', ['title' => "%{$where['title']}%"]);
}
if (isset($where['published'])) {
$builder->andWhere('published = :published:', ['published' => $where['published']]);
}
if (isset($where['deleted'])) {
$builder->andWhere('deleted = :deleted:', ['deleted' => $where['deleted']]);
}
switch ($sort) {
default:
$orderBy = 'id DESC';
break;
}
$builder->orderBy($orderBy);
$pager = new PagerQueryBuilder([
'builder' => $builder,
'page' => $page,
'limit' => $limit,
]);
return $pager->paginate();
}
/**
* @param int $id
* @return HelpModel|Model|bool
@ -80,6 +42,10 @@ class Help extends Repository
$query->where('1 = 1');
if (!empty($where['title'])) {
$query->andWhere('title LIKE :title:', ['title' => "%{$where['title']}%"]);
}
if (isset($where['published'])) {
$query->andWhere('published = :published:', ['published' => $where['published']]);
}

View File

@ -4,22 +4,6 @@
display: none;
}
.sidebar-chapter-list::-webkit-scrollbar {
background-color: #fff;
width: 5px;
height: 15px;
}
.sidebar-chapter-list::-webkit-scrollbar-thumb {
border-radius: 5px;
background: #393D49;
}
.sidebar-chapter-list::-webkit-scrollbar-track {
border: 0;
background-color: #fff;
}
.full {
background-color: #f2f2f2;
}
@ -79,10 +63,6 @@
width: 320px;
}
.layui-badge, .layui-badge-rim {
padding-bottom: 1px;
}
.layui-fixbar {
bottom: 60px;
}
@ -98,7 +78,7 @@
#main {
margin-top: 80px;
margin-bottom: 40px;
margin-bottom: 30px;
min-height: 550px;
}
@ -284,32 +264,37 @@
margin-bottom: 5px;
}
.page-title {
padding-bottom: 10px;
margin-bottom: 20px;
border-bottom: 1px solid #d3d3d3;
text-align: center;
color: #666;
.page-info {
padding: 20px 50px;
min-height: 500px;
}
.page-content {
min-height: 450px;
color: #666;
.page-info .page-content {
}
.page-info .help-content {
min-height: 50px;
}
.page-info .layui-field-title legend {
margin: 0 10px 10px 0;
padding: 0 10px;
text-align: center;
}
.topic-info {
margin-bottom: 20px;
padding-top: 10px;
margin-bottom: 40px;
}
.topic-info .title {
.topic-info .layui-field-title {
border-color: #d2d2d2;
}
.topic-info .layui-field-title legend {
text-align: center;
}
.topic-info .summary {
padding: 15px 0;
color: #666;
}
.course-list {
margin-bottom: 20px;
}
@ -750,8 +735,17 @@
margin-right: 10px;
}
.sidebar-chapter-list::-webkit-scrollbar {
width: 5px;
}
.sidebar-chapter-list::-webkit-scrollbar-thumb {
border-radius: 10px;
background: rgba(0, 0, 0, 0.1);
}
.sidebar-chapter-list {
max-height: 500px;
height: 405px;
overflow-y: auto;
}
@ -779,7 +773,12 @@
color: gray;
}
.live-player {
.read-info {
min-height: 428px;
margin-bottom: 0;
}
.player {
width: 760px;
height: 428px;
}
@ -857,68 +856,6 @@
margin-right: 10px;
}
.chapter-bg {
background-color: #f2f2f2;
}
.chapter-main {
top: 0;
left: 0;
right: 0;
bottom: 0;
position: absolute;
}
.chapter-main .header {
height: 50px;
line-height: 50px;
color: rgba(255, 255, 255, 0.7);
background-color: #393D49;
}
.chapter-main .header a {
color: rgba(255, 255, 255, 0.7);
}
.chapter-main .header .back {
float: left;
margin-left: 5px;
}
.chapter-main .header .stats {
float: left;
margin-left: 50px;
margin-right: 150px;
}
.chapter-main .header .action {
float: right;
margin-right: 150px;
}
.chapter-main .content {
}
.chapter-sidebar {
top: 0;
right: 0;
bottom: 0;
width: 0;
position: absolute;
background-color: white;
}
.chapter-sidebar-btn {
top: 15px;
right: 15px;
position: absolute;
cursor: pointer;
}
.chapter-sidebar-btn .switch-icon {
color: rgba(255, 255, 255, 0.7);
}
.vip-header {
font-size: 18px;
text-align: center;

View File

@ -4,7 +4,7 @@ layui.use(['jquery', 'helper'], function () {
var helper = layui.helper;
var interval = null;
var intervalTime = 5000;
var intervalTime = 15000;
var position = 0;
var userId = window.koogua.user.id;
var chapterId = $('input[name="chapter.id"]').val();

View File

@ -0,0 +1,51 @@
layui.use(['jquery', 'helper'], function () {
var $ = layui.jquery;
var helper = layui.helper;
var interval = null;
var intervalTime = 15000;
var userId = window.koogua.user.id;
var chapterId = $('input[name="chapter.id"]').val();
var planId = $('input[name="chapter.plan_id"]').val();
var learningUrl = $('input[name="chapter.learning_url"]').val();
var requestId = helper.getRequestId();
if (userId !== '0' && planId !== '0') {
start();
document.addEventListener('visibilitychange', function () {
if (document.visibilityState === 'hidden') {
stop();
} else if (document.visibilityState === 'visible') {
start();
}
});
}
function start() {
if (interval != null) {
clearInterval(interval);
interval = null;
}
interval = setInterval(learning, intervalTime);
}
function stop() {
clearInterval(interval);
interval = null;
}
function learning() {
$.ajax({
type: 'POST',
url: learningUrl,
data: {
request_id: requestId,
chapter_id: chapterId,
plan_id: planId,
interval: intervalTime,
}
});
}
});

View File

@ -4,7 +4,7 @@ layui.use(['jquery', 'helper'], function () {
var helper = layui.helper;
var interval = null;
var intervalTime = 5000;
var intervalTime = 15000;
var position = 0;
var userId = window.koogua.user.id;
var chapterId = $('input[name="chapter.id"]').val();
@ -16,7 +16,7 @@ layui.use(['jquery', 'helper'], function () {
var options = {
autoplay: false,
width: 760,
height: 450
height: 428
};
if (playUrls.od) {