From 5e8e179fe80257b52a8b514ee46cab81b17069e6 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Fri, 22 May 2020 19:42:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Web/Controllers/CourseController.php | 2 + app/Http/Web/Controllers/SearchController.php | 6 +- app/Http/Web/Views/course/list.volt | 46 +++-- app/Http/Web/Views/index/index.volt | 24 ++- app/Http/Web/Views/partials/footer.volt | 31 ++-- app/Http/Web/Views/partials/header.volt | 4 +- app/Http/Web/Views/search/list.volt | 39 +++++ app/Http/Web/Views/templates/base.volt | 12 +- public/static/web/css/common.css | 159 +++++++++++++++--- 9 files changed, 262 insertions(+), 61 deletions(-) create mode 100644 app/Http/Web/Views/search/list.volt diff --git a/app/Http/Web/Controllers/CourseController.php b/app/Http/Web/Controllers/CourseController.php index af4a9eae..bf8918b9 100644 --- a/app/Http/Web/Controllers/CourseController.php +++ b/app/Http/Web/Controllers/CourseController.php @@ -30,6 +30,8 @@ class CourseController extends Controller $pager = $service->handle(); + $pager->items = kg_array_object($pager->items); + $service = new CourseQueryService(); $topCategories = $service->handleTopCategories(); diff --git a/app/Http/Web/Controllers/SearchController.php b/app/Http/Web/Controllers/SearchController.php index 6ae34aac..160d8a9b 100644 --- a/app/Http/Web/Controllers/SearchController.php +++ b/app/Http/Web/Controllers/SearchController.php @@ -16,9 +16,9 @@ class SearchController extends Controller use ResponseTrait; /** - * @Get("/", name="web.search.show") + * @Get("/", name="web.search.list") */ - public function showAction() + public function listAction() { $query = $this->request->get('query', ['trim']); @@ -34,6 +34,8 @@ class SearchController extends Controller $pager = $service->handle(); + $pager->items = kg_array_object($pager->items); + $this->view->setVar('hot_queries', $hotQueries); $this->view->setVar('related_queries', $relatedQueries); $this->view->setVar('pager', $pager); diff --git a/app/Http/Web/Views/course/list.volt b/app/Http/Web/Views/course/list.volt index 11e3056a..b0870473 100644 --- a/app/Http/Web/Views/course/list.volt +++ b/app/Http/Web/Views/course/list.volt @@ -3,7 +3,7 @@ {% block content %}
-
+
方向
{% for category in top_categories %} @@ -13,7 +13,7 @@
{% if sub_categories %} -
+
分类
{% for category in sub_categories %} @@ -23,7 +23,7 @@
{% endif %} -
+
类型
{% for model in models %} @@ -32,7 +32,7 @@ {% endfor %}
-
+
难度
{% for level in levels %} @@ -41,27 +41,41 @@ {% endfor %}
+
+
排序
+
+ {% for sort in sorts %} + {% set class = request.get('sort','trim','score') == sort.id ? 'layui-btn layui-btn-xs' : 'none' %} + {{ sort.name }} + {% endfor %} +
+
-
- {% for sort in sorts %} - {% set class = request.get('sort','trim','score') == sort.id ? 'layui-badge active' : 'layui-badge' %} - {{ sort.name }} - {% endfor %} -
- -
+
{% for item in pager.items %}
+
+ {% if item.market_price > 0 %} + ¥{{ item.market_price }} + 中级 + {{ item.lesson_count }}节课 + {{ item.user_count }}人购买 + {% else %} + 免费 + 中级 + {{ item.lesson_count }}节课 + {{ item.user_count }}人报名 + {% endif %}
-
{% endfor %}
diff --git a/app/Http/Web/Views/index/index.volt b/app/Http/Web/Views/index/index.volt index e0e597c2..4923f48f 100644 --- a/app/Http/Web/Views/index/index.volt +++ b/app/Http/Web/Views/index/index.volt @@ -14,7 +14,7 @@ {% for category in courses %} {% set class = loop.first ? 'layui-tab-item layui-show' : 'layui-tab-item' %}
-
+
{% for course in category.courses %}
@@ -25,7 +25,19 @@ -
+
+ {% if course.market_price > 0 %} + ¥{{ course.market_price }} + 中级 + {{ course.lesson_count }}节课 + {{ course.user_count }}人购买 + {% else %} + 免费 + 中级 + {{ course.lesson_count }}节课 + {{ course.user_count }}人报名 + {% endif %} +
{% endfor %}
@@ -35,13 +47,13 @@
{%- endmacro %} -
+