From dca1ccf79a48428fec9c80bf66af994e771e1abd Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Sun, 10 Dec 2023 20:55:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8E=92=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Caches/CourseRecommendedList.php | 90 ------------------- app/Console/Tasks/CleanDemoDataTask.php | 9 +- .../Admin/Controllers/AnswerController.php | 3 + .../Admin/Controllers/ConsultController.php | 3 + app/Http/Admin/Services/Question.php | 4 + app/Http/Admin/Views/answer/edit.volt | 19 +++- app/Http/Admin/Views/article/edit_basic.volt | 14 +-- app/Http/Admin/Views/consult/edit.volt | 16 ++++ app/Http/Admin/Views/package/edit.volt | 12 +-- app/Http/Admin/Views/question/edit.volt | 6 ++ app/Http/Admin/Views/question/edit_basic.volt | 15 ++-- app/Http/Admin/Views/question/edit_desc.volt | 2 +- app/Http/Admin/Views/question/edit_seo.volt | 21 +++++ .../Home/Controllers/CourseController.php | 14 --- app/Http/Home/Views/course/show.volt | 5 -- app/Http/Home/Views/macros/course.volt | 21 ++--- app/Http/Home/Views/partials/header.volt | 8 +- app/Http/Home/Views/search/index.volt | 32 +++++-- .../Home/Views/user/console/favorites.volt | 2 +- app/Models/Article.php | 2 +- app/Services/Logic/Article/ArticleList.php | 14 ++- app/Services/Logic/Course/RecommendedList.php | 30 ------- app/Services/Logic/Deliver/CourseDeliver.php | 7 +- app/Validators/Consult.php | 15 +--- app/Validators/Question.php | 13 +++ config/errors.php | 2 + public/static/home/css/common.css | 4 + public/static/home/js/article.edit.js | 20 +---- public/static/home/js/common.js | 1 - public/static/home/js/course.show.js | 5 -- public/static/home/js/question.edit.js | 19 +--- 31 files changed, 168 insertions(+), 260 deletions(-) delete mode 100644 app/Caches/CourseRecommendedList.php create mode 100644 app/Http/Admin/Views/question/edit_seo.volt delete mode 100644 app/Services/Logic/Course/RecommendedList.php diff --git a/app/Caches/CourseRecommendedList.php b/app/Caches/CourseRecommendedList.php deleted file mode 100644 index c810082f..00000000 --- a/app/Caches/CourseRecommendedList.php +++ /dev/null @@ -1,90 +0,0 @@ -lifetime; - } - - public function getKey($id = null) - { - return "course_recommended_list:{$id}"; - } - - public function getContent($id = null) - { - $courses = $this->findCourses(5); - - if ($courses->count() == 0) { - return []; - } - - return $this->handleContent($courses); - } - - /** - * @param CourseModel[] $courses - * @return array - */ - public function handleContent($courses) - { - $result = []; - - foreach ($courses as $course) { - - $userCount = $course->user_count; - - if ($course->fake_user_count > $course->user_count) { - $userCount = $course->fake_user_count; - } - - $result[] = [ - 'id' => $course->id, - 'title' => $course->title, - 'cover' => $course->cover, - 'model' => $course->model, - 'level' => $course->level, - 'rating' => round($course->rating, 1), - 'market_price' => (float)$course->market_price, - 'vip_price' => (float)$course->vip_price, - 'user_count' => $userCount, - 'lesson_count' => $course->lesson_count, - 'review_count' => $course->review_count, - 'favorite_count' => $course->favorite_count, - ]; - } - - return $result; - } - - /** - * @param int $limit - * @return ResultsetInterface|Resultset|CourseModel[] - */ - public function findCourses($limit = 5) - { - return CourseModel::query() - ->where('market_price > 0') - ->andWhere('published = 1') - ->andWhere('deleted = 0') - ->orderBy('RAND()') - ->limit($limit) - ->execute(); - } - -} diff --git a/app/Console/Tasks/CleanDemoDataTask.php b/app/Console/Tasks/CleanDemoDataTask.php index 24cba3df..fabd6a6d 100644 --- a/app/Console/Tasks/CleanDemoDataTask.php +++ b/app/Console/Tasks/CleanDemoDataTask.php @@ -8,12 +8,13 @@ namespace App\Console\Tasks; use App\Caches\CategoryList as CategoryListCache; +use App\Caches\CategoryAllList as CategoryAllListCache; use App\Caches\CategoryTreeList as CategoryTreeListCache; use App\Caches\IndexSlideList as IndexSlideListCache; use App\Models\Account as AccountModel; use App\Models\Category as CategoryModel; use App\Repos\User as UserRepo; -use App\Services\Utils\IndexCourseCache as IndexCourseCacheUtil; +use App\Services\Utils\IndexPageCache as IndexPageCacheUtil; class CleanDemoDataTask extends Task { @@ -81,17 +82,19 @@ class CleanDemoDataTask extends Task protected function cleanCache() { - $util = new IndexCourseCacheUtil(); + $util = new IndexPageCacheUtil(); $util->rebuild(); $slideListCache = new IndexSlideListCache(); $slideListCache->rebuild(); $categoryListCache = new CategoryListCache(); + $categoryAllListCache = new CategoryAllListCache(); $categoryTreeListCache = new CategoryTreeListCache(); foreach (CategoryModel::types() as $key => $value) { $categoryListCache->rebuild($key); + $categoryAllListCache->rebuild($key); $categoryTreeListCache->rebuild($key); } } @@ -114,7 +117,7 @@ class CleanDemoDataTask extends Task $user = $userRepo->findById(100015); - return $user ? true : false; + return (bool)$user; } } diff --git a/app/Http/Admin/Controllers/AnswerController.php b/app/Http/Admin/Controllers/AnswerController.php index b0ecffa5..d592c327 100644 --- a/app/Http/Admin/Controllers/AnswerController.php +++ b/app/Http/Admin/Controllers/AnswerController.php @@ -61,12 +61,15 @@ class AnswerController extends Controller { $answerService = new AnswerService(); + $publishTypes = $answerService->getPublishTypes(); + $answer = $answerService->getAnswer($id); $questionService = new QuestionService(); $question = $questionService->getQuestion($answer->question_id); + $this->view->setVar('publish_types', $publishTypes); $this->view->setVar('question', $question); $this->view->setVar('answer', $answer); } diff --git a/app/Http/Admin/Controllers/ConsultController.php b/app/Http/Admin/Controllers/ConsultController.php index 7f66dcf5..92a22c0d 100644 --- a/app/Http/Admin/Controllers/ConsultController.php +++ b/app/Http/Admin/Controllers/ConsultController.php @@ -57,8 +57,11 @@ class ConsultController extends Controller { $consultService = new ConsultService(); + $publishTypes = $consultService->getPublishTypes(); + $consult = $consultService->getConsult($id); + $this->view->setVar('publish_types', $publishTypes); $this->view->setVar('consult', $consult); } diff --git a/app/Http/Admin/Services/Question.php b/app/Http/Admin/Services/Question.php index 18bfc401..9e69c819 100644 --- a/app/Http/Admin/Services/Question.php +++ b/app/Http/Admin/Services/Question.php @@ -162,6 +162,10 @@ class Question extends Service $data['keywords'] = $validator->checkKeywords($post['keywords']); } + if (isset($post['summary'])) { + $data['summary'] = $validator->checkSummary($post['keywords']); + } + if (isset($post['anonymous'])) { $data['anonymous'] = $validator->checkAnonymousStatus($post['anonymous']); } diff --git a/app/Http/Admin/Views/answer/edit.volt b/app/Http/Admin/Views/answer/edit.volt index 9f5d83a5..3e354819 100644 --- a/app/Http/Admin/Views/answer/edit.volt +++ b/app/Http/Admin/Views/answer/edit.volt @@ -7,16 +7,27 @@ 编辑答案
-
- + +
+
{{ question.title }}
-
+ +
-
+
+ +
+ {% for value,title in publish_types %} + {% set checked = value == answer.published ? 'checked="checked"' : '' %} + + {% endfor %} +
+
+
diff --git a/app/Http/Admin/Views/article/edit_basic.volt b/app/Http/Admin/Views/article/edit_basic.volt index 1b956c39..05d12083 100644 --- a/app/Http/Admin/Views/article/edit_basic.volt +++ b/app/Http/Admin/Views/article/edit_basic.volt @@ -52,10 +52,12 @@
- +
- - + {% for value,title in publish_types %} + {% set checked = value == article.published ? 'checked="checked"' : '' %} + + {% endfor %}
@@ -66,10 +68,10 @@
- +
- - + +
diff --git a/app/Http/Admin/Views/consult/edit.volt b/app/Http/Admin/Views/consult/edit.volt index d556935b..f01813fc 100644 --- a/app/Http/Admin/Views/consult/edit.volt +++ b/app/Http/Admin/Views/consult/edit.volt @@ -18,6 +18,22 @@
+
+ +
+ {% for value,title in publish_types %} + {% set checked = value == consult.published ? 'checked="checked"' : '' %} + + {% endfor %} +
+
+
+ +
+ + +
+
diff --git a/app/Http/Admin/Views/package/edit.volt b/app/Http/Admin/Views/package/edit.volt index b23c5016..c7c97b97 100644 --- a/app/Http/Admin/Views/package/edit.volt +++ b/app/Http/Admin/Views/package/edit.volt @@ -6,12 +6,6 @@
编辑套餐
-
- -
- -
-
@@ -22,6 +16,12 @@
+
+ +
+ +
+
diff --git a/app/Http/Admin/Views/question/edit.volt b/app/Http/Admin/Views/question/edit.volt index 0b895993..0552b16c 100644 --- a/app/Http/Admin/Views/question/edit.volt +++ b/app/Http/Admin/Views/question/edit.volt @@ -2,6 +2,8 @@ {% block content %} + {% set update_url = url({'for':'admin.question.update','id':question.id}) %} +
编辑问题
@@ -9,12 +11,16 @@
  • 基本信息
  • +
  • 搜索优化
  • 内容详情
{{ partial('question/edit_basic') }}
+
+ {{ partial('question/edit_seo') }} +
{{ partial('question/edit_desc') }}
diff --git a/app/Http/Admin/Views/question/edit_basic.volt b/app/Http/Admin/Views/question/edit_basic.volt index 5517328e..9df6661f 100644 --- a/app/Http/Admin/Views/question/edit_basic.volt +++ b/app/Http/Admin/Views/question/edit_basic.volt @@ -1,4 +1,4 @@ -
+
@@ -24,20 +24,23 @@
- +
- + {% for value,title in publish_types %} + {% set checked = value == question.published ? 'checked="checked"' : '' %} + + {% endfor %}
- +
- +
@@ -46,7 +49,7 @@
- +
diff --git a/app/Http/Admin/Views/question/edit_desc.volt b/app/Http/Admin/Views/question/edit_desc.volt index c6282d55..2deb0bb5 100644 --- a/app/Http/Admin/Views/question/edit_desc.volt +++ b/app/Http/Admin/Views/question/edit_desc.volt @@ -1,4 +1,4 @@ - +
diff --git a/app/Http/Admin/Views/question/edit_seo.volt b/app/Http/Admin/Views/question/edit_seo.volt new file mode 100644 index 00000000..c5c0d1b0 --- /dev/null +++ b/app/Http/Admin/Views/question/edit_seo.volt @@ -0,0 +1,21 @@ + +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + +
+
+ \ No newline at end of file diff --git a/app/Http/Home/Controllers/CourseController.php b/app/Http/Home/Controllers/CourseController.php index 6047b3e9..48a84342 100644 --- a/app/Http/Home/Controllers/CourseController.php +++ b/app/Http/Home/Controllers/CourseController.php @@ -15,7 +15,6 @@ use App\Services\Logic\Course\CourseFavorite as CourseFavoriteService; use App\Services\Logic\Course\CourseInfo as CourseInfoService; 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; @@ -174,19 +173,6 @@ class CourseController extends Controller $this->view->setVar('items', $items); } - /** - * @Get("/{id:[0-9]+}/recommended", name="home.course.recommended") - */ - public function recommendedAction($id) - { - $service = new CourseRecommendedListService(); - - $courses = $service->handle($id); - - $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); - $this->view->setVar('courses', $courses); - } - /** * @Get("/{id:[0-9]+}/related", name="home.course.related") */ diff --git a/app/Http/Home/Views/course/show.volt b/app/Http/Home/Views/course/show.volt index 11353557..e1051ac9 100644 --- a/app/Http/Home/Views/course/show.volt +++ b/app/Http/Home/Views/course/show.volt @@ -79,7 +79,6 @@
{% set show_sidebar_topics = 1 %} - {% set show_sidebar_recommended = 1 %} {% set show_sidebar_related = 1 %}
@@ -89,10 +88,6 @@ {% set topics_url = url({'for':'home.course.topics','id':course.id}) %} {% endif %} - {% if show_sidebar_recommended %} - {% set recommended_url = url({'for':'home.course.recommended','id':course.id}) %} - - {% endif %} {% if show_sidebar_related %} {% set related_url = url({'for':'home.course.related','id':course.id}) %} diff --git a/app/Http/Home/Views/macros/course.volt b/app/Http/Home/Views/macros/course.volt index 704a4564..94dd056b 100644 --- a/app/Http/Home/Views/macros/course.volt +++ b/app/Http/Home/Views/macros/course.volt @@ -43,25 +43,18 @@ {{ course.title }}
- {% if course.market_price > course.vip_price %} - {{ '¥%0.2f'|format(course.market_price) }} - {% if course.vip_price > 0 %} - {{ '会员¥%0.2f'|format(course.vip_price) }} - {% else %} - 会员免费 - {% endif %} - {{ level_type(course.level) }} + {% if course.market_price == 0 %} + 全员免费 + {{ course.lesson_count }}节课 + {{ course.user_count }}人报名 + {% elseif course.vip_price == 0 %} + 会员免费 + {{ course.lesson_count }}节课 {{ course.user_count }}人购买 {% elseif course.market_price > 0 %} {{ '¥%0.2f'|format(course.market_price) }} - {{ level_type(course.level) }} {{ course.lesson_count }}节课 {{ course.user_count }}人购买 - {% else %} - 免费 - {{ level_type(course.level) }} - {{ course.lesson_count }}节课 - {{ course.user_count }}人报名 {% endif %}
diff --git a/app/Http/Home/Views/partials/header.volt b/app/Http/Home/Views/partials/header.volt index b06e3480..3b8dff4f 100644 --- a/app/Http/Home/Views/partials/header.volt +++ b/app/Http/Home/Views/partials/header.volt @@ -22,17 +22,13 @@
-{% set s_type = request.get('type',['trim','string'],'course') %} -{% set s_query = request.get('query',['trim','striptags'],'') %} -{% set s_url = url({'for':'home.search.index'}) %} -
  • - 搜索 + 搜索
  • - 会员 + 会员
  • {% if auth_user.id > 0 %}
  • diff --git a/app/Http/Home/Views/search/index.volt b/app/Http/Home/Views/search/index.volt index 9ca3d0e9..59c2a956 100644 --- a/app/Http/Home/Views/search/index.volt +++ b/app/Http/Home/Views/search/index.volt @@ -8,13 +8,18 @@ {% set type = request.get('type','trim','course') %} {% set query = request.get('query','striptags','') %} - +
    +
    +
    + +
    +
    + + +
    +
    +
    - {% set tab_show = type %}
    @@ -50,4 +55,19 @@
    +{% endblock %} + +{% block inline_js %} + + + {% endblock %} \ No newline at end of file diff --git a/app/Http/Home/Views/user/console/favorites.volt b/app/Http/Home/Views/user/console/favorites.volt index 09db7f85..54c56715 100644 --- a/app/Http/Home/Views/user/console/favorites.volt +++ b/app/Http/Home/Views/user/console/favorites.volt @@ -2,7 +2,7 @@ {% block content %} - {% set types = {'course':'课程','article':'文章','question':'问题'} %} + {% set types = {'course':'课程','article':'专栏','question':'问题'} %} {% set type = request.get('type','trim','course') %}
    diff --git a/app/Models/Article.php b/app/Models/Article.php index 3ebfe3f7..4fac85c1 100644 --- a/app/Models/Article.php +++ b/app/Models/Article.php @@ -267,7 +267,7 @@ class Article extends Model public function afterFetch() { - if (!empty($this->cover) && !Text::startsWith($this->cover, 'http')) { + if (!Text::startsWith($this->cover, 'http')) { $this->cover = kg_cos_article_cover_url($this->cover); } diff --git a/app/Services/Logic/Article/ArticleList.php b/app/Services/Logic/Article/ArticleList.php index d34377b9..53147885 100644 --- a/app/Services/Logic/Article/ArticleList.php +++ b/app/Services/Logic/Article/ArticleList.php @@ -78,20 +78,16 @@ class ArticleList extends LogicService $items = []; - $baseUrl = kg_cos_url(); + $cosUrl = kg_cos_url(); foreach ($articles as $article) { + if (!empty($question['cover']) && !Text::startsWith($question['cover'], 'http')) { + $question['cover'] = $cosUrl . $question['cover']; + } + $article['tags'] = json_decode($article['tags'], true); - if (empty($article['cover'])) { - $article['cover'] = kg_default_article_cover_path(); - } - - if (!Text::startsWith($article['cover'], 'http')) { - $article['cover'] = $baseUrl . $article['cover']; - } - $category = $categories[$article['category_id']] ?? new \stdClass(); $owner = $users[$article['owner_id']] ?? new \stdClass(); diff --git a/app/Services/Logic/Course/RecommendedList.php b/app/Services/Logic/Course/RecommendedList.php deleted file mode 100644 index f8aa1e70..00000000 --- a/app/Services/Logic/Course/RecommendedList.php +++ /dev/null @@ -1,30 +0,0 @@ -checkCourse($id); - - $cache = new CourseRecommendedListCache(); - - $result = $cache->get($course->id); - - return $result ?: []; - } - -} diff --git a/app/Services/Logic/Deliver/CourseDeliver.php b/app/Services/Logic/Deliver/CourseDeliver.php index dbd9153e..19eec15f 100644 --- a/app/Services/Logic/Deliver/CourseDeliver.php +++ b/app/Services/Logic/Deliver/CourseDeliver.php @@ -27,10 +27,10 @@ class CourseDeliver extends LogicService protected function handleCourseUser(CourseModel $course, UserModel $user) { + $expiryTime = strtotime("+{$course->study_expiry} months"); + if ($course->model == CourseModel::MODEL_OFFLINE) { $expiryTime = strtotime($course->attrs['end_date']); - } else { - $expiryTime = strtotime("+{$course->study_expiry} months"); } $sourceType = CourseUserModel::SOURCE_CHARGE; @@ -50,8 +50,7 @@ class CourseDeliver extends LogicService foreach ($relations as $relation) { if ($relation->deleted == 0) { - $relation->deleted = 1; - $relation->update(); + $this->deleteCourseUser($relation); } } } diff --git a/app/Validators/Consult.php b/app/Validators/Consult.php index e555a588..38422bae 100644 --- a/app/Validators/Consult.php +++ b/app/Validators/Consult.php @@ -89,7 +89,7 @@ class Consult extends Validator public function checkPublishStatus($status) { - if (!in_array($status, [0, 1])) { + if (!array_key_exists($status, ConsultModel::publishTypes())) { throw new BadRequestException('consult.invalid_publish_status'); } @@ -98,18 +98,11 @@ class Consult extends Validator public function checkReplyPriv(ConsultModel $consult, UserModel $user) { - $repo = new CourseRepo(); + $courseRepo = new CourseRepo(); - $teachers = $repo->findTeachers($consult->course_id); + $course = $courseRepo->findById($consult->course_id); - $isTeacher = false; - - if ($teachers->count() > 0) { - $teacherIds = kg_array_column($teachers->toArray(), 'id'); - $isTeacher = in_array($user->id, $teacherIds); - } - - if (!$isTeacher) { + if ($course->teacher_id != $user->id) { throw new ForbiddenException('sys.forbidden'); } } diff --git a/app/Validators/Question.php b/app/Validators/Question.php index e2ccfe06..5f3d66b7 100644 --- a/app/Validators/Question.php +++ b/app/Validators/Question.php @@ -90,6 +90,19 @@ class Question extends Validator return $value; } + public function checkSummary($summary) + { + $value = $this->filter->sanitize($summary, ['trim', 'string']); + + $length = kg_strlen($value); + + if ($length > 255) { + throw new BadRequestException('question.summary_too_long'); + } + + return $value; + } + public function checkKeywords($keywords) { $keywords = $this->filter->sanitize($keywords, ['trim', 'string']); diff --git a/config/errors.php b/config/errors.php index d1c570cc..2c6283af 100644 --- a/config/errors.php +++ b/config/errors.php @@ -120,6 +120,7 @@ $error['article.not_found'] = '文章不存在'; $error['article.title_too_short'] = '标题太短(少于2个字符)'; $error['article.title_too_long'] = '标题太长(多于50个字符)'; $error['article.keyword_too_long'] = '关键字太长(多于100个字符)'; +$error['article.summary_too_long'] = '摘要太长(多于255个字符)'; $error['article.content_too_short'] = '内容太短(少于10个字符)'; $error['article.content_too_long'] = '内容太长(多于30000个字符)'; $error['article.invalid_source_type'] = '无效的来源类型'; @@ -138,6 +139,7 @@ $error['question.not_found'] = '问题不存在'; $error['question.title_too_short'] = '标题太短(少于5个字符)'; $error['question.title_too_long'] = '标题太长(多于50个字符)'; $error['question.keyword_too_long'] = '关键字太长(多于100个字符)'; +$error['question.summary_too_long'] = '摘要太长(多于255个字符)'; $error['question.content_too_short'] = '内容太短(少于10个字符)'; $error['question.content_too_long'] = '内容太长(多于30000个字符)'; $error['question.invalid_publish_status'] = '无效的发布状态'; diff --git a/public/static/home/css/common.css b/public/static/home/css/common.css index 7012fd2e..231bcd9a 100644 --- a/public/static/home/css/common.css +++ b/public/static/home/css/common.css @@ -330,6 +330,10 @@ height: 100%; } +.query-input { + width: 720px; +} + .search-tab { margin: 0; } diff --git a/public/static/home/js/article.edit.js b/public/static/home/js/article.edit.js index 23207122..65523688 100644 --- a/public/static/home/js/article.edit.js +++ b/public/static/home/js/article.edit.js @@ -1,23 +1,7 @@ -layui.use(['jquery', 'form', 'layer'], function () { +layui.use(['jquery', 'form'], function () { var $ = layui.jquery; var form = layui.form; - var layer = layui.layer; - - $('.publish').on('click', function () { - var layerWidth = 360; - var layerTop = $(this).offset().top + $(this).height() + 5 + 'px'; - var layerLeft = ($(this).offset().left + $(this).width() - layerWidth) + 'px'; - layer.open({ - type: 1, - title: false, - closeBtn: false, - shadeClose: true, - content: $('#layer-publish'), - offset: [layerTop, layerLeft], - area: layerWidth + 'px', - }); - }); form.on('select(source_type)', function (data) { var block = $('#source-url-block'); @@ -35,8 +19,6 @@ layui.use(['jquery', 'form', 'layer'], function () { name: 'xm_tag_ids', max: 3, data: xmTags, - layVerify: 'required', - layVerType: 'msg', autoRow: true, filterable: true, filterMethod: function (val, item, index, prop) { diff --git a/public/static/home/js/common.js b/public/static/home/js/common.js index a5df2cba..3d379ed9 100644 --- a/public/static/home/js/common.js +++ b/public/static/home/js/common.js @@ -102,7 +102,6 @@ layui.use(['jquery', 'form', 'element', 'layer', 'helper'], function () { $('.nav-search').on('click', function () { var content = '
    '; content += ''; - content += ''; content += '
    '; layer.open({ type: 1, diff --git a/public/static/home/js/course.show.js b/public/static/home/js/course.show.js index ae7ae753..9604de82 100644 --- a/public/static/home/js/course.show.js +++ b/public/static/home/js/course.show.js @@ -145,11 +145,6 @@ layui.use(['jquery', 'layer', 'helper'], function () { helper.ajaxLoadHtml($sdTopics.data('url'), $sdTopics.attr('id')); } - if ($('#sidebar-recommended').length > 0) { - var $sdRecommended = $('#sidebar-recommended'); - helper.ajaxLoadHtml($sdRecommended.data('url'), $sdRecommended.attr('id')); - } - if ($('#sidebar-related').length > 0) { var $sdRelated = $('#sidebar-related'); helper.ajaxLoadHtml($sdRelated.data('url'), $sdRelated.attr('id')); diff --git a/public/static/home/js/question.edit.js b/public/static/home/js/question.edit.js index 99bf6d10..b627ece8 100644 --- a/public/static/home/js/question.edit.js +++ b/public/static/home/js/question.edit.js @@ -1,22 +1,7 @@ -layui.use(['jquery', 'form', 'layer'], function () { +layui.use(['jquery'], function () { var $ = layui.jquery; - $('.publish').on('click', function () { - var layerWidth = 360; - var layerTop = $(this).offset().top + $(this).height() + 5 + 'px'; - var layerLeft = ($(this).offset().left + $(this).width() - layerWidth) + 'px'; - layer.open({ - type: 1, - title: false, - closeBtn: false, - shadeClose: true, - content: $('#layer-publish'), - offset: [layerTop, layerLeft], - area: [layerWidth + 'px', '360px'], - }); - }); - var xmTags = JSON.parse($('input[name=xm_tags]').val()); xmSelect.render({ @@ -24,8 +9,6 @@ layui.use(['jquery', 'form', 'layer'], function () { name: 'xm_tag_ids', max: 3, data: xmTags, - layVerify: 'required', - layVerType: 'msg', autoRow: true, filterable: true, filterMethod: function (val, item, index, prop) {