Commit 02a6f31c authored by 18868195926's avatar 18868195926

feat: 顶部自定义导航修改

parent 4609c279
import Taro, { Component } from '@tarojs/taro'
import { View, Button, Text } from '@tarojs/components'
import { View, Image } from '@tarojs/components'
import { connect } from '@tarojs/redux'
import './index.scss'
......@@ -31,23 +29,30 @@ class Index extends Component {
//回主页
toIndex = () => {
Taro.navigateTo({
url: '/pages/admin/home/index/index'
url: '/pages/index/index'
})
}
render () {
const {showNav, bgColor, pageName, nav} = this.props
const {showBack, bgColor, pageName, nav, showIndex} = this.props
console.log(this.props)
const titleTop = (nav.globalData.navHeight - nav.globalData.navTop - 20) / 2 + nav.globalData.navTop
return (
<View className='navbar custom-class' style={`height:${nav.globalData.navHeight}px;background-color:${bgColor}`}>
{showNav && <View
{showBack && <View
className='navbar-action-wrap navbar-action-group'
style={`top:${titleTop}px;background-color:rgba(255,255,255,.6)`}
>
<Image onClick={this.navBack} className='icon' src='http://hh-oss-picture.miyapay.com/box/c66db9ee434dd2061fbb949db0af797d.png' />
</View>
}
{showIndex && <View
className='navbar-action-wrap navbar-action-group'
style={`top:${titleTop}px;background-color:rgba(255,255,255,.6)`}
>
<Image onClick={this.toIndex} className='icon' src='http://hh-oss-picture.miyapay.com/box/2df3231a694bd87e613eedef7a236d4b.png' />
</View>
}
{this.props.children}
<View class='navbar-title' style={`top:${titleTop}px`}>
{pageName}
......
......@@ -152,7 +152,7 @@ class CitySelect extends BaseComponent {
return (
<View>
<NavBar pageName='我是标题' bgColor='#fff' showNav></NavBar>
<NavBar pageName='我是标题' bgColor='#fff' showBack></NavBar>
<View className={`header${showSearch ? ' searching': ''}`}>
<View className='search'>
<View className='input-wrapper'>
......
......@@ -16,10 +16,6 @@ import './index.scss'
}))
class Index extends BaseComponent {
config = {
navigationBarTitleText: '首页'
}
state = {
located: false
}
......@@ -49,17 +45,21 @@ class Index extends BaseComponent {
url: '/pages/citySelect/index'
})
}
// 跳转到门店详情
jumpDetail = () => {
Taro.navigateTo({
url: '/pages/storeDetail/index'
})
}
render () {
const {nav} = this.props
const titleTop = (nav.globalData.navHeight - nav.globalData.navTop - 17) / 2 + nav.globalData.navTop
const {located} = this.state;
const user = this.props.user;
console.log('user', user)
// const noLocation = located && (!user.longitude || !user.latitude);
const noLoc = (!user || !user.longitude || !user.latitude);
return (
<View>
<NavBar pageName='我是标题' bgColor='#fff' showNav={false}>
<NavBar pageName='首页' bgColor='#fff'>
<View
style={`left:${nav.globalData.navRight}px;top:${titleTop}px;background-color:rgba(255,255,255,.6)`}
className='city'
......@@ -109,7 +109,7 @@ class Index extends BaseComponent {
className='scrollview'
scrollY
>
<View className='list-view'>
<View className='list-view' onClick={this.jumpDetail}>
<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>
......
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