|
@@ -1,4 +1,4 @@
|
1
|
|
-import React, { useState } from "react"
|
|
1
|
+import React, { useState , useEffect } from "react"
|
2
|
2
|
import Taro from "@tarojs/taro";
|
3
|
3
|
import { View, Input, Swiper, Image, SwiperItem, Text, ScrollView } from "@tarojs/components"
|
4
|
4
|
import positionImg from '@/assets/comm/position.png'
|
|
@@ -6,26 +6,29 @@ import searchImg from '@/assets/comm/search.png'
|
6
|
6
|
import orderImg from '@/assets/comm/orderList.png'
|
7
|
7
|
import Footer from "@/components/Footer";
|
8
|
8
|
import MyCard from "@/components/MyCard";
|
|
9
|
+import { getBannerList } from "@/services/banner";
|
9
|
10
|
import './style.less'
|
10
|
11
|
|
11
|
|
-export default () => {
|
12
|
12
|
|
13
|
|
- const [swiperImgHeightList, setSwiperImgHeightList] = useState([])
|
14
|
|
- const [swiperImgWidthList, setSwiperImgWidthList] = useState([])
|
15
|
|
- const imglist = [
|
16
|
|
- {
|
17
|
|
- url: require('@/assets/banner/1.jpg')
|
18
|
|
- },
|
19
|
|
- {
|
20
|
|
- url: require('@/assets/banner/2.jpg')
|
21
|
|
- },
|
22
|
|
- ]
|
|
13
|
+export default () => {
|
|
14
|
+ const [imgList,setImgList]=useState([])
|
23
|
15
|
const handleSearch = (e) => {
|
24
|
16
|
console.log(e.detail.value)
|
25
|
17
|
}
|
26
|
18
|
const handleMore = () => {
|
27
|
19
|
Taro.navigateTo({ url: '/pages/moreOrder/index' });
|
28
|
20
|
}
|
|
21
|
+ useEffect(() => {
|
|
22
|
+ getBannerList({ position: 'bannerWorker' })
|
|
23
|
+ .then(res => {
|
|
24
|
+ setImgList(res)
|
|
25
|
+ }).catch(err => {
|
|
26
|
+ Taro.showToast({
|
|
27
|
+ title: '网络异常, 请刷新小程序重试',
|
|
28
|
+ icon: 'none',
|
|
29
|
+ })
|
|
30
|
+ })
|
|
31
|
+ }, [])
|
29
|
32
|
return (
|
30
|
33
|
<View className='orderIndex'>
|
31
|
34
|
<View className='top'>
|
|
@@ -46,9 +49,9 @@ export default () => {
|
46
|
49
|
autoplay
|
47
|
50
|
className='swiper'
|
48
|
51
|
>
|
49
|
|
- {imglist.map((item, inx) => (
|
|
52
|
+ {imgList.map((item, inx) => (
|
50
|
53
|
<SwiperItem key={inx}>
|
51
|
|
- <Image src={item.url} mode='widthFix' className='storeImage' />
|
|
54
|
+ <Image src={item.thumb} mode='widthFix' className='storeImage' />
|
52
|
55
|
</SwiperItem>
|
53
|
56
|
))}
|
54
|
57
|
</Swiper>
|