Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cdsf-wx-app
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
姜雷
cdsf-wx-app
Commits
d2c4dae4
Commit
d2c4dae4
authored
Oct 15, 2018
by
姜雷
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into 'test'
添加下拉刷新 See merge request
!11
parents
c39df64c
da60d25e
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
246 additions
and
170 deletions
+246
-170
PublicCarList.js
src/containers/PublicCar/PublicCarList.js
+55
-27
style.css
src/containers/PublicCar/style.css
+3
-0
index.js
src/containers/PublicCarDeal/index.js
+62
-35
RepairList.js
src/containers/Repair/RepairList.js
+57
-55
RepairItem.js
src/containers/Repair/components/RepairItem.js
+1
-1
style.css
src/containers/Repair/components/style.css
+3
-0
style.css
src/containers/Repair/style.css
+3
-1
index.js
src/containers/RepairDeal/index.js
+62
-51
No files found.
src/containers/PublicCar/PublicCarList.js
View file @
d2c4dae4
import
React
,
{
Component
}
from
'react'
;
import
React
,
{
Component
}
from
'react'
;
import
{
fetchPublicCarList
}
from
'../../api/index'
;
import
{
fetchPublicCarList
}
from
'../../api/index'
;
import
{
PullToRefresh
,
Toast
}
from
'antd-mobile'
;
import
{
ListView
,
PullToRefresh
,
Toast
}
from
'antd-mobile'
;
import
styles
from
'./style.css'
;
import
styles
from
'./style.css'
;
import
PublicCarItem
from
'./components/PublicCarItem'
;
import
PublicCarItem
from
'./components/PublicCarItem'
;
class
PublicCarList
extends
Component
{
class
PublicCarList
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
const
list
=
new
ListView
.
DataSource
({
rowHasChanged
:
(
row1
,
row2
)
=>
row1
!==
row2
,
});
this
.
state
=
{
this
.
state
=
{
refreshing
:
false
,
refreshing
:
false
,
down
:
true
,
down
:
true
,
height
:
document
.
documentElement
.
clientHeight
,
height
:
document
.
documentElement
.
clientHeight
,
list
:
[],
list
:
list
,
sourceList
:
[],
pagination
:
{
pagination
:
{
nowDate
:
''
,
nowDate
:
''
,
pageNum
:
1
,
pageNum
:
1
,
pageSize
:
5
0
,
pageSize
:
1
0
,
},
},
};
};
}
}
...
@@ -32,6 +36,12 @@ class PublicCarList extends Component {
...
@@ -32,6 +36,12 @@ class PublicCarList extends Component {
);
);
this
.
fetchList
();
this
.
fetchList
();
}
}
updateList
=
()
=>
{
const
{
sourceList
}
=
this
.
state
;
this
.
setState
(({
list
})
=>
({
list
:
list
.
cloneWithRows
(
sourceList
),
}));
};
fetchList
=
fetchMore
=>
{
fetchList
=
fetchMore
=>
{
const
{
pagination
}
=
this
.
state
;
const
{
pagination
}
=
this
.
state
;
const
nowDate
=
new
Date
().
toISOString
();
const
nowDate
=
new
Date
().
toISOString
();
...
@@ -48,11 +58,11 @@ class PublicCarList extends Component {
...
@@ -48,11 +58,11 @@ class PublicCarList extends Component {
fetchPublicCarList
(
entity
)
fetchPublicCarList
(
entity
)
.
then
(
res
=>
{
.
then
(
res
=>
{
this
.
setState
(
this
.
setState
(
({
l
ist
,
pagination
})
=>
({
sourceL
ist
,
pagination
})
=>
fetchMore
fetchMore
?
res
.
data
.
length
?
res
.
data
.
length
?
{
?
{
list
:
[...
l
ist
,
...
res
.
data
],
sourceList
:
[...
sourceL
ist
,
...
res
.
data
],
pagination
:
{
pagination
:
{
...
pagination
,
...
pagination
,
pageNum
:
pagination
.
pageNum
+
1
,
pageNum
:
pagination
.
pageNum
+
1
,
...
@@ -63,14 +73,16 @@ class PublicCarList extends Component {
...
@@ -63,14 +73,16 @@ class PublicCarList extends Component {
refreshing
:
false
,
refreshing
:
false
,
}
}
:
{
:
{
l
ist
:
res
.
data
,
sourceL
ist
:
res
.
data
,
pagination
:
{
pagination
:
{
...
pagination
,
...
pagination
,
pageNum
:
1
,
nowDate
,
nowDate
,
},
},
refreshing
:
false
,
refreshing
:
false
,
}
}
);
);
this
.
updateList
();
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
Toast
.
fail
(
err
.
msg
||
'请求失败!'
);
Toast
.
fail
(
err
.
msg
||
'请求失败!'
);
...
@@ -82,30 +94,46 @@ class PublicCarList extends Component {
...
@@ -82,30 +94,46 @@ class PublicCarList extends Component {
refreshHandle
=
()
=>
{
refreshHandle
=
()
=>
{
this
.
fetchList
(
true
);
this
.
fetchList
(
true
);
};
};
render
()
{
MyBody
=
props
=>
{
return
(
return
(
<
div
className
=
{
styles
.
publicCarList
}
>
<
div
className
=
{
styles
.
repairList
}
>
<
PullToRefresh
<
div
className
=
{
styles
.
listInfo
}
>
显示最近半年的报修记录
<
/div
>
damping
=
{
60
}
{
props
.
children
}
ref
=
{
el
=>
(
this
.
ptr
=
el
)}
style
=
{{
height
:
this
.
state
.
height
,
overflow
:
'auto'
,
}}
indicator
=
{{
deactivate
:
'上拉可以刷新'
}}
direction
=
{
'up'
}
refreshing
=
{
this
.
state
.
refreshing
}
onRefresh
=
{
this
.
refreshHandle
}
>
<
div
className
=
{
styles
.
listInfo
}
>
显示最近半年的报修记录
<
/div
>
{
this
.
state
.
list
.
length
?
(
this
.
state
.
list
.
map
(
i
=>
<
PublicCarItem
key
=
{
i
.
id
}
data
=
{
i
}
/>
)
)
:
(
<
div
className
=
{
styles
.
noData
}
>
暂无数据
<
/div
>
)}
<
/PullToRefresh
>
<
/div
>
<
/div
>
);
);
};
render
()
{
const
{
list
,
pagination
}
=
this
.
state
;
return
(
<
ListView
style
=
{{
height
:
this
.
state
.
height
,
}}
className
=
{
styles
.
scrollWrap
}
dataSource
=
{
list
}
pageSize
=
{
pagination
.
pageSize
}
renderBodyComponent
=
{()
=>
<
this
.
MyBody
/>
}
renderRow
=
{
rowData
=>
(
<
PublicCarItem
key
=
{
rowData
.
id
}
data
=
{
rowData
}
showView
=
{
this
.
showViewHandle
}
/
>
)}
onEndReached
=
{
this
.
refreshHandle
}
pullToRefresh
=
{
<
PullToRefresh
refreshing
=
{
this
.
state
.
refreshing
}
onRefresh
=
{
this
.
fetchList
}
/
>
}
// renderFooter={() => (
// <div style={{ textAlign: 'center' }}>
// {this.state.refreshing ? 'Loading...' : 'Loaded'}
// </div>
// )}
/
>
);
}
}
}
}
...
...
src/containers/PublicCar/style.css
View file @
d2c4dae4
...
@@ -14,6 +14,9 @@
...
@@ -14,6 +14,9 @@
composes
:
noData
from
'../Repair/style.css'
;
composes
:
noData
from
'../Repair/style.css'
;
}
}
/* apply */
/* apply */
.scrollWrap
{
background-color
:
#f2f2f2
;
}
.content
{
.content
{
padding
:
30px
40px
20px
;
padding
:
30px
40px
20px
;
}
}
...
...
src/containers/PublicCarDeal/index.js
View file @
d2c4dae4
import
React
,
{
Component
}
from
'react'
;
import
React
,
{
Component
}
from
'react'
;
import
{
PullToRefresh
,
Modal
,
Toast
,
TextareaItem
}
from
'antd-mobile'
;
import
{
ListView
,
PullToRefresh
,
Modal
,
Toast
,
TextareaItem
,
}
from
'antd-mobile'
;
import
styles
from
'./style.css'
;
import
styles
from
'./style.css'
;
import
PublicCarItem
from
'../PublicCar/components/PublicCarItem'
;
import
PublicCarItem
from
'../PublicCar/components/PublicCarItem'
;
import
{
import
{
...
@@ -16,15 +22,19 @@ import Select from './Select';
...
@@ -16,15 +22,19 @@ import Select from './Select';
class
PublicCarDeal
extends
Component
{
class
PublicCarDeal
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
const
list
=
new
ListView
.
DataSource
({
rowHasChanged
:
(
row1
,
row2
)
=>
row1
!==
row2
,
});
this
.
state
=
{
this
.
state
=
{
refreshing
:
false
,
refreshing
:
false
,
down
:
true
,
down
:
true
,
height
:
document
.
documentElement
.
clientHeight
,
height
:
document
.
documentElement
.
clientHeight
,
pagination
:
{
pagination
:
{
pageNum
:
1
,
pageNum
:
1
,
pageSize
:
5
0
,
pageSize
:
1
0
,
},
},
list
:
[],
list
:
list
,
sourceList
:
[],
dealDialogVisible
:
false
,
dealDialogVisible
:
false
,
selected
:
{
selected
:
{
id
:
''
,
id
:
''
,
...
@@ -38,6 +48,12 @@ class PublicCarDeal extends Component {
...
@@ -38,6 +48,12 @@ class PublicCarDeal extends Component {
componentDidMount
()
{
componentDidMount
()
{
this
.
fetchList
();
this
.
fetchList
();
}
}
updateList
=
()
=>
{
const
{
sourceList
}
=
this
.
state
;
this
.
setState
(({
list
})
=>
({
list
:
list
.
cloneWithRows
(
sourceList
),
}));
};
fetchList
=
fetchMore
=>
{
fetchList
=
fetchMore
=>
{
this
.
setState
({
refreshing
:
true
});
this
.
setState
({
refreshing
:
true
});
const
{
pagination
}
=
this
.
state
;
const
{
pagination
}
=
this
.
state
;
...
@@ -55,29 +71,24 @@ class PublicCarDeal extends Component {
...
@@ -55,29 +71,24 @@ class PublicCarDeal extends Component {
fetchApplyPublicCarList
(
entity
)
fetchApplyPublicCarList
(
entity
)
.
then
(
res
=>
{
.
then
(
res
=>
{
this
.
setState
(
this
.
setState
(
({
list
,
pagination
})
=>
({
sourceList
})
=>
fetchMore
fetchMore
?
res
.
data
.
length
?
res
.
data
.
length
?
{
?
{
list
:
[...
list
,
...
res
.
data
],
sourceList
:
[...
sourceList
,
...
res
.
data
],
pagination
:
{
pagination
:
entity
,
...
pagination
,
pageNum
:
pagination
.
pageNum
+
1
,
},
refreshing
:
false
,
refreshing
:
false
,
}
}
:
{
:
{
refreshing
:
false
,
refreshing
:
false
,
}
}
:
{
:
{
list
:
res
.
data
,
sourceList
:
res
.
data
,
pagination
:
{
pagination
:
entity
,
...
pagination
,
nowDate
,
},
refreshing
:
false
,
refreshing
:
false
,
}
}
);
);
this
.
updateList
();
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
Toast
.
fail
(
err
.
msg
||
'请求失败!'
);
Toast
.
fail
(
err
.
msg
||
'请求失败!'
);
...
@@ -197,33 +208,16 @@ class PublicCarDeal extends Component {
...
@@ -197,33 +208,16 @@ class PublicCarDeal extends Component {
},
},
}));
}));
};
};
render
()
{
MyBody
=
props
=>
{
const
{
const
{
selected
:
{
value
,
dealOpinion
,
carPlate
},
selected
:
{
value
,
dealOpinion
,
carPlate
},
dealDialogVisible
,
dealDialogVisible
,
carPlateList
,
carPlateList
,
}
=
this
.
state
;
}
=
this
.
state
;
return
(
return
(
<
PullToRefresh
<
div
className
=
{
styles
.
repairList
}
>
damping
=
{
60
}
ref
=
{
el
=>
(
this
.
ptr
=
el
)}
style
=
{{
height
:
this
.
state
.
height
,
overflow
:
'auto'
,
}}
indicator
=
{{
deactivate
:
'上拉可以刷新'
}}
direction
=
{
'up'
}
refreshing
=
{
this
.
state
.
refreshing
}
onRefresh
=
{
this
.
refreshHandle
}
>
<
div
className
=
{
styles
.
listInfo
}
>
显示最近半年的报修记录
<
/div
>
<
div
className
=
{
styles
.
listInfo
}
>
显示最近半年的报修记录
<
/div
>
{
this
.
state
.
list
.
length
?
(
{
props
.
children
}
this
.
state
.
list
.
map
(
i
=>
(
<
PublicCarItem
key
=
{
i
.
id
}
data
=
{
i
}
dealHandle
=
{
this
.
dealHandle
}
/
>
))
)
:
(
<
div
className
=
{
styles
.
noData
}
>
暂无数据
<
/div
>
)}
<
Modal
<
Modal
className
=
{
styles
.
dealDialog
}
className
=
{
styles
.
dealDialog
}
visible
=
{
dealDialogVisible
}
visible
=
{
dealDialogVisible
}
...
@@ -300,7 +294,40 @@ class PublicCarDeal extends Component {
...
@@ -300,7 +294,40 @@ class PublicCarDeal extends Component {
)
:
null
}
)
:
null
}
<
/div
>
<
/div
>
<
/Modal
>
<
/Modal
>
<
/PullToRefresh
>
<
/div
>
);
};
render
()
{
const
{
list
,
pagination
}
=
this
.
state
;
return
(
<
ListView
style
=
{{
height
:
this
.
state
.
height
,
}}
className
=
{
styles
.
scrollWrap
}
dataSource
=
{
list
}
pageSize
=
{
pagination
.
pageSize
}
renderBodyComponent
=
{()
=>
<
this
.
MyBody
/>
}
renderRow
=
{
rowData
=>
(
<
PublicCarItem
key
=
{
rowData
.
id
}
data
=
{
rowData
}
dealHandle
=
{
this
.
dealHandle
}
/
>
)}
onEndReached
=
{
this
.
refreshHandle
}
pullToRefresh
=
{
<
PullToRefresh
refreshing
=
{
this
.
state
.
refreshing
}
onRefresh
=
{
this
.
fetchList
}
/
>
}
// renderFooter={() => (
// <div style={{ textAlign: 'center' }}>
// {this.state.refreshing ? 'Loading...' : 'Loaded'}
// </div>
// )}
/
>
);
);
}
}
}
}
...
...
src/containers/Repair/RepairList.js
View file @
d2c4dae4
import
React
,
{
Component
}
from
'react'
;
import
React
,
{
Component
}
from
'react'
;
import
{
PullToRefresh
,
Modal
,
Toast
}
from
'antd-mobile'
;
import
{
ListView
,
PullToRefresh
,
Modal
,
Toast
}
from
'antd-mobile'
;
import
styles
from
'./style.css'
;
import
styles
from
'./style.css'
;
import
RepairItem
from
'./components/RepairItem'
;
import
RepairItem
from
'./components/RepairItem'
;
import
{
fetchRepairList
}
from
'../../api/index'
;
import
{
fetchRepairList
}
from
'../../api/index'
;
...
@@ -8,14 +8,9 @@ import Perview from '../../components/Perview/Perview';
...
@@ -8,14 +8,9 @@ import Perview from '../../components/Perview/Perview';
class
RepairList
extends
Component
{
class
RepairList
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
// const getSectionData = (dataBlob, sectionID) => dataBlob[sectionID];
const
list
=
new
ListView
.
DataSource
({
// const getRowData = (dataBlob, sectionID, rowID) => dataBlob[rowID];
rowHasChanged
:
(
row1
,
row2
)
=>
row1
!==
row2
,
// const list = new ListView.DataSource({
});
// getRowData,
// getSectionHeaderData: getSectionData,
// rowHasChanged: (row1, row2) => row1 !== row2,
// sectionHeaderHasChanged: (s1, s2) => s1 !== s2,
// });
this
.
state
=
{
this
.
state
=
{
refreshing
:
false
,
refreshing
:
false
,
down
:
true
,
down
:
true
,
...
@@ -23,13 +18,15 @@ class RepairList extends Component {
...
@@ -23,13 +18,15 @@ class RepairList extends Component {
pagination
:
{
pagination
:
{
nowDate
:
''
,
nowDate
:
''
,
pageNum
:
1
,
pageNum
:
1
,
pageSize
:
5
0
,
pageSize
:
1
0
,
},
},
list
:
[],
list
:
list
,
sourceList
:
[],
perviewVisibility
:
false
,
perviewVisibility
:
false
,
selectedImgList
:
[],
selectedImgList
:
[],
perviewIndex
:
0
,
perviewIndex
:
0
,
};
};
// this.sourceList = [];
}
}
componentDidMount
()
{
componentDidMount
()
{
let
wrap
=
document
.
querySelector
(
'.RepairContent'
);
let
wrap
=
document
.
querySelector
(
'.RepairContent'
);
...
@@ -43,6 +40,12 @@ class RepairList extends Component {
...
@@ -43,6 +40,12 @@ class RepairList extends Component {
);
);
this
.
fetchList
();
this
.
fetchList
();
}
}
updateList
=
()
=>
{
const
{
sourceList
}
=
this
.
state
;
this
.
setState
(({
list
})
=>
({
list
:
list
.
cloneWithRows
(
sourceList
),
}));
};
fetchList
=
fetchMore
=>
{
fetchList
=
fetchMore
=>
{
const
{
pagination
}
=
this
.
state
;
const
{
pagination
}
=
this
.
state
;
const
nowDate
=
new
Date
().
toISOString
();
const
nowDate
=
new
Date
().
toISOString
();
...
@@ -59,11 +62,11 @@ class RepairList extends Component {
...
@@ -59,11 +62,11 @@ class RepairList extends Component {
fetchRepairList
(
entity
)
fetchRepairList
(
entity
)
.
then
(
res
=>
{
.
then
(
res
=>
{
this
.
setState
(
this
.
setState
(
({
l
ist
,
pagination
})
=>
({
sourceL
ist
,
pagination
})
=>
fetchMore
fetchMore
?
res
.
data
.
length
?
res
.
data
.
length
?
{
?
{
list
:
[...
l
ist
,
...
res
.
data
],
sourceList
:
[...
sourceL
ist
,
...
res
.
data
],
pagination
:
{
pagination
:
{
...
pagination
,
...
pagination
,
pageNum
:
pagination
.
pageNum
+
1
,
pageNum
:
pagination
.
pageNum
+
1
,
...
@@ -74,14 +77,16 @@ class RepairList extends Component {
...
@@ -74,14 +77,16 @@ class RepairList extends Component {
refreshing
:
false
,
refreshing
:
false
,
}
}
:
{
:
{
l
ist
:
res
.
data
,
sourceL
ist
:
res
.
data
,
pagination
:
{
pagination
:
{
...
pagination
,
...
pagination
,
pageNum
:
1
,
nowDate
,
nowDate
,
},
},
refreshing
:
false
,
refreshing
:
false
,
}
}
);
);
this
.
updateList
();
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
Toast
.
fail
(
err
.
msg
||
'请求失败!'
);
Toast
.
fail
(
err
.
msg
||
'请求失败!'
);
...
@@ -105,49 +110,12 @@ class RepairList extends Component {
...
@@ -105,49 +110,12 @@ class RepairList extends Component {
perviewVisibility
:
false
,
perviewVisibility
:
false
,
});
});
};
};
render
()
{
MyBody
=
props
=>
{
const
{
const
{
perviewVisibility
,
selectedImgList
,
perviewIndex
}
=
this
.
state
;
list
,
perviewVisibility
,
selectedImgList
,
perviewIndex
,
}
=
this
.
state
;
return
(
return
(
<
div
className
=
{
styles
.
repairList
}
>
<
div
className
=
{
styles
.
repairList
}
>
{
/* <ListView
<
div
className
=
{
styles
.
listInfo
}
>
显示最近半年的报修记录
<
/div
>
style={{
{
props
.
children
}
height: this.state.height,
}}
dataSource={list}
renderRow={rowData => (
<RepairItem
key={rowData.id}
data={rowData}
showView={this.showViewHandle}
/>
)}
/> */
}
<
PullToRefresh
damping
=
{
60
}
ref
=
{
el
=>
(
this
.
ptr
=
el
)}
style
=
{{
height
:
this
.
state
.
height
,
overflow
:
'auto'
,
}}
indicator
=
{{
deactivate
:
'上拉可以刷新'
}}
direction
=
{
'up'
}
refreshing
=
{
this
.
state
.
refreshing
}
onRefresh
=
{
this
.
refreshHandle
}
>
<
div
className
=
{
styles
.
listInfo
}
>
显示最近半年的报修记录
<
/div
>
{
list
.
length
?
(
list
.
map
(
i
=>
(
<
RepairItem
key
=
{
i
.
id
}
data
=
{
i
}
showView
=
{
this
.
showViewHandle
}
/
>
))
)
:
(
<
div
className
=
{
styles
.
noData
}
>
暂无数据
<
/div
>
)}
<
/PullToRefresh
>
<
Modal
<
Modal
className
=
{
styles
.
perViewDialog
}
className
=
{
styles
.
perViewDialog
}
visible
=
{
perviewVisibility
}
visible
=
{
perviewVisibility
}
...
@@ -160,6 +128,40 @@ class RepairList extends Component {
...
@@ -160,6 +128,40 @@ class RepairList extends Component {
<
/Modal
>
<
/Modal
>
<
/div
>
<
/div
>
);
);
};
render
()
{
const
{
list
,
pagination
}
=
this
.
state
;
return
(
<
ListView
style
=
{{
height
:
this
.
state
.
height
,
}}
className
=
{
styles
.
scrollWrap
}
dataSource
=
{
list
}
pageSize
=
{
pagination
.
pageSize
}
renderBodyComponent
=
{()
=>
<
this
.
MyBody
/>
}
renderRow
=
{
rowData
=>
(
<
RepairItem
key
=
{
rowData
.
id
}
data
=
{
rowData
}
showView
=
{
this
.
showViewHandle
}
/
>
)}
onEndReached
=
{
this
.
refreshHandle
}
pullToRefresh
=
{
<
PullToRefresh
refreshing
=
{
this
.
state
.
refreshing
}
onRefresh
=
{
this
.
fetchList
}
/
>
}
// renderFooter={() => (
// <div style={{ textAlign: 'center' }}>
// {this.state.refreshing ? 'Loading...' : 'Loaded'}
// </div>
// )}
/
>
);
}
}
}
}
...
...
src/containers/Repair/components/RepairItem.js
View file @
d2c4dae4
...
@@ -86,7 +86,7 @@ class RepairItem extends Component {
...
@@ -86,7 +86,7 @@ class RepairItem extends Component {
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div>
,
<
/div>
,
<
div
key
=
"uploadImg"
className
=
{
styles
.
listLine
}
>
<
div
key
=
"uploadImg"
className
=
{
`
${
styles
.
listLine
}
${
styles
.
listLineImg
}
`
}
>
{
imgList
[
0
]
&&
{
imgList
[
0
]
&&
imgList
.
map
((
item
,
idx
)
=>
(
imgList
.
map
((
item
,
idx
)
=>
(
<
div
<
div
...
...
src/containers/Repair/components/style.css
View file @
d2c4dae4
...
@@ -49,6 +49,9 @@
...
@@ -49,6 +49,9 @@
line-height
:
30px
;
line-height
:
30px
;
margin-bottom
:
30px
;
margin-bottom
:
30px
;
}
}
.listLineImg
{
justify-content
:
space-between
;
}
.listLine
:last-child
{
.listLine
:last-child
{
margin-bottom
:
0
;
margin-bottom
:
0
;
}
}
...
...
src/containers/Repair/style.css
View file @
d2c4dae4
...
@@ -3,7 +3,9 @@
...
@@ -3,7 +3,9 @@
flex
:
auto
;
flex
:
auto
;
overflow-y
:
auto
;
overflow-y
:
auto
;
-webkit-overflow-scrolling
:
touch
;
-webkit-overflow-scrolling
:
touch
;
padding-bottom
:
20px
;
}
.scrollWrap
{
background-color
:
#f2f2f2
;
}
}
.footerTopLine
{
.footerTopLine
{
position
:
absolute
;
position
:
absolute
;
...
...
src/containers/RepairDeal/index.js
View file @
d2c4dae4
import
React
,
{
Component
}
from
'react'
;
import
React
,
{
Component
}
from
'react'
;
import
{
PullToRefresh
,
Modal
,
Toast
}
from
'antd-mobile'
;
import
{
ListView
,
PullToRefresh
,
Modal
,
Toast
}
from
'antd-mobile'
;
import
styles
from
'./style.css'
;
import
styles
from
'./style.css'
;
import
RepairItem
from
'../Repair/components/RepairItem'
;
import
RepairItem
from
'../Repair/components/RepairItem'
;
import
{
fetchReportRepairList
,
dealRepair
}
from
'../../api/index'
;
import
{
fetchReportRepairList
,
dealRepair
}
from
'../../api/index'
;
...
@@ -9,6 +9,9 @@ import onCheckIcon from '../../images/Check/radio_on_btn@2x.png';
...
@@ -9,6 +9,9 @@ import onCheckIcon from '../../images/Check/radio_on_btn@2x.png';
class
RepairDeal
extends
Component
{
class
RepairDeal
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
const
list
=
new
ListView
.
DataSource
({
rowHasChanged
:
(
row1
,
row2
)
=>
row1
!==
row2
,
});
this
.
state
=
{
this
.
state
=
{
refreshing
:
false
,
refreshing
:
false
,
down
:
true
,
down
:
true
,
...
@@ -16,14 +19,21 @@ class RepairDeal extends Component {
...
@@ -16,14 +19,21 @@ class RepairDeal extends Component {
pagination
:
{
pagination
:
{
nowDate
:
''
,
nowDate
:
''
,
pageNum
:
1
,
pageNum
:
1
,
pageSize
:
5
0
,
pageSize
:
1
0
,
},
},
list
:
[],
list
:
list
,
sourceList
:
[],
};
};
}
}
componentDidMount
()
{
componentDidMount
()
{
this
.
fetchList
();
this
.
fetchList
();
}
}
updateList
=
()
=>
{
const
{
sourceList
}
=
this
.
state
;
this
.
setState
(({
list
})
=>
({
list
:
list
.
cloneWithRows
(
sourceList
),
}));
};
fetchList
=
fetchMore
=>
{
fetchList
=
fetchMore
=>
{
this
.
setState
({
refreshing
:
true
});
this
.
setState
({
refreshing
:
true
});
const
{
pagination
}
=
this
.
state
;
const
{
pagination
}
=
this
.
state
;
...
@@ -41,29 +51,24 @@ class RepairDeal extends Component {
...
@@ -41,29 +51,24 @@ class RepairDeal extends Component {
fetchReportRepairList
(
entity
)
fetchReportRepairList
(
entity
)
.
then
(
res
=>
{
.
then
(
res
=>
{
this
.
setState
(
this
.
setState
(
({
list
,
pagination
})
=>
({
sourceList
})
=>
fetchMore
fetchMore
?
res
.
data
.
length
?
res
.
data
.
length
?
{
?
{
list
:
[...
list
,
...
res
.
data
],
sourceList
:
[...
sourceList
,
...
res
.
data
],
pagination
:
{
pagination
:
entity
,
...
pagination
,
pageNum
:
pagination
.
pageNum
+
1
,
},
refreshing
:
false
,
refreshing
:
false
,
}
}
:
{
:
{
refreshing
:
false
,
refreshing
:
false
,
}
}
:
{
:
{
list
:
res
.
data
,
sourceList
:
res
.
data
,
pagination
:
{
pagination
:
entity
,
...
pagination
,
nowDate
,
},
refreshing
:
false
,
refreshing
:
false
,
}
}
);
);
this
.
updateList
();
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
Toast
.
fail
(
err
.
msg
||
'请求失败!'
);
Toast
.
fail
(
err
.
msg
||
'请求失败!'
);
...
@@ -116,48 +121,54 @@ class RepairDeal extends Component {
...
@@ -116,48 +121,54 @@ class RepairDeal extends Component {
perviewVisibility
:
false
,
perviewVisibility
:
false
,
});
});
};
};
render
()
{
MyBody
=
props
=>
{
const
{
perviewVisibility
,
selectedImgList
,
perviewIndex
}
=
this
.
state
;
const
{
perviewVisibility
,
selectedImgList
,
perviewIndex
}
=
this
.
state
;
return
[
return
(
<
PullToRefresh
<
div
className
=
{
styles
.
repairList
}
>
key
=
"repairList"
<
div
className
=
{
styles
.
listInfo
}
>
显示最近半年的报修记录
<
/div
>
damping
=
{
60
}
{
props
.
children
}
ref
=
{
el
=>
(
this
.
ptr
=
el
)}
<
Modal
key
=
"repairImgPerview"
className
=
{
styles
.
perViewDialog
}
visible
=
{
perviewVisibility
}
transparent
maskClosable
=
{
true
}
onClose
=
{
this
.
resetDialog
}
title
=
""
>
<
Perview
data
=
{
selectedImgList
}
index
=
{
perviewIndex
}
/
>
<
/Modal
>
<
/div
>
);
};
render
()
{
const
{
list
,
pagination
}
=
this
.
state
;
return
(
<
ListView
style
=
{{
style
=
{{
height
:
this
.
state
.
height
,
height
:
this
.
state
.
height
,
overflow
:
'auto'
,
}}
}}
indicator
=
{{
deactivate
:
'上拉可以刷新'
}}
className
=
{
styles
.
scrollWrap
}
direction
=
{
'up'
}
dataSource
=
{
list
}
refreshing
=
{
this
.
state
.
refreshing
}
pageSize
=
{
pagination
.
pageSize
}
onRefresh
=
{
this
.
refreshHandle
}
renderBodyComponent
=
{()
=>
<
this
.
MyBody
/>
}
>
renderRow
=
{
rowData
=>
(
<
div
className
=
{
styles
.
listInfo
}
>
显示最近半年的报修记录
<
/div
>
<
RepairItem
{
this
.
state
.
list
.
length
?
(
key
=
{
rowData
.
id
}
this
.
state
.
list
.
map
(
i
=>
(
data
=
{
rowData
}
<
RepairItem
dealHandle
=
{
this
.
dealHandle
}
key
=
{
i
.
id
}
showView
=
{
this
.
showViewHandle
}
data
=
{
i
}
/
>
dealHandle
=
{
this
.
dealHandle
}
showView
=
{
this
.
showViewHandle
}
/
>
))
)
:
(
<
div
className
=
{
styles
.
noData
}
>
暂无数据
<
/div
>
)}
)}
<
/PullToRefresh>
,
onEndReached
=
{
this
.
refreshHandle
}
<
Modal
pullToRefresh
=
{
key
=
"repairImgPerview"
<
PullToRefresh
className
=
{
styles
.
perViewDialog
}
refreshing
=
{
this
.
state
.
refreshing
}
visible
=
{
perviewVisibility
}
onRefresh
=
{
this
.
fetchList
}
transparent
/
>
maskClosable
=
{
true
}
}
onClose
=
{
this
.
resetDialog
}
/
>
title
=
""
);
>
<
Perview
data
=
{
selectedImgList
}
index
=
{
perviewIndex
}
/
>
<
/Modal>
,
];
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment