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 11:24:25 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
86ce18845c330bcb4f8d1c979a5e740e36fbc086
86ce1884
1 parent
594aa453
能选中状态
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
13 deletions
src/pages/Customer/Import.js
src/pages/Customer/index.js
src/pages/Customer/Import.js
View file @
86ce188
...
...
@@ -16,7 +16,9 @@ import post from "../../utils/fetch";
export
default
class
Import
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{};
this
.
state
=
{
customersList
:
this
.
props
.
navigation
.
state
.
params
.
customersList
};
}
componentWillMount
()
{}
...
...
@@ -28,13 +30,65 @@ export default class Import extends Component {
post
(
"/test/insurance/article"
,
{},
res
=>
{},
err
=>
{});
}
/* customersList: [
...this.state.customersList.slice(0, index),
{
...this.state.customersList[index],
selected: !this.state.customersList[index].selected
},
...this.state.slice(index + 1)
] */
render
()
{
const
{
navigate
}
=
this
.
props
.
navigation
;
const
customersList
=
this
.
props
.
navigation
.
state
.
params
.
customersList
;
const
{
customersList
}
=
this
.
state
;
// const customersList = this.props.navigation.state.params.customersList;
const
ds
=
new
ListView
.
DataSource
({
rowHasChanged
:
(
r1
,
r2
)
=>
r1
!==
r2
});
const
dataSource
=
ds
.
cloneWithRows
(
customersList
);
return
(
<
View
style
=
{
styles
.
container
}
>
{
/* <Text>导入客户</Text> */
}
<
ScrollView
style
=
{
styles
.
mainSvcContainer
}
>
<
ListView
style
=
{
styles
.
mainSvcContainer
}
dataSource
=
{
dataSource
}
enableEmptySections
=
{
true
}
renderRow
=
{(
item
,
secid
,
index
)
=>
{
return
(
<
TouchableOpacity
key
=
{
index
}
style
=
{
styles
.
CustomerItemContaier
}
onPress
=
{()
=>
{
let
Temp
=
customersList
;
console
.
log
(
index
);
{
/* return; */
}
Temp
.
splice
(
index
,
1
,
{
...
customersList
[
index
],
selected
:
!
customersList
[
index
].
selected
});
this
.
setState
({
customersList
:
Temp
});
}}
>
<
View
style
=
{
styles
.
itemSelectIconContainer
}
>
{
item
.
selected
?
(
<
Image
style
=
{
styles
.
itemSelectIcon
}
source
=
{
require
(
"../../assets/customer/ic1_s.png"
)}
/
>
)
:
(
<
Image
style
=
{
styles
.
itemSelectIcon
}
source
=
{
require
(
"../../assets/customer/ic1_n.png"
)}
/
>
)}
<
/View
>
<
Text
style
=
{
styles
.
CustomerItemText
}
>
{
item
.
name
}
<
/Text
>
<
/TouchableOpacity
>
);
}}
/
>
{
/* <ScrollView style={styles.mainSvcContainer}>
{customersList.map((item, index) => {
return (
<TouchableOpacity key={index} style={styles.CustomerItemContaier}>
...
...
@@ -45,7 +99,7 @@ export default class Import extends Component {
</TouchableOpacity>
);
})}
<
/ScrollView
>
</ScrollView>
*/
}
<
View
style
=
{
styles
.
selectBtnContaier
}
>
<
View
style
=
{
styles
.
selectBtnContaierLeft
}
>
<
TouchableOpacity
style
=
{
styles
.
selectAllContainer
}
>
...
...
@@ -93,11 +147,11 @@ const styles = StyleSheet.create({
itemSelectIconContainer
:
{
justifyContent
:
"center"
,
alignItems
:
"center"
,
marginRight
:
10
,
marginRight
:
10
},
itemSelectIcon
:
{
width
:
15
,
height
:
15
,
height
:
15
},
CustomerItemText
:
{
fontSize
:
16
,
...
...
@@ -118,25 +172,25 @@ const styles = StyleSheet.create({
borderTopWidth
:
1
},
selectBtnContaierLeft
:
{
flexDirection
:
"row"
,
flexDirection
:
"row"
},
selectAllContainer
:
{
marginLeft
:
20
,
marginLeft
:
20
},
selectAllText
:
{},
selectedTextContaier
:
{
flexDirection
:
"row"
,
marginLeft
:
20
,
marginLeft
:
20
},
importBtnContaier
:
{
width
:
100
,
height
:
49
,
backgroundColor
:
"#1B9341"
,
justifyContent
:
"center"
,
alignItems
:
"center"
,
alignItems
:
"center"
},
importBtnText
:
{
color
:
"white"
,
fontSize
:
16
,
fontSize
:
16
}
});
...
...
src/pages/Customer/index.js
View file @
86ce188
...
...
@@ -64,7 +64,8 @@ export default class Customer extends Component {
contacts
.
forEach
((
item
,
index
)
=>
{
customersList
.
push
({
name
:
item
.
familyName
+
item
.
givenName
,
phone
:
item
.
phoneNumbers
[
0
]
?
item
.
phoneNumbers
[
0
].
number
:
''
,
phone
:
item
.
phoneNumbers
[
0
]
?
item
.
phoneNumbers
[
0
].
number
:
""
,
selected
:
false
,
});
});
// console.log("通信录", contacts);
...
...
Please
register
or
login
to post a comment