From a84417c167da14c91ac3ea89d14459752754fe5d Mon Sep 17 00:00:00 2001 From: xuanchen <122383162@qq.com> Date: Fri, 26 Nov 2021 15:37:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=96=B0=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=E6=89=93=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/index/js/plugin.js | 72 +++++++++++++----------- resources/views/article/search.blade.php | 2 +- resources/views/category/dzjs.blade.php | 8 +-- resources/views/category/fygk.blade.php | 9 ++- resources/views/category/kxyj.blade.php | 14 ++--- resources/views/category/ldbz.blade.php | 4 +- resources/views/category/left.blade.php | 2 +- resources/views/category/list.blade.php | 2 +- resources/views/category/rcdw.blade.php | 8 +-- resources/views/category/show.blade.php | 4 +- resources/views/category/xwdt.blade.php | 8 +-- resources/views/index/index.blade.php | 38 +++++++------ resources/views/layouts/app.blade.php | 2 +- 13 files changed, 90 insertions(+), 83 deletions(-) diff --git a/public/assets/index/js/plugin.js b/public/assets/index/js/plugin.js index ac11c61..335c5e2 100644 --- a/public/assets/index/js/plugin.js +++ b/public/assets/index/js/plugin.js @@ -1,32 +1,34 @@ -$('[data-href]').on('click', function(event) { +$('[data-href]').on('click', function (event) { event.preventDefault(); if ($(this).hasClass('ajax-get') || $(this).hasClass('ajax-post')) { return; } - location.href = $(this).data('href'); + window.open($(this).data('href')); + // location.href = $(this).data('href'); }); // ajax GET 请求 -$('body').on('click', '.ajax-get', function(event) { +$('body').on('click', '.ajax-get', function (event) { event.preventDefault(); if ($(this).hasClass('disabled') || $(this).attr('disabled')) { return false; - }; - var $this = $(this); - var $tips = $this.attr('tip') || '确认要执行该操作吗?'; + } + ; + var $this = $(this); + var $tips = $this.attr('tip') || '确认要执行该操作吗?'; var $target = $this.data('href') || $this.attr('href') || $this.attr('url') || $this.data('url'); if ($this.hasClass('confirm')) { - if(!confirm($tips)){ + if (!confirm($tips)) { return false; } } $.ajax({ type: "GET", url: $target, - success: function(data){ - if(data.code==1){ - updateAlert(data.msg, 'success', function() { + success: function (data) { + if (data.code == 1) { + updateAlert(data.msg, 'success', function () { if ($this.hasClass('no-refresh')) { } else if (data.url == null) { location.reload(); @@ -40,7 +42,7 @@ $('body').on('click', '.ajax-get', function(event) { updateAlert(data.msg); } }, - error: function(error){ + error: function (error) { if (error.responseJSON.message) { updateAlert(error.responseJSON.message, 'warning'); } else { @@ -51,18 +53,19 @@ $('body').on('click', '.ajax-get', function(event) { }); // ajax POST 请求 -$('body').on('click', '.ajax-post', function(event) { +$('body').on('click', '.ajax-post', function (event) { if ($(this).hasClass('disabled') || $(this).attr('disabled')) { return false; - }; + } + ; event.preventDefault(); - var $this = $(this); - var $form = $this.parents('form'); - var $tips = $this.attr('tip') || '确认要执行该操作吗?'; + var $this = $(this); + var $form = $this.parents('form'); + var $tips = $this.attr('tip') || '确认要执行该操作吗?'; var $action = $form.attr("action"); if ($this.hasClass('confirm')) { - if(!confirm($tips)){ + if (!confirm($tips)) { return false; } } @@ -73,12 +76,12 @@ $('body').on('click', '.ajax-post', function(event) { type: "POST", url: $action, data: query, - success: function(data) { + success: function (data) { if (data.code == 0) { updateAlert(data.msg); $this.removeAttr('disabled'); } else { - updateAlert(data.msg, 'success', function() { + updateAlert(data.msg, 'success', function () { if (data.url) { location.href = data.url; } else if (data.url == null) { @@ -89,11 +92,11 @@ $('body').on('click', '.ajax-post', function(event) { }); } }, - error: function(error) { + error: function (error) { $this.removeAttr('disabled'); if (error.responseJSON.errors) { var err = ''; - $.each(error.responseJSON.errors, function(i, n) { + $.each(error.responseJSON.errors, function (i, n) { // err += n + "\r\n"; updateAlert(n[0], 'warning'); return false; @@ -108,32 +111,33 @@ $('body').on('click', '.ajax-post', function(event) { }); }); -$('body').on('click', '.ajax-post-confirm', function(event) { +$('body').on('click', '.ajax-post-confirm', function (event) { if ($(this).hasClass('disabled') || $(this).attr('disabled')) { return false; - }; + } + ; event.preventDefault(); - var $this = $(this); - var $form = $this.parents('form'); + var $this = $(this); + var $form = $this.parents('form'); var $action = $form.attr("action"); - var $tips = $this.attr('tip') || '确认要执行该操作吗?'; + var $tips = $this.attr('tip') || '确认要执行该操作吗?'; var query = $form.serialize(); $this.attr('disabled', 'disabled'); layer.open({ content: $tips - ,btn: ['确定', '取消'] - ,yes: function(index){ + , btn: ['确定', '取消'] + , yes: function (index) { $.ajax({ type: "POST", url: $action, data: query, - success: function(data) { + success: function (data) { if (data.code == 0) { updateAlert(data.msg); $this.removeAttr('disabled'); } else { - updateAlert(data.msg, data.error, function() { + updateAlert(data.msg, data.error, function () { if (data.url) { location.href = data.url; } else if (data.url == null) { @@ -144,11 +148,11 @@ $('body').on('click', '.ajax-post-confirm', function(event) { }); } }, - error: function(error) { + error: function (error) { $this.removeAttr('disabled'); if (error.responseJSON.errors) { var err = ''; - $.each(error.responseJSON.errors, function(i, n) { + $.each(error.responseJSON.errors, function (i, n) { // err += n + "\r\n"; updateAlert(n[0], 'warning'); return false; @@ -166,7 +170,7 @@ $('body').on('click', '.ajax-post-confirm', function(event) { }); }); -window.updateAlert = function(text, type, callback) { +window.updateAlert = function (text, type, callback) { if (typeof type != 'string') { if (type) { type = "success"; @@ -181,7 +185,7 @@ window.updateAlert = function(text, type, callback) { showConfirmButton: false }); if (typeof callback == "function") { - setTimeout(function() { + setTimeout(function () { callback(); }, 1500) } diff --git a/resources/views/article/search.blade.php b/resources/views/article/search.blade.php index 480ca3e..6d25935 100644 --- a/resources/views/article/search.blade.php +++ b/resources/views/article/search.blade.php @@ -14,7 +14,7 @@
- 查看更多> + 查看更多>
@@ -48,7 +48,7 @@ {{ getOneCategory(30,'title') }} - + 查看更多>> @@ -56,7 +56,7 @@ @if (getArticlesBYCate(30,4)->isNotEmpty()) @foreach (getArticlesBYCate(30,4) as $article)
  • - +
    {{ $article->title }}
    diff --git a/resources/views/category/fygk.blade.php b/resources/views/category/fygk.blade.php index 69a50a7..6b6216d 100644 --- a/resources/views/category/fygk.blade.php +++ b/resources/views/category/fygk.blade.php @@ -29,7 +29,8 @@
    {{ getOneArticleBYCate(15,'description') }}
    -
    查看更多> + 查看更多> @@ -42,7 +43,7 @@ {{ getOneCategory(14,'title') }} - + 查看更多>> @@ -98,7 +99,9 @@ @if(in_array($cate->parent->id,config('setting.no_href'))) {{ $child->title }} @else - {{ $child->title }} + + {{ $child->title }} + @endif
  • @endforeach diff --git a/resources/views/category/kxyj.blade.php b/resources/views/category/kxyj.blade.php index 1ccb2e2..012f08a 100644 --- a/resources/views/category/kxyj.blade.php +++ b/resources/views/category/kxyj.blade.php @@ -20,7 +20,7 @@ @if (getArticlesBYCate(8,3)->isNotEmpty()) @foreach (getArticlesBYCate(8,3) as $article)
  • - +
    @@ -44,7 +44,7 @@ @endif
    - 查看更多> + 查看更多>
    @@ -55,7 +55,7 @@ {{ getOneCategory(16,'title') }} - + 查看更多>> @@ -63,7 +63,7 @@ @if (getArticlesBYCate(16,4)->isNotEmpty()) @foreach (getArticlesBYCate(16,4) as $article)
  • - +
    {{ $article->title }}
    @@ -84,7 +84,7 @@ {{ getOneCategory(18,'title') }} -
    + 查看更多>> @@ -93,7 +93,7 @@ @if (getArticlesBYCate(18,4)->isNotEmpty()) @foreach (getArticlesBYCate(18,4) as $article)
  • - +
    {{ $article->title }}
    @@ -119,7 +119,7 @@ @if (getArticlesBYCate(24,6)->isNotEmpty()) @foreach (getArticlesBYCate(24,6) as $article)
  • - +
    {{ $article->title }} diff --git a/resources/views/category/ldbz.blade.php b/resources/views/category/ldbz.blade.php index f36a1c2..39be9f4 100644 --- a/resources/views/category/ldbz.blade.php +++ b/resources/views/category/ldbz.blade.php @@ -16,7 +16,7 @@ {{ getOneCategory(14,'title') }}
    -
    + 查看更多>>
    @@ -24,7 +24,7 @@ @if (getArticlesBYCate(14,3)->isNotEmpty()) @foreach (getArticlesBYCate(14,3) as $article)
  • - +
    diff --git a/resources/views/category/left.blade.php b/resources/views/category/left.blade.php index a1f700d..78cb194 100644 --- a/resources/views/category/left.blade.php +++ b/resources/views/category/left.blade.php @@ -11,7 +11,7 @@ @if(in_array($parent->id,config('setting.no_href')) || in_array($child->id,config('setting.no_href')))
    {{ $child->title }} @else - {{ $child->title }} + {{ $child->title }} @endif
  • @endforeach diff --git a/resources/views/category/list.blade.php b/resources/views/category/list.blade.php index 3ad4fed..7b61ecc 100644 --- a/resources/views/category/list.blade.php +++ b/resources/views/category/list.blade.php @@ -21,7 +21,7 @@ @if ($articles->isNotEmpty()) @foreach ($articles as $article)
  • - +
    {{ $article->created_at->format('m/d') }} {{ $article->created_at->format('Y') }} diff --git a/resources/views/category/rcdw.blade.php b/resources/views/category/rcdw.blade.php index 734e8e7..744e06c 100644 --- a/resources/views/category/rcdw.blade.php +++ b/resources/views/category/rcdw.blade.php @@ -21,7 +21,7 @@ @if (getArticlesBYCate(27,6)->isNotEmpty()) @foreach (getArticlesBYCate(27,6) as $article) - + 查看更多>>
    @@ -75,7 +75,7 @@ {{ getOneCategory(29,'title') }} - + 查看更多>> @@ -83,7 +83,7 @@ @if (getArticlesBYCate(29,6)->isNotEmpty()) @foreach (getArticlesBYCate(29,6) as $article)
  • - +
    客座教授
    {{ $article->title }}
    diff --git a/resources/views/category/show.blade.php b/resources/views/category/show.blade.php index db28f1e..27ace45 100644 --- a/resources/views/category/show.blade.php +++ b/resources/views/category/show.blade.php @@ -23,7 +23,7 @@ @if ($articles->isNotEmpty()) @foreach ($articles as $article)
  • - +
    {{ $article->title }}
    @@ -35,9 +35,7 @@ @endforeach @endif - - @if ($articles->isNotEmpty()) {{ $articles->links('layouts.pagination') }} @endif diff --git a/resources/views/category/xwdt.blade.php b/resources/views/category/xwdt.blade.php index 816dcd4..ac1c0f0 100644 --- a/resources/views/category/xwdt.blade.php +++ b/resources/views/category/xwdt.blade.php @@ -21,7 +21,7 @@ @if (getArticlesBYCate(7,4)->isNotEmpty()) @foreach (getArticlesBYCate(7,4) as $article)
  • - +
    {{-- --}}
    @@ -45,7 +45,7 @@ @endif
    - 查看更多> + 查看更多>
    @@ -61,7 +61,7 @@ @if (getArticlesBYCate(17,4)->isNotEmpty()) @foreach (getArticlesBYCate(17,4) as $article)
  • - +
    {{-- --}}
    @@ -85,7 +85,7 @@ @endif
    - 查看更多> + 查看更多>
    diff --git a/resources/views/index/index.blade.php b/resources/views/index/index.blade.php index cbca460..dc08cef 100644 --- a/resources/views/index/index.blade.php +++ b/resources/views/index/index.blade.php @@ -14,9 +14,9 @@
    url) data-href="{{ $advert->url }}" @endif> - +
    --> @endforeach @@ -67,7 +67,7 @@ @if (getArticlesByCateIds(6)->isNotEmpty()) @foreach (getArticlesByCateIds(6) as $article)
  • - +
    {{ $article->title }}
    @@ -91,7 +91,7 @@ @if (getArticlesBYCate(24,4)->isNotEmpty()) @foreach (getArticlesBYCate(24,4) as $article)
  • - +
    @@ -108,7 +108,7 @@
    @@ -147,7 +147,7 @@ @if (getArticlesBYCate(24,5,'all',false,'asc')->isNotEmpty()) @foreach (getArticlesBYCate(24,5) as $article) @if($loop->index==4) -
    @@ -192,7 +192,8 @@ @if (getArticlesBYCate(8,6)->isNotEmpty()) @foreach (getArticlesBYCate(8,6) as $article)
  • - +
    {{ $article->title }}
    @@ -211,7 +212,8 @@ @if (getArticlesBYCate(5,6)->isNotEmpty()) @foreach (getArticlesBYCate(5,6) as $article)
  • - +
    {{ $article->title }}
    @@ -290,7 +292,7 @@ @if (getArticlesBYCate(12,5)->isNotEmpty()) @foreach (getArticlesBYCate(12,5) as $article)
  • -
    {{ $article->title }} @@ -308,7 +310,7 @@ @if (getArticlesBYCate(30,5)->isNotEmpty()) @foreach (getArticlesBYCate(30,5) as $article)
  • -
    {{ $article->title }} @@ -371,7 +373,7 @@ @if (getArticlesBYCate(27,4)->isNotEmpty()) @foreach (getArticlesBYCate(27,4) as $article)
  • - +
    @@ -397,7 +399,7 @@ @if (getArticlesBYCate(29,9)->isNotEmpty()) @foreach (getArticlesBYCate(29,9) as $article)
  • - +
    客座教授
    {{ $article->title }}
    @@ -408,7 +410,7 @@ @endif
    @@ -419,7 +421,7 @@ @if (getArticlesBYCate(18,4)->isNotEmpty()) @foreach (getArticlesBYCate(18,4) as $article)
  • - +
    {{ $article->title }}
    @@ -432,7 +434,7 @@ @endif
    - 查看更多 > + 查看更多 >
    @@ -443,7 +445,7 @@ @if (getArticlesBYCate(16,4)->isNotEmpty()) @foreach (getArticlesBYCate(16,4) as $article)
  • - +
    {{ $article->title }}
    @@ -456,7 +458,7 @@ @endif
    - 查看更多 > + 查看更多 >
    diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 90f46cc..39775d6 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -86,7 +86,7 @@