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-30 09:33:26 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
01cae57e31f3092e3c5c820e45c9a63fd54dd04a
01cae57e
1 parent
da899421
处理好本地通信录数据
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
20 deletions
index.ios.js
src/pages/Customer/Import.js
src/pages/Customer/index.js
index.ios.js
View file @
01cae57
...
...
@@ -14,6 +14,7 @@ import InsuranceChurch from "./src/pages/InsuranceChurch/index";
import
Mine
from
"./src/pages/Mine/index"
;
import
Customer
from
"./src/pages/Customer/index"
;
import
CustomerEdit
from
"./src/pages/Customer/edit"
;
import
CustomerImport
from
"./src/pages/Customer/Import"
;
import
Login
from
"./src/pages/Login"
;
import
AllProduct
from
"./src/pages/Home/allProduct"
;
import
ProductTemplate
from
"./src/Components/ProductTemplate"
;
...
...
@@ -112,6 +113,10 @@ const ProtectGod = StackNavigator(
screen
:
CustomerEdit
,
navigationOptions
:
{
headerTitle
:
"客户信息"
}
},
CustomerImport
:
{
screen
:
CustomerImport
,
navigationOptions
:
{
headerTitle
:
"导入客户"
}
},
AllProduct
:
{
screen
:
AllProduct
,
navigationOptions
:
{
headerTitle
:
"全部产品"
}
...
...
src/pages/Customer/Import.js
0 → 100644
View file @
01cae57
import
React
,
{
Component
}
from
"react"
;
import
{
AppRegistry
,
StyleSheet
,
Text
,
View
,
Image
,
TouchableOpacity
,
ScrollView
,
ListView
,
Dimensions
,
}
from
"react-native"
;
import
{
StackNavigator
,
TabNavigator
}
from
"react-navigation"
;
import
post
from
"../../utils/fetch"
;
export
default
class
Import
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{};
}
componentWillMount
()
{}
componentDidMount
()
{
console
.
log
(
"导入客户"
,
this
.
props
.
navigation
.
state
.
params
);
}
getListData
()
{
post
(
"/test/insurance/article"
,
{},
res
=>
{},
err
=>
{});
}
render
()
{
const
{
navigate
}
=
this
.
props
.
navigation
;
return
(
<
View
style
=
{
styles
.
container
}
>
<
Text
>
导入客户
<
/Text
>
<
/View
>
);
}
}
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
justifyContent
:
"flex-start"
,
alignItems
:
"stretch"
,
backgroundColor
:
"#EFEFEF"
}
});
...
...
src/pages/Customer/index.js
View file @
01cae57
...
...
@@ -14,7 +14,7 @@ import {
}
from
"react-native"
;
import
{
StackNavigator
,
TabNavigator
}
from
"react-navigation"
;
import
post
from
"../../utils/fetch"
;
import
Contacts
from
'react-native-contacts'
;
import
Contacts
from
"react-native-contacts"
;
export
default
class
Customer
extends
Component
{
constructor
(
props
)
{
...
...
@@ -56,26 +56,21 @@ export default class Customer extends Component {
post
(
"/test/insurance/article"
,
{},
res
=>
{},
err
=>
{});
}
getAllPhone
()
{
const
{
navigate
}
=
this
.
props
.
navigation
;
Contacts
.
getAll
((
err
,
contacts
)
=>
{
if
(
err
&&
err
.
type
===
"permissionDenied"
)
{
}
else
{
// let phones = [];
// contacts.forEach((item, index) => {
// item.phoneNumbers.forEach((phone, i) => {
// phones.push(phone.number);
// });
// });
console
.
log
(
"通信录"
,
contacts
)
// post(
// "/spreader/rank/friends/contact",
// { contact: phones },
// res => {
// this.getRankData();
// },
// resErr => {
// Toast.show(resErr.cnmsg, Toast.error);
// }
// );
let
customersList
=
[];
contacts
.
forEach
((
item
,
index
)
=>
{
customersList
.
push
({
name
:
item
.
familyName
+
item
.
givenName
,
phone
:
item
.
phoneNumbers
.
map
((
phone
,
index2
)
=>
{
return
phone
.
number
;
})
});
});
console
.
log
(
"通信录"
,
customersList
);
navigate
(
"CustomerImport"
,
{
customersList
:
customersList
});
}
});
}
...
...
@@ -126,8 +121,7 @@ export default class Customer extends Component {
Alert
.
alert
(
"请先登录账号"
);
}
else
{
{
/* navigate("CustomerEdit"); */
this
.
getAllPhone
()
this
.
getAllPhone
();
}
}
}}
...
...
Please
register
or
login
to post a comment