From 2450d70fdcfd913dcf1d69a0c6fc985903a43f4a Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Mon, 25 May 2020 20:32:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E7=99=BB=E5=BD=95=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Caches/CourseRecommendedList.php | 2 +- app/Http/Admin/Services/Course.php | 2 +- app/Http/Admin/Views/public/login.volt | 4 +- app/Http/Admin/Views/setting/captcha.volt | 12 +- .../Web/Controllers/AccountController.php | 10 +- .../Web/Views/account/forget_password.volt | 51 ++++++ app/Http/Web/Views/account/login.volt | 13 ++ .../Web/Views/account/login_by_password.volt | 14 +- .../Web/Views/account/login_by_verify.volt | 12 +- app/Http/Web/Views/account/register.volt | 51 ++---- .../Web/Views/account/reset_password.volt | 80 --------- app/Http/Web/Views/course/chapters.volt | 12 +- app/Http/Web/Views/course/show.volt | 25 ++- .../Web/Views/course/sidebar_recommended.volt | 23 +++ .../Web/Views/course/sidebar_related.volt | 23 +++ .../Web/Views/course/sidebar_teachers.volt | 18 ++ app/Http/Web/Views/course/sidebar_topics.volt | 8 + .../Web/Views/course/widget_recommended.volt | 18 -- app/Http/Web/Views/course/widget_related.volt | 18 -- app/Http/Web/Views/course/widget_teacher.volt | 14 -- app/Http/Web/Views/course/widget_topic.volt | 8 - app/Http/Web/Views/partials/header.volt | 2 +- app/Http/Web/Views/search/list.volt | 3 +- app/Http/Web/Views/templates/base.volt | 1 + app/Library/Helper.php | 20 --- public/static/web/css/common.css | 163 +++++++++++++----- public/static/web/js/captcha.login.js | 15 ++ public/static/web/js/captcha.verify.js | 28 +++ 28 files changed, 360 insertions(+), 290 deletions(-) create mode 100644 app/Http/Web/Views/account/forget_password.volt delete mode 100644 app/Http/Web/Views/account/reset_password.volt create mode 100644 app/Http/Web/Views/course/sidebar_recommended.volt create mode 100644 app/Http/Web/Views/course/sidebar_related.volt create mode 100644 app/Http/Web/Views/course/sidebar_teachers.volt create mode 100644 app/Http/Web/Views/course/sidebar_topics.volt delete mode 100644 app/Http/Web/Views/course/widget_recommended.volt delete mode 100644 app/Http/Web/Views/course/widget_related.volt delete mode 100644 app/Http/Web/Views/course/widget_teacher.volt delete mode 100644 app/Http/Web/Views/course/widget_topic.volt create mode 100644 public/static/web/js/captcha.login.js create mode 100644 public/static/web/js/captcha.verify.js diff --git a/app/Caches/CourseRecommendedList.php b/app/Caches/CourseRecommendedList.php index 7ded04c0..5943fbea 100644 --- a/app/Caches/CourseRecommendedList.php +++ b/app/Caches/CourseRecommendedList.php @@ -65,7 +65,7 @@ class CourseRecommendedList extends Cache public function findCourses($limit = 5) { return CourseModel::query() - ->where('published = 1 AND deleted = 0') + ->where('published = 1 AND deleted = 0 AND market_price > 0') ->orderBy('RAND()') ->limit($limit) ->execute(); diff --git a/app/Http/Admin/Services/Course.php b/app/Http/Admin/Services/Course.php index f766fea2..ff170bbc 100644 --- a/app/Http/Admin/Services/Course.php +++ b/app/Http/Admin/Services/Course.php @@ -395,7 +395,7 @@ class Course extends Service $cache = new CourseTeacherListCache(); - $cache->rebuild(); + $cache->rebuild($course->id); } protected function saveCategories(CourseModel $course, $categoryIds) diff --git a/app/Http/Admin/Views/public/login.volt b/app/Http/Admin/Views/public/login.volt index 1eaca7ff..e85f22bd 100644 --- a/app/Http/Admin/Views/public/login.volt +++ b/app/Http/Admin/Views/public/login.volt @@ -23,7 +23,7 @@
点击完成验证 - 验证成功 + 验证成功
{% endif %} @@ -62,7 +62,7 @@ $('input[name=rand]').val(res.randstr); $('#captcha-btn').remove(); $('#submit-btn').removeAttr('disabled'); - $('#verify-tips').removeClass('layui-hide'); + $('#verify-btn').removeClass('layui-hide'); } } ); diff --git a/app/Http/Admin/Views/setting/captcha.volt b/app/Http/Admin/Views/setting/captcha.volt index b45cc081..028a4708 100644 --- a/app/Http/Admin/Views/setting/captcha.volt +++ b/app/Http/Admin/Views/setting/captcha.volt @@ -37,8 +37,8 @@
- 前台验证 - 前台验证成功 + 前台验证 + 前台验证成功
@@ -46,7 +46,7 @@
后台验证 - 后台验证成功 + 后台验证成功
@@ -65,13 +65,13 @@ var layer = layui.layer; var captcha = new TencentCaptcha( - $('#front-verify-btn')[0], - $('#front-verify-btn').attr('app-id'), + $('#front-captcha-btn')[0], + $('#front-captcha-btn').attr('data-app-id'), function (res) { if (res.ret === 0) { $('input[name=ticket]').val(res.ticket); $('input[name=rand]').val(res.randstr); - $('#front-verify-btn').remove(); + $('#front-captcha-btn').remove(); $('#back-verify-btn').removeAttr('disabled'); $('#front-verify-tips').removeClass('layui-hide'); } diff --git a/app/Http/Web/Controllers/AccountController.php b/app/Http/Web/Controllers/AccountController.php index 14a8b409..52020e24 100644 --- a/app/Http/Web/Controllers/AccountController.php +++ b/app/Http/Web/Controllers/AccountController.php @@ -88,22 +88,22 @@ class AccountController extends Controller } /** - * @Get("/password/reset", name="web.account.reset_pwd") + * @Get("/password/forget", name="web.account.forget_pwd") */ - public function resetPasswordAction() + public function forgetPasswordAction() { $service = new AccountService(); $captcha = $service->getSectionSettings('captcha'); - $this->view->pick('account/reset_password'); + $this->view->pick('account/forget_password'); $this->view->setVar('captcha', $captcha); } /** - * @Post("/password/reset", name="web.account.do_reset_pwd") + * @Post("/password/reset", name="web.account.reset_pwd") */ - public function doResetPasswordAction() + public function resetPasswordAction() { } diff --git a/app/Http/Web/Views/account/forget_password.volt b/app/Http/Web/Views/account/forget_password.volt new file mode 100644 index 00000000..ca4915cb --- /dev/null +++ b/app/Http/Web/Views/account/forget_password.volt @@ -0,0 +1,51 @@ +{% extends 'templates/base.volt' %} + +{% block content %} + + + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ 点击完成验证 + 验证成功 +
+
+
+
+ +
+
+
+
+ +{% endblock %} + +{% block include_js %} + + {{ js_include('https://ssl.captcha.qq.com/TCaptcha.js',false) }} + {{ js_include('web/js/captcha.verify.js') }} + +{% endblock %} \ No newline at end of file diff --git a/app/Http/Web/Views/account/login.volt b/app/Http/Web/Views/account/login.volt index d9b7595f..293c350e 100644 --- a/app/Http/Web/Views/account/login.volt +++ b/app/Http/Web/Views/account/login.volt @@ -2,6 +2,11 @@ {% block content %} + +
+{% endblock %} + +{% block include_js %} + + {{ js_include('https://ssl.captcha.qq.com/TCaptcha.js',false) }} + {{ js_include('web/js/captcha.login.js') }} + {{ js_include('web/js/captcha.verify.js') }} + {% endblock %} \ No newline at end of file diff --git a/app/Http/Web/Views/account/login_by_password.volt b/app/Http/Web/Views/account/login_by_password.volt index 1ac69fdb..384f914c 100644 --- a/app/Http/Web/Views/account/login_by_password.volt +++ b/app/Http/Web/Views/account/login_by_password.volt @@ -1,8 +1,8 @@ -
+
- +
@@ -11,22 +11,16 @@
-
- -
- -
-
点击完成验证 - 验证成功 + 验证成功
- + diff --git a/app/Http/Web/Views/account/login_by_verify.volt b/app/Http/Web/Views/account/login_by_verify.volt index 1fbd05e4..646b664a 100644 --- a/app/Http/Web/Views/account/login_by_verify.volt +++ b/app/Http/Web/Views/account/login_by_verify.volt @@ -1,8 +1,8 @@ - +
- +
@@ -14,16 +14,14 @@
- 点击完成验证 - 验证成功 + 点击完成验证 + 验证成功
- + - -
\ No newline at end of file diff --git a/app/Http/Web/Views/account/register.volt b/app/Http/Web/Views/account/register.volt index 5c0d9573..895ca9cd 100644 --- a/app/Http/Web/Views/account/register.volt +++ b/app/Http/Web/Views/account/register.volt @@ -2,6 +2,11 @@ {% block content %} + +
@@ -30,52 +35,18 @@
- + - -
+ {% endblock %} -{% block inline_js %} +{% block include_js %} - + {{ js_include('https://ssl.captcha.qq.com/TCaptcha.js',false) }} + {{ js_include('web/js/captcha.js') }} - - -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/app/Http/Web/Views/account/reset_password.volt b/app/Http/Web/Views/account/reset_password.volt deleted file mode 100644 index 861be26f..00000000 --- a/app/Http/Web/Views/account/reset_password.volt +++ /dev/null @@ -1,80 +0,0 @@ -{% extends 'templates/base.volt' %} - -{% block content %} - -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
-
- 点击完成验证 - 验证成功 -
-
-
-
- - - -
-
-
-
-{% endblock %} - -{% block inline_js %} - - - - - -{% endblock %} \ No newline at end of file diff --git a/app/Http/Web/Views/course/chapters.volt b/app/Http/Web/Views/course/chapters.volt index 31962796..b6d19774 100644 --- a/app/Http/Web/Views/course/chapters.volt +++ b/app/Http/Web/Views/course/chapters.volt @@ -1,10 +1,14 @@ {%- macro lesson_info(lesson) %} + + {% set url = lesson.me.owned ? url({'for':'web.chapter.show','id':lesson.id}) : 'javascript:' %} + {% set free_badge = lesson.free ? '免费' : '' %} + {% if lesson.attrs.model == 'vod' %} -
  • {{ lesson.title }}
  • + {{ lesson.title }} {{ free_badge }} {% elseif lesson.attrs.model == 'live' %} -
  • {{ lesson.title }}
  • + {{ lesson.title }} {{ free_badge }} {% elseif lesson.attrs.model == 'read' %} -
  • {{ lesson.title }}
  • + {{ lesson.title }} {{ free_badge }} {% endif %} {%- endmacro %} @@ -15,7 +19,7 @@
      {% for lesson in chapter.children %} - {{ lesson_info(lesson) }} +
    • {{ lesson_info(lesson) }}
    • {% endfor %}
    diff --git a/app/Http/Web/Views/course/show.volt b/app/Http/Web/Views/course/show.volt index 115116a2..1297cd28 100644 --- a/app/Http/Web/Views/course/show.volt +++ b/app/Http/Web/Views/course/show.volt @@ -12,14 +12,13 @@
    -
    -
    -
    -
    - -
    -
    -
    +
    +
    +
    +
    +
    +
    +
    • 详情
    • 目录
    • @@ -36,21 +35,21 @@
    - diff --git a/app/Http/Web/Views/course/sidebar_recommended.volt b/app/Http/Web/Views/course/sidebar_recommended.volt new file mode 100644 index 00000000..3efa3136 --- /dev/null +++ b/app/Http/Web/Views/course/sidebar_recommended.volt @@ -0,0 +1,23 @@ +
    +
    推荐课程
    +
    + {% for course in recommended_courses %} + {% set url = url({'for':'web.course.show','id':course.id}) %} + + {% endfor %} +
    +
    \ No newline at end of file diff --git a/app/Http/Web/Views/course/sidebar_related.volt b/app/Http/Web/Views/course/sidebar_related.volt new file mode 100644 index 00000000..9c80d9a2 --- /dev/null +++ b/app/Http/Web/Views/course/sidebar_related.volt @@ -0,0 +1,23 @@ +
    +
    相关课程
    +
    + {% for course in related_courses %} + {% set url = url({'for':'web.course.show','id':course.id}) %} + + {% endfor %} +
    +
    \ No newline at end of file diff --git a/app/Http/Web/Views/course/sidebar_teachers.volt b/app/Http/Web/Views/course/sidebar_teachers.volt new file mode 100644 index 00000000..beee4305 --- /dev/null +++ b/app/Http/Web/Views/course/sidebar_teachers.volt @@ -0,0 +1,18 @@ +
    +
    授课教师
    +
    + {% for teacher in teachers %} + + {% endfor %} +
    +
    \ No newline at end of file diff --git a/app/Http/Web/Views/course/sidebar_topics.volt b/app/Http/Web/Views/course/sidebar_topics.volt new file mode 100644 index 00000000..3ceea437 --- /dev/null +++ b/app/Http/Web/Views/course/sidebar_topics.volt @@ -0,0 +1,8 @@ +
    +
    热门专题
    +
    + {% for topic in topics %} + {{ topic.title }} + {% endfor %} +
    +
    \ No newline at end of file diff --git a/app/Http/Web/Views/course/widget_recommended.volt b/app/Http/Web/Views/course/widget_recommended.volt deleted file mode 100644 index 10db6f21..00000000 --- a/app/Http/Web/Views/course/widget_recommended.volt +++ /dev/null @@ -1,18 +0,0 @@ -
    -
    推荐课程
    -
    - {% for course in courses %} -
    -
    -
    -
    {{ course.title }}
    -
    - - - -
    -
    -
    - {% endfor %} -
    -
    \ No newline at end of file diff --git a/app/Http/Web/Views/course/widget_related.volt b/app/Http/Web/Views/course/widget_related.volt deleted file mode 100644 index 5a46fbd9..00000000 --- a/app/Http/Web/Views/course/widget_related.volt +++ /dev/null @@ -1,18 +0,0 @@ -
    -
    相关课程
    -
    - {% for course in courses %} -
    -
    -
    -
    {{ course.title }}
    -
    - - - -
    -
    -
    - {% endfor %} -
    -
    \ No newline at end of file diff --git a/app/Http/Web/Views/course/widget_teacher.volt b/app/Http/Web/Views/course/widget_teacher.volt deleted file mode 100644 index 73df81b3..00000000 --- a/app/Http/Web/Views/course/widget_teacher.volt +++ /dev/null @@ -1,14 +0,0 @@ -
    -
    授课教师
    -
    - {% for teacher in teachers %} -
    -
    -
    -
    {{ teacher.name }}
    -
    {{ teacher.title }}
    -
    -
    - {% endfor %} -
    -
    \ No newline at end of file diff --git a/app/Http/Web/Views/course/widget_topic.volt b/app/Http/Web/Views/course/widget_topic.volt deleted file mode 100644 index ae279125..00000000 --- a/app/Http/Web/Views/course/widget_topic.volt +++ /dev/null @@ -1,8 +0,0 @@ -
    -
    热门专题
    -
    - {% for topic in topics %} - {{ topic.title }} - {% endfor %} -
    -
    \ No newline at end of file diff --git a/app/Http/Web/Views/partials/header.volt b/app/Http/Web/Views/partials/header.volt index aed135ad..e8ec69cd 100644 --- a/app/Http/Web/Views/partials/header.volt +++ b/app/Http/Web/Views/partials/header.volt @@ -23,7 +23,7 @@ diff --git a/app/Http/Web/Views/search/list.volt b/app/Http/Web/Views/search/list.volt index f56a5418..463625a2 100644 --- a/app/Http/Web/Views/search/list.volt +++ b/app/Http/Web/Views/search/list.volt @@ -9,8 +9,9 @@ +
    {% if type == 'course' %} diff --git a/app/Http/Web/Views/templates/base.volt b/app/Http/Web/Views/templates/base.volt index 02da4987..5ef00a1e 100644 --- a/app/Http/Web/Views/templates/base.volt +++ b/app/Http/Web/Views/templates/base.volt @@ -5,6 +5,7 @@ + {{ site_seo.getTitle() }} {{ icon_link('favicon.ico') }} {{ css_link('lib/layui/css/layui.css') }} diff --git a/app/Library/Helper.php b/app/Library/Helper.php index 779ef6da..0327e41f 100644 --- a/app/Library/Helper.php +++ b/app/Library/Helper.php @@ -74,26 +74,6 @@ function kg_array_column($rows, $columnKey, $indexKey = null) return array_unique($result); } -/** - * 依据白名单取数据 - * - * @param array $params - * @param array $whitelist - * @return array - */ -function kg_array_whitelist($params, $whitelist) -{ - $result = []; - - foreach ($params as $key => $value) { - if (in_array($key, $whitelist)) { - $result[$key] = $value; - } - } - - return $result; -} - /** * 数组转对象 * diff --git a/public/static/web/css/common.css b/public/static/web/css/common.css index b2cd394a..9a16d8aa 100644 --- a/public/static/web/css/common.css +++ b/public/static/web/css/common.css @@ -1,5 +1,9 @@ -.layui-badge, .layui-badge-rim { - padding-bottom: 1px; +body { + background-color: #f2f2f2; +} + +.clearfix { + zoom: 1 } .clearfix:after { @@ -7,15 +11,7 @@ clear: both; content: ""; visibility: hidden; - height: 0 -} - -body { - background-color: #f2f2f2; -} - -.clearfix { - zoom: 1 + height: 0; } .fl { @@ -35,6 +31,19 @@ body { background-color: #393D49; } +#main { + margin-top: 80px; + margin-bottom: 40px; + min-height: 550px; +} + +#footer { + padding: 30px 0; + text-align: center; + font-size: 12px; + background: #474443; +} + .logo { } @@ -58,19 +67,6 @@ body { background-color: rgba(255, 255, 255, 0.05); } -#main { - margin-top: 80px; - margin-bottom: 40px; - min-height: 550px; -} - -#footer { - padding: 30px 0; - text-align: center; - font-size: 12px; - background: #474443; -} - #footer span, #footer a { color: #999; } @@ -98,7 +94,9 @@ body { .layout-content { float: left; - width: 800px; + width: 730px; + padding: 30px; + background-color: #fff; } .layout-sidebar { @@ -124,10 +122,6 @@ body { line-height: 30px; } -.index-module .content { - -} - .index-carousel { margin-bottom: 30px; text-align: center; @@ -206,10 +200,6 @@ body { overflow: hidden; } -.search-course-card .meta { - -} - .search-course-card .meta span { margin-right: 10px; } @@ -294,6 +284,11 @@ body { margin-bottom: 20px; } +.course-meta { + border: 1px dashed #ccc; + margin-bottom: 30px; +} + .course-meta .left { float: left; } @@ -302,25 +297,111 @@ body { float: right; } -.course-body { +.course-info-tab .layui-tab-content { + padding-top: 30px; } -.course-body .content { +ul.lesson-list { + +} + +.lesson-list li { + padding-left: 10px; + line-height: 40px; +} + +.lesson-list li a { + display: block; +} + +.lesson-list li:hover { + background-color: #f2f2f2; +} + +.sidebar-teacher-card { + margin-bottom: 15px; +} + +.sidebar-teacher-card .avatar { float: left; - width: 780px; + width: 60px; + height: 60px; + margin-right: 10px; } -.course-body .sidebar { +.sidebar-teacher-card .avatar img { + width: 100%; + height: 100%; + border-radius: 60px; +} + +.sidebar-teacher-card .info { float: left; - width: 320px; + padding: 5px 0; } -.btn-verify { +.sidebar-teacher-card .info .name { +} + +.sidebar-teacher-card .info .title { + color: #999; + font-size: 12px; +} + +.topic-badge { + padding: 5px; + margin-right: 10px; + margin-bottom: 10px; +} + +.sidebar-course-card { + padding-bottom: 10px; + margin-bottom: 10px; + border-bottom: 1px dashed #ccc; +} + +.sidebar-course-card:last-child { + border-bottom: none; +} + +.sidebar-course-card .cover { + float: left; + width: 90px; + height: 50px; + margin-right: 5px; +} + +.sidebar-course-card .cover img { + width: 100%; + height: 100%; +} + +.sidebar-course-card .info { + float: left; + width: 190px; + color: #999; + overflow: hidden; +} + +.sidebar-course-card .title { + font-size: 12px; + white-space: nowrap; +} + +.sidebar-course-card .meta { + font-size: 10px; +} + +.sidebar-course-card .meta span { + margin-right: 10px; +} + +.verify-tips-btn { color: green; } .register-container { - padding: 50px 30px; + padding: 40px 30px; background-color: #fff; } @@ -329,7 +410,7 @@ body { } .login-tab { - padding: 30px; + padding: 20px 30px; background-color: #fff; } diff --git a/public/static/web/js/captcha.login.js b/public/static/web/js/captcha.login.js new file mode 100644 index 00000000..9c9c6678 --- /dev/null +++ b/public/static/web/js/captcha.login.js @@ -0,0 +1,15 @@ +var $ = layui.jquery; +var layer = layui.layer; +var captcha = new TencentCaptcha( + $('#captcha-btn')[0], + $('#captcha-btn').attr('data-app-id'), + function (res) { + if (res.ret === 0) { + $('input[name=ticket]').val(res.ticket); + $('input[name=rand]').val(res.randstr); + $('#captcha-btn').remove(); + $('#submit-btn').removeAttr('disabled'); + $('#verify-btn').removeClass('layui-hide'); + } + } +); \ No newline at end of file diff --git a/public/static/web/js/captcha.verify.js b/public/static/web/js/captcha.verify.js new file mode 100644 index 00000000..e5a4b122 --- /dev/null +++ b/public/static/web/js/captcha.verify.js @@ -0,0 +1,28 @@ +var $ = layui.jquery; +var layer = layui.layer; +var captcha = new TencentCaptcha( + $('#cv-captcha-btn')[0], + $('#cv-captcha-btn').attr('data-app-id'), + function (res) { + if (res.ret === 0) { + $.ajax({ + type: 'POST', + url: '/verify/code', + data: { + account: $('#cv-account').val(), + ticket: res.ticket, + rand: res.randstr + }, + success: function (res) { + var icon = res.code === 0 ? 1 : 2; + if (res.msg) { + layer.msg(res.msg, {icon: icon}); + } + } + }); + $('#cv-captcha-btn').remove(); + $('#cv-submit-btn').removeAttr('disabled'); + $('#cv-verify-btn').removeClass('layui-hide'); + } + } +); \ No newline at end of file