...
|
...
|
@@ -23,16 +23,13 @@ Page({ |
|
|
let api = new MyAssetsService();
|
|
|
this.setData({ api: api });
|
|
|
this.fetchIncomeList();
|
|
|
//绘制背景
|
|
|
this.drawProgressbg();
|
|
|
//开始progress
|
|
|
this.startProgress();
|
|
|
|
|
|
// this.setData({api: new MyAssetsService()});
|
|
|
},
|
|
|
/**
|
|
|
* 画progress底部背景
|
|
|
*/
|
|
|
drawProgressbg: function () {
|
|
|
drawProgressbg: function (summary) {
|
|
|
// let summary = {
|
|
|
// totalIncome: '130.98',
|
|
|
// goodsIncome: '30.98',
|
...
|
...
|
@@ -47,7 +44,7 @@ Page({ |
|
|
ctx.setLineWidth(10);
|
|
|
// 设置圆环的颜色
|
|
|
let strokeColor = '#E0E0E0'
|
|
|
if (this.data.summary.totalIncome >= 0) {
|
|
|
if (summary && summary.totalIncome >= 0) {
|
|
|
strokeColor = '#65AB85';
|
|
|
}
|
|
|
ctx.setStrokeStyle(strokeColor);
|
...
|
...
|
@@ -93,10 +90,10 @@ Page({ |
|
|
/**
|
|
|
* 开始progress
|
|
|
*/
|
|
|
startProgress: function () {
|
|
|
startProgress: function (summary) {
|
|
|
|
|
|
// 设置倒计时 定时器 每100毫秒执行一次,计数器count+1 ,耗时6秒绘一圈
|
|
|
if (this.data.summary.totalIncome > 0) {
|
|
|
if (summary && summary.totalIncome > 0) {
|
|
|
// this.countTimer = setInterval(() => {
|
|
|
|
|
|
// if (this.data.count <= 60) {
|
...
|
...
|
@@ -126,14 +123,32 @@ Page({ |
|
|
that.data.api.getAssetsList(params, () => {
|
|
|
wx.hideLoading();
|
|
|
}).then(data => {
|
|
|
// let detail = data.data;
|
|
|
that.setData(data);
|
|
|
if (that.data.currentPage <= data.pagetotal){
|
|
|
let cPage = data.page+1;
|
|
|
that.setData({ currentPage: cPage});
|
|
|
}else{
|
|
|
that.setData({ isLast: true });
|
|
|
if(data){
|
|
|
let detail = data.data;
|
|
|
let summary = data.summary;
|
|
|
let cPage = data.page;
|
|
|
if (cPage == 1){
|
|
|
//绘制背景
|
|
|
that.drawProgressbg(summary);
|
|
|
//开始progress
|
|
|
that.startProgress(summary);
|
|
|
}
|
|
|
|
|
|
let isLast = false;
|
|
|
// that.setData(data);
|
|
|
if (that.data.currentPage <= data.pagetotal) {
|
|
|
cPage = data.page + 1;
|
|
|
} else {
|
|
|
isLast = true;
|
|
|
}
|
|
|
that.setData({
|
|
|
data: detail,
|
|
|
currentPage: cPage,
|
|
|
isLast: isLast,
|
|
|
summary: summary
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// console.log(data);
|
|
|
})
|
|
|
},
|
...
|
...
|
|