Toggle navigation
Toggle navigation
This project
Loading...
Sign in
罗广聪
/
ProtectGod
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
罗广聪
2017-09-26 10:23:36 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1219ce2d64880e556936d835ff69b82f632aaaa1
1219ce2d
1 parent
bc80213a
首页入口
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
64 deletions
ios/ProtectGod.xcodeproj/xcshareddata/xcschemes/ProtectGod.xcscheme
src/pages/Home/index.js
ios/ProtectGod.xcodeproj/xcshareddata/xcschemes/ProtectGod.xcscheme
View file @
1219ce2
...
...
@@ -54,6 +54,7 @@
buildConfiguration =
"Debug"
selectedDebuggerIdentifier =
"Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier =
"Xcode.DebuggerFoundation.Launcher.LLDB"
language =
""
shouldUseLaunchSchemeArgsEnv =
"YES"
>
<Testables>
<TestableReference
...
...
@@ -80,9 +81,10 @@
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration =
"
Release
"
buildConfiguration =
"
Debug
"
selectedDebuggerIdentifier =
"Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier =
"Xcode.DebuggerFoundation.Launcher.LLDB"
language =
""
launchStyle =
"0"
useCustomWorkingDirectory =
"NO"
ignoresPersistentStateOnLaunch =
"NO"
...
...
src/pages/Home/index.js
View file @
1219ce2
...
...
@@ -17,7 +17,6 @@ import Swiper from "react-native-swiper";
export
default
class
Home
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
_renderMap
=
this
.
_renderMap
.
bind
(
this
);
this
.
_swiper
=
this
.
_swiper
.
bind
(
this
);
this
.
state
=
{
ListData
:
[],
...
...
@@ -33,9 +32,10 @@ export default class Home extends Component {
}
componentWillMount
()
{
this
.
getListData
();
// this.getBannar();
}
componentDidMount
()
{}
getListData
()
{
let
that
=
this
;
return
fetch
(
`https://devpay.brae.co/test/insurance/topic`
,
{
...
...
@@ -58,11 +58,12 @@ export default class Home extends Component {
}
else
{
that
.
setState
({
ListData
:
respJson
.
data
.
topic
})
console
.
log
(
"首页列表"
,
this
.
state
.
ListData
)
})
;
console
.
log
(
"首页列表"
,
this
.
state
.
ListData
);
}
});
}
getBannar
()
{
let
that
=
this
;
return
fetch
(
`https://devpay.brae.co/test/insurance/banner`
,
{
...
...
@@ -85,35 +86,12 @@ export default class Home extends Component {
}
else
{
that
.
setState
({
swiperImgList
:
respJson
.
data
.
banner
})
console
.
log
(
"bannar图"
,
respJson
.
data
.
banner
)
})
;
console
.
log
(
"bannar图"
,
respJson
.
data
.
banner
);
}
});
}
_renderMap
()
{
const
{
navigate
}
=
this
.
props
.
navigation
;
return
this
.
state
.
ListData
.
map
((
item
,
index
)
=>
{
return
(
<
TouchableOpacity
style
=
{
styles
.
itemContainer
}
key
=
{
index
}
onPress
=
{()
=>
navigate
(
"CommonWebView"
,
{
item
:
item
})}
>
<
View
style
=
{
styles
.
itemImgWrapper
}
>
<
Image
source
=
{
item
.
imgurl
}
style
=
{{
width
:
74
,
height
:
74
}}
/
>
<
/View
>
<
View
style
=
{
styles
.
itemRightWrapper
}
>
<
Text
style
=
{
styles
.
itemTextTop
}
numberOfLines
=
{
1
}
>
{
item
.
title
}
<
/Text
>
<
Text
style
=
{
styles
.
itemTextBottom
}
numberOfLines
=
{
1
}
>
{
item
.
context
}
<
/Text
>
<
/View
>
<
/TouchableOpacity
>
);
});
}
_swiper
()
{
const
{
navigate
}
=
this
.
props
.
navigation
;
const
{
height
,
width
}
=
Dimensions
.
get
(
"window"
);
...
...
@@ -150,15 +128,21 @@ export default class Home extends Component {
<
/View
>
);
}
render
()
{
// console.log("首页的this.props", this);
// console.log("render首页文章列表", this.state.ListData);
const
{
navigate
}
=
this
.
props
.
navigation
;
const
ds
=
new
ListView
.
DataSource
({
rowHasChanged
:
(
r1
,
r2
)
=>
r1
!==
r2
});
const
ds
=
new
ListView
.
DataSource
({
rowHasChanged
:
(
r1
,
r2
)
=>
r1
!==
r2
});
const
dataSource
=
ds
.
cloneWithRows
(
this
.
state
.
ListData
);
return
(
<
View
style
=
{
styles
.
container
}
>
{
/* 轮播图 */
}
{
this
.
_swiper
()}
{
/* 保险产品入口 */
}
<
TouchableOpacity
style
=
{
styles
.
midContainer
}
onPress
=
{()
=>
navigate
(
"AllProduct"
)}
...
...
@@ -173,17 +157,33 @@ export default class Home extends Component {
style
=
{
styles
.
midArrow
}
/
>
<
/TouchableOpacity
>
{
/* 智能方案和健康问卷入口 */
}
<
View
style
=
{
styles
.
AIAndHealthContainer
}
>
<
TouchableOpacity
style
=
{
styles
.
AHContainer
}
>
<
Image
style
=
{
styles
.
AHIcon
}
/
>
<
Text
style
=
{
styles
.
AHText
}
>
智能方案
<
/Text
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{
styles
.
AHContainer
}
>
<
Image
style
=
{
styles
.
AHIcon
}
/
>
<
Text
style
=
{
styles
.
AHText
}
>
健康问卷
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
<
View
style
=
{
styles
.
textContainer
}
>
<
Text
style
=
{
styles
.
minText
}
>
保险头条
<
/Text
>
<
/View
>
{
/* 保险头条列表 */
}
<
ListView
dataSource
=
{
dataSource
}
enableEmptySections
=
{
true
}
enableEmptySections
=
{
true
}
renderRow
=
{(
item
,
index
)
=>
{
return
(
<
TouchableOpacity
style
=
{
styles
.
itemContainer
}
onPress
=
{()
=>
navigate
(
"ArticleTemplate"
,
{
item
:
item
,
model
:
"topic"
})}
onPress
=
{()
=>
navigate
(
"ArticleTemplate"
,
{
item
:
item
,
model
:
"topic"
})}
>
<
View
style
=
{
styles
.
itemImgWrapper
}
>
<
Image
...
...
@@ -203,36 +203,6 @@ export default class Home extends Component {
);
}}
/
>
{
/* <ScrollView
style={styles.listContainer}
automaticallyAdjustContentInsets={false}
>
{this.state.ListData.map((item, index) => {
return (
<TouchableOpacity
style={styles.itemContainer}
key={index}
onPress={() => navigate("ArticleTemplate", { item: item })}
>
<View style={styles.itemImgWrapper}>
<Image
source={{uri: item.image}}
style={{ width: 74, height: 74 }}
/>
</View>
<View style={styles.itemRightWrapper}>
<Text style={styles.itemTextTop} numberOfLines={1}>
{item.title}
</Text>
<Text style={styles.itemTextBottom} numberOfLines={1}>
{item.summary}
</Text>
</View>
</TouchableOpacity>
);
})}
<Text style={styles.scrollViewText}>没有更多了</Text>
</ScrollView> */
}
<
/View
>
);
}
...
...
@@ -276,6 +246,17 @@ const styles = StyleSheet.create({
position
:
"absolute"
,
right
:
15
},
AIAndHealthContainer
:
{
flexDirection
:
"row"
,
justifyContent
:
"space-around"
,
alignItems
:
"center"
,
marginTop
:
10
,
// marginBottom: 10,
backgroundColor
:
"white"
,
},
AHContainer
:
{},
AHIcon
:
{},
AHText
:
{},
textContainer
:
{
backgroundColor
:
"#fff"
,
marginTop
:
10
,
...
...
Please
register
or
login
to post a comment