Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
X
xiaoya-agent-program
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenqian
xiaoya-agent-program
Commits
02a6f31c
Commit
02a6f31c
authored
Apr 08, 2020
by
18868195926
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 顶部自定义导航修改
parent
4609c279
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
15 deletions
+20
-15
index.jsx
src/components/NavBar/index.jsx
+11
-6
index.js
src/pages/citySelect/index.js
+1
-1
index.jsx
src/pages/index/index.jsx
+8
-8
No files found.
src/components/NavBar/index.jsx
View file @
02a6f31c
import
Taro
,
{
Component
}
from
'@tarojs/taro'
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
{
connect
}
from
'@tarojs/redux'
import
'./index.scss'
import
'./index.scss'
...
@@ -31,23 +29,30 @@ class Index extends Component {
...
@@ -31,23 +29,30 @@ class Index extends Component {
//回主页
//回主页
toIndex
=
()
=>
{
toIndex
=
()
=>
{
Taro
.
navigateTo
({
Taro
.
navigateTo
({
url
:
'/pages/
admin/home/
index/index'
url
:
'/pages/index/index'
})
})
}
}
render
()
{
render
()
{
const
{
show
Nav
,
bgColor
,
pageName
,
nav
}
=
this
.
props
const
{
show
Back
,
bgColor
,
pageName
,
nav
,
showIndex
}
=
this
.
props
console
.
log
(
this
.
props
)
console
.
log
(
this
.
props
)
const
titleTop
=
(
nav
.
globalData
.
navHeight
-
nav
.
globalData
.
navTop
-
20
)
/
2
+
nav
.
globalData
.
navTop
const
titleTop
=
(
nav
.
globalData
.
navHeight
-
nav
.
globalData
.
navTop
-
20
)
/
2
+
nav
.
globalData
.
navTop
return
(
return
(
<
View
className=
'navbar custom-class'
style=
{
`height:${nav.globalData.navHeight}px;background-color:${bgColor}`
}
>
<
View
className=
'navbar custom-class'
style=
{
`height:${nav.globalData.navHeight}px;background-color:${bgColor}`
}
>
{
show
Nav
&&
<
View
{
show
Back
&&
<
View
className=
'navbar-action-wrap navbar-action-group'
className=
'navbar-action-wrap navbar-action-group'
style=
{
`top:${titleTop}px;background-color:rgba(255,255,255,.6)`
}
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'
/>
<
Image
onClick=
{
this
.
navBack
}
className=
'icon'
src=
'http://hh-oss-picture.miyapay.com/box/c66db9ee434dd2061fbb949db0af797d.png'
/>
</
View
>
</
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
}
{
this
.
props
.
children
}
<
View
class=
'navbar-title'
style=
{
`top:${titleTop}px`
}
>
<
View
class=
'navbar-title'
style=
{
`top:${titleTop}px`
}
>
{
pageName
}
{
pageName
}
...
...
src/pages/citySelect/index.js
View file @
02a6f31c
...
@@ -152,7 +152,7 @@ class CitySelect extends BaseComponent {
...
@@ -152,7 +152,7 @@ class CitySelect extends BaseComponent {
return
(
return
(
<
View
>
<
View
>
<
NavBar
pageName
=
'我是标题'
bgColor
=
'#fff'
show
Nav
><
/NavBar
>
<
NavBar
pageName
=
'我是标题'
bgColor
=
'#fff'
show
Back
><
/NavBar
>
<
View
className
=
{
`header
${
showSearch
?
' searching'
:
''
}
`
}
>
<
View
className
=
{
`header
${
showSearch
?
' searching'
:
''
}
`
}
>
<
View
className
=
'search'
>
<
View
className
=
'search'
>
<
View
className
=
'input-wrapper'
>
<
View
className
=
'input-wrapper'
>
...
...
src/pages/index/index.jsx
View file @
02a6f31c
...
@@ -16,10 +16,6 @@ import './index.scss'
...
@@ -16,10 +16,6 @@ import './index.scss'
}))
}))
class
Index
extends
BaseComponent
{
class
Index
extends
BaseComponent
{
config
=
{
navigationBarTitleText
:
'首页'
}
state
=
{
state
=
{
located
:
false
located
:
false
}
}
...
@@ -49,17 +45,21 @@ class Index extends BaseComponent {
...
@@ -49,17 +45,21 @@ class Index extends BaseComponent {
url
:
'/pages/citySelect/index'
url
:
'/pages/citySelect/index'
})
})
}
}
// 跳转到门店详情
jumpDetail
=
()
=>
{
Taro
.
navigateTo
({
url
:
'/pages/storeDetail/index'
})
}
render
()
{
render
()
{
const
{
nav
}
=
this
.
props
const
{
nav
}
=
this
.
props
const
titleTop
=
(
nav
.
globalData
.
navHeight
-
nav
.
globalData
.
navTop
-
17
)
/
2
+
nav
.
globalData
.
navTop
const
titleTop
=
(
nav
.
globalData
.
navHeight
-
nav
.
globalData
.
navTop
-
17
)
/
2
+
nav
.
globalData
.
navTop
const
{
located
}
=
this
.
state
;
const
user
=
this
.
props
.
user
;
const
user
=
this
.
props
.
user
;
console
.
log
(
'user'
,
user
)
console
.
log
(
'user'
,
user
)
// const noLocation = located && (!user.longitude || !user.latitude);
const
noLoc
=
(
!
user
||
!
user
.
longitude
||
!
user
.
latitude
);
const
noLoc
=
(
!
user
||
!
user
.
longitude
||
!
user
.
latitude
);
return
(
return
(
<
View
>
<
View
>
<
NavBar
pageName=
'
我是标题'
bgColor=
'#fff'
showNav=
{
false
}
>
<
NavBar
pageName=
'
首页'
bgColor=
'#fff'
>
<
View
<
View
style=
{
`left:${nav.globalData.navRight}px;top:${titleTop}px;background-color:rgba(255,255,255,.6)`
}
style=
{
`left:${nav.globalData.navRight}px;top:${titleTop}px;background-color:rgba(255,255,255,.6)`
}
className=
'city'
className=
'city'
...
@@ -109,7 +109,7 @@ class Index extends BaseComponent {
...
@@ -109,7 +109,7 @@ class Index extends BaseComponent {
className=
'scrollview'
className=
'scrollview'
scrollY
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'
/>
<
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'
>
<
View
className=
'text-cont'
>
<
Text
>
米雅遍历(北京店)
</
Text
>
<
Text
>
米雅遍历(北京店)
</
Text
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment