From ebd310caa6ef39e488e84cef6953019e6c81e56a Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Thu, 31 Aug 2023 17:18:05 +0800 Subject: [PATCH] v1.6.6 --- CHANGELOG.md | 10 +++- .../Admin/Controllers/ChapterController.php | 13 ----- .../Admin/Controllers/CourseController.php | 16 ++++++ app/Http/Admin/Services/Chapter.php | 19 ------- app/Http/Admin/Services/Course.php | 18 +++++++ app/Http/Admin/Services/Resource.php | 51 ++----------------- app/Http/Admin/Views/chapter/edit_lesson.volt | 7 --- app/Http/Admin/Views/course/chapters.volt | 3 -- app/Http/Admin/Views/course/edit.volt | 6 +++ .../{chapter => course}/edit_resource.volt | 6 +-- .../Views/{chapter => course}/resources.volt | 5 +- .../Home/Controllers/ChapterController.php | 13 ----- .../Home/Controllers/CourseController.php | 14 +++++ app/Http/Home/Views/chapter/resources.volt | 29 ----------- app/Http/Home/Views/chapter/sticky.volt | 18 ------- app/Http/Home/Views/course/resources.volt | 20 ++++++++ app/Http/Home/Views/course/show.volt | 8 +++ app/Repos/Course.php | 11 ++++ app/Services/Logic/Chapter/ResourceList.php | 39 -------------- app/Services/Logic/Course/ResourceList.php | 28 +--------- ...chapter.resource.js => course.resource.js} | 4 +- public/static/home/js/chapter.show.js | 24 --------- public/static/home/js/course.show.js | 5 ++ 23 files changed, 119 insertions(+), 248 deletions(-) rename app/Http/Admin/Views/{chapter => course}/edit_resource.volt (82%) rename app/Http/Admin/Views/{chapter => course}/resources.volt (84%) delete mode 100644 app/Http/Home/Views/chapter/resources.volt create mode 100644 app/Http/Home/Views/course/resources.volt delete mode 100644 app/Services/Logic/Chapter/ResourceList.php rename public/static/admin/js/{chapter.resource.js => course.resource.js} (97%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2177671d..505a5ed3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,12 @@ -### [v1.6.6](https://gitee.com/koogua/course-tencent-cloud/releases/v1.6.6)(2023-08-15) +### [v1.6.6](https://gitee.com/koogua/course-tencent-cloud/releases/v1.6.6)(2023-08-30) + +- 还原意外删除的AnswerList.php文件 +- 修正邮箱注册提交按钮不可用问题 +- 去除删除远程课件逻辑 +- 增加课程课件资料总览 +- 优化cleanDemoDataTask脚本 +- 优化tag表migration脚本 +- 命名结构等常规优化 ### [v1.6.5](https://gitee.com/koogua/course-tencent-cloud/releases/v1.6.5)(2023-07-15) diff --git a/app/Http/Admin/Controllers/ChapterController.php b/app/Http/Admin/Controllers/ChapterController.php index 16e9a6ef..5da3e57c 100644 --- a/app/Http/Admin/Controllers/ChapterController.php +++ b/app/Http/Admin/Controllers/ChapterController.php @@ -20,19 +20,6 @@ use Phalcon\Mvc\View; class ChapterController extends Controller { - /** - * @Get("/{id:[0-9]+}/resources", name="admin.chapter.resources") - */ - public function resourcesAction($id) - { - $chapterService = new ChapterService(); - - $resources = $chapterService->getResources($id); - - $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); - $this->view->setVar('resources', $resources); - } - /** * @Get("/{id:[0-9]+}/lessons", name="admin.chapter.lessons") */ diff --git a/app/Http/Admin/Controllers/CourseController.php b/app/Http/Admin/Controllers/CourseController.php index aab1a83f..2121110f 100644 --- a/app/Http/Admin/Controllers/CourseController.php +++ b/app/Http/Admin/Controllers/CourseController.php @@ -9,6 +9,7 @@ namespace App\Http\Admin\Controllers; use App\Http\Admin\Services\Course as CourseService; use App\Models\Category as CategoryModel; +use Phalcon\Mvc\View; /** * @RoutePrefix("/admin/course") @@ -100,6 +101,7 @@ class CourseController extends Controller { $courseService = new CourseService(); + $cos = $courseService->getSettings('cos'); $course = $courseService->getCourse($id); $xmTeachers = $courseService->getXmTeachers($id); $xmCategories = $courseService->getXmCategories($id); @@ -107,6 +109,7 @@ class CourseController extends Controller $studyExpiryOptions = $courseService->getStudyExpiryOptions(); $refundExpiryOptions = $courseService->getRefundExpiryOptions(); + $this->view->setVar('cos', $cos); $this->view->setVar('course', $course); $this->view->setVar('xm_teachers', $xmTeachers); $this->view->setVar('xm_categories', $xmCategories); @@ -177,4 +180,17 @@ class CourseController extends Controller $this->view->setVar('chapters', $chapters); } + /** + * @Get("/{id:[0-9]+}/resources", name="admin.course.resources") + */ + public function resourcesAction($id) + { + $courseService = new CourseService(); + + $resources = $courseService->getResources($id); + + $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); + $this->view->setVar('resources', $resources); + } + } diff --git a/app/Http/Admin/Services/Chapter.php b/app/Http/Admin/Services/Chapter.php index ef5aaa94..5b01ce92 100644 --- a/app/Http/Admin/Services/Chapter.php +++ b/app/Http/Admin/Services/Chapter.php @@ -7,37 +7,18 @@ namespace App\Http\Admin\Services; -use App\Builders\ResourceList as ResourceListBuilder; use App\Caches\Chapter as ChapterCache; use App\Caches\CourseChapterList as CatalogCache; use App\Models\Chapter as ChapterModel; use App\Models\Course as CourseModel; use App\Repos\Chapter as ChapterRepo; use App\Repos\Course as CourseRepo; -use App\Repos\Resource as ResourceRepo; use App\Services\CourseStat as CourseStatService; use App\Validators\Chapter as ChapterValidator; class Chapter extends Service { - public function getResources($id) - { - $resourceRepo = new ResourceRepo(); - - $resources = $resourceRepo->findByChapterId($id); - - if ($resources->count() == 0) return []; - - $builder = new ResourceListBuilder(); - - $items = $resources->toArray(); - - $items = $builder->handleUploads($items); - - return $builder->objects($items); - } - public function getLessons($parentId) { $deleted = $this->request->getQuery('deleted', 'int', 0); diff --git a/app/Http/Admin/Services/Course.php b/app/Http/Admin/Services/Course.php index 7a53da9c..7e8bd99f 100644 --- a/app/Http/Admin/Services/Course.php +++ b/app/Http/Admin/Services/Course.php @@ -8,6 +8,7 @@ namespace App\Http\Admin\Services; use App\Builders\CourseList as CourseListBuilder; +use App\Builders\ResourceList as ResourceListBuilder; use App\Caches\Course as CourseCache; use App\Caches\CourseCategoryList as CourseCategoryListCache; use App\Caches\CourseRelatedList as CourseRelatedListCache; @@ -404,6 +405,23 @@ class Course extends Service ]); } + public function getResources($id) + { + $courseRepo = new CourseRepo(); + + $resources = $courseRepo->findResources($id); + + if ($resources->count() == 0) return []; + + $builder = new ResourceListBuilder(); + + $items = $resources->toArray(); + + $items = $builder->handleUploads($items); + + return $builder->objects($items); + } + protected function findOrFail($id) { $validator = new CourseValidator(); diff --git a/app/Http/Admin/Services/Resource.php b/app/Http/Admin/Services/Resource.php index 793a2154..439d4931 100644 --- a/app/Http/Admin/Services/Resource.php +++ b/app/Http/Admin/Services/Resource.php @@ -7,13 +7,10 @@ namespace App\Http\Admin\Services; -use App\Models\Chapter as ChapterModel; use App\Models\Course as CourseModel; use App\Models\Resource as ResourceModel; use App\Models\Upload as UploadModel; -use App\Repos\Chapter as ChapterRepo; use App\Repos\Course as CourseRepo; -use App\Validators\Chapter as ChapterValidator; use App\Validators\Resource as ResourceValidator; use App\Validators\Upload as UploadValidator; @@ -24,10 +21,9 @@ class Resource extends Service { $post = $this->request->getPost(); - $validator = new ChapterValidator(); + $validator = new ResourceValidator(); - $chapter = $validator->checkChapter($post['chapter_id']); - $course = $validator->checkCourse($chapter->course_id); + $course = $validator->checkCourse($post['course_id']); $upload = new UploadModel(); @@ -43,12 +39,10 @@ class Resource extends Service $resource = new ResourceModel(); $resource->course_id = $course->id; - $resource->chapter_id = $chapter->id; $resource->upload_id = $upload->id; $resource->create(); - $this->recountChapterResources($chapter); $this->recountCourseResources($course); return $upload; @@ -82,11 +76,9 @@ class Resource extends Service $validator = new ResourceValidator(); $course = $validator->checkCourse($resource->course_id); - $chapter = $validator->checkChapter($resource->chapter_id); $resource->delete(); - $this->recountChapterResources($chapter); $this->recountCourseResources($course); } @@ -97,48 +89,11 @@ class Resource extends Service return $validator->checkResource($id); } - protected function recountChapterResources(ChapterModel $chapter) - { - $chapterRepo = new ChapterRepo(); - - $chapter->resource_count = $chapterRepo->countResources($chapter->id); - - $chapter->update(); - - $parent = $chapterRepo->findById($chapter->parent_id); - - $lessons = $chapterRepo->findLessons($parent->id); - - $resourceCount = 0; - - foreach ($lessons as $lesson) { - if ($lesson->deleted == 0) { - $resourceCount += $chapterRepo->countResources($lesson->id); - } - } - - $parent->resource_count = $resourceCount; - - $parent->update(); - } - protected function recountCourseResources(CourseModel $course) { $courseRepo = new CourseRepo(); - $lessons = $courseRepo->findLessons($course->id); - - $chapterRepo = new ChapterRepo(); - - $resourceCount = 0; - - if ($lessons->count() > 0) { - foreach ($lessons as $lesson) { - if ($lesson->deleted == 0) { - $resourceCount += $chapterRepo->countResources($lesson->id); - } - } - } + $resourceCount = $courseRepo->countResources($course->id); $course->resource_count = $resourceCount; diff --git a/app/Http/Admin/Views/chapter/edit_lesson.volt b/app/Http/Admin/Views/chapter/edit_lesson.volt index 6a2902b6..90b926bf 100644 --- a/app/Http/Admin/Views/chapter/edit_lesson.volt +++ b/app/Http/Admin/Views/chapter/edit_lesson.volt @@ -22,7 +22,6 @@
@@ -39,9 +38,6 @@ {{ partial('chapter/edit_lesson_offline') }} {% endif %}
-
- {{ partial('chapter/edit_resource') }} -
@@ -65,9 +61,6 @@ {% endif %} - {{ js_include('lib/cos-js-sdk-v5.min.js') }} - {{ js_include('admin/js/chapter.resource.js') }} - {% endblock %} {% block inline_js %} diff --git a/app/Http/Admin/Views/course/chapters.volt b/app/Http/Admin/Views/course/chapters.volt index 5db9943b..0fe08f17 100644 --- a/app/Http/Admin/Views/course/chapters.volt +++ b/app/Http/Admin/Views/course/chapters.volt @@ -29,7 +29,6 @@ - @@ -37,7 +36,6 @@ 编号 名称 课时 - 课件 学员 点赞 评论 @@ -59,7 +57,6 @@ {{ item.lesson_count }} - {{ item.resource_count }} {{ item.user_count }} {{ item.like_count }} {{ item.comment_count }} diff --git a/app/Http/Admin/Views/course/edit.volt b/app/Http/Admin/Views/course/edit.volt index 9d92e9d8..4ecce804 100644 --- a/app/Http/Admin/Views/course/edit.volt +++ b/app/Http/Admin/Views/course/edit.volt @@ -14,6 +14,7 @@ {% endif %}
  • 课程介绍
  • 营销设置
  • +
  • 课件资料
  • 相关课程
  • @@ -31,6 +32,9 @@
    {{ partial('course/edit_sale') }}
    +
    + {{ partial('course/edit_resource') }} +
    {{ partial('course/edit_related') }}
    @@ -42,10 +46,12 @@ {% block include_js %} {{ js_include('lib/xm-select.js') }} + {{ js_include('lib/cos-js-sdk-v5.min.js') }} {{ js_include('lib/kindeditor/kindeditor.min.js') }} {{ js_include('lib/kindeditor/lang/zh-CN.js') }} {{ js_include('admin/js/content.editor.js') }} {{ js_include('admin/js/cover.upload.js') }} + {{ js_include('admin/js/course.resource.js') }} {% endblock %} diff --git a/app/Http/Admin/Views/chapter/edit_resource.volt b/app/Http/Admin/Views/course/edit_resource.volt similarity index 82% rename from app/Http/Admin/Views/chapter/edit_resource.volt rename to app/Http/Admin/Views/course/edit_resource.volt index e2c860c9..5c13e51a 100644 --- a/app/Http/Admin/Views/chapter/edit_resource.volt +++ b/app/Http/Admin/Views/course/edit_resource.volt @@ -1,4 +1,4 @@ -{% set res_list_url = url({'for':'admin.chapter.resources','id':chapter.id}) %} +{% set res_list_url = url({'for':'admin.course.resources','id':course.id}) %}
    资料列表 @@ -17,7 +17,7 @@
    -
    +
    @@ -26,7 +26,7 @@
    - +
    diff --git a/app/Http/Admin/Views/chapter/resources.volt b/app/Http/Admin/Views/course/resources.volt similarity index 84% rename from app/Http/Admin/Views/chapter/resources.volt rename to app/Http/Admin/Views/course/resources.volt index 4bfc0552..1b882762 100644 --- a/app/Http/Admin/Views/chapter/resources.volt +++ b/app/Http/Admin/Views/course/resources.volt @@ -1,4 +1,5 @@ -{% if resources %} +{% if resources|length > 0 %} +
    @@ -16,7 +17,7 @@ diff --git a/app/Http/Home/Controllers/ChapterController.php b/app/Http/Home/Controllers/ChapterController.php index 9d6b8021..1119a909 100644 --- a/app/Http/Home/Controllers/ChapterController.php +++ b/app/Http/Home/Controllers/ChapterController.php @@ -13,7 +13,6 @@ use App\Models\Course as CourseModel; use App\Services\Logic\Chapter\ChapterInfo as ChapterInfoService; use App\Services\Logic\Chapter\ChapterLike as ChapterLikeService; use App\Services\Logic\Chapter\Learning as ChapterLearningService; -use App\Services\Logic\Chapter\ResourceList as ChapterResourceListService; use App\Services\Logic\Course\BasicInfo as CourseInfoService; use App\Services\Logic\Course\ChapterList as CourseChapterListService; @@ -23,18 +22,6 @@ use App\Services\Logic\Course\ChapterList as CourseChapterListService; class ChapterController extends Controller { - /** - * @Get("/{id:[0-9]+}/resources", name="home.chapter.resources") - */ - public function resourcesAction($id) - { - $service = new ChapterResourceListService(); - - $items = $service->handle($id); - - $this->view->setVar('items', $items); - } - /** * @Get("/{id:[0-9]+}", name="home.chapter.show") */ diff --git a/app/Http/Home/Controllers/CourseController.php b/app/Http/Home/Controllers/CourseController.php index 9e82fc2f..6047b3e9 100644 --- a/app/Http/Home/Controllers/CourseController.php +++ b/app/Http/Home/Controllers/CourseController.php @@ -17,6 +17,7 @@ use App\Services\Logic\Course\CourseList as CourseListService; use App\Services\Logic\Course\PackageList as CoursePackageListService; use App\Services\Logic\Course\RecommendedList as CourseRecommendedListService; use App\Services\Logic\Course\RelatedList as CourseRelatedListService; +use App\Services\Logic\Course\ResourceList as CourseResourceListService; use App\Services\Logic\Course\ReviewList as CourseReviewListService; use App\Services\Logic\Course\TopicList as CourseTopicListService; use App\Services\Logic\Reward\OptionList as RewardOptionList; @@ -160,6 +161,19 @@ class CourseController extends Controller $this->view->setVar('pager', $pager); } + /** + * @Get("/{id:[0-9]+}/resources", name="home.course.resources") + */ + public function resourcesAction($id) + { + $service = new CourseResourceListService(); + + $items = $service->handle($id); + + $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); + $this->view->setVar('items', $items); + } + /** * @Get("/{id:[0-9]+}/recommended", name="home.course.recommended") */ diff --git a/app/Http/Home/Views/chapter/resources.volt b/app/Http/Home/Views/chapter/resources.volt deleted file mode 100644 index 67c32c57..00000000 --- a/app/Http/Home/Views/chapter/resources.volt +++ /dev/null @@ -1,29 +0,0 @@ -{% extends 'templates/layer.volt' %} - -{% block content %} - -
    名称{{ item.upload.size|human_size }} {{ date('Y-m-d H:i:s',item.create_time) }} - 删除 + 删除 下载
    - - - - - - {% for item in items %} - - - - - - {% endfor %} -
    名称大小操作
    {{ item.name }}{{ item.size|human_size }}下载
    - -{% endblock %} - -{% block inline_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 index cc4c20b3..85244ea1 100644 --- a/app/Http/Home/Views/chapter/sticky.volt +++ b/app/Http/Home/Views/chapter/sticky.volt @@ -1,5 +1,3 @@ -{% 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' : '' %} @@ -23,20 +21,4 @@
    {{ 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/course/resources.volt b/app/Http/Home/Views/course/resources.volt new file mode 100644 index 00000000..a500b8bb --- /dev/null +++ b/app/Http/Home/Views/course/resources.volt @@ -0,0 +1,20 @@ +{% if items|length > 0 %} + + + + + + + {% for item in items %} + + + + {% if item.me.owned == 1 and auth_user.id > 0 %} + + {% else %} + + {% endif %} + + {% endfor %} +
    名称大小操作
    {{ item.name }}{{ item.size|human_size }}下载下载
    +{% endif %} \ No newline at end of file diff --git a/app/Http/Home/Views/course/show.volt b/app/Http/Home/Views/course/show.volt index b3a60cca..b03dcb0d 100644 --- a/app/Http/Home/Views/course/show.volt +++ b/app/Http/Home/Views/course/show.volt @@ -28,6 +28,7 @@ {% set show_tab_packages = course.package_count > 0 %} {% set show_tab_consults = course.consult_count > 0 %} {% set show_tab_reviews = course.review_count > 0 %} + {% set show_tab_resources = course.resource_count > 0 %}
    @@ -44,6 +45,9 @@ {% if show_tab_reviews %}
  • 评价{{ course.review_count }}
  • {% endif %} + {% if show_tab_resources %} +
  • 课件{{ course.resource_count }}
  • + {% endif %}
    @@ -64,6 +68,10 @@ {% set reviews_url = url({'for':'home.course.reviews','id':course.id}) %}
    {% endif %} + {% if show_tab_resources %} + {% set resources_url = url({'for':'home.course.resources','id':course.id}) %} +
    + {% endif %}
    diff --git a/app/Repos/Course.php b/app/Repos/Course.php index 538aad47..40000ae0 100644 --- a/app/Repos/Course.php +++ b/app/Repos/Course.php @@ -305,6 +305,17 @@ class Course extends Repository ->execute(); } + /** + * @param int $courseId + * @return ResultsetInterface|Resultset|ResourceModel[] + */ + public function findResources($courseId) + { + return ResourceModel::query() + ->where('course_id = :course_id:', ['course_id' => $courseId]) + ->execute(); + } + /** * @param int $courseId * @param int $userId diff --git a/app/Services/Logic/Chapter/ResourceList.php b/app/Services/Logic/Chapter/ResourceList.php deleted file mode 100644 index ed21327a..00000000 --- a/app/Services/Logic/Chapter/ResourceList.php +++ /dev/null @@ -1,39 +0,0 @@ -checkChapter($id); - - $resourceRepo = new ResourceRepo(); - - $resources = $resourceRepo->findByChapterId($chapter->id); - - if ($resources->count() == 0) { - return []; - } - - $builder = new ResourceListBuilder(); - - $relations = $resources->toArray(); - - return $builder->getUploads($relations); - } - -} diff --git a/app/Services/Logic/Course/ResourceList.php b/app/Services/Logic/Course/ResourceList.php index 9a712384..abead04c 100644 --- a/app/Services/Logic/Course/ResourceList.php +++ b/app/Services/Logic/Course/ResourceList.php @@ -9,7 +9,6 @@ namespace App\Services\Logic\Course; use App\Builders\ResourceList as ResourceListBuilder; use App\Repos\Course as CourseRepo; -use App\Repos\Resource as ResourceRepo; use App\Services\Logic\CourseTrait; use App\Services\Logic\Service as LogicService; @@ -28,26 +27,7 @@ class ResourceList extends LogicService $courseRepo = new CourseRepo(); - $lessons = $courseRepo->findLessons($course->id); - - if ($lessons->count() == 0) { - return []; - } - - $lessonIds = []; - - /** - * 过滤掉未发布和已删除的课时 - */ - foreach ($lessons as $lesson) { - if ($lesson->published == 1 && $lesson->deleted == 0) { - $lessonIds[] = $lesson->id; - } - } - - $resourceRepo = new ResourceRepo(); - - $resources = $resourceRepo->findByCourseId($course->id); + $resources = $courseRepo->findResources($course->id); if ($resources->count() == 0) { return []; @@ -57,12 +37,6 @@ class ResourceList extends LogicService $relations = $resources->toArray(); - foreach ($relations as $key => $relation) { - if (!in_array($relation['chapter_id'], $lessonIds)) { - unset($relations[$key]); - } - } - $uploads = $builder->getUploads($relations); foreach ($uploads as $key => $upload) { diff --git a/public/static/admin/js/chapter.resource.js b/public/static/admin/js/course.resource.js similarity index 97% rename from public/static/admin/js/chapter.resource.js rename to public/static/admin/js/course.resource.js index e7300692..e8be73e8 100644 --- a/public/static/admin/js/chapter.resource.js +++ b/public/static/admin/js/course.resource.js @@ -8,7 +8,7 @@ layui.use(['jquery', 'element', 'layer'], function () { var $resFile = $('input[name=res_file]'); var $uploadBlock = $('#res-upload-block'); var $progressBlock = $('#res-progress-block'); - var chapterId = $('input[name=chapter_id]').val(); + var courseId = $('input[name=course_id]').val(); var myConfig = { bucket: $('input[name=bucket]').val(), @@ -70,7 +70,7 @@ layui.use(['jquery', 'element', 'layer'], function () { path: keyName, md5: data.ETag ? data.ETag.replace(/"/g, '') : '' }, - chapter_id: chapterId, + course_id: courseId, }, function () { $uploadBlock.removeClass('layui-hide'); $progressBlock.addClass('layui-hide'); diff --git a/public/static/home/js/chapter.show.js b/public/static/home/js/chapter.show.js index 39d33773..d7d76e29 100644 --- a/public/static/home/js/chapter.show.js +++ b/public/static/home/js/chapter.show.js @@ -34,30 +34,6 @@ layui.use(['jquery', 'helper'], function () { }); }); - $('.icon-help').on('click', function () { - var url = $(this).parent().data('url'); - helper.checkLogin(function () { - layer.open({ - type: 2, - title: '课程咨询', - content: [url, 'no'], - area: ['640px', '300px'] - }); - }); - }); - - $('.icon-download').on('click', function () { - var url = $(this).parent().data('url'); - helper.checkLogin(function () { - layer.open({ - type: 2, - title: '资料下载', - content: [url, 'no'], - area: ['640px', '300px'] - }); - }); - }); - $('.icon-reply').on('click', function () { $('html').animate({ scrollTop: $('#comment-anchor').offset().top diff --git a/public/static/home/js/course.show.js b/public/static/home/js/course.show.js index 0abfb5a0..ae7ae753 100644 --- a/public/static/home/js/course.show.js +++ b/public/static/home/js/course.show.js @@ -135,6 +135,11 @@ layui.use(['jquery', 'layer', 'helper'], function () { helper.ajaxLoadHtml($tabReviews.data('url'), $tabReviews.attr('id')); } + if ($('#tab-resources').length > 0) { + var $tabResources = $('#tab-resources'); + helper.ajaxLoadHtml($tabResources.data('url'), $tabResources.attr('id')); + } + if ($('#sidebar-topics').length > 0) { var $sdTopics = $('#sidebar-topics'); helper.ajaxLoadHtml($sdTopics.data('url'), $sdTopics.attr('id'));