index.js 5.3 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["plugins/book/index/index"],{1305:function(t,e,n){},"59cd":function(t,e,n){"use strict";var a;n.d(e,"b",(function(){return o})),n.d(e,"c",(function(){return r})),n.d(e,"a",(function(){return a}));var o=function(){var t=this,e=t.$createElement;t._self._c},r=[]},"5be9":function(t,e,n){"use strict";n.r(e);var a=n("de53"),o=n.n(a);for(var r in a)"default"!==r&&function(t){n.d(e,t,(function(){return a[t]}))}(r);e["default"]=o.a},"709c":function(t,e,n){"use strict";var a=n("1305"),o=n.n(a);o.a},9366:function(t,e,n){"use strict";n.r(e);var a=n("59cd"),o=n("5be9");for(var r in o)"default"!==r&&function(t){n.d(e,t,(function(){return o[t]}))}(r);n("709c");var i,c=n("f0c5"),s=Object(c["a"])(o["default"],a["b"],a["c"],!1,null,"2ec8ebc6",null,!1,a["a"],i);e["default"]=s.exports},"9bb7":function(t,e,n){"use strict";(function(t){n("ecb4");a(n("66fd"));var e=a(n("9366"));function a(t){return t&&t.__esModule?t:{default:t}}t(e.default)}).call(this,n("543d")["createPage"])},de53:function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var a=o(n("a34a"));function o(t){return t&&t.__esModule?t:{default:t}}function r(t,e,n,a,o,r,i){try{var c=t[r](i),s=c.value}catch(u){return void n(u)}c.done?e(s):Promise.resolve(s).then(a,o)}function i(t){return function(){var e=this,n=arguments;return new Promise((function(a,o){var i=t.apply(e,n);function c(t){r(i,a,o,c,s,"next",t)}function s(t){r(i,a,o,c,s,"throw",t)}c(void 0)}))}}function c(t){return l(t)||d(t)||u(t)||s()}function s(){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 u(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(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(t,e):void 0}}function d(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,a=new Array(e);n<e;n++)a[n]=t[n];return a}var h=function(){n.e("plugins/book/components/app-head-nav-list").then(function(){return resolve(n("da4e"))}.bind(null,n)).catch(n.oe)},p=function(){Promise.all([n.e("common/vendor"),n.e("plugins/book/components/app-product-list")]).then(function(){return resolve(n("9c60"))}.bind(null,n)).catch(n.oe)},g=function(){Promise.all([n.e("common/vendor"),n.e("components/page-component/app-quick-navigation/app-quick-navigation")]).then(function(){return resolve(n("e726"))}.bind(null,n)).catch(n.oe)},v=function(){n.e("components/page-component/app-no-goods/app-no-goods").then(function(){return resolve(n("0406"))}.bind(null,n)).catch(n.oe)},b={name:"index",data:function(){return{catList:[{name:"全部",id:0}],cat_id:0,page:1,goods_list:[],page_count:1,dateArr:[],dateArrIndex:0,dateArrActive:!1}},onLoad:function(e){var n=this;t.showLoading({title:"加载中"}),e.cat_id?this.cat_id=e.cat_id:this.cat_id=this.catList[0].id,this.request(),this.$request({url:this.$api.book.cats}).then((function(e){t.hideLoading(),0===e.code&&(n.catList=[].concat(c(n.catList),c(e.data.cat)))})),this.getDate(7)},computed:{getStausBarHeight:function(){try{var e=t.getSystemInfoSync();return e.statusBarHeight+"px"}catch(n){console.log(n)}},headerBgHeight:function(){try{var e=t.getSystemInfoSync();return 164+e.statusBarHeight+"px"}catch(n){console.log(n)}}},methods:{dateActive:function(e,n){t.showToast({icon:"none",title:"选中日期",duration:1e3}),this.dateArrIndex=e,this.dateArrActive=!0,t.setStorage({key:"date",data:n})},changeStatus:function(t){this.page=1,this.cat_id=t,this.goods_list=[],this.request()},request:function(){var e=this;return i(a.default.mark((function n(){var o;return a.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return t.showLoading({title:"加载中"}),n.next=3,e.$request({url:e.$api.book.list,data:{page:e.page,cat_id:e.cat_id}});case 3:o=n.sent,t.hideLoading(),0===o.code&&e.dataProcessing(o.data);case 6:case"end":return n.stop()}}),n)})))()},dataProcessing:function(t){for(var e=0;e<t.list.length;e+=2)e+1!==t.list.length?this.goods_list.push([t.list[e],t.list[e+1]]):this.goods_list.push([t.list[e]]);this.page_count=t.pagination.page_count},getDate:function(e){for(var n=new Date,a=0;a<e;a++){var o=new Date;o.setDate(n.getDate()+a+1);var r=o.getMonth()+1+"月"+o.getDate()+"日";console.log(r);var i=o.getDay(),c=void 0;switch(i){case 1:c="星期一";break;case 2:c="星期二";break;case 3:c="星期三";break;case 4:c="星期四";break;case 5:c="星期五";break;case 6:c="星期六";break;case 0:c="星期日";break}console.log(c);var s={date:r,week:c};for(a in this.dateArr.push(s),this.dateArr)a==this.dateArrIndex&&t.setStorage({key:"date",data:this.dateArr[a]})}}},onReachBottom:function(){this.page<this.page_count&&(this.page++,this.request())},onShareAppMessage:function(){return this.$shareAppMessage({path:"/plugins/book/index/index",title:this.$children[0].navigationBarTitle})},components:{"app-head-nav-list":h,"app-product-list":p,"app-quick-navigation":g,"app-no-goods":v}};e.default=b}).call(this,n("543d")["default"])}},[["9bb7","common/runtime","common/vendor"]]]);