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-07 12:03:28 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
83f2e55038b908451ae65c1197db7709c2a7621b
83f2e550
1 parent
ec9ba189
完成登录+我的页面
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
762 additions
and
184 deletions
index.ios.js
src/pages/InsuranceCircle/details.js
src/pages/Login.js
src/pages/Mine/MsgNotification.js
src/pages/Mine/PersonalInfo.js
src/pages/Mine/index.js
src/pages/Mine/myQuestion.js
src/pages/main.js
index.ios.js
View file @
83f2e55
...
...
@@ -14,10 +14,19 @@ import {
import
Main
from
'./src/pages/main'
;
export
default
class
ProtectGod
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
isLogin
:
true
}
}
render
()
{
console
.
log
(
"看看这个登录state"
,
this
.
state
.
isLogin
);
return
(
<
Main
loginSuccess
=
{
false
}
loginSuccess
=
{
this
.
state
.
isLogin
}
onLogin
=
{
(
isLogin
)
=>
{
this
.
setState
({
isLogin
})}}
/
>
);
}
...
...
src/pages/InsuranceCircle/details.js
View file @
83f2e55
...
...
@@ -15,7 +15,7 @@ export default class Details extends Component {
super
(
props
);
this
.
state
=
{
data
:
this
.
props
.
data
,
text
:
"
回复 汉克斯
"
text
:
""
};
}
componentWillMount
()
{
...
...
@@ -84,9 +84,9 @@ export default class Details extends Component {
<
View
style
=
{
styles
.
sendMsgContaier
}
>
<
TextInput
style
=
{
styles
.
msgInput
}
placeholder
=
"回复 汉克斯"
onChangeText
=
{
text
=>
this
.
setState
({
text
})}
value
=
{
this
.
state
.
text
}
placeholderTextColor
=
"gray"
selectionColor
=
"#1B9341"
clearTextOnFocus
=
{
true
}
numberOfLines
=
{
1
}
...
...
src/pages/Login.js
View file @
83f2e55
...
...
@@ -7,12 +7,16 @@ import {
Image
,
TouchableOpacity
,
ScrollView
,
TextInput
}
from
"react-native"
;
export
default
class
Login
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{};
this
.
state
=
{
phone
:
""
,
password
:
""
};
}
componentDidMount
()
{
console
.
log
(
"thisprops"
,
this
.
props
);
...
...
@@ -20,20 +24,141 @@ export default class Login extends Component {
render
()
{
return
(
<
View
style
=
{
styles
.
container
}
>
<
Text
>
我是登录页面
<
/Text
>
<
Text
style
=
{
styles
.
appName
}
>
保护神
<
/Text
>
<
View
style
=
{
styles
.
inputField
}
>
<
Image
style
=
{
styles
.
icon
}
source
=
{
require
(
"../assets/login/ic_phone.png"
)}
/
>
<
TextInput
style
=
{
styles
.
textInput
}
placeholder
=
"请输入手机号"
value
=
{
this
.
state
.
phone
}
onChangeText
=
{
phone
=>
this
.
setState
({
phone
})}
autoFocus
=
{
true
}
selectionColor
=
"#1B9341"
clearTextOnFocus
=
{
true
}
numberOfLines
=
{
1
}
clearButtonMode
=
"always"
keyboardType
=
"default"
/
>
<
/View
>
<
View
style
=
{
styles
.
inputField
}
>
<
Image
style
=
{
styles
.
icon
}
source
=
{
require
(
"../assets/login/ic_password2.png"
)}
/
>
<
TextInput
style
=
{
styles
.
textInput
}
placeholder
=
"请输入密码"
secureTextEntry
=
{
true
}
value
=
{
this
.
state
.
password
}
onChangeText
=
{
password
=>
this
.
setState
({
password
})}
selectionColor
=
"#1B9341"
clearTextOnFocus
=
{
true
}
numberOfLines
=
{
1
}
clearButtonMode
=
"always"
keyboardType
=
"default"
/
>
<
/View
>
{
/* <TouchableOpacity style={styles.helpContaier}>
<Text style={styles.forgetPassword}>忘记密码?</Text>
</TouchableOpacity> */
}
<
TouchableOpacity
style
=
{
styles
.
confirmBtn
}
onPress
=
{()
=>
{
this
.
loginRequest
()}}
>
<
Text
style
=
{
styles
.
login
}
>
登录
<
/Text
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{
styles
.
registerContaier
}
>
<
Text
style
=
{
styles
.
register
}
>
注册账号
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
);
}
loginRequest
()
{
if
(
this
.
props
.
loginSuccess
)
return
;
let
phone
=
this
.
state
.
phone
,
password
=
this
.
state
.
password
;
if
(
!
(
/^1
(
3|4|5|7|8
)\d{9}
$/
.
test
(
phone
)))
{
alert
(
"请正确输入手机号码"
);
return
;
}
// } else if (phone != 13000000000 && phone != 18888888888) {
// console.log("手机号和密码",phone,password)
// alert("登录账号错误");
// return;
// }
if
(
password
===
""
)
{
alert
(
"请输入密码"
);
return
;
}
else
if
(
password
!==
"000000"
)
{
alert
(
"账号密码有误"
);
return
;
}
this
.
props
.
onLogin
(
true
);
}
}
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
paddingTop
:
64
,
paddingTop
:
125
,
justifyContent
:
"flex-start"
,
alignItems
:
"stretch"
,
backgroundColor
:
"
white
"
,
backgroundColor
:
"
#F5FCFF
"
,
paddingLeft
:
38
,
paddingRight
:
38
,
paddingRight
:
38
},
appName
:
{
fontSize
:
26
,
color
:
"#030303"
,
alignSelf
:
"center"
,
marginBottom
:
77
},
inputField
:
{
flexDirection
:
"row"
,
alignItems
:
"center"
,
borderStyle
:
"solid"
,
borderBottomWidth
:
1
,
borderColor
:
"#E6E6E6"
,
height
:
51
},
icon
:
{
width
:
11
,
height
:
15
,
marginRight
:
10
},
textInput
:
{
flex
:
1
},
helpContaier
:
{
flexDirection
:
"row"
,
justifyContent
:
"flex-end"
,
marginTop
:
10
,
},
forgetPassword
:
{
color
:
"#999999"
,
fontSize
:
14
,
},
confirmBtn
:
{
marginTop
:
30
,
width
:
299
,
height
:
45
,
backgroundColor
:
"#1B9341"
,
borderRadius
:
5
,
alignItems
:
"center"
,
justifyContent
:
"center"
,
},
login
:
{
color
:
"#fff"
,
fontSize
:
16
,
},
registerContaier
:
{
alignItems
:
"center"
,
justifyContent
:
"center"
,
},
register
:
{
marginTop
:
24
,
color
:
"#1B9341"
,
}
});
...
...
src/pages/Mine/MsgNotification.js
View file @
83f2e55
import
React
,
{
Component
}
from
"react"
;
import
{
AppRegistry
,
StyleSheet
,
Text
,
View
,
ScrollView
,
TouchableOpacity
,
Image
}
from
"react-native"
;
export
default
class
MsgNotification
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
ListData
:
[{
icon
:
require
(
"../../assets/Mine/iconpic1.png"
),
title
:
"评论回复"
,
time
:
"10小时前"
,
tips
:
"XXX回复了你的评论,点击查看"
,
},{
icon
:
require
(
"../../assets/Mine/iconpic1.png"
),
title
:
"评论回复"
,
time
:
"10小时前"
,
tips
:
"XXX回复了你的评论,点击查看"
,
},{
icon
:
require
(
"../../assets/Mine/iconpic1.png"
),
title
:
"评论回复"
,
time
:
"10小时前"
,
tips
:
"XXX回复了你的评论,点击查看"
,
},{
icon
:
require
(
"../../assets/Mine/iconpic1.png"
),
title
:
"评论回复"
,
time
:
"10小时前"
,
tips
:
"XXX回复了你的评论,点击查看"
,
}],
};
}
render
()
{
return
(
<
View
style
=
{
styles
.
container
}
>
{
this
.
state
.
ListData
.
map
((
item
,
index
)
=>
{
return
(
<
TouchableOpacity
style
=
{
styles
.
itemContainer
}
key
=
{
index
}
>
<
Image
style
=
{
styles
.
itemIcon
}
source
=
{
item
.
icon
}
/
>
<
View
style
=
{
styles
.
itemLeft
}
>
<
View
style
=
{
styles
.
itemLeftTop
}
>
<
Text
style
=
{
styles
.
itemTitle
}
>
{
item
.
title
}
<
/Text
>
<
Text
style
=
{
styles
.
itemTime
}
>
{
item
.
time
}
<
/Text
>
<
/View
>
<
Text
style
=
{
styles
.
itemTips
}
>
{
item
.
tips
}
<
/Text
>
<
/View
>
<
/TouchableOpacity
>
)
})}
<
/View
>
);
}
}
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
justifyContent
:
"flex-start"
,
alignItems
:
"stretch"
,
backgroundColor
:
"#EFEFEF"
,
paddingTop
:
74
},
itemContainer
:
{
flexDirection
:
"row"
,
alignItems
:
"center"
,
height
:
72
,
padding
:
13
,
backgroundColor
:
"white"
,
marginBottom
:
1
,
},
itemIcon
:
{
width
:
46
,
height
:
46
,
marginRight
:
13
,
},
itemLeft
:
{
flex
:
1
},
itemLeftTop
:
{
flexDirection
:
"row"
,
alignItems
:
"center"
,
justifyContent
:
"space-between"
,
},
itemTitle
:
{
fontSize
:
16
,
color
:
"#030303"
},
itemTime
:
{
fontSize
:
13
,
color
:
"#999999"
},
itemTips
:
{
marginTop
:
3
,
fontSize
:
13
,
color
:
"#7A7A7A"
},
});
...
...
src/pages/Mine/PersonalInfo.js
View file @
83f2e55
import
React
,
{
Component
}
from
"react"
;
import
{
AppRegistry
,
StyleSheet
,
Text
,
View
,
ScrollView
,
TouchableOpacity
,
TouchableHighlight
,
Image
,
Modal
}
from
"react-native"
;
export
default
class
PersonalInfo
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
modalVisible
:
false
};
}
setModalVisible
(
visible
)
{
this
.
setState
({
modalVisible
:
visible
});
}
render
()
{
const
{
name
,
identity
}
=
this
.
props
;
return
(
<
View
style
=
{
styles
.
container
}
>
<
TouchableOpacity
style
=
{
styles
.
itemContainer
}
onPress
=
{()
=>
{
this
.
setModalVisible
(
true
);
}}
>
<
Text
style
=
{
styles
.
itemLeft
}
>
昵称
<
/Text
>
<
View
style
=
{
styles
.
itemRight
}
>
<
Text
style
=
{
styles
.
itemContent
}
>
{
name
}
<
/Text
>
<
Image
style
=
{
styles
.
itemArrow
}
source
=
{
require
(
"../../assets/Mine/rightArrow_gray.png"
)}
/
>
<
/View
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{
styles
.
itemContainer
}
onPress
=
{()
=>
{
this
.
setModalVisible
(
true
);
}}
>
<
Text
style
=
{
styles
.
itemLeft
}
>
职业
<
/Text
>
<
View
style
=
{
styles
.
itemRight
}
>
<
Text
style
=
{
styles
.
itemContent
}
>
{
identity
}
<
/Text
>
<
Image
style
=
{
styles
.
itemArrow
}
source
=
{
require
(
"../../assets/Mine/rightArrow_gray.png"
)}
/
>
<
/View
>
<
/TouchableOpacity
>
<
Modal
animationType
=
{
"slide"
}
transparent
=
{
false
}
visible
=
{
this
.
state
.
modalVisible
}
onRequestClose
=
{()
=>
{
alert
(
"Modal has been closed."
);
}}
>
<
View
style
=
{{
marginTop
:
22
}}
>
<
View
>
<
Text
>
Hello
World
!<
/Text
>
<
TouchableOpacity
onPress
=
{()
=>
{
this
.
setModalVisible
(
!
this
.
state
.
modalVisible
);
}}
>
<
Text
>
Hide
Modal
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
<
/Modal
>
<
/View
>
);
}
}
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
justifyContent
:
"flex-start"
,
alignItems
:
"stretch"
,
backgroundColor
:
"#EFEFEF"
,
paddingTop
:
74
},
itemContainer
:
{
flexDirection
:
"row"
,
alignItems
:
"center"
,
justifyContent
:
"space-between"
,
paddingLeft
:
16
,
paddingRight
:
16
,
paddingTop
:
13
,
paddingBottom
:
13
,
marginBottom
:
1
,
backgroundColor
:
"white"
},
itemLeft
:
{
fontSize
:
15
,
color
:
"#242424"
},
itemRight
:
{
flexDirection
:
"row"
,
alignItems
:
"center"
},
itemContent
:
{
fontSize
:
15
,
color
:
"#7A7A7A"
,
marginRight
:
6
},
itemArrow
:
{
width
:
14
,
height
:
14
}
});
...
...
src/pages/Mine/index.js
View file @
83f2e55
import
React
,
{
Component
}
from
'react'
;
import
React
,
{
Component
}
from
"react"
;
import
{
AppRegistry
,
StyleSheet
,
Text
,
View
,
TouchableOpacity
,
Image
,
}
from
'react-native'
;
Image
}
from
"react-native"
;
import
myQuestion
from
"./myQuestion"
;
import
MsgNotification
from
"./MsgNotification"
;
import
PersonalInfo
from
"./PersonalInfo"
;
export
default
class
Mine
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
name
:
"哈哈哈"
,
identity
:
"职业代理人"
};
}
render
()
{
return
(
<
View
style
=
{
styles
.
container
}
>
<
TouchableOpacity
style
=
{
styles
.
header
}
>
<
TouchableOpacity
style
=
{
styles
.
header
}
onPress
=
{()
=>
{
this
.
props
.
navigator
.
push
({
component
:
PersonalInfo
,
passProps
:
{
name
:
this
.
state
.
name
,
identity
:
this
.
state
.
identity
}
});
}}
>
<
View
style
=
{
styles
.
headerLeft
}
>
<
Image
source
=
{
require
(
"../../assets/Mine/iconpic1.png"
)}
style
=
{
styles
.
mineIcon
}
/
>
<
Text
style
=
{
styles
.
mineName
}
>
汉克斯
<
/Text
>
<
Image
source
=
{
require
(
"../../assets/Mine/iconpic1.png"
)}
style
=
{
styles
.
mineIcon
}
/
>
<
Text
style
=
{
styles
.
mineName
}
>
{
this
.
state
.
name
}
<
/Text
>
<
/View
>
<
Image
source
=
{
require
(
"../../assets/Mine/rightArrow_white.png"
)}
style
=
{
styles
.
headerRight
}
/
>
<
Image
source
=
{
require
(
"../../assets/Mine/rightArrow_white.png"
)}
style
=
{
styles
.
headerRight
}
/
>
<
/TouchableOpacity
>
<
BarList
style
=
{
styles
.
midContainer
}
/
>
<
TouchableOpacity
style
=
{
styles
.
loginOut
}
>
<
View
style
=
{
styles
.
midContainer
}
>
<
TouchableOpacity
style
=
{
styles
.
itemContainer
}
onPress
=
{()
=>
{
this
.
props
.
navigator
.
push
({
component
:
MsgNotification
,
passProps
:
{}
});
}}
>
<
View
style
=
{
styles
.
itemLeft
}
>
<
Image
style
=
{
styles
.
leftIcon
}
source
=
{
require
(
"../../assets/tabbar/ic_circle_s.png"
)}
/
>
<
Text
style
=
{
styles
.
leftTitle
}
>
消息通知
<
/Text
>
<
Text
style
=
{
styles
.
leftNum
}
>
(
11
)
<
/Text
>
<
/View
>
<
Image
style
=
{
styles
.
itemRight
}
source
=
{
require
(
"../../assets/Mine/rightArrow_gray.png"
)}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{
styles
.
itemContainer
}
onPress
=
{()
=>
{
this
.
props
.
navigator
.
push
({
component
:
myQuestion
,
passProps
:
{}
});
}}
>
<
View
style
=
{
styles
.
itemLeft
}
>
<
Image
style
=
{
styles
.
leftIcon
}
source
=
{
require
(
"../../assets/tabbar/ic_circle_s.png"
)}
/
>
<
Text
style
=
{
styles
.
leftTitle
}
>
我的提问
<
/Text
>
<
/View
>
<
Image
style
=
{
styles
.
itemRight
}
source
=
{
require
(
"../../assets/Mine/rightArrow_gray.png"
)}
/
>
<
/TouchableOpacity
>
<
/View
>
<
TouchableOpacity
style
=
{
styles
.
loginOut
}
onLogin
=
{
this
.
props
.
onLogin
}
onPress
=
{()
=>
{
this
.
loginOut
();
}}
>
<
Text
style
=
{
styles
.
loginOutText
}
>
退出登录
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
);
}
loginOut
()
{
console
.
log
(
"看看this是什么"
,
this
);
this
.
props
.
onLogin
(
false
);
}
}
class
BarList
extends
Component
{
...
...
@@ -38,7 +117,7 @@ class BarList extends Component {
<
ListItem
title
=
{
"消息通知"
}
num
=
{
"11"
}
/
>
<
ListItem
title
=
{
"我的提问"
}
/
>
<
/View
>
)
)
;
}
}
...
...
@@ -47,14 +126,22 @@ class ListItem extends Component {
return
(
<
TouchableOpacity
style
=
{
styles
.
itemContainer
}
>
<
View
style
=
{
styles
.
itemLeft
}
>
<
Image
style
=
{
styles
.
leftIcon
}
source
=
{
require
(
"../../assets/tabbar/ic_circle_s.png"
)}
/
>
<
Image
style
=
{
styles
.
leftIcon
}
source
=
{
require
(
"../../assets/tabbar/ic_circle_s.png"
)}
/
>
{
/* <Image style={styles.leftIcon} source={require("../../assets/Mine/iconpic1.png")} /> */
}
<
Text
style
=
{
styles
.
leftTitle
}
>
{
this
.
props
.
title
}
<
/Text
>
{
this
.
props
.
num
?
<
Text
style
=
{
styles
.
leftNum
}
>
({
this
.
props
.
num
})
<
/Text>:null
}
{
this
.
props
.
num
?
(
<
Text
style
=
{
styles
.
leftNum
}
>
({
this
.
props
.
num
})
<
/Text
>
)
:
null
}
<
/View
>
<
Image
style
=
{
styles
.
itemRight
}
source
=
{
require
(
"../../assets/Mine/rightArrow_gray.png"
)}
/
>
<
Image
style
=
{
styles
.
itemRight
}
source
=
{
require
(
"../../assets/Mine/rightArrow_gray.png"
)}
/
>
<
/TouchableOpacity
>
)
)
;
}
}
...
...
@@ -64,7 +151,7 @@ const styles = StyleSheet.create({
justifyContent
:
"flex-start"
,
alignItems
:
"stretch"
,
backgroundColor
:
"#EFEFEF"
,
paddingTop
:
64
,
paddingTop
:
64
},
header
:
{
backgroundColor
:
"#1B9341"
,
...
...
@@ -74,12 +161,12 @@ const styles = StyleSheet.create({
paddingLeft
:
13
,
paddingRight
:
13
,
alignItems
:
"center"
,
marginBottom
:
10
,
marginBottom
:
10
},
headerLeft
:
{
flexDirection
:
"row"
,
justifyContent
:
"flex-start"
,
alignItems
:
"center"
,
alignItems
:
"center"
},
mineIcon
:
{
width
:
46
,
...
...
@@ -93,7 +180,7 @@ const styles = StyleSheet.create({
},
headerRight
:
{
width
:
14
,
height
:
14
,
height
:
14
},
midContainer
:
{
// marginTop: 10,
...
...
@@ -110,17 +197,17 @@ const styles = StyleSheet.create({
backgroundColor
:
"#fff"
,
borderStyle
:
"solid"
,
borderColor
:
"#F0F0F0"
,
borderBottomWidth
:
1
,
borderBottomWidth
:
1
},
itemLeft
:
{
flexDirection
:
"row"
,
justifyContent
:
"flex-start"
,
alignItems
:
"center"
,
alignItems
:
"center"
},
leftIcon
:
{
marginRight
:
11
,
width
:
16
,
height
:
16
,
height
:
16
},
leftTitle
:
{
fontSize
:
15
,
...
...
@@ -132,17 +219,16 @@ const styles = StyleSheet.create({
},
itemRight
:
{
width
:
14
,
height
:
14
,
height
:
14
},
loginOut
:
{
marginTop
:
10
,
height
:
46
,
backgroundColor
:
"#fff"
,
justifyContent
:
"center"
,
justifyContent
:
"center"
},
loginOutText
:
{
textAlign
:
"center"
,
fontSize
:
15
,
}
,
fontSize
:
15
}
});
...
...
src/pages/Mine/myQuestion.js
0 → 100644
View file @
83f2e55
import
React
,
{
Component
}
from
"react"
;
import
{
AppRegistry
,
StyleSheet
,
Text
,
View
,
ScrollView
,
TouchableOpacity
,
Image
}
from
"react-native"
;
export
default
class
MyQuestion
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
ListData
:
[
{
title
:
"家庭经济越差越应该买保险,因为你病不起,输不起,也折腾不起…"
,
content
:
"现实生活就是如此矛盾现实生活,就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实矛是如此此…"
,
name
:
"嘿嘿嘿"
,
identity
:
"保险代理人"
,
image
:
require
(
"../../assets/Mine/iconpic1.png"
),
num
:
"30"
,
time
:
"2017-8-15"
,
comments
:
[{
replyer
:
"噢噢噢"
,
replayicon
:
require
(
"../../assets/Mine/iconpic1.png"
),
beenreplyer
:
"嘿嘿嘿"
,
content
:
"生活就是如此矛是如此此生活就是如此矛盾现实生活就是如此矛盾现"
,
time
:
"两小时前"
,
},{
replyer
:
"哦哦哦"
,
replayicon
:
require
(
"../../assets/Mine/iconpic1.png"
),
beenreplyer
:
"哈哈哈"
,
content
:
"生活就是如此矛是如此此生活就是如此矛盾现实生活就是如此矛盾现"
,
time
:
"两小时前"
,
},{
replyer
:
"洛洛洛"
,
replayicon
:
require
(
"../../assets/Mine/iconpic1.png"
),
beenreplyer
:
"额额额"
,
content
:
"生活就是如此矛是如此此生活就是如此矛盾现实生活就是如此矛盾现"
,
time
:
"两小时前"
,
}],
},
{
title
:
"家庭经济越差越应该买保险,因为你病不起,输不起,也折腾不起…"
,
content
:
"现实生活就是如此矛盾现实生活,就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实矛是如此此…"
,
name
:
"嘿嘿嘿"
,
identity
:
"保险代理人"
,
image
:
require
(
"../../assets/circle/newspic.png"
),
num
:
"29"
,
time
:
"2017-8-15"
,
comments
:
[]
},
{
title
:
"因为你病不起,输不起,也折腾不起…"
,
content
:
"现实生活就是如此矛盾现实生活,就是如此矛盾现实生活就是如此矛盾现实生活,就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实矛是如此此…现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实矛是如此此…"
,
name
:
"luosf"
,
identity
:
"保险代理人"
,
image
:
require
(
"../../assets/circle/newspic.png"
),
num
:
"10"
,
time
:
"2017-8-15"
,
comments
:
[]
}
],
testData
:
[],
};
}
// componentWillMount() {
// var that = this;
// return fetch(`https://mpay.brae.co/test/insurance/article`,{
// method: "POST",
// headers: {
// 'Accept': 'application/json',
// 'Content-Type': 'application/json',
// },
// })
// .then((resp) => {
// console.log("测试接口",resp);
// // return false;
// if (resp.status === 200) {
// return resp.json();
// } else {
// console.error("something went wrong!");
// }
// })
// .then((respJson) => {
// if (respJson.enmsg != 'ok') {
// console.error(err);
// alert(respJson.cnmsg);
// } else {
// that.setState({
// testData: respJson.data
// });
// console.log('state.testData',that.state.testData);
// }
// })
// .catch((err) => console.error(err))
// }
render
()
{
return
(
<
View
style
=
{
styles
.
container
}
>
<
ScrollView
style
=
{
styles
.
scrollViewContainer
}
automaticallyAdjustContentInsets
=
{
false
}
>
{
this
.
state
.
ListData
.
map
((
item
,
index
)
=>
{
return
(
<
TouchableOpacity
style
=
{
styles
.
itemContainer
}
key
=
{
index
}
>
<
Text
style
=
{
styles
.
itemTitle
}
numberOfLines
=
{
2
}
>
{
item
.
title
}
<
/Text
>
<
Text
style
=
{
styles
.
itemContent
}
numberOfLines
=
{
3
}
>
{
item
.
content
}
<
/Text
>
<
View
style
=
{
styles
.
itemInfoWrapper
}
>
<
View
style
=
{
styles
.
itemInfoLeft
}
>
{
/* <Image
source={item.image}
style={[styles.itemInfoIcon, { width: 26, height: 26 }]}
/>
<Text style={styles.itemInfoName}>{item.name}</Text> */
}
<
/View
>
<
Text
style
=
{
styles
.
itemInfoRight
}
>
{
item
.
num
}
评论
<
/Text
>
<
/View
>
<
/TouchableOpacity
>
);
})}
<
/ScrollView
>
<
/View
>
);
}
}
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
justifyContent
:
"flex-start"
,
alignItems
:
"stretch"
,
backgroundColor
:
"#EFEFEF"
,
paddingTop
:
74
},
scrollViewContainer
:
{
// height: 300
},
scrollViewText
:
{
color
:
"#7A7A7A"
,
fontSize
:
13
,
marginTop
:
10
,
textAlign
:
"center"
},
itemContainer
:
{
backgroundColor
:
"#fff"
,
marginBottom
:
10
,
height
:
180
,
paddingLeft
:
13
,
paddingRight
:
13
,
paddingTop
:
19
},
itemTitle
:
{
fontSize
:
17
,
color
:
"#242424"
,
lineHeight
:
24
},
itemContent
:
{
marginTop
:
5
,
fontSize
:
14
,
color
:
"#7A7A7A"
,
lineHeight
:
20
},
itemInfoWrapper
:
{
flexDirection
:
"row"
,
justifyContent
:
"flex-end"
,
alignItems
:
"center"
,
marginTop
:
11
},
itemInfoLeft
:
{
flexDirection
:
"row"
,
justifyContent
:
"flex-start"
,
alignItems
:
"center"
},
itemInfoIcon
:
{
marginRight
:
10
},
itemInfoName
:
{
fontSize
:
13
,
color
:
"#242424"
,
lineHeight
:
18
},
itemInfoRight
:
{
fontSize
:
13
,
color
:
"#999999"
,
lineHeight
:
18
}
});
...
...
src/pages/main.js
View file @
83f2e55
...
...
@@ -30,165 +30,93 @@ export default class Main extends Component {
}
render
()
{
// {this.state.loginSuccess ? {} : {}}
const
{
loginSuccess
}
=
this
.
props
;
return
(
loginSuccess
?
(
<
TabBarIOS
tintColor
=
"#08CC6A"
barTintColor
=
"white"
>
<
TabBarIOS
.
Item
title
=
"首页"
icon
=
{
require
(
"../assets/tabbar/ic_home_n.png"
)}
selected
=
{
this
.
state
.
selectedItem
==
"home"
}
onPress
=
{()
=>
{
this
.
setState
({
selectedItem
:
"home"
});
}}
>
<
NavigatorIOS
style
=
{{
flex
:
1
}}
initialRoute
=
{{
component
:
Home
,
title
:
"保护神"
<
TabBarIOS
.
Item
title
=
"首页"
icon
=
{
require
(
"../assets/tabbar/ic_home_n.png"
)}
selected
=
{
this
.
state
.
selectedItem
==
"home"
}
onPress
=
{()
=>
{
this
.
setState
({
selectedItem
:
"home"
});
}}
/
>
<
/TabBarIOS.Item
>
<
TabBarIOS
.
Item
title
=
"保圈"
icon
=
{
require
(
"../assets/tabbar/ic_circle_n.png"
)}
selected
=
{
this
.
state
.
selectedItem
==
"insuranceCircle"
}
onPress
=
{()
=>
{
this
.
setState
({
selectedItem
:
"insuranceCircle"
});
}}
>
<
NavigatorIOS
style
=
{{
flex
:
1
}}
initialRoute
=
{
{
component
:
InsuranceCircle
,
title
:
"保护神"
,
>
<
NavigatorIOS
style
=
{{
flex
:
1
}}
initialRoute
=
{{
component
:
Home
,
title
:
"保护神"
}
}
/
>
<
/TabBarIOS.Item
>
<
TabBarIOS
.
Item
title
=
"保圈"
icon
=
{
require
(
"../assets/tabbar/ic_circle_n.png"
)}
selected
=
{
this
.
state
.
selectedItem
==
"insuranceCircle"
}
onPress
=
{()
=>
{
this
.
setState
(
{
selectedItem
:
"insuranceCircle"
});
}}
/
>
<
/TabBarIOS.Item
>
<
TabBarIOS
.
Item
title
=
"保堂"
icon
=
{
require
(
"../assets/tabbar/ic_umbrella_n.png"
)}
selected
=
{
this
.
state
.
selectedItem
==
"insuranceChurch"
}
onPress
=
{()
=>
{
this
.
setState
({
selectedItem
:
"insuranceChurch"
});
}}
>
<
NavigatorIOS
style
=
{{
flex
:
1
}}
initialRoute
=
{
{
component
:
InsuranceChurch
,
title
:
"保护神"
>
<
NavigatorIOS
style
=
{{
flex
:
1
}}
initialRoute
=
{{
component
:
InsuranceCircle
,
title
:
"保护神"
,
}}
/
>
<
/TabBarIOS.Item
>
<
TabBarIOS
.
Item
title
=
"保堂"
icon
=
{
require
(
"../assets/tabbar/ic_umbrella_n.png"
)}
selected
=
{
this
.
state
.
selectedItem
==
"insuranceChurch"
}
onPress
=
{()
=>
{
this
.
setState
(
{
selectedItem
:
"insuranceChurch"
});
}}
/
>
<
/TabBarIOS.Item
>
<
TabBarIOS
.
Item
title
=
"我的"
icon
=
{
require
(
"../assets/tabbar/ic_mine_n.png"
)}
selected
=
{
this
.
state
.
selectedItem
==
"mine"
}
onPress
=
{()
=>
{
this
.
setState
({
selectedItem
:
"mine"
});
}}
>
<
NavigatorIOS
style
=
{{
flex
:
1
}}
initialRoute
=
{
{
component
:
Mine
,
title
:
"保护神"
>
<
NavigatorIOS
style
=
{{
flex
:
1
}}
initialRoute
=
{{
component
:
InsuranceChurch
,
title
:
"保护神"
}}
/
>
<
/TabBarIOS.Item
>
<
TabBarIOS
.
Item
title
=
"我的"
icon
=
{
require
(
"../assets/tabbar/ic_mine_n.png"
)}
selected
=
{
this
.
state
.
selectedItem
==
"mine"
}
onPress
=
{()
=>
{
this
.
setState
(
{
selectedItem
:
"mine"
});
}}
/
>
<
/TabBarIOS.Item
>
<
/TabBarIOS
>
>
<
NavigatorIOS
style
=
{{
flex
:
1
}}
initialRoute
=
{{
component
:
Mine
,
title
:
"保护神"
,
passProps
:
{
onLogin
:
this
.
props
.
onLogin
}
}}
/
>
<
/TabBarIOS.Item
>
<
/TabBarIOS
>
)
:
(
<
Login
/>
<
Login
loginSuccess
=
{
this
.
props
.
loginSuccess
}
onLogin
=
{
this
.
props
.
onLogin
}
/
>
)
// <TabBarIOS tintColor="#08CC6A" barTintColor="white">
// <TabBarIOS.Item
// title="首页"
// icon={require("../assets/tabbar/ic_home_n.png")}
// selected={this.state.selectedItem == "home"}
// onPress={() => {
// this.setState({
// selectedItem: "home"
// });
// }}
// >
// <NavigatorIOS
// style={{ flex: 1 }}
// initialRoute={{
// component: Home,
// title: "保护神"
// }}
// />
// </TabBarIOS.Item>
// <TabBarIOS.Item
// title="保圈"
// icon={require("../assets/tabbar/ic_circle_n.png")}
// selected={this.state.selectedItem == "insuranceCircle"}
// onPress={() => {
// this.setState({
// selectedItem: "insuranceCircle"
// });
// }}
// >
// <NavigatorIOS
// style={{ flex: 1 }}
// initialRoute={{
// component: InsuranceCircle,
// title: "保护神",
// }}
// />
// </TabBarIOS.Item>
// <TabBarIOS.Item
// title="保堂"
// icon={require("../assets/tabbar/ic_umbrella_n.png")}
// selected={this.state.selectedItem == "insuranceChurch"}
// onPress={() => {
// this.setState({
// selectedItem: "insuranceChurch"
// });
// }}
// >
// <NavigatorIOS
// style={{ flex: 1 }}
// initialRoute={{
// component: InsuranceChurch,
// title: "保护神"
// }}
// />
// </TabBarIOS.Item>
// <TabBarIOS.Item
// title="我的"
// icon={require("../assets/tabbar/ic_mine_n.png")}
// selected={this.state.selectedItem == "mine"}
// onPress={() => {
// this.setState({
// selectedItem: "mine"
// });
// }}
// >
// <NavigatorIOS
// style={{ flex: 1 }}
// initialRoute={{
// component: Mine,
// title: "保护神"
// }}
// />
// </TabBarIOS.Item>
// </TabBarIOS>
);
}
}
...
...
Please
register
or
login
to post a comment