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 21:11:03 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9ee444c0ee761cd5cf6063c967ed3d0515f7b1ce
9ee444c0
1 parent
1a2dd91d
文章OK
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
10 deletions
src/Components/CommonImageView.js
src/Components/articleTemplate.js
src/pages/Home/index.js
src/pages/InsuranceChurch/index.js
src/Components/CommonImageView.js
View file @
9ee444c
...
...
@@ -12,6 +12,11 @@ import { StackNavigator, TabNavigator } from "react-navigation";
export
default
class
CommonImageView
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
products
:
[
]
}
}
render
()
{
console
.
log
(
"Image index"
,
this
.
props
.
navigation
.
state
.
params
.
index
);
...
...
src/Components/articleTemplate.js
View file @
9ee444c
...
...
@@ -17,19 +17,21 @@ export default class ArticleTemplate extends Component {
super
(
props
);
this
.
state
=
{
id
:
this
.
props
.
navigation
.
state
.
params
.
item
.
id
,
model
:
this
.
props
.
navigation
.
state
.
params
.
model
,
articleData
:
{
paragraph
:
[]
}
};
}
componentWillMount
()
{
console
.
log
(
"will
的ID"
,
this
.
state
.
id
);
console
.
log
(
"will
model"
,
this
.
state
.
model
);
this
.
getArticles
();
}
getArticles
()
{
let
that
=
this
,
id
=
this
.
state
.
id
;
return
fetch
(
`https://devpay.brae.co/test/insurance/topic/
${
id
}
`
,
{
id
=
this
.
state
.
id
,
model
=
this
.
state
.
model
;
return
fetch
(
`https://devpay.brae.co/test/insurance/
${
model
}
/
${
id
}
`
,
{
method
:
"POST"
,
headers
:
{
Accept
:
"application/json"
,
...
...
@@ -37,6 +39,7 @@ export default class ArticleTemplate extends Component {
}
})
.
then
(
resp
=>
{
console
.
log
(
"大爷"
,
resp
);
if
(
resp
.
status
===
200
)
{
return
resp
.
json
();
}
else
{
...
...
@@ -48,9 +51,9 @@ export default class ArticleTemplate extends Component {
alert
(
respJson
.
cnmsg
);
}
else
{
that
.
setState
({
articleData
:
respJson
.
data
.
articleData
articleData
:
respJson
.
data
.
data
.
articleData
});
console
.
log
(
"详情页的文章"
,
respJson
.
data
.
articleData
);
console
.
log
(
"详情页的文章"
,
respJson
.
data
.
data
.
articleData
);
}
});
}
...
...
@@ -75,7 +78,7 @@ export default class ArticleTemplate extends Component {
)
:
null
}
{
item
.
image
?
(
<
Image
style
=
{
[
styles
.
paragraphImage
,{
width
:
320
,
height
:
178
}]
}
style
=
{
{
width
:
item
.
width
,
height
:
item
.
height
,
alignSelf
:
"center"
,
marginBottom
:
20
}
}
resizeMode
=
"contain"
source
=
{{
uri
:
item
.
image
}}
/
>
...
...
@@ -136,8 +139,8 @@ const styles = StyleSheet.create({
// backgroundColor: "red",
},
paragraphImage
:
{
width
:
Dimensions
.
get
(
"window"
).
width
-
30
,
height
:
140
,
//
width: Dimensions.get("window").width - 30,
//
height: 140,
// backgroundColor: "blue",
marginBottom
:
20
},
...
...
src/pages/Home/index.js
View file @
9ee444c
...
...
@@ -194,7 +194,7 @@ export default class Home extends Component {
return
(
<
TouchableOpacity
style
=
{
styles
.
itemContainer
}
onPress
=
{()
=>
navigate
(
"ArticleTemplate"
,
{
item
:
item
})}
onPress
=
{()
=>
navigate
(
"ArticleTemplate"
,
{
item
:
item
,
model
:
"topic"
})}
>
<
View
style
=
{
styles
.
itemImgWrapper
}
>
<
Image
...
...
src/pages/InsuranceChurch/index.js
View file @
9ee444c
...
...
@@ -68,7 +68,7 @@ export default class InsuranceChurch extends Component {
<
TouchableOpacity
style
=
{
styles
.
itemContainer
}
key
=
{
index
}
onPress
=
{()
=>
navigate
(
"ArticleTemplate"
,
{
item
:
item
})}
onPress
=
{()
=>
navigate
(
"ArticleTemplate"
,
{
item
:
item
,
model
:
"story"
})}
>
<
Image
style
=
{
styles
.
itemImgWrapper
}
source
=
{{
uri
:
item
.
imgurl
}}
/
>
<
View
style
=
{
styles
.
itemRightWrapper
}
>
...
...
Please
register
or
login
to post a comment