Toggle navigation
Toggle navigation
This project
Loading...
Sign in
mobile
/
yh_vendor
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
盖剑秋
9 years ago
Commit
90aa9c379000b73adbbf4de7afedf35a922559e9
1 parent
a38ac630
Add loading indicator.
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
22 deletions
js/components/AccountSettlement.js
js/containers/AccountSettlementContainer.js
js/services/HomeService.js
js/components/AccountSettlement.js
View file @
90aa9c3
...
...
@@ -9,6 +9,9 @@ import {
Text
,
ListView
,
Dimensions
,
ActivityIndicatorIOS
,
Platform
,
ProgressBarAndroid
,
}
from
'react-native'
;
...
...
@@ -78,14 +81,32 @@ export default class AccountSettlement extends Component {
return
(
<
Text
>
Error
data
source
<
/Text>
)
;
}
render
()
{
let
isFetching
=
this
.
props
.
isFetching
;
let
loadText
=
isFetching
?
'加载中'
:
'上拉加载更多'
;
return
(
<
View
style
=
{
styles
.
container
}
>
<
View
>
<
ListView
style
=
{
styles
.
container
}
dataSource
=
{
this
.
dataSource
.
cloneWithRowsAndSections
(
this
.
props
.
dataBlob
.
toJS
())}
renderRow
=
{
this
.
renderRow
}
onEndReachedThreshold
=
{
-
50
}
onEndReached
=
{
this
.
props
.
fetchNextPage
}
enableEmptySections
=
{
true
}
renderFooter
=
{()
=>
{
if
(
Platform
.
OS
===
'android'
)
{
return
<
View
style
=
{
styles
.
footerContainer
}
>
<
ProgressBarAndroid
style
=
{
styles
.
footerIndicator
}
/
>
<
Text
style
=
{
styles
.
footerText
}
>
{
loadText
}
<
/Text
>
<
/View
>
}
else
{
return
<
View
style
=
{
styles
.
footerContainer
}
>
<
ActivityIndicatorIOS
style
=
{
styles
.
footerIndicator
}
size
=
'small'
animating
=
{
isFetching
}
/
>
<
Text
style
=
{
styles
.
footerText
}
>
{
loadText
}
<
/Text
>
<
/View
>
}
}}
/
>
<
/View
>
);
...
...
@@ -113,6 +134,21 @@ const styles = StyleSheet.create({
textAlign
:
'center'
,
},
footerContainer
:
{
flexDirection
:
'row'
,
},
footerIndicator
:
{
marginTop
:
15
,
marginLeft
:
Dimensions
.
get
(
'window'
).
width
/
2
-
50
,
marginRight
:
10
,
},
footerText
:
{
marginTop
:
17
,
textAlign
:
'center'
,
color
:
'#b1b1b1'
,
},
container
:
{
top
:
64
,
flex
:
1
,
...
...
js/containers/AccountSettlementContainer.js
View file @
90aa9c3
...
...
@@ -70,6 +70,7 @@ export default class AccountSettlementContainer extends Component {
<
AccountSettlement
dataBlob
=
{
mapBlob
}
fetchNextPage
=
{
this
.
fetchNextPage
}
isFetching
=
{
this
.
props
.
actStmt
.
isFetching
}
/
>
);
...
...
js/services/HomeService.js
View file @
90aa9c3
'use strict'
;
import
Request
from
'./Request'
;
import
moment
from
'moment'
;
export
default
class
UserService
{
...
...
@@ -10,30 +9,12 @@ export default class UserService {
this
.
api
=
new
Request
();
}
async
overview
(
brandId
)
{
let
dateId
=
moment
().
format
(
'YYYYMMDD'
);
//20160524
return
await
this
.
api
.
get
({
url
:
'/operations/api/v6/category/getCategory'
,
body
:
{
brandId
,
dateId
}
})
.
then
((
json
)
=>
{
return
json
;
})
.
catch
((
error
)
=>
{
throw
(
error
);
});
}
async
overview
(
shopId
)
{
async
brandRank
(
brandId
)
{
let
dateId
=
moment
().
format
(
'YYYYMMDD'
);
//20160524
return
await
this
.
api
.
get
({
url
:
'/operations/api/v6/category/getCategory'
,
body
:
{
brandId
,
dateId
shopId
,
}
})
.
then
((
json
)
=>
{
...
...
Please
register
or
login
to post a comment