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-18 20:15:59 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1a2dd91daed636ac1582c97dec22d96cf70fc6ec
1a2dd91d
1 parent
aa687257
change
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
59 deletions
src/Components/articleTemplate.js
src/pages/Home/index.js
src/pages/InsuranceChurch/index.js
src/Components/articleTemplate.js
View file @
1a2dd91
...
...
@@ -23,19 +23,19 @@ export default class ArticleTemplate extends Component {
};
}
componentWillMount
()
{
console
.
log
(
"will 的ID"
,
this
.
state
.
id
)
console
.
log
(
"will 的ID"
,
this
.
state
.
id
);
this
.
getArticles
();
}
getArticles
()
{
let
that
=
this
,
id
=
this
.
state
.
id
;
return
fetch
(
`https://devpay.brae.co/test/insurance/topic/
${
id
}
`
,
{
return
fetch
(
`https://devpay.brae.co/test/insurance/topic/
${
id
}
`
,
{
method
:
"POST"
,
headers
:
{
Accept
:
"application/json"
,
"Content-Type"
:
"application/json"
}
})
})
.
then
(
resp
=>
{
if
(
resp
.
status
===
200
)
{
return
resp
.
json
();
...
...
@@ -49,8 +49,8 @@ return fetch(`https://devpay.brae.co/test/insurance/topic/${id}`, {
}
else
{
that
.
setState
({
articleData
:
respJson
.
data
.
articleData
})
console
.
log
(
"详情页的文章"
,
respJson
.
data
.
articleData
)
});
console
.
log
(
"详情页的文章"
,
respJson
.
data
.
articleData
);
}
});
}
...
...
@@ -74,7 +74,11 @@ return fetch(`https://devpay.brae.co/test/insurance/topic/${id}`, {
<
Text
style
=
{
styles
.
paragraphTitle
}
>
{
item
.
title
}
<
/Text
>
)
:
null
}
{
item
.
image
?
(
<
Image
style
=
{
styles
.
paragraphImage
}
resizeMode
=
"contain"
source
=
{{
uri
:
item
.
image
}}
/
>
<
Image
style
=
{[
styles
.
paragraphImage
,{
width
:
320
,
height
:
178
}]}
resizeMode
=
"contain"
source
=
{{
uri
:
item
.
image
}}
/
>
)
:
null
}
<
Text
style
=
{
styles
.
paragraphContent
}
>
{
item
.
content
}
<
/Text
>
<
/View
>
...
...
@@ -128,19 +132,19 @@ const styles = StyleSheet.create({
alignSelf
:
"center"
,
color
:
"#1B9341"
,
fontSize
:
15
,
marginBottom
:
15
,
marginBottom
:
15
// backgroundColor: "red",
},
paragraphImage
:
{
width
:
Dimensions
.
get
(
"window"
).
width
-
30
,
height
:
140
,
// backgroundColor: "blue",
marginBottom
:
20
,
marginBottom
:
20
},
paragraphContent
:
{
color
:
"#555555"
,
fontSize
:
15
,
lineHeight
:
22
,
lineHeight
:
22
// backgroundColor: "yellow",
}
});
...
...
src/pages/Home/index.js
View file @
1a2dd91
...
...
@@ -17,12 +17,8 @@ import Swiper from "react-native-swiper";
import
CommonWebView
from
"../../Components/CommonWebView"
;
export
default
class
Home
extends
Component
{
// static navigationOptions = {
// title: "首页"
// };
constructor
(
props
)
{
super
(
props
);
this
.
_renderMap
=
this
.
_renderMap
.
bind
(
this
);
this
.
_swiper
=
this
.
_swiper
.
bind
(
this
);
this
.
state
=
{
...
...
@@ -45,7 +41,7 @@ export default class Home extends Component {
}
componentWillMount
()
{
this
.
getListData
();
this
.
getBannar
();
//
this.getBannar();
}
componentDidMount
()
{}
getListData
()
{
...
...
@@ -71,6 +67,7 @@ export default class Home extends Component {
that
.
setState
({
ListData
:
respJson
.
data
.
topic
})
console
.
log
(
"首页列表"
,
this
.
state
.
ListData
)
}
});
}
...
...
src/pages/InsuranceChurch/index.js
View file @
1a2dd91
...
...
@@ -6,7 +6,8 @@ import {
View
,
ScrollView
,
TouchableOpacity
,
Image
Image
,
ListView
}
from
"react-native"
;
import
{
StackNavigator
,
TabNavigator
}
from
'react-navigation'
;
import
CommonWebView
from
"../../Components/CommonWebView"
;
...
...
@@ -17,40 +18,8 @@ export default class InsuranceChurch extends Component {
// };
constructor
(
props
)
{
super
(
props
);
// this._renderMap = this._renderMap.bind(this);
this
.
state
=
{
ListData
:
[
// {
// title: "凶猛台风来袭!与伤亡相关的保险知识你需要了解!",
// time: "刚刚",
// url: "http://mp.weixin.qq.com/s/_lGAz9sSxuulbdPGZ020cQ",
// imgurl: require("../../assets/church/1.png")
// },
// {
// title: "17世纪伦敦火灾频发,牛掰的保险公司有高招!",
// time: "3小时前",
// url: "http://mp.weixin.qq.com/s/cJ7oHQ__GBiBxBGZ1SCgDg",
// imgurl: require("../../assets/church/2.png")
// },
// {
// title: "这两个国家为何会有这些天气保险呢?原来是这样.....",
// time: "昨天",
// url: "http://mp.weixin.qq.com/s/EimQbKC0ziqN0o8_S1ACFQ",
// imgurl: require("../../assets/church/3.png")
// },
// {
// title: "车险小白必须知道的不计免赔险",
// time: "9月10日",
// url: "http://mp.weixin.qq.com/s/W9uR5G6ZlTb7HLLX-DZzSQ",
// imgurl: require("../../assets/church/4.png")
// },
// {
// title: "“五险一金”进了嘻哈歌词,有关社保和商业保险的知识你了解吗?",
// time: "9月9日",
// url: "http://mp.weixin.qq.com/s/0I7p2vaM23CsDiI41hHNOQ",
// imgurl: require("../../assets/church/5.png")
// },
]
ListData
:
[]
};
}
componentWillMount
()
{
...
...
@@ -77,29 +46,31 @@ export default class InsuranceChurch extends Component {
alert
(
respJson
.
cnmsg
);
}
else
{
that
.
setState
({
ListData
:
respJson
.
data
ListData
:
respJson
.
data
.
story
})
console
.
log
(
"保堂列表"
,
respJson
.
data
)
console
.
log
(
"保堂列表"
,
respJson
.
data
.
story
)
}
});
}
render
()
{
const
{
navigate
}
=
this
.
props
.
navigation
;
const
ds
=
new
ListView
.
DataSource
({
rowHasChanged
:
(
r1
,
r2
)
=>
r1
!==
r2
});
const
dataSource
=
ds
.
cloneWithRows
(
this
.
state
.
ListData
);
return
(
<
View
style
=
{
styles
.
container
}
>
<
Scroll
View
<
List
View
style
=
{
styles
.
scrollViewContainer
}
automaticallyAdjustContentInsets
=
{
fals
e
}
>
{
this
.
state
.
ListData
.
map
((
item
,
index
)
=>
{
dataSource
=
{
dataSourc
e
}
enableEmptySections
=
{
true
}
renderRow
=
{(
item
,
index
)
=>
{
return
(
<
TouchableOpacity
style
=
{
styles
.
itemContainer
}
key
=
{
index
}
onPress
=
{()
=>
navigate
(
"
CommonWebView
"
,
{
item
:
item
})}
onPress
=
{()
=>
navigate
(
"
ArticleTemplate
"
,
{
item
:
item
})}
>
<
Image
style
=
{
styles
.
itemImgWrapper
}
source
=
{
item
.
imgurl
}
/
>
<
Image
style
=
{
styles
.
itemImgWrapper
}
source
=
{
{
uri
:
item
.
imgurl
}
}
/
>
<
View
style
=
{
styles
.
itemRightWrapper
}
>
<
Text
style
=
{
styles
.
itemTextTop
}
numberOfLines
=
{
2
}
>
{
item
.
title
}
...
...
@@ -107,10 +78,10 @@ export default class InsuranceChurch extends Component {
<
Text
style
=
{
styles
.
itemTextBottom
}
>
{
item
.
time
}
<
/Text
>
<
/View
>
<
/TouchableOpacity
>
);
})}
)
}}
/
>
<
Text
style
=
{
styles
.
scrollViewText
}
>
没有更多了
<
/Text
>
<
/ScrollView
>
<
/View
>
);
}
...
...
Please
register
or
login
to post a comment