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-10-01 12:04:41 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9a7aa2f97d0aa7f54d3a810370b89bec38c397ad
9a7aa2f9
1 parent
452368db
share
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
1 deletions
src/Components/articleTemplate.js
src/pages/Home/healthQuestionnaire.js
src/Components/articleTemplate.js
View file @
9a7aa2f
...
...
@@ -8,14 +8,33 @@ import {
ScrollView
,
Text
,
FlatList
,
ListView
ListView
,
Share
,
TouchableOpacity
,
AsyncStorage
}
from
"react-native"
;
import
{
StackNavigator
,
TabNavigator
}
from
"react-navigation"
;
import
post
from
"../utils/fetch"
;
export
default
class
ArticleTemplate
extends
Component
{
static
navigationOptions
=
({
navigation
})
=>
{
const
{
state
,
setParams
,
navigate
}
=
navigation
;
return
{
headerRight
:
(
<
TouchableOpacity
style
=
{{
marginRight
:
13
}}
onPress
=
{()
=>
state
.
params
.
share
()}
>
<
Text
>
分享
<
/Text
>
<
/TouchableOpacity
>
)
};
};
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
IS_LOGIN
:
''
,
USER_ID
:
''
,
id
:
this
.
props
.
navigation
.
state
.
params
.
item
.
id
,
model
:
this
.
props
.
navigation
.
state
.
params
.
model
,
articleData
:
{
...
...
@@ -23,9 +42,44 @@ export default class ArticleTemplate extends Component {
}
};
}
componentWillMount
()
{
console
.
log
(
"will model"
,
this
.
state
.
model
);
this
.
getArticles
();
this
.
getAsyncStorage
();
this
.
props
.
navigation
.
setParams
({
share
:
this
.
share
.
bind
(
this
)
});
}
share
()
{
const
that
=
this
;
console
.
log
(
"share"
)
Share
.
share
({
title
:
"保护神"
,
message
:
this
.
state
.
articleData
.
title
,
url
:
`https://devpay.brae.co/insurance.html?uid=
${
this
.
state
.
USER_ID
}
&sid=
${
this
.
state
.
id
}
`
},{
// dialogTitle: 'Share React Native website',
excludedActivityTypes
:
[
'com.apple.UIKit.activity.PostToTwitter'
],
tintColor
:
'green'
})
.
then
(
that
.
_showResult
)
.
catch
(
error
=>
this
.
setState
({
result
:
"error: "
+
error
.
message
}));
}
getAsyncStorage
()
{
const
that
=
this
;
AsyncStorage
.
multiGet
([
"IS_LOGIN"
,
"USER_ID"
],
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
err
);
}
that
.
setState
({
IS_LOGIN
:
result
[
0
][
1
],
USER_ID
:
result
[
1
][
1
]
!=
null
?
result
[
1
][
1
]
:
""
});
});
}
getArticles
()
{
let
that
=
this
,
...
...
src/pages/Home/healthQuestionnaire.js
View file @
9a7aa2f
...
...
@@ -8,6 +8,7 @@ import {
TouchableWithoutFeedback
,
View
,
}
from
'react-native'
;
import
post
from
"../../utils/fetch"
;
const
questions
=
[
{
question
:
'早上起床时,有持续的发丝掉落。'
,
score
:
5
},
...
...
Please
register
or
login
to post a comment