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-09 14:29:45 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
66293239c55efa531f0081babf84c0172f20ab87
66293239
1 parent
9b5076ce
说真的,我也不知道改了啥
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
231 additions
and
103 deletions
index.ios.js
package.json
src/assets/Mine/iconpic1.png
src/assets/circle/iconpic1.png
src/pages/Home/index.js
src/pages/InsuranceCircle/details.js
src/pages/Login.js
src/pages/Mine/index.js
yarn.lock
接口.txt
index.ios.js
View file @
6629323
...
...
@@ -12,20 +12,52 @@ export default class ProtectGod extends Component {
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
isLo
gin
:
tru
e
,
selectedItem
:
"home"
isLo
ading
:
fals
e
,
isLogin
:
true
};
}
componentWillMount
()
{
// console.log("componentWillMount生命周期");
// var that = this;
// return fetch(`https://devpay.brae.co/test/insurance/login`,{
// 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
()
{
console
.
log
(
"看看这个登录state"
,
this
.
state
.
isLogin
);
return
(
return
this
.
state
.
isLoading
?
null
:
(
<
Main
loginSuccess
=
{
this
.
state
.
isLogin
}
selectedItem
=
{
this
.
state
.
selectedItem
}
onLogin
=
{
isLogin
=>
{
this
.
setState
({
isLogin
:
isLogin
,
selectedItem
:
"home"
isLogin
:
isLogin
});
}}
/
>
...
...
package.json
View file @
6629323
...
...
@@ -8,7 +8,8 @@
},
"dependencies"
:
{
"react"
:
"16.0.0-alpha.12"
,
"react-native"
:
"0.48.1"
"react-native"
:
"0.48.1"
,
"react-native-swiper"
:
"^1.5.11"
},
"devDependencies"
:
{
"babel-jest"
:
"20.0.3"
,
...
...
src/assets/Mine/iconpic1.png
View file @
6629323
29.5 KB
|
W:
|
H:
12.7 KB
|
W:
|
H:
2-up
Swipe
Onion skin
src/assets/circle/iconpic1.png
View file @
6629323
29.5 KB
|
W:
|
H:
12.7 KB
|
W:
|
H:
2-up
Swipe
Onion skin
src/pages/Home/index.js
View file @
6629323
...
...
@@ -8,6 +8,7 @@ import {
TouchableOpacity
,
ScrollView
}
from
"react-native"
;
import
Swiper
from
"react-native-swiper"
;
import
Carousel
from
"../../Components/Carousel"
;
import
AllProduct
from
"./allProduct"
;
import
CommonWebView
from
"../../Components/CommonWebView"
;
...
...
@@ -16,24 +17,28 @@ export default class Home extends Component {
constructor
(
props
)
{
super
(
props
);
this
.
_renderMap
=
this
.
_renderMap
.
bind
(
this
);
this
.
_swiper
=
this
.
_swiper
.
bind
(
this
);
this
.
state
=
{
ListData
:
[
{
title
:
"平安保险第一个"
,
context
:
"600万医疗报废,自费药,进口药,器材费"
,
url
:
"http://m.people.cn/n4/2017/0907/c190-9825877.html?admincptm=1504789835057"
,
url
:
"http://m.people.cn/n4/2017/0907/c190-9825877.html?admincptm=1504789835057"
,
imgurl
:
require
(
"../../assets/circle/newspic.png"
)
},
{
title
:
"平安保险第二个"
,
context
:
"600万医疗报废,自费药,进口药,器材费"
,
url
:
"https://mmbiz.qpic.cn/mmbiz_jpg/cdwcq52BJlibS0nnF7IFq72VPba2ZEEOPVbMX370LHt8gW5nEicvQ4zpyX626y4hYPdk7CUUrHwCOVc2nMicY0xcw/640?wx_fmt=jpeg&tp=webp&wxfrom=5&wx_lazy=1"
,
url
:
"https://mmbiz.qpic.cn/mmbiz_jpg/cdwcq52BJlibS0nnF7IFq72VPba2ZEEOPVbMX370LHt8gW5nEicvQ4zpyX626y4hYPdk7CUUrHwCOVc2nMicY0xcw/640?wx_fmt=jpeg&tp=webp&wxfrom=5&wx_lazy=1"
,
imgurl
:
require
(
"../../assets/circle/newspic.png"
)
},
{
title
:
"平安保险第三个"
,
context
:
"600万医疗报废,自费药,进口药,器材费"
,
url
:
"http://m.people.cn/n4/2017/0907/c190-9825877.html?admincptm=1504789835057"
,
url
:
"http://m.people.cn/n4/2017/0907/c190-9825877.html?admincptm=1504789835057"
,
imgurl
:
require
(
"../../assets/circle/newspic.png"
)
},
{
...
...
@@ -42,6 +47,28 @@ export default class Home extends Component {
url
:
"https://www.baidu.com"
,
imgurl
:
require
(
"../../assets/circle/newspic.png"
)
}
],
swiperImgList
:
[
{
img
:
require
(
"../../assets/WechatIMG10.png"
),
url
:
"https://www.baidu.com/"
},
{
img
:
require
(
"../../assets/WechatIMG10.png"
),
url
:
"https://www.baidu.com/"
},
{
img
:
require
(
"../../assets/WechatIMG10.png"
),
url
:
"https://www.baidu.com/"
},
{
img
:
require
(
"../../assets/WechatIMG10.png"
),
url
:
"https://www.baidu.com/"
},
{
img
:
require
(
"../../assets/WechatIMG10.png"
),
url
:
"https://www.baidu.com/"
}
]
};
}
...
...
@@ -68,6 +95,7 @@ export default class Home extends Component {
});
}
_jumpToWebView
(
item
)
{
// console.log("跳转到webview的item",item);
this
.
props
.
navigator
.
push
({
component
:
CommonWebView
,
passProps
:
{
...
...
@@ -81,10 +109,52 @@ export default class Home extends Component {
title
:
"全部产品"
});
}
_swiper
()
{
return
(
<
View
style
=
{{
height
:
120
}}
>
<
Swiper
style
=
{
styles
.
swiperWrapper
}
autoplay
=
{
true
}
autoplayTimeout
=
{
6
}
height
=
{
120
}
dotStyle
=
{{
width
:
6
,
height
:
6
,
}}
activeDotStyle
=
{{
width
:
6
,
height
:
6
}}
>
{
this
.
state
.
swiperImgList
.
map
((
item
,
index
)
=>
{
{
/* console.log("图片item",item); */
}
return
(
<
TouchableOpacity
style
=
{
styles
.
slide
}
key
=
{
index
}
onPress
=
{()
=>
{
console
.
log
(
"我是轮播图"
)
this
.
_jumpToWebView
(
item
);
}}
>
<
Image
style
=
{
styles
.
slideImg
}
source
=
{
item
.
img
}
resizeMode
=
"contain"
/>
<
/TouchableOpacity
>
);
})}
<
/Swiper
>
<
/View
>
);
}
render
()
{
return
(
<
View
style
=
{
styles
.
container
}
>
<
Carousel
/>
{
/* <Carousel /> */
}
{
this
.
_swiper
()}
<
TouchableOpacity
style
=
{
styles
.
midContainer
}
onPress
=
{()
=>
{
...
...
@@ -96,7 +166,10 @@ export default class Home extends Component {
style
=
{{
width
:
72
,
height
:
18
}}
/
>
<
Text
style
=
{
styles
.
midText
}
>
平安保险
2017
版
<
/Text
>
<
Image
source
=
{
require
(
"../../assets/Mine/rightArrow_gray.png"
)}
style
=
{
styles
.
midArrow
}
/
>
<
Image
source
=
{
require
(
"../../assets/Mine/rightArrow_gray.png"
)}
style
=
{
styles
.
midArrow
}
/
>
<
/TouchableOpacity
>
<
View
style
=
{
styles
.
textContainer
}
>
<
Text
style
=
{
styles
.
minText
}
>
保险头条
<
/Text
>
...
...
@@ -121,10 +194,19 @@ const styles = StyleSheet.create({
alignItems
:
"stretch"
,
backgroundColor
:
"#EFEFEF"
},
swiperWrapper
:
{},
slide
:
{
height
:
120
,
justifyContent
:
"center"
,
alignItems
:
"center"
,
backgroundColor
:
"#92BBD9"
},
slideImg
:
{
flex
:
1
,
height
:
120
},
midContainer
:
{
height
:
45
,
// width: 200,
// alignSelf: 'center',
backgroundColor
:
"#fff"
,
alignItems
:
"center"
,
flexDirection
:
"row"
,
...
...
@@ -140,7 +222,7 @@ const styles = StyleSheet.create({
width
:
14
,
height
:
14
,
position
:
"absolute"
,
right
:
15
,
right
:
15
},
textContainer
:
{
backgroundColor
:
"#fff"
,
...
...
@@ -155,7 +237,7 @@ const styles = StyleSheet.create({
// height: 150
flex
:
1
,
// paddingBottom: 64,
marginBottom
:
49
,
marginBottom
:
49
},
itemContainer
:
{
height
:
90
,
...
...
@@ -195,5 +277,5 @@ const styles = StyleSheet.create({
marginTop
:
10
,
textAlign
:
"center"
,
marginBottom
:
10
}
,
}
});
...
...
src/pages/InsuranceCircle/details.js
View file @
6629323
...
...
@@ -10,6 +10,7 @@ import {
TextInput
,
KeyboardAvoidingView
}
from
"react-native"
;
import
WebView
from
"../../Components/CommonWebView"
;
export
default
class
Details
extends
Component
{
constructor
(
props
)
{
...
...
@@ -106,6 +107,18 @@ export default class Details extends Component {
<
Text
style
=
{
styles
.
sendButton
}
>
发送
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
{
/* <TouchableOpacity
ononPress={() => {
this.props.navigator.push({
component: WebView,
passProps: {
url: "https://www.baidu.com"
}
});
}}
>
<Text>跳转试试看</Text>
</TouchableOpacity> */
}
<
/KeyboardAvoidingView
>
<
/View
>
);
...
...
src/pages/Login.js
View file @
6629323
...
...
@@ -17,6 +17,7 @@ export default class Login extends Component {
this
.
state
=
{
phone
:
""
,
password
:
""
,
// 处于登录还是注册页面
isRegister
:
false
};
}
...
...
@@ -64,10 +65,6 @@ export default class Login extends Component {
keyboardType
=
"default"
/
>
<
/View
>
{
/* <TouchableOpacity style={styles.helpContaier}>
<Text style={styles.forgetPassword}>忘记密码?</Text>
</TouchableOpacity> */
}
{
/* 登录/注册 按钮 */
}
{
!
this
.
state
.
isRegister
?
(
<
TouchableOpacity
...
...
@@ -89,7 +86,7 @@ export default class Login extends Component {
<
/TouchableOpacity
>
)}
{
/* 点击
进行注册
*/
}
{
/* 点击
切换 不用管这里
*/
}
{
!
this
.
state
.
isRegister
?
(
<
TouchableOpacity
style
=
{
styles
.
registerContaier
}
...
...
@@ -118,11 +115,6 @@ export default class Login extends Component {
alert
(
"请正确输入手机号码"
);
return
;
}
// } else if (phone != 13000000000 && phone != 18888888888) {
// console.log("手机号和密码",phone,password)
// alert("登录账号错误");
// return;
// }
if
(
password
===
""
)
{
alert
(
"请输入密码"
);
return
;
...
...
src/pages/Mine/index.js
View file @
6629323
...
...
@@ -8,9 +8,6 @@ import {
Image
,
AlertIOS
}
from
"react-native"
;
import
myQuestion
from
"./myQuestion"
;
import
MsgNotification
from
"./MsgNotification"
;
import
PersonalInfo
from
"./PersonalInfo"
;
export
default
class
Mine
extends
Component
{
constructor
(
props
)
{
...
...
@@ -28,18 +25,19 @@ export default class Mine extends Component {
saveResponse2
(
d
)
{
this
.
setState
({
identity
:
d
});
}
loginOut
()
{
console
.
log
(
"看看this是什么"
,
this
);
this
.
props
.
onLogin
(
false
);
}
render
()
{
return
(
<
View
style
=
{
styles
.
container
}
>
<
TouchableOpacity
style
=
{
styles
.
header
}
>
<
View
style
=
{
styles
.
headerLeft
}
>
<
View
style
=
{
styles
.
header
}
>
<
Image
source
=
{
require
(
"../../assets/Mine/iconpic1.png"
)}
style
=
{
styles
.
mineIcon
}
/
>
<
Text
style
=
{
styles
.
mineName
}
>
{
this
.
state
.
name
}
<
/Text
>
<
/View
>
<
/TouchableOpacity
>
<
View
style
=
{
styles
.
midContainer
}
>
<
TouchableOpacity
style
=
{
styles
.
itemContainer
}
...
...
@@ -98,57 +96,6 @@ export default class Mine extends Component {
<
/View
>
);
}
loginOut
()
{
console
.
log
(
"看看this是什么"
,
this
);
this
.
props
.
onLogin
(
false
);
}
changeInfo
(
type
,
text
)
{
if
(
type
==
"name"
)
{
this
.
setState
({
name
:
text
});
}
else
{
this
.
setState
({
identity
:
text
});
}
}
}
class
BarList
extends
Component
{
render
()
{
return
(
<
View
>
<
ListItem
title
=
{
"消息通知"
}
num
=
{
"11"
}
/
>
<
ListItem
title
=
{
"我的提问"
}
/
>
<
/View
>
);
}
}
class
ListItem
extends
Component
{
render
()
{
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/Mine/iconpic1.png")} /> */
}
<
Text
style
=
{
styles
.
leftTitle
}
>
{
this
.
props
.
title
}
<
/Text
>
{
this
.
props
.
num
?
(
<
Text
style
=
{
styles
.
leftNum
}
>
({
this
.
props
.
num
})
<
/Text
>
)
:
null
}
<
/View
>
<
Image
style
=
{
styles
.
itemRight
}
source
=
{
require
(
"../../assets/Mine/rightArrow_gray.png"
)}
/
>
<
/TouchableOpacity
>
);
}
}
const
styles
=
StyleSheet
.
create
({
...
...
@@ -161,23 +108,15 @@ const styles = StyleSheet.create({
},
header
:
{
backgroundColor
:
"#1B9341"
,
height
:
78
,
height
:
154
,
flexDirection
:
"row"
,
justifyContent
:
"space-between"
,
paddingLeft
:
13
,
paddingRight
:
13
,
justifyContent
:
"center"
,
alignItems
:
"center"
,
marginBottom
:
10
},
headerLeft
:
{
flexDirection
:
"row"
,
justifyContent
:
"flex-start"
,
alignItems
:
"center"
},
mineIcon
:
{
width
:
46
,
height
:
46
,
marginRight
:
14
width
:
86
,
height
:
86
,
},
mineName
:
{
fontSize
:
16
,
...
...
@@ -188,11 +127,7 @@ const styles = StyleSheet.create({
width
:
14
,
height
:
14
},
midContainer
:
{
// marginTop: 10,
// marginBottom: 10,
// height: 92,
},
midContainer
:
{},
itemContainer
:
{
height
:
46
,
paddingLeft
:
16
,
...
...
@@ -210,7 +145,6 @@ const styles = StyleSheet.create({
justifyContent
:
"flex-start"
,
alignItems
:
"center"
},
leftIcon
:
{
marginRight
:
11
,
width
:
16
,
...
...
yarn.lock
View file @
6629323
...
...
@@ -3147,7 +3147,7 @@ promise@^7.1.1:
dependencies:
asap "~2.0.3"
prop-types@^15.5.6, prop-types@^15.5.8:
prop-types@^15.5.
10, prop-types@^15.5.
6, prop-types@^15.5.8:
version "15.5.10"
resolved "http://registry.npm.taobao.org/prop-types/download/prop-types-15.5.10.tgz#2797dfc3126182e3a95e3dfbb2e893ddd7456154"
dependencies:
...
...
@@ -3221,6 +3221,12 @@ react-devtools-core@^2.5.0:
shell-quote "^1.6.1"
ws "^2.0.3"
react-native-swiper@^1.5.11:
version "1.5.11"
resolved "http://registry.npm.taobao.org/react-native-swiper/download/react-native-swiper-1.5.11.tgz#2d46ded43f383dbde4540d513cb4eaaa60eaed61"
dependencies:
prop-types "^15.5.10"
react-native@0.48.1:
version "0.48.1"
resolved "http://registry.npm.taobao.org/react-native/download/react-native-0.48.1.tgz#052ba5a86d3bdb748c288124248727d02b1c0939"
...
...
接口.txt
0 → 100644
View file @
6629323
POST https://devpay.brae.co
注册 /test/insurance/register
传入值
{
"phone":13131313131,
"password":"12313123",
"nickname":"hhee"
}
返回值
{
"id": 3,
"nickname": "hhee"
}
登录 /test/insurance/login
传入值
{
"phone":13131313131,
"password":"12313123"
}
返回值
{
"id": 3,
"nickname": "hhee"
}
获取文章 /test/insurance/article
返回值
{
"0": {
"title": "家庭经济越差越应该买保险,因为你病不起,输不起,也折腾不起…",
"content": "现实生活就是如此矛盾现实生活,就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实矛是如此此…",
"name": "jack",
"identify": "保险代理人",
"num": "30",
"id": "1"
},
"1": {
"title": "因为你病不起,输不起,也折腾不起…",
"content": "现实生活就是如此矛盾现实生活,就是如此矛盾现实生活就是如此矛盾现实生活,就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实矛是如此此…现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实矛是如此此…",
"name": "luosf",
"identify": "保险代理人",
"num": "10",
"id": "2"
}
}
评论文章 /test/insurance/comment/add
传入值
{
"user":2,
"article":1,
"content":"哈哈哈哈哈哈哈哈"
}
获取评论 /test/insurance/comment/get
返回值
{
"0": {
"time": "2017-09-08 16:35:28",
"user": "yyy",
"content": "哈哈~"
}
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment