{"ast":null,"code":"import _defineProperty from \"D:/Work/WorkSpace/GitWorkSpace/TenShop/resource/ElectronicMall/src/ElectronicMallVue/node_modules/@babel/runtime/helpers/esm/defineProperty.js\";\nimport \"core-js/modules/es.array.slice.js\";\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nimport search from \"../../components/Search\";\nexport default {\n name: \"TopView\",\n data: function data() {\n return _defineProperty({\n //轮播图\n carousels: [],\n //推荐商品\n good: [],\n baseApi: this.$store.state.baseApi,\n //分类icon,每个icon包含id、value、categories对象数组.category:id,name\n icons: [],\n //搜索内容\n searchText: \"\"\n }, \"baseApi\", this.$store.state.baseApi);\n },\n components: {\n search: search\n },\n created: function created() {\n var _this = this;\n\n this.request.get(\"/api/good\").then(function (res) {\n if (res.code === \"200\") {\n _this.good = res.data;\n } else {\n _this.$message.error(res.msg);\n }\n }).catch(function (e) {\n console.log(e);\n\n if (e.response == undefined || e.response.data == undefined) {\n _this.$message({\n showClose: true,\n message: e,\n type: \"error\",\n duration: 5000\n });\n } else {\n _this.$message({\n showClose: true,\n message: e.response.data,\n type: \"error\",\n duration: 5000\n });\n }\n });\n this.request.get(\"/api/icon\").then(function (res) {\n if (res.code === \"200\") {\n _this.icons = res.data;\n\n if (_this.icons.length > 6) {\n // 截取前六个分类\n _this.icons = _this.icons.slice(0, 6);\n }\n }\n }).catch(function (e) {\n console.log(e);\n\n if (e.response == undefined || e.response.data == undefined) {\n _this.$message({\n showClose: true,\n message: e,\n type: \"error\",\n duration: 5000\n });\n } else {\n _this.$message({\n showClose: true,\n message: e.response.data,\n type: \"error\",\n duration: 5000\n });\n }\n });\n this.request.get(\"/api/carousel\").then(function (res) {\n if (res.code === \"200\") {\n _this.carousels = res.data;\n }\n }).catch(function (e) {\n console.log(e);\n\n if (e.response == undefined || e.response.data == undefined) {\n _this.$message({\n showClose: true,\n message: e,\n type: \"error\",\n duration: 5000\n });\n } else {\n _this.$message({\n showClose: true,\n message: e.response.data,\n type: \"error\",\n duration: 5000\n });\n }\n });\n },\n methods: {\n handleSearch: function handleSearch(text) {\n this.searchText = text;\n this.$router.push({\n path: \"/goodList\",\n query: {\n searchText: this.searchText\n }\n });\n }\n }\n};","map":{"version":3,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmHA;AAEA;AACAA,iBADA;AAEAC,MAFA,kBAEA;AACA;AACA;AACAC,mBAFA;AAGA;AACAC,cAJA;AAKAC,wCALA;AAOA;AACAC,eARA;AASA;AACAC;AAVA,kBAWA,yBAXA;AAaA,GAhBA;AAiBAC;AACAC;AADA,GAjBA;AAoBAC,SApBA,qBAoBA;AAAA;;AACA,iBACAC,GADA,CACA,WADA,EAEAC,IAFA,CAEA;AACA;AACA;AACA,OAFA,MAEA;AACA;AACA;AACA,KARA,EASAC,KATA,CASA;AACAC;;AACA;AACA;AACAC,yBADA;AAEAC,oBAFA;AAGAC,uBAHA;AAIAC;AAJA;AAMA,OAPA,MAOA;AACA;AACAH,yBADA;AAEAC,kCAFA;AAGAC,uBAHA;AAIAC;AAJA;AAMA;AACA,KA1BA;AA2BA,iBACAP,GADA,CACA,WADA,EAEAC,IAFA,CAEA;AACA;AACA;;AACA;AACA;AACA;AACA;AACA;AACA,KAVA,EAWAC,KAXA,CAWA;AACAC;;AACA;AACA;AACAC,yBADA;AAEAC,oBAFA;AAGAC,uBAHA;AAIAC;AAJA;AAMA,OAPA,MAOA;AACA;AACAH,yBADA;AAEAC,kCAFA;AAGAC,uBAHA;AAIAC;AAJA;AAMA;AACA,KA5BA;AA6BA,iBACAP,GADA,CACA,eADA,EAEAC,IAFA,CAEA;AACA;AACA;AACA;AAEA,KAPA,EAQAC,KARA,CAQA;AACAC;;AACA;AACA;AACAC,yBADA;AAEAC,oBAFA;AAGAC,uBAHA;AAIAC;AAJA;AAMA,OAPA,MAOA;AACA;AACAH,yBADA;AAEAC,kCAFA;AAGAC,uBAHA;AAIAC;AAJA;AAMA;AAEA,KA1BA;AA2BA,GAxGA;AAyGAC;AACAC,gBADA,wBACAC,IADA,EACA;AACA;AACA;AACAC,yBADA;AAEAC;AAAAhB;AAAA;AAFA;AAIA;AAPA;AAzGA","names":["name","data","carousels","good","baseApi","icons","searchText","components","search","created","get","then","catch","console","showClose","message","type","duration","methods","handleSearch","text","path","query"],"sourceRoot":"src/views/front","sources":["TopView.vue"],"sourcesContent":["\r\n\r\n\r\n\r\n\r\n"]},"metadata":{},"sourceType":"module"}