From 28e37b4ef1b4871010718470725384ba42b86f1f Mon Sep 17 00:00:00 2001 From: devil_gong Date: Thu, 21 Feb 2019 11:30:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E9=97=AE=E5=A5=BD=E9=94=99?= =?UTF-8?q?=E8=AF=AF=EF=BC=8C=E5=9C=A8=E7=BA=BF=E7=95=99=E8=A8=80=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/index/controller/Search.php | 2 +- .../commonrightnavigation/index/content.html | 2 +- .../plugins/js/commonrightnavigation/style.js | 173 +++++++++--------- 3 files changed, 90 insertions(+), 87 deletions(-) diff --git a/application/index/controller/Search.php b/application/index/controller/Search.php index bb0efecc5..fe3ab1914 100755 --- a/application/index/controller/Search.php +++ b/application/index/controller/Search.php @@ -46,7 +46,7 @@ class Search extends Common $this->params['screening_price_id'] = intval(input('screening_price_id', 0)); // 搜索关键字 - $this->params['keywords'] = trim(input('keywords')); + $this->params['keywords'] = str_replace(['?'], '', trim(input('keywords'))); // 排序方式 $this->params['order_by_field'] = input('order_by_field', 'default'); diff --git a/application/plugins/view/commonrightnavigation/index/content.html b/application/plugins/view/commonrightnavigation/index/content.html index 398b87843..7f5590bac 100755 --- a/application/plugins/view/commonrightnavigation/index/content.html +++ b/application/plugins/view/commonrightnavigation/index/content.html @@ -150,7 +150,7 @@
-
+ 在线留言 diff --git a/public/static/plugins/js/commonrightnavigation/style.js b/public/static/plugins/js/commonrightnavigation/style.js index 0bb829ac9..60958a652 100755 --- a/public/static/plugins/js/commonrightnavigation/style.js +++ b/public/static/plugins/js/commonrightnavigation/style.js @@ -1,99 +1,102 @@ $(function() { - // 回顶部监测 - $(window).scroll(function() + // 在线留言表单初始化 + FromInit('form.form-validation-plugins-commonrightnavigation-answer'); + + // 回顶部监测 + $(window).scroll(function() + { + if($(window).scrollTop() > 100) { - if($(window).scrollTop() > 100) - { - $("#plugins-commonrightnavigation").fadeIn(1000); - } else { - $("#plugins-commonrightnavigation").fadeOut(1000); - } - }); + $("#plugins-commonrightnavigation").fadeIn(1000); + } else { + $("#plugins-commonrightnavigation").fadeOut(1000); + } + }); - // 购物车查询 - $('.commonrightnavigation-cart').on('mouseenter', function() + // 购物车查询 + $('.commonrightnavigation-cart').on('mouseenter', function() + { + // 当前鼠标是否还在元素上,防止鼠标直接进入子级元素导致重复执行事件 + if($(this).attr('data-is-has-mouse') == 1) { - // 当前鼠标是否还在元素上,防止鼠标直接进入子级元素导致重复执行事件 - if($(this).attr('data-is-has-mouse') == 1) - { - return false; - } else { - $(this).attr('data-is-has-mouse', 1); - } - - // url - var $this = $(this); - var ajax_url = $this.data('cart-ajax-url'); - var delete_url = $this.data('cart-delete-ajax-url'); + return false; + } else { + $(this).attr('data-is-has-mouse', 1); + } + + // url + var $this = $(this); + var ajax_url = $this.data('cart-ajax-url'); + var delete_url = $this.data('cart-delete-ajax-url'); - // ajax请求 - $.ajax({ - url: ajax_url, - type: 'post', - dataType: "json", - timeout: 10000, - data: {}, - success: function(result) - { - if(result.code == 0 && result.data.cart_list.length > 0) + // ajax请求 + $.ajax({ + url: ajax_url, + type: 'post', + dataType: "json", + timeout: 10000, + data: {}, + success: function(result) + { + if(result.code == 0 && result.data.cart_list.length > 0) + { + var html = ''; + for(var i in result.data.cart_list) { - var html = '
'; - for(var i in result.data.cart_list) + html += ''; + html += ''; - html += ''; - html += ''; - html += ''; + html += ''; } - html += '
'; + html += '
'; + html += ''; + html += ''; + html += ''; + html += '
'; + html += ''+result.data.cart_list[i]['title']+''; + if((result.data.cart_list[i]['spec'] || null) != null) { - html += '
'; - html += '
'; - html += ''; - html += ''; - html += ''; - html += '
'; - html += ''+result.data.cart_list[i]['title']+''; - if((result.data.cart_list[i]['spec'] || null) != null) + html += '
    '; + for(var s in result.data.cart_list[i]['spec']) { - html += '
      '; - for(var s in result.data.cart_list[i]['spec']) - { - html += '
    • '+result.data.cart_list[i]['spec'][s]['type']+':'+result.data.cart_list[i]['spec'][s]['value']+'
    • '; - } - html += '
    '; + html += '
  • '+result.data.cart_list[i]['spec'][s]['type']+':'+result.data.cart_list[i]['spec'][s]['value']+'
  • '; } - html += '
'; - html += '¥'+result.data.cart_list[i]['total_price']+''; - html += ' x'+result.data.cart_list[i]['stock']+''; - html += ''; - html += '删除'; - html += '
'; - $this.find('.cart-items').html(html); - $this.find('.mixed-tips').hide(); - $this.find('.cart-nav').show(); - $this.find('.cart-items').show(); - $this.find('.cart-nav .selected-tips strong').text(result.data.base.cart_count); - $this.find('.cart-nav .nav-total-price').text('¥'+result.data.base.total_price); - $this.find('.cart-nav input[name="ids"]').val(result.data.base.ids); - HomeCartNumberTotalUpdate(result.data.base.cart_count); - } else { - $this.find('.mixed-tips').show(); - $this.find('.cart-nav').hide(); - $this.find('.cart-items').hide(); - $this.find('.cart-nav .selected-tips strong').text(0); - $this.find('.cart-nav .nav-total-price').text('¥0.00'); - $this.find('.cart-nav input[name="ids"]').val(''); - HomeCartNumberTotalUpdate(0); + html += ''; + html += '¥'+result.data.cart_list[i]['total_price']+''; + html += ' x'+result.data.cart_list[i]['stock']+''; + html += ''; + html += ''; + html += '删除'; + html += ''; + html += ''; } - }, - error: function(xhr, type) - { - Prompt('服务器错误'); - } - }); - }).mouseleave(function() - { - // 鼠标离开元素标记 - $(this).attr('data-is-has-mouse', 0); + html += ''; + $this.find('.cart-items').html(html); + $this.find('.mixed-tips').hide(); + $this.find('.cart-nav').show(); + $this.find('.cart-items').show(); + $this.find('.cart-nav .selected-tips strong').text(result.data.base.cart_count); + $this.find('.cart-nav .nav-total-price').text('¥'+result.data.base.total_price); + $this.find('.cart-nav input[name="ids"]').val(result.data.base.ids); + HomeCartNumberTotalUpdate(result.data.base.cart_count); + } else { + $this.find('.mixed-tips').show(); + $this.find('.cart-nav').hide(); + $this.find('.cart-items').hide(); + $this.find('.cart-nav .selected-tips strong').text(0); + $this.find('.cart-nav .nav-total-price').text('¥0.00'); + $this.find('.cart-nav input[name="ids"]').val(''); + HomeCartNumberTotalUpdate(0); + } + }, + error: function(xhr, type) + { + Prompt('服务器错误'); + } }); + }).mouseleave(function() + { + // 鼠标离开元素标记 + $(this).attr('data-is-has-mouse', 0); + }); }); \ No newline at end of file