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-13 14:20:46 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1b81311537c5127251b097c1f32097cbd42e8b4d
1b813115
1 parent
756c5bf0
适配轮播图宽度,跳转注册页面样式
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
29 deletions
src/pages/Home/index.js
src/pages/InsuranceCircle/index.js
src/pages/Login.js
src/pages/Home/index.js
View file @
1b81311
...
...
@@ -7,7 +7,8 @@ import {
Image
,
TouchableOpacity
,
ScrollView
,
FlatList
FlatList
,
Dimensions
}
from
"react-native"
;
import
{
StackNavigator
,
TabNavigator
}
from
"react-navigation"
;
import
Swiper
from
"react-native-swiper"
;
...
...
@@ -110,13 +111,15 @@ export default class Home extends Component {
}
_swiper
()
{
const
{
navigate
}
=
this
.
props
.
navigation
;
const
{
height
,
width
}
=
Dimensions
.
get
(
'window'
);
const
imgHeight
=
width
*
140
/
375
;
return
(
<
View
style
=
{{
height
:
120
}}
>
<
View
style
=
{{
height
:
imgHeight
}}
>
<
Swiper
style
=
{
styles
.
swiperWrapper
}
autoplay
=
{
true
}
autoplayTimeout
=
{
6
}
height
=
{
120
}
height
=
{
imgHeight
}
dotStyle
=
{{
width
:
6
,
height
:
6
...
...
@@ -135,7 +138,8 @@ export default class Home extends Component {
<
Image
style
=
{
styles
.
slideImg
}
source
=
{
item
.
img
}
resizeMode
=
"contain"
width
=
{
Dimensions
.
get
(
'window'
).
width
}
resizeMode
=
"stretch"
/>
<
/TouchableOpacity
>
);
...
...
@@ -215,7 +219,8 @@ const styles = StyleSheet.create({
},
swiperWrapper
:
{},
slide
:
{
height
:
140
,
height
:
Dimensions
.
get
(
'window'
).
width
*
140
/
375
,
width
:
Dimensions
.
get
(
'window'
).
width
,
justifyContent
:
"center"
,
alignItems
:
"center"
,
backgroundColor
:
"#92BBD9"
...
...
src/pages/InsuranceCircle/index.js
View file @
1b81311
...
...
@@ -6,9 +6,9 @@ import {
View
,
ScrollView
,
TouchableOpacity
,
Image
Image
,
}
from
"react-native"
;
import
{
StackNavigator
,
TabNavigator
}
from
'react-navigation'
;
import
{
StackNavigator
,
TabNavigator
}
from
"react-navigation"
;
import
CommonWebView
from
"../../Components/CommonWebView"
;
import
Details
from
"./details"
;
...
...
@@ -21,33 +21,37 @@ export default class InsuranceCircle extends Component {
}
componentDidMount
()
{
this
.
getArticles
();
}
getArticles
()
{
var
that
=
this
;
// 请求文章数据
return
fetch
(
`https://devpay.brae.co/test/insurance/article`
,{
return
fetch
(
`https://devpay.brae.co/test/insurance/article`
,
{
method
:
"POST"
,
headers
:
{
'Accept'
:
'application/json'
,
'Content-Type'
:
'application/json'
,
}
,
Accept
:
"application/json"
,
"Content-Type"
:
"application/json"
}
})
.
then
(
(
resp
)
=>
{
.
then
(
resp
=>
{
if
(
resp
.
status
===
200
)
{
return
resp
.
json
();
}
else
{
console
.
error
(
"something went wrong!"
);
}
})
.
then
(
(
respJson
)
=>
{
if
(
respJson
.
enmsg
!=
'ok'
)
{
.
then
(
respJson
=>
{
if
(
respJson
.
enmsg
!=
"ok"
)
{
alert
(
respJson
.
cnmsg
);
}
else
{
that
.
setState
({
ListData
:
respJson
.
data
.
data
ListData
:
respJson
.
data
.
data
,
});
console
.
log
(
'state.ListData'
,
this
.
state
.
ListData
);
console
.
log
(
"state.ListData"
,
this
.
state
.
ListData
);
}
})
.
catch
(
(
err
)
=>
console
.
error
(
err
))
.
catch
(
err
=>
console
.
error
(
err
));
}
render
()
{
...
...
@@ -96,11 +100,11 @@ const styles = StyleSheet.create({
flex
:
1
,
justifyContent
:
"flex-start"
,
alignItems
:
"stretch"
,
backgroundColor
:
"#EFEFEF"
,
backgroundColor
:
"#EFEFEF"
},
scrollViewContainer
:
{
// height: 300
flex
:
1
,
flex
:
1
// marginBottom: 49,
},
scrollViewText
:
{
...
...
@@ -117,7 +121,7 @@ const styles = StyleSheet.create({
paddingLeft
:
13
,
paddingRight
:
13
,
paddingTop
:
19
,
paddingBottom
:
12
,
paddingBottom
:
12
},
itemTitle
:
{
fontSize
:
17
,
...
...
src/pages/Login.js
View file @
1b81311
...
...
@@ -9,7 +9,8 @@ import {
ScrollView
,
TextInput
,
KeyboardAvoidingView
,
AsyncStorage
AsyncStorage
,
Dimensions
}
from
"react-native"
;
export
default
class
Login
extends
Component
{
...
...
@@ -22,6 +23,7 @@ export default class Login extends Component {
nickname
:
""
,
profession
:
""
,
id
:
""
,
registerDone
:
false
,
// 处于登录页面还是注册页面
isRegister
:
false
,
IS_LOGIN
:
""
,
...
...
@@ -47,6 +49,7 @@ export default class Login extends Component {
}
render
()
{
const
{
navigate
}
=
this
.
props
.
navigation
;
const
{
phone
,
password
,
nickname
,
profession
}
=
this
.
state
;
return
(
<
View
style
=
{
styles
.
container
}
>
<
KeyboardAvoidingView
behavior
=
"padding"
style
=
{
styles
.
KAVContainer
}
>
...
...
@@ -140,7 +143,7 @@ export default class Login extends Component {
<
/TouchableOpacity
>
)
:
(
<
TouchableOpacity
style
=
{
styles
.
confirmBtnRegister
}
style
=
{
[
styles
.
confirmBtnRegister
,{
backgroundColor
:
(
phone
&&
password
&&
nickname
&&
profession
)
?
"#1B9341"
:
"#BBBBBB"
}]
}
onPress
=
{()
=>
{
this
.
register
();
}}
...
...
@@ -307,9 +310,9 @@ export default class Login extends Component {
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
paddingTop
:
8
0
,
justifyContent
:
"
flex-start
"
,
alignItems
:
"
stretch
"
,
paddingTop
:
5
0
,
justifyContent
:
"
center
"
,
alignItems
:
"
center
"
,
backgroundColor
:
"#F5FCFF"
,
paddingLeft
:
38
,
paddingRight
:
38
...
...
@@ -322,7 +325,7 @@ const styles = StyleSheet.create({
fontSize
:
26
,
color
:
"#030303"
,
alignSelf
:
"center"
,
marginBottom
:
77
marginBottom
:
50
},
inputField
:
{
flexDirection
:
"row"
,
...
...
@@ -351,7 +354,7 @@ const styles = StyleSheet.create({
},
confirmBtnLogin
:
{
marginTop
:
30
,
width
:
299
,
width
:
Dimensions
.
get
(
'window'
).
width
*
0.8
,
height
:
45
,
backgroundColor
:
"#1B9341"
,
borderRadius
:
5
,
...
...
@@ -360,9 +363,9 @@ const styles = StyleSheet.create({
},
confirmBtnRegister
:
{
marginTop
:
30
,
width
:
299
,
width
:
Dimensions
.
get
(
'window'
).
width
*
0.8
,
height
:
45
,
backgroundColor
:
"#BBBBBB"
,
//
backgroundColor: "#BBBBBB",
borderRadius
:
5
,
alignItems
:
"center"
,
justifyContent
:
"center"
...
...
Please
register
or
login
to post a comment