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 09:32:30 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2cd1b75d4b1f86ed1aa61743563b66a3a970a77c
2cd1b75d
1 parent
f36fcd9e
通信录OK
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
13 deletions
src/pages/Customer/edit.js
src/pages/Customer/index.js
src/pages/InsuranceChurch/index.js
src/pages/Customer/edit.js
View file @
2cd1b75
...
...
@@ -41,8 +41,6 @@ export default class Edit extends Component {
}
componentWillMount
()
{
this
.
getAsyncStorage
();
console
.
log
(
"customer_id"
,
this
.
state
.
customer_id
);
console
.
log
(
"回调是啥?"
,
this
.
props
.
navigation
);
this
.
getItemInfo
();
}
...
...
@@ -117,8 +115,9 @@ export default class Edit extends Component {
const
{
USER_ID
}
=
this
.
state
;
const
{
goBack
,
state
}
=
this
.
props
.
navigation
;
post
(
`/test/insurance/contact/
update/
${
USER_ID
}
`
,
`/test/insurance/contact/
add
`
,
{
user
:
USER_ID
,
name
:
this
.
state
.
name
,
age
:
this
.
state
.
age
,
phone
:
this
.
state
.
phone
,
...
...
@@ -129,7 +128,6 @@ export default class Edit extends Component {
has_children
:
this
.
state
.
has_children
},
res
=>
{
// console.log("修改客户个人信息", res);
Alert
.
alert
(
"提交成功"
,
null
,
()
=>
goBack
());
},
err
=>
{
...
...
@@ -350,6 +348,7 @@ export default class Edit extends Component {
>
<
Text
style
=
{
styles
.
confirmBtnText
}
>
确定
<
/Text
>
<
/TouchableOpacity
>
{
this
.
state
.
todo
==
"edit"
?
(
<
TouchableOpacity
onPress
=
{()
=>
{
Alert
.
alert
(
...
...
@@ -374,6 +373,7 @@ export default class Edit extends Component {
>
<
Text
style
=
{
styles
.
deleteText
}
>
删除
<
/Text
>
<
/TouchableOpacity
>
)
:
null
}
<
/View
>
<
/View
>
);
...
...
src/pages/Customer/index.js
View file @
2cd1b75
...
...
@@ -24,7 +24,6 @@ export default class Customer extends Component {
USER_ID
:
""
,
NICKNAME
:
""
,
PROFESSION
:
""
,
hasCustomer
:
false
,
customersList
:
[]
};
this
.
getAllPhone
=
this
.
getAllPhone
.
bind
(
this
);
...
...
@@ -57,7 +56,7 @@ export default class Customer extends Component {
getAsyncStorage
()
{
const
that
=
this
;
const
{
USER_ID
,
customersList
}
=
this
.
state
;
const
{
IS_LOGIN
,
USER_ID
,
customersList
}
=
this
.
state
;
AsyncStorage
.
multiGet
([
"IS_LOGIN"
,
"USER_ID"
],
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
err
);
...
...
@@ -69,13 +68,14 @@ export default class Customer extends Component {
},
()
=>
{
console
.
log
(
that
.
state
.
USER_ID
);
if
(
that
.
state
.
IS_LOGIN
==
"yes"
)
{
post
(
`/test/insurance/contact/get/
${
that
.
state
.
USER_ID
}
`
,
{},
res
=>
{
console
.
log
(
"我的通信录呢?"
,
res
)
if
(
res
.
data
.
contacts
)
{
that
.
setState
({
hasCustomer
:
true
,
customersList
:
res
.
data
.
contacts
});
}
...
...
@@ -86,6 +86,7 @@ export default class Customer extends Component {
}
);
}
}
);
});
}
...
...
@@ -102,11 +103,24 @@ export default class Customer extends Component {
<
TouchableOpacity
style
=
{
styles
.
beginBtnLeft
}
onPress
=
{()
=>
{
AsyncStorage
.
multiGet
([
"IS_LOGIN"
,
"USER_ID"
],
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
err
);
}
this
.
setState
(
{
IS_LOGIN
:
result
[
0
][
1
],
USER_ID
:
result
[
1
][
1
]
!=
null
?
result
[
1
][
1
]
:
""
},
()
=>
{
if
(
this
.
state
.
IS_LOGIN
!=
"yes"
)
{
Alert
.
alert
(
"请先登录账号"
);
}
else
{
navigate
(
"CustomerEdit"
);
navigate
(
"CustomerEdit"
,{
todo
:
"add"
,
item
:
null
}
);
}
}
);
});
}}
>
<
Text
style
=
{
styles
.
beginBtnLeftText
}
>
手动添加
<
/Text
>
...
...
@@ -114,13 +128,24 @@ export default class Customer extends Component {
<
TouchableOpacity
style
=
{
styles
.
beginBtnRight
}
onPress
=
{()
=>
{
AsyncStorage
.
multiGet
([
"IS_LOGIN"
,
"USER_ID"
],
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
err
);
}
this
.
setState
(
{
IS_LOGIN
:
result
[
0
][
1
],
USER_ID
:
result
[
1
][
1
]
!=
null
?
result
[
1
][
1
]
:
""
},
()
=>
{
if
(
this
.
state
.
IS_LOGIN
!=
"yes"
)
{
Alert
.
alert
(
"请先登录账号"
);
}
else
{
{
this
.
getAllPhone
();
}
}
);
});
}}
>
<
Text
style
=
{
styles
.
beginBtnRightText
}
>
通信录导入
<
/Text
>
...
...
@@ -138,7 +163,7 @@ export default class Customer extends Component {
<
TouchableOpacity
style
=
{
styles
.
mainBtnContaierLeft
}
onPress
=
{()
=>
{
navigate
(
"CustomerEdit"
,
{
todo
:
"add"
});
navigate
(
"CustomerEdit"
,
{
todo
:
"add"
,
item
:
null
});
}}
>
<
Image
...
...
@@ -147,6 +172,9 @@ export default class Customer extends Component {
/
>
<
Text
style
=
{
styles
.
mainBtnLeftText
}
>
手动添加
<
/Text
>
<
/TouchableOpacity
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
getAsyncStorage
()}
>
<
Image
source
=
{
require
(
'../../assets/customer/ic_add.png'
)}
style
=
{{
width
:
44
,
height
:
44
}}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{
styles
.
mainBtnContaierRight
}
onPress
=
{()
=>
{
...
...
@@ -188,10 +216,10 @@ export default class Customer extends Component {
render
()
{
const
{
navigate
}
=
this
.
props
.
navigation
;
const
{
IS_LOGIN
,
hasCustomer
,
customers
}
=
this
.
state
;
const
{
IS_LOGIN
,
customers
}
=
this
.
state
;
return
(
<
View
style
=
{
styles
.
container
}
>
{
hasCustomer
?
this
.
_renderMain
()
:
this
.
_renderBegin
()}
{
IS_LOGIN
==
"yes"
?
this
.
_renderMain
()
:
this
.
_renderBegin
()}
<
/View
>
);
}
...
...
src/pages/InsuranceChurch/index.js
View file @
2cd1b75
...
...
@@ -87,7 +87,7 @@ export default class InsuranceChurch extends Component {
);
}}
/
>
<
Text
style
=
{
styles
.
scrollViewText
}
>
没有更多了
<
/Text
>
{
/* <Text style={styles.scrollViewText}>没有更多了</Text> */
}
<
/View
>
);
}
...
...
Please
register
or
login
to post a comment