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-27 18:22:32 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d7d4ebee01661d8bdfb43edbfee89d33ffd2efb9
d7d4ebee
1 parent
7f448563
jjj
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
119 additions
and
7 deletions
src/pages/InsuranceCircle/index.js
src/pages/InsuranceCircle/release.js
src/pages/InsuranceCircle/index.js
View file @
d7d4ebe
...
...
@@ -16,7 +16,6 @@ import Details from "./details";
export
default
class
InsuranceCircle
extends
Component
{
static
navigationOptions
=
({
navigation
})
=>
{
const
{
state
,
setParams
,
navigate
}
=
navigation
;
// console.log("保圈页面-发布", state);
return
{
headerRight
:
(
<
TouchableOpacity
...
...
src/pages/InsuranceCircle/release.js
View file @
d7d4ebe
...
...
@@ -9,18 +9,48 @@ import {
ScrollView
,
ListView
,
Dimensions
,
TextInput
,
AsyncStorage
,
Alert
}
from
"react-native"
;
import
{
StackNavigator
,
TabNavigator
}
from
"react-navigation"
;
export
default
class
Home
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{};
this
.
state
=
{
title
:
""
,
content
:
""
,
IS_LOGIN
:
""
,
USER_ID
:
""
,
NICKNAME
:
""
,
PROFESSION
:
""
};
}
componentWillMount
()
{
this
.
getAsyncStorage
();
}
componentWillMount
()
{}
componentDidMount
()
{}
getAsyncStorage
()
{
const
that
=
this
;
AsyncStorage
.
multiGet
(
[
"IS_LOGIN"
,
"USER_ID"
,
"NICKNAME"
,
"PROFESSION"
],
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
err
);
}
console
.
log
(
"点击登录后的值"
,
result
);
that
.
setState
({
IS_LOGIN
:
result
[
0
][
1
],
USER_ID
:
result
[
1
][
1
]
!=
null
?
result
[
1
][
1
]
:
""
,
NICKNAME
:
result
[
2
][
1
]
!=
null
?
result
[
2
][
1
]
:
""
,
PROFESSION
:
result
[
3
][
1
]
!=
null
?
result
[
3
][
1
]
:
""
});
}
);
}
getListData
()
{
let
that
=
this
;
return
fetch
(
`https://devpay.brae.co/test/insurance/topic`
,
{
...
...
@@ -48,14 +78,65 @@ export default class Home extends Component {
}
});
}
submit
()
{
if
(
!
this
.
state
.
title
)
{
Alert
.
alert
(
"请填写标题"
);
return
false
;
}
if
(
!
this
.
state
.
content
)
{
Alert
.
alert
(
"请填写内容"
);
return
false
;
}
console
.
log
(
"title和content"
,
this
.
state
.
title
,
this
.
state
.
content
);
}
render
()
{
// console.log("首页的this.props", this);
// console.log("render首页文章列表", this.state.ListData);
const
{
navigate
}
=
this
.
props
.
navigation
;
return
(
<
View
style
=
{
styles
.
container
}
>
<
Text
>
发布
<
/Text
>
<
View
style
=
{
styles
.
inputContaier
}
>
<
TextInput
style
=
{
styles
.
titleInput
}
placeholder
=
"文章标题"
onChangeText
=
{
title
=>
this
.
setState
({
title
})}
value
=
{
this
.
state
.
title
}
autoCapitalize
=
"none"
selectionColor
=
"#1B9341"
numberOfLines
=
{
1
}
clearButtonMode
=
"always"
keyboardType
=
"default"
enablesReturnKeyAutomatically
=
{
true
}
returnKeyType
=
"send"
onSubmitEditing
=
{()
=>
{
Keyboard
.
dismiss
();
}}
/
>
<
/View
>
<
View
style
=
{
styles
.
inputContaier
}
>
<
TextInput
style
=
{
styles
.
contentInput
}
placeholder
=
"填写发布内容"
onChangeText
=
{
content
=>
this
.
setState
({
content
})}
value
=
{
this
.
state
.
content
}
autoCapitalize
=
"none"
multiline
=
{
true
}
selectionColor
=
"#1B9341"
clearButtonMode
=
"always"
keyboardType
=
"default"
enablesReturnKeyAutomatically
=
{
true
}
returnKeyType
=
"send"
onSubmitEditing
=
{()
=>
{
Keyboard
.
dismiss
();
}}
/
>
<
/View
>
<
TouchableOpacity
onPress
=
{()
=>
{
this
.
submit
();
}}
style
=
{
styles
.
confirmBtn
}
>
<
Text
style
=
{
styles
.
confirmBtnText
}
>
发布
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
);
}
...
...
@@ -68,4 +149,36 @@ const styles = StyleSheet.create({
alignItems
:
"stretch"
,
backgroundColor
:
"#EFEFEF"
},
inputContaier
:
{
backgroundColor
:
"white"
,
paddingHorizontal
:
15
,
paddingVertical
:
10
,
borderStyle
:
"solid"
,
borderColor
:
"#EFEFEF"
,
borderTopWidth
:
1
},
titleInput
:
{
fontSize
:
15
,
paddingTop
:
8
,
paddingBottom
:
7
},
contentInput
:
{
fontSize
:
15
,
paddingTop
:
8
,
paddingBottom
:
7
,
height
:
200
},
confirmBtn
:
{
marginVertical
:
20
,
marginHorizontal
:
40
,
justifyContent
:
"center"
,
alignItems
:
"center"
,
backgroundColor
:
"#1B9341"
,
height
:
45
,
borderRadius
:
5
},
confirmBtnText
:
{
fontSize
:
16
,
color
:
"white"
}
});
...
...
Please
register
or
login
to post a comment