Commit 4d9f1c46 authored by 18868195926's avatar 18868195926

feat: 首页框架开发

parent 7de4e4e2
import Taro from '@tarojs/taro' import Taro from '@tarojs/taro'
import BaseComponent from '@/helper/baseComponent'; import BaseComponent from '@/helper/baseComponent';
import { View, Image, Text, Button } from '@tarojs/components' import { View, Image, Text, Swiper, SwiperItem, ScrollView } from '@tarojs/components'
import { connect } from '@tarojs/redux' import { connect } from '@tarojs/redux'
import { setUserInfo } from '@/actions/user' import { setUserInfo } from '@/actions/user'
import NavBar from '@/components/NavBar' import NavBar from '@/components/NavBar'
...@@ -43,18 +43,15 @@ class Index extends BaseComponent { ...@@ -43,18 +43,15 @@ class Index extends BaseComponent {
this.setState({located: true}) this.setState({located: true})
}) })
} }
// 手动选择地址
selectCity(){ selectCity(){
Taro.navigateTo({ Taro.navigateTo({
url: '/pages/citySelect/index' url: '/pages/citySelect/index'
}) })
} }
bindgetuserinfo (e) {
console.log(e)
}
render () { render () {
const {nav} = this.props const {nav} = this.props
const titleTop = nav.globalData.navHeight - nav.globalData.navTop const titleTop = (nav.globalData.navHeight - nav.globalData.navTop - 17) / 2 + nav.globalData.navTop
const {located} = this.state; const {located} = this.state;
const user = this.props.user; const user = this.props.user;
console.log('user', user) console.log('user', user)
...@@ -72,7 +69,98 @@ class Index extends BaseComponent { ...@@ -72,7 +69,98 @@ class Index extends BaseComponent {
<Text className={`${noLoc ? 'no-loc' : ''}`}>{noLoc ? '未获取定位' : user.city}</Text> <Text className={`${noLoc ? 'no-loc' : ''}`}>{noLoc ? '未获取定位' : user.city}</Text>
</View> </View>
</NavBar> </NavBar>
<Button onGetUserInfo={this.bindgetuserinfo} openType='getUserInfo'>获取授权</Button> <Swiper
className='swpier-view'
indicatorColor='#999'
indicatorActiveColor='#333'
circular
indicatorDots
autoplay
>
<SwiperItem>
<Image className='img' src='https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1586229157&di=6997346b65b0e2e2ff7a733ae9b5fcc5&src=http://a3.att.hudong.com/14/75/01300000164186121366756803686.jpg' />
</SwiperItem>
<SwiperItem>
<Image className='img' src='https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1586229157&di=6997346b65b0e2e2ff7a733ae9b5fcc5&src=http://a3.att.hudong.com/14/75/01300000164186121366756803686.jpg' />
</SwiperItem>
<SwiperItem>
<Image className='img' src='https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1586229157&di=6997346b65b0e2e2ff7a733ae9b5fcc5&src=http://a3.att.hudong.com/14/75/01300000164186121366756803686.jpg' />
</SwiperItem>
</Swiper>
<View className='sub-nav'>
<View className='content'>
<Image className='img' src='https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1586229157&di=6997346b65b0e2e2ff7a733ae9b5fcc5&src=http://a3.att.hudong.com/14/75/01300000164186121366756803686.jpg' />
<Text>领券</Text>
</View>
<View className='content'>
<Image className='img' src='https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1586229157&di=6997346b65b0e2e2ff7a733ae9b5fcc5&src=http://a3.att.hudong.com/14/75/01300000164186121366756803686.jpg' />
<Text>券包</Text>
</View>
</View>
<View className='sub-title'>
<Text>领券中心</Text>
<Text>查看全部</Text>
</View>
<View className='store-list-title'>
<Text>附近门店</Text>
</View>
<View>
<ScrollView
className='scrollview'
scrollY
>
<View className='list-view'>
<Image className='img' src='https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1586229157&di=6997346b65b0e2e2ff7a733ae9b5fcc5&src=http://a3.att.hudong.com/14/75/01300000164186121366756803686.jpg' />
<View className='text-cont'>
<Text>米雅遍历(北京店)</Text>
<Text>营业时间 10:00 - 18:00</Text>
</View>
<View className='distance'>
<Text>200m</Text>
</View>
</View>
<View className='list-view'>
<Image className='img' src='https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1586229157&di=6997346b65b0e2e2ff7a733ae9b5fcc5&src=http://a3.att.hudong.com/14/75/01300000164186121366756803686.jpg' />
<View className='text-cont'>
<Text>米雅遍历(北京店)</Text>
<Text>营业时间 10:00 - 18:00</Text>
</View>
<View className='distance'>
<Text>200m</Text>
</View>
</View>
<View className='list-view'>
<Image className='img' src='https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1586229157&di=6997346b65b0e2e2ff7a733ae9b5fcc5&src=http://a3.att.hudong.com/14/75/01300000164186121366756803686.jpg' />
<View className='text-cont'>
<Text>米雅遍历(北京店)</Text>
<Text>营业时间 10:00 - 18:00</Text>
</View>
<View className='distance'>
<Text>200m</Text>
</View>
</View>
<View className='list-view'>
<Image className='img' src='https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1586229157&di=6997346b65b0e2e2ff7a733ae9b5fcc5&src=http://a3.att.hudong.com/14/75/01300000164186121366756803686.jpg' />
<View className='text-cont'>
<Text>米雅遍历(北京店)</Text>
<Text>营业时间 10:00 - 18:00</Text>
</View>
<View className='distance'>
<Text>200m</Text>
</View>
</View>
<View className='list-view'>
<Image className='img' src='https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1586229157&di=6997346b65b0e2e2ff7a733ae9b5fcc5&src=http://a3.att.hudong.com/14/75/01300000164186121366756803686.jpg' />
<View className='text-cont'>
<Text>米雅遍历(北京店)</Text>
<Text>营业时间 10:00 - 18:00</Text>
</View>
<View className='distance'>
<Text>200m</Text>
</View>
</View>
</ScrollView>
</View>
</View> </View>
) )
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment