You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
7.2 KiB
1 line
7.2 KiB
{"remainingRequest":"/Users/linhuakun/Downloads/nodejs/codewhy/node_modules/vue-loader/lib/index.js??vue-loader-options!/Users/linhuakun/Downloads/nodejs/codewhy/src/views/detail/Detail.vue?vue&type=style&index=0&id=117d0e76&scoped=true&lang=css&","dependencies":[{"path":"/Users/linhuakun/Downloads/nodejs/codewhy/src/views/detail/Detail.vue","mtime":1608357744699},{"path":"/Users/linhuakun/Downloads/nodejs/codewhy/node_modules/css-loader/dist/cjs.js","mtime":499162500000},{"path":"/Users/linhuakun/Downloads/nodejs/codewhy/node_modules/vue-loader/lib/loaders/stylePostLoader.js","mtime":499162500000},{"path":"/Users/linhuakun/Downloads/nodejs/codewhy/node_modules/postcss-loader/src/index.js","mtime":499162500000},{"path":"/Users/linhuakun/Downloads/nodejs/codewhy/node_modules/cache-loader/dist/cjs.js","mtime":499162500000},{"path":"/Users/linhuakun/Downloads/nodejs/codewhy/node_modules/vue-loader/lib/index.js","mtime":499162500000}],"contextDependencies":[],"result":[{"type":"Buffer","data":"base64:CgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgojZGV0YWlsewogIHBvc2l0aW9uOiByZWxhdGl2ZTsKICB6LWluZGV4OiA5OwogIGJhY2tncm91bmQtY29sb3I6ICNmZmZmZmY7CiAgaGVpZ2h0OiAxMDB2aDsKfQouZGV0YWlsLW5hdnsKICBwb3NpdGlvbjogcmVsYXRpdmU7CiAgei1pbmRleDogOTsKICBiYWNrZ3JvdW5kLWNvbG9yOiAjZmZmZmZmOwp9Ci5jb250ZW50ewogIGhlaWdodDogY2FsYygxMDAlIC0gOTZweCk7CiAgcG9zaXRpb246IHJlbGF0aXZlOwp9Cg=="},{"version":3,"sources":["Detail.vue"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"Detail.vue","sourceRoot":"src/views/detail","sourcesContent":["<template>\n <div id=\"detail\" >\n <DetailNewBar class=\"detail-nav\" @titleClick=\"titleClick\" ref=\"nav\"/>\n <scroll class=\"content\"\n ref=\"scroll\"\n @scroll=\"totalScroll\"\n :probe-type=\"3\" >\n <DetailSwiper :top-images=\"topImages\"/>\n <DetailBaseInfo :goods=\"goods\"/>\n <DetailShopInfo :shop=\"shop\" />\n <DetailGoodsInfo :detail-info=\"detailInfo\" @detailImageload=\"detailImageload\"/>\n <DetailParamInfo ref=\"params\" :param-info=\"paramInfo\"/>\n <DetailCommentInfo ref=\"comment\" :comment-info=\"commentInfo\"/>\n <GoodsList ref=\"recommend\" :goods=\"recommends\"></GoodsList>\n </scroll>\n <detail-bottom-bar class=\"bottom-nav\" @addToCart=\"addToCart\"/>\n\n <back-top @click.native=\"backClick\" v-show=\"isShowBackTop\"/>\n </div>\n</template>\n\n<script>\nimport DetailNewBar from \"@/views/detail/childComps/DetailNewBar\";\nimport DetailSwiper from \"@/views/detail/childComps/DetailSwiper\";\nimport DetailBaseInfo from \"@/views/detail/childComps/DetailBaseInfo\";\nimport DetailShopInfo from \"@/views/detail/childComps/DetailShopInfo\";\nimport DetailGoodsInfo from \"@/views/detail/childComps/DetailGoodsInfo\";\nimport DetailParamInfo from \"@/views/detail/childComps/DetailParamInfo\";\nimport DetailCommentInfo from \"@/views/detail/childComps/DetailCommentInfo\";\nimport DetailBottomBar from \"@/views/detail/childComps/DetailBottomBar\";\n\nimport backTop from \"@/components/content/backTop/backTop\";\nimport GoodsList from \"@/components/content/goods/GoodsList\";\nimport scroll from \"@/components/common/Scroll/Scroll\";\n\nimport {itemListenerMixin,backTopMixin} from \"@/common/mixin\";\nimport {debounce} from \"@/common/utils\";\n\nimport {getDetail, Goods, Shop, GoodsParam, getRecommend} from \"@/network/detail\";\n\n\nexport default {\n name: \"Detail\",\n components: {\n DetailNewBar,\n DetailSwiper,\n DetailBaseInfo,\n DetailShopInfo,\n DetailGoodsInfo,\n DetailParamInfo,\n DetailCommentInfo,\n DetailBottomBar,\n\n backTop,\n GoodsList,\n scroll,\n\n },\n mixins: [itemListenerMixin,backTopMixin],\n data() {\n return {\n iid: null,\n topImages: [],\n goods: {},\n shop: {},\n detailInfo: {},\n paramInfo: {},\n commentInfo: {},\n recommends: [],\n themeTopYs: [],\n getThemeTopY: null,\n currentIndex:0,\n\n message:'',\n show:false\n }\n },\n created() {\n //home主页传入iid\n this.iid = this.$route.params.iid\n //数据的展示\n getDetail(this.iid).then(res => {\n const data = res.data.result\n //轮播图的切换\n this.topImages = data.itemInfo.topImages\n //商品介绍\n this.goods = new Goods(data.itemInfo, data.columns, data.shopInfo.services)\n //店铺名的展示\n this.shop = new Shop(data.shopInfo)\n //穿着展示\n this.detailInfo = data.detailInfo\n //商品推荐的展示\n this.paramInfo = new GoodsParam(data.itemParams.info, data.itemParams.rule)\n\n if (data.rate.list) {\n this.commentInfo = data.rate.list[0];\n }\n //导航栏点击切换\n this.getThemeTopY = debounce(() => {\n this.themeTopYs = []\n this.themeTopYs.push(0);\n this.themeTopYs.push(this.$refs.params.$el.offsetTop)\n this.themeTopYs.push(this.$refs.comment.$el.offsetTop)\n this.themeTopYs.push(this.$refs.recommend.$el.offsetTop)\n this.themeTopYs.push(Number.MAX_VALUE)\n }, 500)\n\n })\n //获取评论的数据\n getRecommend().then(res => {\n this.recommends = res.data.data.list\n })\n },\n mounted() {\n },\n destroyed() {\n //无keep-live时activated无法使用\n this.$bus.$off('itemImgLoad', this.itemImgListener)\n },\n methods: {\n //上拉图片加载\n detailImageload() {\n this.itemImgListener()\n this.getThemeTopY()\n },\n //导航栏点击切换\n titleClick(index) {\n this.$refs.scroll.scrollTo(0, -this.themeTopYs[index], 1000);\n },\n //位置移动时导航栏跟着移动\n positionScroll(position) {\n const positionY = -position.y\n let length = this.themeTopYs.length\n for (let i = 0; i < length-1; i++) {\n if(this.currentIndex!==i&&(positionY>=this.themeTopYs[i]&&positionY<this.themeTopYs[i+1]))\n {\n this .currentIndex=i;\n this.$refs.nav.currentIndex=this.currentIndex\n }\n }\n },\n //mixin混入回退顶部的按钮\n totalScroll(position){\n this.positionScroll(position)\n this.contentScoll(position)\n },\n //加入购物车\n addToCart(){\n //获取购物车需要展示的东西\n const product={}\n product.image=this.topImages[0];\n product.title=this.detailInfo.title;\n product.desc=this.detailInfo.desc;\n product.price=this.goods.nowPrice;\n product.iid=this.iid;\n this.$store.dispatch('addCart',product).then(res=>{\n this.$toast.show(res,2000)\n })\n }\n }\n}\n</script>\n\n<style scoped>\n#detail{\n position: relative;\n z-index: 9;\n background-color: #ffffff;\n height: 100vh;\n}\n.detail-nav{\n position: relative;\n z-index: 9;\n background-color: #ffffff;\n}\n.content{\n height: calc(100% - 96px);\n position: relative;\n}\n</style>\n"]}]} |