| 
									
										
										
										
											2022-04-10 01:21:21 +08:00
										 |  |  | <template> | 
					
						
							|  |  |  |   <view class="container"> | 
					
						
							|  |  |  |     <!--搜索栏--> | 
					
						
							|  |  |  |     <u-sticky style="top: 0" offset-top="0"> | 
					
						
							|  |  |  |       <view class="search-wrap"> | 
					
						
							|  |  |  |         <u-search placeholder="搜索" disabled height="32" :show-action="false" @click="handleSearchClick"></u-search> | 
					
						
							|  |  |  |       </view> | 
					
						
							|  |  |  |     </u-sticky> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     <!--轮播图--> | 
					
						
							| 
									
										
										
										
											2022-12-05 21:51:39 +08:00
										 |  |  |     <yd-banner :banner-list="bannerList"></yd-banner> | 
					
						
							| 
									
										
										
										
											2022-04-10 01:21:21 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-11 23:02:08 +08:00
										 |  |  |     <u-gap height="20px"></u-gap> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-10 01:21:21 +08:00
										 |  |  |     <!--宫格菜单按钮--> | 
					
						
							| 
									
										
										
										
											2022-11-19 21:40:26 +08:00
										 |  |  |     <u-grid :border="false" col="4"> | 
					
						
							|  |  |  |       <u-grid-item v-for="(item, index) in menuList" :key="index"> | 
					
						
							| 
									
										
										
										
											2022-04-16 22:04:02 +08:00
										 |  |  |         <u-icon :name="item.icon" :size="40"></u-icon> | 
					
						
							|  |  |  |         <text class="grid-title">{{ item.title }}</text> | 
					
						
							|  |  |  |       </u-grid-item> | 
					
						
							| 
									
										
										
										
											2022-04-11 23:02:08 +08:00
										 |  |  |     </u-grid> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     <u-gap height="15px"></u-gap> | 
					
						
							| 
									
										
										
										
											2022-04-10 01:21:21 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     <!--消息滚动栏--> | 
					
						
							|  |  |  |     <u-notice-bar style="padding: 13px 12px" :text="noticeList" mode="link" direction="column" @click="click"></u-notice-bar> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     <!--商品展示栏--> | 
					
						
							| 
									
										
										
										
											2022-11-19 21:40:26 +08:00
										 |  |  |     <yd-product-box :product-list="productList" :title="'每日上新'" show-type="normal"></yd-product-box> | 
					
						
							|  |  |  |     <yd-product-box :product-list="productList" :title="'热卖商品'" show-type="half"></yd-product-box> | 
					
						
							| 
									
										
										
										
											2022-11-23 00:20:35 +08:00
										 |  |  |     <yd-product-more :product-list="productList" :more-status="moreStatus"></yd-product-more> | 
					
						
							| 
									
										
										
										
											2022-04-10 01:21:21 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-19 21:40:26 +08:00
										 |  |  |     <u-gap height="5px"></u-gap> | 
					
						
							| 
									
										
										
										
											2022-04-10 01:21:21 +08:00
										 |  |  |   </view> | 
					
						
							|  |  |  | </template> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <script> | 
					
						
							| 
									
										
										
										
											2022-05-01 22:39:16 +08:00
										 |  |  | import { getBannerData, getNoticeData } from '../../api/index' | 
					
						
							| 
									
										
										
										
											2022-04-10 01:21:21 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | export default { | 
					
						
							| 
									
										
										
										
											2022-04-16 22:04:02 +08:00
										 |  |  |   components: {}, | 
					
						
							| 
									
										
										
										
											2022-04-10 01:21:21 +08:00
										 |  |  |   data() { | 
					
						
							|  |  |  |     return { | 
					
						
							| 
									
										
										
										
											2022-11-19 21:40:26 +08:00
										 |  |  |       bannerList: [ | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           id: 1, | 
					
						
							|  |  |  |           title: '山不在高,有仙则名', | 
					
						
							|  |  |  |           url: 'https://cdn.uviewui.com/uview/swiper/swiper1.png' | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           id: 2, | 
					
						
							|  |  |  |           title: '水不在深,有龙则灵', | 
					
						
							|  |  |  |           url: 'https://cdn.uviewui.com/uview/swiper/swiper2.png' | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           id: 3, | 
					
						
							|  |  |  |           title: '斯是陋室,惟吾德馨', | 
					
						
							|  |  |  |           url: 'https://cdn.uviewui.com/uview/swiper/swiper3.png' | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       ], | 
					
						
							| 
									
										
										
										
											2022-04-16 22:04:02 +08:00
										 |  |  |       menuList: [ | 
					
						
							|  |  |  |         { icon: 'gift', title: '热门推荐' }, | 
					
						
							|  |  |  |         { icon: 'star', title: '收藏转发' }, | 
					
						
							|  |  |  |         { icon: 'thumb-up', title: '点赞投币' }, | 
					
						
							|  |  |  |         { icon: 'heart', title: '感谢支持' } | 
					
						
							| 
									
										
										
										
											2022-04-10 01:21:21 +08:00
										 |  |  |       ], | 
					
						
							| 
									
										
										
										
											2022-04-16 22:04:02 +08:00
										 |  |  |       noticeList: ['寒雨连江夜入吴', '平明送客楚山孤', '洛阳亲友如相问', '一片冰心在玉壶'], | 
					
						
							| 
									
										
										
										
											2022-04-10 01:21:21 +08:00
										 |  |  |       productList: [ | 
					
						
							| 
									
										
										
										
											2022-04-11 23:02:08 +08:00
										 |  |  |         { | 
					
						
							|  |  |  |           id: 1, | 
					
						
							|  |  |  |           image: 'https://cdn.uviewui.com/uview/album/1.jpg', | 
					
						
							|  |  |  |           title: '山不在高,有仙则名。水不在深,有龙则灵。斯是陋室,惟吾德馨。', | 
					
						
							|  |  |  |           desc: '山不在于高,有了神仙就会有名气。水不在于深,有了龙就会有灵气。这是简陋的房子,只是我品德好就感觉不到简陋了。', | 
					
						
							|  |  |  |           price: '13.00' | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           id: 2, | 
					
						
							|  |  |  |           image: 'https://cdn.uviewui.com/uview/album/2.jpg', | 
					
						
							|  |  |  |           title: '商品222', | 
					
						
							|  |  |  |           desc: '', | 
					
						
							|  |  |  |           price: '23.00' | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           id: 3, | 
					
						
							|  |  |  |           image: 'https://cdn.uviewui.com/uview/album/3.jpg', | 
					
						
							|  |  |  |           title: '商品333', | 
					
						
							|  |  |  |           desc: '商品描述信息2', | 
					
						
							|  |  |  |           price: '33.00' | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           id: 4, | 
					
						
							|  |  |  |           image: 'https://cdn.uviewui.com/uview/album/4.jpg', | 
					
						
							|  |  |  |           title: '商品444', | 
					
						
							|  |  |  |           desc: '商品描述信息4', | 
					
						
							|  |  |  |           price: '43.00' | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           id: 5, | 
					
						
							|  |  |  |           image: 'https://cdn.uviewui.com/uview/album/5.jpg', | 
					
						
							|  |  |  |           title: '商品555', | 
					
						
							|  |  |  |           desc: '商品描述信息5', | 
					
						
							|  |  |  |           price: '53.00' | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2022-04-10 01:21:21 +08:00
										 |  |  |       ], | 
					
						
							| 
									
										
										
										
											2022-11-19 21:40:26 +08:00
										 |  |  |       moreStatus: 'nomore' | 
					
						
							| 
									
										
										
										
											2022-04-10 01:21:21 +08:00
										 |  |  |     } | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   onLoad() { | 
					
						
							| 
									
										
										
										
											2022-11-19 21:40:26 +08:00
										 |  |  |     this.loadBannerData() | 
					
						
							|  |  |  |     this.loadNoticeData() | 
					
						
							| 
									
										
										
										
											2022-04-10 01:21:21 +08:00
										 |  |  |   }, | 
					
						
							|  |  |  |   methods: { | 
					
						
							|  |  |  |     loadBannerData() { | 
					
						
							| 
									
										
										
										
											2022-04-21 01:46:45 +08:00
										 |  |  |       getBannerData().then(res => { | 
					
						
							|  |  |  |         this.bannerList = res.data | 
					
						
							|  |  |  |       }) | 
					
						
							| 
									
										
										
										
											2022-04-10 01:21:21 +08:00
										 |  |  |     }, | 
					
						
							|  |  |  |     loadNoticeData() { | 
					
						
							| 
									
										
										
										
											2022-04-21 01:46:45 +08:00
										 |  |  |       getNoticeData().then(res => { | 
					
						
							|  |  |  |         this.noticeList = res.data | 
					
						
							|  |  |  |       }) | 
					
						
							| 
									
										
										
										
											2022-04-10 01:21:21 +08:00
										 |  |  |     }, | 
					
						
							|  |  |  |     handleSearchClick(e) { | 
					
						
							| 
									
										
										
										
											2022-04-19 17:58:39 +08:00
										 |  |  |       uni.$u.route('/pages/search/search') | 
					
						
							| 
									
										
										
										
											2022-04-10 01:21:21 +08:00
										 |  |  |     } | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   computed: { | 
					
						
							|  |  |  |     noticeTextList() { | 
					
						
							|  |  |  |       return this.noticeList.map(item => { | 
					
						
							| 
									
										
										
										
											2022-04-16 22:04:02 +08:00
										 |  |  |         if (item.title) { | 
					
						
							|  |  |  |           return item.title | 
					
						
							| 
									
										
										
										
											2022-04-10 01:21:21 +08:00
										 |  |  |         } | 
					
						
							|  |  |  |       }) | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <style lang="scss" scoped> | 
					
						
							|  |  |  | .search-wrap { | 
					
						
							| 
									
										
										
										
											2022-04-11 23:02:08 +08:00
										 |  |  |   background: $custom-bg-color; | 
					
						
							| 
									
										
										
										
											2022-04-10 01:21:21 +08:00
										 |  |  |   padding: 20rpx; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .grid-title { | 
					
						
							|  |  |  |   line-height: 50rpx; | 
					
						
							|  |  |  |   font-size: 26rpx; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | </style> |