index.js 5.4 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["plugins/pt/index/index"],{"04a3":function(t,e,n){"use strict";(function(t){n("8748");r(n("66fd"));var e=r(n("c0c5"));function r(t){return t&&t.__esModule?t:{default:t}}t(e.default)}).call(this,n("543d")["createPage"])},3634:function(t,e,n){},"6b01":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=a(n("4795"));function a(t){return t&&t.__esModule?t:{default:t}}function i(t,e,n,r,a,i,o){try{var c=t[i](o),u=c.value}catch(s){return void n(s)}c.done?e(u):Promise.resolve(u).then(r,a)}function o(t){return function(){var e=this,n=arguments;return new Promise((function(r,a){var o=t.apply(e,n);function c(t){i(o,r,a,c,u,"next",t)}function u(t){i(o,r,a,c,u,"throw",t)}c(void 0)}))}}function c(t){return l(t)||p(t)||s(t)||u()}function u(){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 s(t,e){if(t){if("string"===typeof t)return f(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(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(t,e):void 0}}function p(t){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}function l(t){if(Array.isArray(t))return f(t)}function f(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 d(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 g(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?d(Object(n),!0).forEach((function(e){v(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function v(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var h=function(){n.e("plugins/pt/components/app-index-nav").then(function(){return resolve(n("a8aa"))}.bind(null,n)).catch(n.oe)},m=function(){n.e("plugins/pt/components/app-banner").then(function(){return resolve(n("1c07"))}.bind(null,n)).catch(n.oe)},b=function(){n.e("components/page-component/app-image-ad/app-image-ad").then(function(){return resolve(n("697c"))}.bind(null,n)).catch(n.oe)},y=function(){Promise.all([n.e("common/vendor"),n.e("plugins/pt/components/app-product-list")]).then(function(){return resolve(n("be7f"))}.bind(null,n)).catch(n.oe)},_=function(){Promise.all([n.e("common/vendor"),n.e("components/page-component/app-quick-navigation/app-quick-navigation")]).then(function(){return resolve(n("cf64"))}.bind(null,n)).catch(n.oe)},O={name:"index",data:function(){return{banners:[],setting:{},nav_list:[{name:"热卖",id:0}],page:1,page_count:1,goods_list:[],cat_id:0,imageStyle:0}},onLoad:function(t){var e=this;t.cat_id&&(this.cat_id=t.cat_id),this.$request({url:this.$api.pt.index}).then((function(t){if(0===t.code){e.banners=t.data.banners,e.setting=t.data.setting;for(var n=t.data.setting.advertisement,r=[],a=0;a<n.list.length;a++)r.push(g({},n.list[a],{link:{value:n.list[a].link_url,open_type:n.list[a].open_type}}));e.setting.advertisement.list=r,e.imageStyle=Number(e.setting.advertisement.type),console.log(e.imageStyle)}})),this.$request({url:this.$api.pt.cats}).then((function(n){var r;0===n.code&&((r=e.nav_list).push.apply(r,c(n.data.list)),t.cat_id||(e.cat_id=e.nav_list[0].id),e.request(0))}))},onReachBottom:function(){this.page<this.page_count&&(this.page++,this.request(1))},methods:{changeStatus:function(t){var e=this;return o(r.default.mark((function n(){return r.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:e.cat_id=t,e.page=1,e.request(0);case 3:case"end":return n.stop()}}),n)})))()},request:function(t){var e=this;return o(r.default.mark((function n(){var a,i;return r.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return n.next=2,e.$request({url:e.$api.pt.goods,data:{page:e.page,cat_id:e.cat_id}});case 2:a=n.sent,0===a.code&&(1===t?(i=e.goods_list).push.apply(i,c(a.data.list)):e.goods_list=a.data.list,e.page_count=a.data.pagination.page_count);case 4:case"end":return n.stop()}}),n)})))()}},onShareAppMessage:function(){return this.$shareAppMessage({path:"/plugins/pt/index/index",title:this.$children[0].navigationBarTitle})},components:{"app-index-nav":h,"app-banner":m,"app-image-ad":b,"app-product-list":y,"app-quick-navigation":_}};e.default=O},8285:function(t,e,n){"use strict";var r,a=function(){var t=this,e=t.$createElement;t._self._c},i=[];n.d(e,"b",(function(){return a})),n.d(e,"c",(function(){return i})),n.d(e,"a",(function(){return r}))},c0c5:function(t,e,n){"use strict";n.r(e);var r=n("8285"),a=n("f47a");for(var i in a)"default"!==i&&function(t){n.d(e,t,(function(){return a[t]}))}(i);n("f3d8");var o,c=n("f0c5"),u=Object(c["a"])(a["default"],r["b"],r["c"],!1,null,"c3474dbe",null,!1,r["a"],o);e["default"]=u.exports},f3d8:function(t,e,n){"use strict";var r=n("3634"),a=n.n(r);a.a},f47a:function(t,e,n){"use strict";n.r(e);var r=n("6b01"),a=n.n(r);for(var i in r)"default"!==i&&function(t){n.d(e,t,(function(){return r[t]}))}(i);e["default"]=a.a}},[["04a3","common/runtime","common/vendor"]]]);