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:55:38 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0c0225aefac7e7f77d3ae7838186669408e9c64a
0c0225ae
1 parent
86ce1884
全选还没处理完
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
31 deletions
src/pages/Customer/Import.js
src/pages/Customer/Import.js
View file @
0c0225a
...
...
@@ -17,7 +17,9 @@ export default class Import extends Component {
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
customersList
:
this
.
props
.
navigation
.
state
.
params
.
customersList
customersList
:
this
.
props
.
navigation
.
state
.
params
.
customersList
,
selected_all
:
false
,
selected_len
:
5
};
}
componentWillMount
()
{}
...
...
@@ -30,18 +32,10 @@ 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
.
state
;
// const customersList = this.props.navigation.state.params.customersList
;
const
{
customersList
,
selected_all
,
selected_len
}
=
this
.
state
;
let
LEN
=
customersList
.
length
;
const
ds
=
new
ListView
.
DataSource
({
rowHasChanged
:
(
r1
,
r2
)
=>
r1
!==
r2
});
...
...
@@ -52,7 +46,7 @@ export default class Import extends Component {
style
=
{
styles
.
mainSvcContainer
}
dataSource
=
{
dataSource
}
enableEmptySections
=
{
true
}
renderRow
=
{(
item
,
secid
,
index
)
=>
{
renderRow
=
{(
item
,
secid
,
index
)
=>
{
return
(
<
TouchableOpacity
key
=
{
index
}
...
...
@@ -60,7 +54,6 @@ export default class Import extends Component {
onPress
=
{()
=>
{
let
Temp
=
customersList
;
console
.
log
(
index
);
{
/* return; */
}
Temp
.
splice
(
index
,
1
,
{
...
customersList
[
index
],
selected
:
!
customersList
[
index
].
selected
...
...
@@ -88,27 +81,36 @@ export default class Import extends Component {
);
}}
/
>
{
/* <ScrollView style={styles.mainSvcContainer}>
{customersList.map((item, index) => {
return (
<TouchableOpacity key={index} style={styles.CustomerItemContaier}>
<View style={styles.itemSelectIconContainer}>
<Image style={styles.itemSelectIcon} source={require("../../assets/customer/ic1_n.png")} />
</View>
<Text style={styles.CustomerItemText}>{item.name}</Text>
</TouchableOpacity>
);
})}
</ScrollView> */
}
<
View
style
=
{
styles
.
selectBtnContaier
}
>
<
View
style
=
{
styles
.
selectBtnContaierLeft
}
>
<
TouchableOpacity
style
=
{
styles
.
selectAllContainer
}
>
<
View
style
=
{
styles
.
selectAllIcon
}
/
>
<
TouchableOpacity
style
=
{
styles
.
selectAllContainer
}
onPress
=
{()
=>
{
this
.
setState
({
selected_all
:
!
this
.
state
.
selected_all
});
}}
>
<
View
style
=
{
styles
.
selectAllIcon
}
>
{
selected_all
?
(
<
Image
style
=
{
styles
.
allIcon
}
source
=
{
require
(
"../../assets/customer/ic2_s.png"
)}
/
>
)
:
(
<
Image
style
=
{
styles
.
allIcon
}
source
=
{
require
(
"../../assets/customer/ic2_n.png"
)}
/
>
)}
<
/View
>
<
Text
style
=
{
styles
.
selectAllText
}
>
全选
<
/Text
>
<
/TouchableOpacity
>
<
View
style
=
{
styles
.
selectedTextContaier
}
>
<
Text
>
已选中
<
/Text
>
<
Text
>
0
<
/Text
>
<
Text
style
=
{
styles
.
selected_num
}
>
{
selected_all
?
LEN
:
selected_len
}
<
/Text
>
<
Text
>
项
<
/Text
>
<
/View
>
<
/View
>
...
...
@@ -175,12 +177,32 @@ const styles = StyleSheet.create({
flexDirection
:
"row"
},
selectAllContainer
:
{
marginLeft
:
20
marginLeft
:
20
,
flexDirection
:
"row"
,
justifyContent
:
"center"
,
alignItems
:
"center"
},
selectAllIcon
:
{
justifyContent
:
"center"
,
alignItems
:
"center"
,
marginRight
:
10
},
allIcon
:
{
width
:
22
,
height
:
22
},
selectAllText
:
{
fontSize
:
17
},
selectAllText
:
{},
selectedTextContaier
:
{
flexDirection
:
"row"
,
marginLeft
:
20
marginLeft
:
20
,
justifyContent
:
"center"
,
alignItems
:
"center"
},
selected_num
:
{
color
:
"#1B9341"
,
fontSize
:
16
},
importBtnContaier
:
{
width
:
100
,
...
...
Please
register
or
login
to post a comment