From 8792688eed3e8a565395dfbed35aac12ca633cab Mon Sep 17 00:00:00 2001 From: koogua Date: Mon, 19 Apr 2021 20:10:32 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=AF=84=E8=AE=BA=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E9=98=B6=E6=AE=B5=E6=80=A7=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Admin/Views/category/list.volt | 8 +- .../Home/Controllers/CommentController.php | 144 ++++++++++++ .../Home/Controllers/PackageController.php | 14 ++ .../Home/Controllers/PublicController.php | 17 ++ app/Http/Home/Services/ShareUrl.php | 159 +++++++++++++ app/Http/Home/Views/article/comment.volt | 21 ++ app/Http/Home/Views/article/show.volt | 62 ++--- app/Http/Home/Views/article/sticky.volt | 27 +++ app/Http/Home/Views/chapter/comment.volt | 20 ++ app/Http/Home/Views/chapter/live/active.volt | 21 +- app/Http/Home/Views/chapter/live/sticky.volt | 27 +++ app/Http/Home/Views/chapter/read.volt | 30 ++- app/Http/Home/Views/chapter/sticky.volt | 42 ++++ app/Http/Home/Views/chapter/vod.volt | 29 ++- app/Http/Home/Views/comment/info.volt | 63 ++++++ app/Http/Home/Views/comment/list.volt | 70 ++++++ app/Http/Home/Views/comment/replies.volt | 69 ++++++ app/Http/Home/Views/comment/reply.volt | 19 ++ app/Http/Home/Views/course/consults.volt | 20 +- app/Http/Home/Views/course/reviews.volt | 20 +- app/Http/Home/Views/course/show.volt | 22 +- app/Http/Home/Views/course/show_teacher.volt | 3 +- app/Http/Home/Views/course/sticky.volt | 33 +++ .../Home/Views/im/group/active_users.volt | 3 +- .../Home/Views/im/group/manage_users.volt | 3 +- app/Http/Home/Views/im/group/pager.volt | 1 - app/Http/Home/Views/im/group/show.volt | 3 +- app/Http/Home/Views/im/group/show_owner.volt | 3 +- app/Http/Home/Views/im/group/users.volt | 3 +- app/Http/Home/Views/im/index_groups.volt | 1 - app/Http/Home/Views/im/index_users.volt | 4 +- app/Http/Home/Views/search/article.volt | 2 +- app/Http/Home/Views/teacher/pager.volt | 4 +- app/Http/Home/Views/user/friends.volt | 4 +- app/Http/Home/Views/user/groups.volt | 1 - app/Http/Home/Views/user/show.volt | 27 ++- app/Http/Home/Views/vip/users.volt | 4 +- app/Models/Comment.php | 4 + app/Repos/Comment.php | 8 +- app/Repos/CommentLike.php | 13 ++ app/Repos/ConsultLike.php | 13 ++ app/Repos/ReviewLike.php | 13 ++ app/Services/Logic/Article/ArticleInfo.php | 4 +- app/Services/Logic/Article/CommentList.php | 8 +- app/Services/Logic/Chapter/BasicInfo.php | 3 + app/Services/Logic/Chapter/CommentList.php | 41 ++++ app/Services/Logic/Chapter/ConsultList.php | 10 +- .../Logic/Comment/CommentCountTrait.php | 70 ++++++ app/Services/Logic/Comment/CommentCreate.php | 32 ++- app/Services/Logic/Comment/CommentDelete.php | 29 ++- app/Services/Logic/Comment/CommentInfo.php | 30 ++- app/Services/Logic/Comment/CommentList.php | 42 ++-- .../Logic/Comment/CommentListTrait.php | 75 ++++++ app/Services/Logic/Comment/CommentReply.php | 77 +++++++ app/Services/Logic/Comment/ReplyList.php | 36 +++ app/Services/Logic/Course/ConsultList.php | 37 +-- .../ConsultListTrait.php} | 45 ++-- app/Services/Logic/Course/ReviewList.php | 29 +++ .../Logic/Teacher/Console/ConsultList.php | 1 - .../Logic/User/Console/ConsultList.php | 1 - public/static/home/css/common.css | 213 +++++++++++------- public/static/home/js/article.show.js | 30 ++- public/static/home/js/chapter.live.chat.js | 2 +- .../js/{chapter.action.js => chapter.show.js} | 30 ++- public/static/home/js/comment.js | 187 +++++++++++++++ public/static/home/js/course.show.js | 31 +-- 66 files changed, 1704 insertions(+), 413 deletions(-) create mode 100644 app/Http/Home/Controllers/CommentController.php create mode 100644 app/Http/Home/Services/ShareUrl.php create mode 100644 app/Http/Home/Views/article/comment.volt create mode 100644 app/Http/Home/Views/article/sticky.volt create mode 100644 app/Http/Home/Views/chapter/comment.volt create mode 100644 app/Http/Home/Views/chapter/live/sticky.volt create mode 100644 app/Http/Home/Views/chapter/sticky.volt create mode 100644 app/Http/Home/Views/comment/info.volt create mode 100644 app/Http/Home/Views/comment/list.volt create mode 100644 app/Http/Home/Views/comment/replies.volt create mode 100644 app/Http/Home/Views/comment/reply.volt create mode 100644 app/Http/Home/Views/course/sticky.volt create mode 100644 app/Services/Logic/Chapter/CommentList.php create mode 100644 app/Services/Logic/Comment/CommentCountTrait.php create mode 100644 app/Services/Logic/Comment/CommentListTrait.php create mode 100644 app/Services/Logic/Comment/CommentReply.php create mode 100644 app/Services/Logic/Comment/ReplyList.php rename app/Services/Logic/{Consult/ConsultList.php => Course/ConsultListTrait.php} (54%) rename public/static/home/js/{chapter.action.js => chapter.show.js} (72%) create mode 100644 public/static/home/js/comment.js diff --git a/app/Http/Admin/Views/category/list.volt b/app/Http/Admin/Views/category/list.volt index dec3b755..1eab62ac 100644 --- a/app/Http/Admin/Views/category/list.volt +++ b/app/Http/Admin/Views/category/list.volt @@ -53,8 +53,12 @@ {% set restore_url = url({'for':'admin.category.restore','id':item.id}) %} {{ item.id }} - {% if item.type == 1 and item.level < 2 %} - {{ item.name }} + {% if item.type == 1 %} + {% if item.level == 1 %} + {{ item.name }} + {% else %} + {{ item.name }} + {% endif %} {% elseif item.type == 2 %} {{ item.name }} {% elseif item.type == 3 %} diff --git a/app/Http/Home/Controllers/CommentController.php b/app/Http/Home/Controllers/CommentController.php new file mode 100644 index 00000000..4d11ee38 --- /dev/null +++ b/app/Http/Home/Controllers/CommentController.php @@ -0,0 +1,144 @@ +handle(); + + $pager->target = 'comment-list'; + + $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); + + $this->view->setVar('pager', $pager); + } + + /** + * @Get("/{id:[0-9]+}/replies", name="home.comment.replies") + */ + public function repliesAction($id) + { + $service = new ReplyListService(); + + $pager = $service->handle($id); + + $pager->target = "reply-list-{$id}"; + + $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); + + $this->view->setVar('pager', $pager); + } + + /** + * @Get("/{id:[0-9]+}/info", name="home.comment.info") + */ + public function infoAction($id) + { + $service = new CommentInfoService(); + + $comment = $service->handle($id); + + $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); + + $this->view->setVar('comment', $comment); + } + + /** + * @Get("/add", name="home.comment.add") + */ + public function addAction() + { + + } + + /** + * @Get("/{id:[0-9]+}/reply", name="home.comment.reply") + */ + public function replyAction($id) + { + $service = new CommentInfoService(); + + $comment = $service->handle($id); + + $this->view->setVar('comment', $comment); + } + + /** + * @Post("/create", name="home.comment.create") + */ + public function createAction() + { + $service = new CommentCreateService(); + + $comment = $service->handle(); + + $service = new CommentInfoService(); + + $comment = $service->handle($comment->id); + + return $this->jsonSuccess(['comment' => $comment]); + } + + /** + * @Post("/{id:[0-9]+}/reply", name="home.comment.create_reply") + */ + public function createReplyAction($id) + { + $service = new CommentReplyService(); + + $comment = $service->handle($id); + + $service = new CommentInfoService(); + + $comment = $service->handle($comment->id); + + return $this->jsonSuccess(['comment' => $comment]); + } + + /** + * @Post("/{id:[0-9]+}/like", name="home.comment.like") + */ + public function likeAction($id) + { + $service = new CommentLikeService(); + + $data = $service->handle($id); + + $msg = $data['action'] == 'do' ? '点赞成功' : '取消点赞成功'; + + return $this->jsonSuccess(['data' => $data, 'msg' => $msg]); + } + + /** + * @Post("/{id:[0-9]+}/delete", name="home.comment.delete") + */ + public function deleteAction($id) + { + $service = new CommentDeleteService(); + + $service->handle($id); + + return $this->jsonSuccess(['msg' => '删除评论成功']); + } + +} diff --git a/app/Http/Home/Controllers/PackageController.php b/app/Http/Home/Controllers/PackageController.php index 12a7f513..a879cde6 100644 --- a/app/Http/Home/Controllers/PackageController.php +++ b/app/Http/Home/Controllers/PackageController.php @@ -12,6 +12,20 @@ use Phalcon\Mvc\View; class PackageController extends Controller { + /** + * @Get("/{id:[0-9]+}", name="home.package.show") + */ + public function showAction($id) + { + $service = new PackageInfoService(); + + $package = $service->handle($id); + + $this->seo->prependTitle(['套餐', $package['title']]); + + $this->view->setVar('package', $package); + } + /** * @Get("/{id:[0-9]+}/info", name="home.package.info") */ diff --git a/app/Http/Home/Controllers/PublicController.php b/app/Http/Home/Controllers/PublicController.php index c37faf2f..e1363c8e 100644 --- a/app/Http/Home/Controllers/PublicController.php +++ b/app/Http/Home/Controllers/PublicController.php @@ -2,6 +2,7 @@ namespace App\Http\Home\Controllers; +use App\Http\Home\Services\ShareUrl as ShareUrlService; use App\Library\CsrfToken as CsrfTokenService; use App\Repos\Upload as UploadRepo; use App\Services\LiveNotify as LiveNotifyService; @@ -43,6 +44,22 @@ class PublicController extends \Phalcon\Mvc\Controller } } + /** + * @Get("/share", name="home.share") + */ + public function shareAction() + { + $id = $this->request->getQuery('id', 'int', 0); + $type = $this->request->getQuery('type', 'string', 'course'); + $referer = $this->request->getQuery('referer', 'int', 0); + + $service = new ShareUrlService(); + + $location = $service->handle($id, $type, $referer); + + return $this->response->redirect($location, true); + } + /** * @Get("/qrcode", name="home.qrcode") */ diff --git a/app/Http/Home/Services/ShareUrl.php b/app/Http/Home/Services/ShareUrl.php new file mode 100644 index 00000000..4c5dd0c5 --- /dev/null +++ b/app/Http/Home/Services/ShareUrl.php @@ -0,0 +1,159 @@ +webBaseUrl = $this->getWebBaseUrl(); + $this->h5BaseUrl = $this->getH5BaseUrl(); + } + + public function handle($id, $type, $referer = 0) + { + if ($type == 'article') { + $result = $this->getArticleUrl($id, $referer); + } elseif ($type == 'course') { + $result = $this->getCourseUrl($id, $referer); + } elseif ($type == 'chapter') { + $result = $this->getChapterUrl($id, $referer); + } elseif ($type == 'package') { + $result = $this->getPackageUrl($id, $referer); + } elseif ($type == 'vip') { + $result = $this->getVipUrl($id, $referer); + } elseif ($type == 'user') { + $result = $this->getUserUrl($id, $referer); + } else { + $result = $this->getHomeUrl($referer); + } + + return $this->h5Enabled() ? $result['h5'] : $result['web']; + } + + public function getHomeUrl($referer = 0) + { + $webUrl = sprintf('%s?referer=%s', $this->webBaseUrl, $referer); + + $h5Url = sprintf('%s?referer=%s', $this->h5BaseUrl, $referer); + + return ['web' => $webUrl, 'h5' => $h5Url]; + } + + public function getArticleUrl($id, $referer = 0) + { + $route = $this->url->get( + ['for' => 'home.article.show', 'id' => $id], + ['referer' => $referer] + ); + + $webUrl = $this->webBaseUrl . $route; + + $h5Url = sprintf('%s/article/info?id=%s&referer=%s', $this->h5BaseUrl, $id, $referer); + + return ['web' => $webUrl, 'h5' => $h5Url]; + } + + public function getCourseUrl($id, $referer = 0) + { + $route = $this->url->get( + ['for' => 'home.course.show', 'id' => $id], + ['referer' => $referer] + ); + + $webUrl = $this->webBaseUrl . $route; + + $h5Url = sprintf('%s/course/info?id=%s&referer=%s', $this->h5BaseUrl, $id, $referer); + + return ['web' => $webUrl, 'h5' => $h5Url]; + } + + public function getChapterUrl($id, $referer = 0) + { + $route = $this->url->get( + ['for' => 'home.chapter.show', 'id' => $id], + ['referer' => $referer] + ); + + $webUrl = $this->webBaseUrl . $route; + + $h5Url = sprintf('%s/chapter/info?id=%s&referer=%s', $this->h5BaseUrl, $id, $referer); + + return ['web' => $webUrl, 'h5' => $h5Url]; + } + + public function getPackageUrl($id, $referer = 0) + { + $route = $this->url->get( + ['for' => 'home.package.show', 'id' => $id], + ['referer' => $referer] + ); + + $webUrl = $this->webBaseUrl . $route; + + $h5Url = sprintf('%s/package/info?id=%s&referer=%s', $this->h5BaseUrl, $id, $referer); + + return ['web' => $webUrl, 'h5' => $h5Url]; + } + + public function getUserUrl($id, $referer = 0) + { + $route = $this->url->get( + ['for' => 'home.user.show', 'id' => $id], + ['referer' => $referer] + ); + + $webUrl = $this->webBaseUrl . $route; + + $h5Url = sprintf('%s/user/info?id=%s&referer=%s', $this->h5BaseUrl, $id, $referer); + + return ['web' => $webUrl, 'h5' => $h5Url]; + } + + public function getVipUrl($id, $referer = 0) + { + $route = $this->url->get( + ['for' => 'home.vip.index'], + ['id' => $id, 'referer' => $referer] + ); + + $webUrl = $this->webBaseUrl . $route; + + $h5Url = sprintf('%s/vip/index?id=%s&referer=%s', $this->h5BaseUrl, $id, $referer); + + return ['web' => $webUrl, 'h5' => $h5Url]; + } + + protected function h5Enabled() + { + $file = public_path('h5/index.html'); + + return file_exists($file); + } + + protected function getWebBaseUrl() + { + return kg_site_url(); + } + + protected function getH5BaseUrl() + { + return sprintf('%s/h5/#/pages', kg_site_url()); + } + +} diff --git a/app/Http/Home/Views/article/comment.volt b/app/Http/Home/Views/article/comment.volt new file mode 100644 index 00000000..91731085 --- /dev/null +++ b/app/Http/Home/Views/article/comment.volt @@ -0,0 +1,21 @@ +{% set item_type = 2 %} +{% set comment_list_url = url({'for':'home.comment.list'},{'item_id':article.id,'item_type':item_type}) %} +{% set comment_create_url = url({'for':'home.comment.create'}) %} +{% set submit_class = auth_user.id > 0 ? 'layui-btn layui-btn-sm' : 'layui-btn layui-btn-sm layui-btn-disabled' %} + +
+
+ + + + +
+
+ +
\ No newline at end of file diff --git a/app/Http/Home/Views/article/show.volt b/app/Http/Home/Views/article/show.volt index 90027ca8..97de06a6 100644 --- a/app/Http/Home/Views/article/show.volt +++ b/app/Http/Home/Views/article/show.volt @@ -4,52 +4,27 @@ {{ partial('macros/article') }} - {% set list_url = url({'for':'home.article.list'}) %} - {% set category_url = url({'for':'home.article.list'},{'category_id':article.category.id}) %} + {% set article_list_url = url({'for':'home.article.list'}) %} + {% set related_article_url = url({'for':'home.article.related','id':article.id}) %} {% set owner_url = url({'for':'home.user.show','id':article.owner.id}) %} - {% set favorite_url = url({'for':'home.article.favorite','id':article.id}) %} - {% set like_url = url({'for':'home.article.like','id':article.id}) %} - {% set favorited_class = article.me.favorited ? 'layui-icon-star-fill' : 'layui-icon-star' %} - {% set liked_class = article.me.liked ? 'active' : '' %} - {% set article.owner.title = article.owner.title ? article.owner.title : '默默无名' %}
- -
-
-
- -
-
{{ article.like_count }}
-
-
-
- -
-
{{ article.comment_count }}
-
-
-
- -
-
{{ article.favorite_count }}
-
+
+ {{ partial('article/sticky') }}
-
{{ article.content }}
{% if article.tags %} @@ -79,18 +54,15 @@
{% endif %}
-
-
- +
+ {% if article.allow_comment == 1 %} +
+ {{ partial('article/comment') }}
-
- -
-
+ {% else %} +
评论已关闭
+ {% endif %}
- - {% set related_article_url = url({'for':'home.article.related','id':article.id}) %} -
@@ -112,10 +84,9 @@
- - {% set share_url = full_url({'for':'home.article.show','id':article.id}) %} + {% set share_url = full_url({'for':'home.share'},{'id':article.id,'type':'article','referer':auth_user.id}) %} {% set qrcode_url = url({'for':'home.qrcode'},{'text':share_url}) %}
@@ -137,5 +108,6 @@ {{ js_include('home/js/article.show.js') }} {{ js_include('home/js/article.share.js') }} + {{ js_include('home/js/comment.js') }} {% endblock %} \ No newline at end of file diff --git a/app/Http/Home/Views/article/sticky.volt b/app/Http/Home/Views/article/sticky.volt new file mode 100644 index 00000000..50be63ab --- /dev/null +++ b/app/Http/Home/Views/article/sticky.volt @@ -0,0 +1,27 @@ +{% set favorite_url = url({'for':'home.article.favorite','id':article.id}) %} +{% set like_url = url({'for':'home.article.like','id':article.id}) %} +{% set favorite_title = article.me.favorited == 1 ? '取消收藏' : '收藏文章' %} +{% set like_title = article.me.liked == 1 ? '取消点赞' : '点赞支持' %} +{% set favorite_class = article.me.favorited == 1 ? 'layui-icon-star-fill' : 'layui-icon-star' %} +{% set like_class = article.me.liked == 1 ? 'active' : '' %} + +
+
+
+ +
+
{{ article.like_count }}
+
+
+
+ +
+
{{ article.comment_count }}
+
+
+
+ +
+
{{ article.favorite_count }}
+
+
\ No newline at end of file diff --git a/app/Http/Home/Views/chapter/comment.volt b/app/Http/Home/Views/chapter/comment.volt new file mode 100644 index 00000000..35a0f786 --- /dev/null +++ b/app/Http/Home/Views/chapter/comment.volt @@ -0,0 +1,20 @@ +{% set item_type = 1 %} +{% set comment_list_url = url({'for':'home.comment.list'},{'item_id':chapter.id,'item_type':item_type}) %} +{% set comment_create_url = url({'for':'home.comment.create'}) %} + +
+
+ + + + +
+
+ +
\ No newline at end of file diff --git a/app/Http/Home/Views/chapter/live/active.volt b/app/Http/Home/Views/chapter/live/active.volt index 26a8f398..da9fb90a 100644 --- a/app/Http/Home/Views/chapter/live/active.volt +++ b/app/Http/Home/Views/chapter/live/active.volt @@ -2,16 +2,12 @@ {% block content %} - {% set full_chapter_url = full_url({'for':'home.chapter.show','id':chapter.id}) %} {% set course_url = url({'for':'home.course.show','id':chapter.course.id}) %} - {% set resources_url = url({'for':'home.chapter.resources','id':chapter.id}) %} {% set learning_url = url({'for':'home.chapter.learning','id':chapter.id}) %} {% set live_chats_url = url({'for':'home.live.chats','id':chapter.id}) %} {% set live_stats_url = url({'for':'home.live.stats','id':chapter.id}) %} {% set send_msg_url = url({'for':'home.live.send_msg','id':chapter.id}) %} {% set bind_user_url = url({'for':'home.live.bind_user','id':chapter.id}) %} - {% set like_url = url({'for':'home.chapter.like','id':chapter.id}) %} - {% set qrcode_url = url({'for':'home.qrcode'},{'text':full_chapter_url}) %}
+
+ {{ partial('chapter/live/sticky') }} +
@@ -63,10 +57,13 @@
+ {% set share_url = full_url({'for':'home.share'},{'id':chapter.id,'type':'chapter','referer':auth_user.id}) %} + {% set qrcode_url = url({'for':'home.qrcode'},{'text':share_url}) %} +
- +
@@ -77,7 +74,7 @@ {{ js_include('https://imgcache.qq.com/open/qcloud/video/vcplayer/TcPlayer-2.3.3.js', false) }} {{ js_include('home/js/chapter.live.player.js') }} {{ js_include('home/js/chapter.live.chat.js') }} - {{ js_include('home/js/chapter.action.js') }} + {{ js_include('home/js/chapter.show.js') }} {{ js_include('home/js/course.share.js') }} {% endblock %} \ No newline at end of file diff --git a/app/Http/Home/Views/chapter/live/sticky.volt b/app/Http/Home/Views/chapter/live/sticky.volt new file mode 100644 index 00000000..52479690 --- /dev/null +++ b/app/Http/Home/Views/chapter/live/sticky.volt @@ -0,0 +1,27 @@ +{% set download_url = url({'for':'home.chapter.resources','id':chapter.id}) %} +{% set like_url = url({'for':'home.chapter.like','id':chapter.id}) %} +{% set like_title = chapter.me.liked == 1 ? '取消点赞' : '点赞支持' %} +{% set like_class = chapter.me.liked == 1 ? 'active' : '' %} + +
+
+
+ +
+
{{ chapter.like_count }}
+
+
+
+ +
+
0
+
+ {% if chapter.resource_count > 0 %} +
+
+ +
+
资料
+
+ {% endif %} +
\ No newline at end of file diff --git a/app/Http/Home/Views/chapter/read.volt b/app/Http/Home/Views/chapter/read.volt index ee858df5..81d10d44 100644 --- a/app/Http/Home/Views/chapter/read.volt +++ b/app/Http/Home/Views/chapter/read.volt @@ -2,13 +2,8 @@ {% block content %} - {% set full_chapter_url = full_url({'for':'home.chapter.show','id':chapter.id}) %} {% set course_url = url({'for':'home.course.show','id':chapter.course.id}) %} - {% set resources_url = url({'for':'home.chapter.resources','id':chapter.id}) %} {% set learning_url = url({'for':'home.chapter.learning','id':chapter.id}) %} - {% set like_url = url({'for':'home.chapter.like','id':chapter.id}) %} - {% set consult_url = url({'for':'home.consult.add'},{'chapter_id':chapter.id}) %} - {% set qrcode_url = url({'for':'home.qrcode'},{'text':full_chapter_url}) %}
+
+ {{ partial('chapter/sticky') }} +
{{ chapter.content }}
+
+
+ {{ partial('chapter/comment') }} +
{{ partial('chapter/catalog') }} @@ -45,10 +39,13 @@
+ {% set share_url = full_url({'for':'home.share'},{'id':chapter.id,'type':'chapter','referer':auth_user.id}) %} + {% set qrcode_url = url({'for':'home.qrcode'},{'text':share_url}) %} +
- +
@@ -66,6 +63,7 @@ {{ js_include('home/js/markdown.preview.js') }} {{ js_include('home/js/course.share.js') }} {{ js_include('home/js/chapter.read.js') }} - {{ js_include('home/js/chapter.action.js') }} + {{ js_include('home/js/chapter.show.js') }} + {{ js_include('home/js/comment.js') }} {% endblock %} \ No newline at end of file diff --git a/app/Http/Home/Views/chapter/sticky.volt b/app/Http/Home/Views/chapter/sticky.volt new file mode 100644 index 00000000..cc4c20b3 --- /dev/null +++ b/app/Http/Home/Views/chapter/sticky.volt @@ -0,0 +1,42 @@ +{% set download_url = url({'for':'home.chapter.resources','id':chapter.id}) %} +{% set consult_url = url({'for':'home.consult.add'},{'chapter_id':chapter.id}) %} +{% set like_url = url({'for':'home.chapter.like','id':chapter.id}) %} +{% set like_title = chapter.me.liked == 1 ? '取消点赞' : '点赞支持' %} +{% set like_class = chapter.me.liked == 1 ? 'active' : '' %} + +
+
+
+ +
+
{{ chapter.like_count }}
+
+
+
+ +
+
{{ chapter.user_count }}
+
+
+
+ +
+
{{ chapter.comment_count }}
+
+ {% if chapter.resource_count > 0 %} +
+
+ +
+
资料
+
+ {% endif %} + {% if course.market_price > 0 %} +
+
+ +
+
咨询
+
+ {% endif %} +
\ No newline at end of file diff --git a/app/Http/Home/Views/chapter/vod.volt b/app/Http/Home/Views/chapter/vod.volt index 4e10cb46..10e69f46 100644 --- a/app/Http/Home/Views/chapter/vod.volt +++ b/app/Http/Home/Views/chapter/vod.volt @@ -2,14 +2,8 @@ {% block content %} - {% set full_chapter_url = full_url({'for':'home.chapter.show','id':chapter.id}) %} {% set course_url = url({'for':'home.course.show','id':chapter.course.id}) %} - {% set resources_url = url({'for':'home.chapter.resources','id':chapter.id}) %} {% set learning_url = url({'for':'home.chapter.learning','id':chapter.id}) %} - {% set like_url = url({'for':'home.chapter.like','id':chapter.id}) %} - {% set qrcode_url = url({'for':'home.qrcode'},{'text':full_chapter_url}) %} - {% set consult_url = url({'for':'home.consult.add'},{'chapter_id':chapter.id}) %} - {% set liked_class = chapter.me.liked ? 'active' : '' %}
+
+ {{ partial('chapter/sticky') }} +
+
+
+ {{ partial('chapter/comment') }} +
{{ partial('chapter/catalog') }} @@ -50,10 +43,13 @@
+ {% set share_url = full_url({'for':'home.share'},{'id':chapter.id,'type':'chapter','referer':auth_user.id}) %} + {% set qrcode_url = url({'for':'home.qrcode'},{'text':share_url}) %} +
- +
@@ -63,7 +59,8 @@ {{ js_include('https://imgcache.qq.com/open/qcloud/video/vcplayer/TcPlayer-2.3.3.js', false) }} {{ js_include('home/js/course.share.js') }} - {{ js_include('home/js/chapter.action.js') }} + {{ js_include('home/js/chapter.show.js') }} {{ js_include('home/js/chapter.vod.player.js') }} + {{ js_include('home/js/comment.js') }} {% endblock %} \ No newline at end of file diff --git a/app/Http/Home/Views/comment/info.volt b/app/Http/Home/Views/comment/info.volt new file mode 100644 index 00000000..f64a65fd --- /dev/null +++ b/app/Http/Home/Views/comment/info.volt @@ -0,0 +1,63 @@ +{% set owner_url = url({'for':'home.user.show','id':comment.owner.id}) %} +{% set delete_url = url({'for':'home.comment.delete','id':comment.id}) %} + +{% if comment.parent_id == 0 %} +
+
+
+ + {{ comment.owner.name }} + +
+
+ +
{{ comment.content }}
+ +
+
+
+{% endif %} + +{% if comment.parent_id > 0 %} +
+
+ + {{ comment.owner.name }} + +
+
+
+ {{ comment.owner.name }} + {% if comment.to_user.id is defined %} + {% set to_user_url = url({'for':'home.user.show','id':comment.to_user.id}) %} + 回复 + {{ comment.to_user.name }} + {% endif %} +
+
{{ comment.content }}
+ +
+
+{% endif %} diff --git a/app/Http/Home/Views/comment/list.volt b/app/Http/Home/Views/comment/list.volt new file mode 100644 index 00000000..15f853bb --- /dev/null +++ b/app/Http/Home/Views/comment/list.volt @@ -0,0 +1,70 @@ +{% if pager.total_pages > 0 %} + {% for item in pager.items %} + {% set owner_url = url({'for':'home.user.show','id':item.owner.id}) %} + {% set like_url = url({'for':'home.comment.like','id':item.id}) %} + {% set delete_url = url({'for':'home.comment.delete','id':item.id}) %} + {% set reply_create_url = url({'for':'home.comment.create_reply','id':item.id}) %} + {% set reply_list_url = url({'for':'home.comment.replies','id':item.id},{'limit':5}) %} +
+
+
+ + {{ item.owner.name }} + +
+
+ +
{{ item.content }}
+ +
+
+ + +
+ {% endfor %} + {{ partial('partials/pager_ajax') }} +{% endif %} \ No newline at end of file diff --git a/app/Http/Home/Views/comment/replies.volt b/app/Http/Home/Views/comment/replies.volt new file mode 100644 index 00000000..4b05ab1b --- /dev/null +++ b/app/Http/Home/Views/comment/replies.volt @@ -0,0 +1,69 @@ +{% if pager.total_pages > 0 %} + {% for item in pager.items %} + {% set owner_url = url({'for':'home.user.show','id':item.owner.id}) %} + {% set like_url = url({'for':'home.comment.like','id':item.id}) %} + {% set delete_url = url({'for':'home.comment.delete','id':item.id}) %} + {% set reply_create_url = url({'for':'home.comment.create_reply','id':item.id}) %} +
+
+
+ + {{ item.owner.name }} + +
+
+
+ {{ item.owner.name }} + {% if item.to_user.id is defined %} + {% set to_user_url = url({'for':'home.user.show','id':item.to_user.id}) %} + 回复 + {{ item.to_user.name }} + {% endif %} +
+
{{ item.content }}
+ +
+
+ +
+ {% endfor %} + {{ partial('partials/pager_ajax') }} +{% endif %} \ No newline at end of file diff --git a/app/Http/Home/Views/comment/reply.volt b/app/Http/Home/Views/comment/reply.volt new file mode 100644 index 00000000..6143f829 --- /dev/null +++ b/app/Http/Home/Views/comment/reply.volt @@ -0,0 +1,19 @@ +{% extends 'templates/layer.volt' %} + +{% block content %} +
+
+ +
+
+ + +
+
+{% endblock %} + +{% block include_js %} + + {{ js_include('home/js/comment.js') }} + +{% endblock %} \ No newline at end of file diff --git a/app/Http/Home/Views/course/consults.volt b/app/Http/Home/Views/course/consults.volt index e1806cb4..9043c915 100644 --- a/app/Http/Home/Views/course/consults.volt +++ b/app/Http/Home/Views/course/consults.volt @@ -5,7 +5,7 @@ {% set owner_url = url({'for':'home.user.show','id':item.owner.id}) %} {% set consult_url = url({'for':'home.consult.show','id':item.id}) %} {% set like_url = url({'for':'home.consult.like','id':item.id}) %} -
+
{{ item.owner.name }} @@ -20,11 +20,19 @@
{{ item.question }}
{{ item.answer }}
diff --git a/app/Http/Home/Views/course/reviews.volt b/app/Http/Home/Views/course/reviews.volt index 31b24ebb..52235a7f 100644 --- a/app/Http/Home/Views/course/reviews.volt +++ b/app/Http/Home/Views/course/reviews.volt @@ -5,7 +5,7 @@ {% for item in pager.items %} {% set owner_url = url({'for':'home.user.show','id':item.owner.id}) %} {% set like_url = url({'for':'home.review.like','id':item.id}) %} -
+
{{ item.content }}
diff --git a/app/Http/Home/Views/course/show.volt b/app/Http/Home/Views/course/show.volt index e10584ed..0c65df54 100644 --- a/app/Http/Home/Views/course/show.volt +++ b/app/Http/Home/Views/course/show.volt @@ -4,13 +4,6 @@ {{ partial('macros/course') }} - {% set favorite_title = course.me.favorited ? '取消收藏' : '收藏课程' %} - {% set favorite_star = course.me.favorited ? 'layui-icon-star-fill' : 'layui-icon-star' %} - {% set full_course_url = full_url({'for':'home.course.show','id':course.id}) %} - {% set favorite_url = url({'for':'home.course.favorite','id':course.id}) %} - {% set consult_url = url({'for':'home.consult.add'},{'course_id':course.id}) %} - {% set qrcode_url = url({'for':'home.qrcode'},{'text':full_course_url}) %} -