search.js 5.2 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/full_reduce/search/search"],{"157d":function(t,e,n){"use strict";var r=n("e884"),o=n.n(r);o.a},"3bb2":function(t,e,n){"use strict";var r;n.d(e,"b",(function(){return o})),n.d(e,"c",(function(){return a})),n.d(e,"a",(function(){return r}));var o=function(){var t=this,e=t.$createElement;t._self._c},a=[]},5489:function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=a(n("a34a")),o=n("2f62");function a(t){return t&&t.__esModule?t:{default:t}}function i(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function s(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?i(Object(n),!0).forEach((function(e){c(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function c(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function u(t){return g(t)||d(t)||l(t)||f()}function f(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(t,e){if(t){if("string"===typeof t)return p(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(t,e):void 0}}function d(t){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}function g(t){if(Array.isArray(t))return p(t)}function p(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function h(t,e,n,r,o,a,i){try{var s=t[a](i),c=s.value}catch(u){return void n(u)}s.done?e(c):Promise.resolve(c).then(r,o)}function y(t){return function(){var e=this,n=arguments;return new Promise((function(r,o){var a=t.apply(e,n);function i(t){h(a,r,o,i,s,"next",t)}function s(t){h(a,r,o,i,s,"throw",t)}i(void 0)}))}}var m="FULL_REDUCE_SEARCH",v=function(){n.e("components/page-component/app-product-list/app-product-list").then(function(){return resolve(n("ede7"))}.bind(null,n)).catch(n.oe)},b=function(){n.e("components/page-component/app-no-goods/app-no-goods").then(function(){return resolve(n("5cd3"))}.bind(null,n)).catch(n.oe)},S={name:"search",data:function(){return{keyword:"",strong:[],page:1,goods_list:[],search:!1,is_search:0,loading:!1}},onLoad:function(){this.$commonLoad.onload(),this.$storage.getStorageSync(m)?this.strong=this.$storage.getStorageSync(m):this.$storage.setStorageSync(m,[])},methods:{request:function(t){var e=this;return y(r.default.mark((function n(){var o,a;return r.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return n.next=2,e.$request({url:e.$api.full_reduce.list,method:"get",data:{page:e.page,keyword:e.keyword}});case 2:o=n.sent,e.loading=!0,0===o.code&&(t&&(e.goods_list=[]),(a=e.goods_list).push.apply(a,u(o.data.list)),e.page_count=o.data.pagination.page_count);case 5:case"end":return n.stop()}}),n)})))()},searchRequest:function(t){this.search=!0,this.goods_list=[],this.page=1,this.keyword=t,this.request(1)},setRequest:function(){var t=this;this.keyword=this.keyword.trim(),this.keyword.match(/^[ ]*$/)||(this.search=!0,this.goods_list=[],this.request().then((function(){for(var e=t.$storage.getStorageSync(m),n=0;n<e.length;n++)if(e[n]===t.keyword)return;e.unshift(t.keyword),e.length>15&&(e=e.slice(0,15)),t.$storage.setStorageSync(m,e)})))},routeGo:function(e){e.video_url&&1==this.getVideo?t.navigateTo({url:"/pages/goods/video?goods_id=".concat(e.id)}):t.navigateTo({url:e.page_url})},empyt_search:function(){this.goods_list=[],this.keyword="",this.search=!1,this.$storage.getStorageSync(m)?this.strong=this.$storage.getStorageSync(m):this.$storage.setStorageSync(m,[])},setClearStorage:function(){this.$storage.removeStorageSync(m),this.strong=[],this.$storage.setStorageSync(m,[])}},components:{"app-product-list":v,appNoGoods:b},computed:s(s(s({},(0,o.mapGetters)("mallConfig",{getTheme:"getTheme"})),(0,o.mapGetters)("mallConfig",{getVideo:"getVideo"})),(0,o.mapState)({platform:function(t){return t.gConfig.systemInfo.platform}})),onReachBottom:function(){this.page<this.page_count&&(this.page++,this.request())}};e.default=S}).call(this,n("543d")["default"])},"5e2f":function(t,e,n){"use strict";n.r(e);var r=n("3bb2"),o=n("865d");for(var a in o)"default"!==a&&function(t){n.d(e,t,(function(){return o[t]}))}(a);n("157d");var i,s=n("f0c5"),c=Object(s["a"])(o["default"],r["b"],r["c"],!1,null,"f704f50c",null,!1,r["a"],i);e["default"]=c.exports},"865d":function(t,e,n){"use strict";n.r(e);var r=n("5489"),o=n.n(r);for(var a in r)"default"!==a&&function(t){n.d(e,t,(function(){return r[t]}))}(a);e["default"]=o.a},e884:function(t,e,n){},e916:function(t,e,n){"use strict";(function(t){n("2d0a");r(n("66fd"));var e=r(n("5e2f"));function r(t){return t&&t.__esModule?t:{default:t}}t(e.default)}).call(this,n("543d")["createPage"])}},[["e916","common/runtime","common/vendor"]]]);