import{n as u,W as p,F as o}from"./index.13f93d3a.js";const f={name:"base",components:{Waterfall:p},data(){return{loading:!1,products:[],limit:5,page:1,totalPage:1}},mounted(){this.getProducts()},methods:{loadData(s){this.getProducts({page:s,newload:!1})},getProducts({page:s=this.page,columnSize:t=this.columnSize,newload:e=!0}={}){this.loading=!0,this.page=s;const a=this.$t("common.failure");this.$axios.get("/api/index/product_list",{params:{type:this.types,limit:this.limit,page:s,go:t}}).then(r=>{const{code:i,msg:n=a,data:d={}}=r.data,{items:l=[],totalPage:c}=d;i==0?(this.products=e?l:refillData(this.products,l),this.totalPage=c):this.$message.error(n)}).catch(()=>{this.$message.error(a)}).finally(()=>{this.loading=!1})}},watch:{columnSize(s,t){this.getProducts({page:this.page,columnSize:s})},filterType(){this.getProducts({newload:!0})}},computed:{columnSize(){return this.$store.state.columnSize},nameKey(){return this.$store.state.nameKey},types(){if(this.filterType&&this.filterType!=="all"){const[s,t]=this.filterType.split(",");return[o.mode,s,t].join(",")}return[o.mode].join(",")},filterType(){return this.$route.query.filter},filterText(){if(this.filterType==="all")return this.$t("common.filter.all");const s=this.filterType.split(",");return JSON.parse(sessionStorage.getItem("conf_filters")).map((e,a)=>e.find(i=>i.id==s[a])[this.nameKey]).join(" ")}}};var h=function(){var t=this,e=t._self._c;return e("div",{staticClass:"base"},[t.filterType?e("div",{staticClass:"header",attrs:{id:"scrollHeader"}},[e("div",{staticClass:"header-content"},[e("div",{staticClass:"left v-center"},[e("b",[t._v(t._s(t.$t("header.navs.nav1")))]),t._v(" "+t._s(t.filterText)+" ")]),e("div",{staticClass:"right"},[e("router-link",{attrs:{to:{path:"/base",query:{filter:"all"}}}},[e("el-button",{attrs:{type:"primary",round:""}},[t._v(t._s(t.$t("common.viewAll")))])],1)],1)])]):t._e(),e("div",{class:["bottom",t.filterType?"margin":""]},[t.products.length?e("Waterfall",{attrs:{page:t.page,totalPage:t.totalPage,loading:t.loading,data:t.products},on:{loadData:t.loadData}}):t._e()],1)])},m=[],_=u(f,h,m,!1,null,"1b408a11",null,null);const y=_.exports;export{y as default};
