|
@@ -1,7 +1,7 @@
|
1
|
1
|
import { View } from '@tarojs/components'
|
2
|
2
|
import { Component } from '@tarojs/taro'
|
3
|
3
|
import './index.scss'
|
4
|
|
-import { GetShopList, GetShopTypeList } from '@/services/shop'
|
|
4
|
+import { GetShopList, GetShopTypeList, GetShopBanner } from '@/services/shop'
|
5
|
5
|
import ready from '@/utils/ready'
|
6
|
6
|
import ShopItem from './item'
|
7
|
7
|
import { connect } from '@tarojs/redux'
|
|
@@ -17,13 +17,7 @@ export default class Index extends Component {
|
17
|
17
|
}
|
18
|
18
|
state = {
|
19
|
19
|
TestImg: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1604566584132&di=33926cb8407ae341fa1d8cc0d322d392&imgtype=0&src=http%3A%2F%2Fattach.bbs.miui.com%2Fforum%2F201305%2F30%2F220025pxfkhykvkgkvuktq.jpg',
|
20
|
|
- BannerData: [
|
21
|
|
- { id: 1, img: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1604485078843&di=e50cb70de152bb6b83f7b1d712b509c8&imgtype=0&src=http%3A%2F%2Fattachments.gfan.com%2Fforum%2F201503%2F19%2F211608ztcq7higicydxhsy.jpg' },
|
22
|
|
- { id: 2, img: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1604486077351&di=a5320b0e8f2dd45ccdee71f7e1a541d5&imgtype=0&src=http%3A%2F%2Fbenyouhuifile.it168.com%2Fforum%2F201304%2F06%2F11435052yrezzae1bua8ee.jpg' },
|
23
|
|
- { id: 3, img: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1604486077351&di=ba0b2021b0dce8807b75bcd81cd44d32&imgtype=0&src=http%3A%2F%2Fbenyouhuifile.it168.com%2Fforum%2Fday_100429%2F1004291840008539c8ac02cd5c.jpg' },
|
24
|
|
- { id: 4, img: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1604486077351&di=014ef8ce837f8762c1e982f093286f42&imgtype=0&src=http%3A%2F%2Fattach.bbs.miui.com%2Fforum%2F201306%2F23%2F110328s72xxse7lfis9fnd.jpg' },
|
25
|
|
- { id: 5, img: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1604486077349&di=861dfd8adb91ede1c5f6de5abb59638b&imgtype=0&src=http%3A%2F%2Fattach.bbs.miui.com%2Fforum%2F201205%2F15%2F152011zser9o5oa9ee9xx6.jpg' }
|
26
|
|
- ],
|
|
20
|
+ BannerData: [],
|
27
|
21
|
isEmpty: false,
|
28
|
22
|
SearchName: '',
|
29
|
23
|
StoreList: [],
|
|
@@ -40,6 +34,11 @@ export default class Index extends Component {
|
40
|
34
|
this.setState({
|
41
|
35
|
CityData: city
|
42
|
36
|
}, () => {
|
|
37
|
+ GetShopBanner({ pageNum: 1, pageSize: 10 }).then((res) => {
|
|
38
|
+ this.setState({
|
|
39
|
+ BannerData: res.records || []
|
|
40
|
+ })
|
|
41
|
+ })
|
43
|
42
|
GetShopTypeList({ pageNum: 1, pageSize: 10 }).then((res) => {
|
44
|
43
|
let Arr = res.records || []
|
45
|
44
|
let aArr = []
|
|
@@ -160,15 +159,18 @@ export default class Index extends Component {
|
160
|
159
|
<View className='Banner'>
|
161
|
160
|
<View>
|
162
|
161
|
<View>
|
163
|
|
- <Swiper className='Swiper' indicatorColor='rgba(0,0,0,0.4)' indicatorActiveColor='#fff' circular indicatorDots autoplay>
|
164
|
|
- {
|
165
|
|
- BannerData.map((item, index) => (
|
166
|
|
- <SwiperItem key={`Swiper-${index}`}>
|
167
|
|
- <Image mode='widthFix' className='centerLabel' src={item.img} />
|
168
|
|
- </SwiperItem>
|
169
|
|
- ))
|
170
|
|
- }
|
171
|
|
- </Swiper>
|
|
162
|
+ {
|
|
163
|
+ BannerData.length &&
|
|
164
|
+ <Swiper className='Swiper' indicatorColor='rgba(0,0,0,0.4)' indicatorActiveColor='#fff' circular indicatorDots autoplay>
|
|
165
|
+ {
|
|
166
|
+ BannerData.map((item, index) => (
|
|
167
|
+ <SwiperItem key={`Swiper-${index}`}>
|
|
168
|
+ <Image mode='widthFix' className='centerLabel' src={item.thumb} />
|
|
169
|
+ </SwiperItem>
|
|
170
|
+ ))
|
|
171
|
+ }
|
|
172
|
+ </Swiper>
|
|
173
|
+ }
|
172
|
174
|
</View>
|
173
|
175
|
</View>
|
174
|
176
|
</View>
|