|
@@ -2,51 +2,51 @@ import * as echarts from '../../ec-canvas/echarts';
|
|
|
var Api = require('../../utils/api.js');
|
|
|
var wxRequest = require('../../utils/wxRequest.js')
|
|
|
var app = getApp()
|
|
|
-function initChart(canvas, width, height, dpr, data) {
|
|
|
- const chart = echarts.init(canvas, null, {
|
|
|
- width: width,
|
|
|
- height: height,
|
|
|
- devicePixelRatio: dpr // new
|
|
|
- });
|
|
|
- canvas.setChart(chart);
|
|
|
+// function initChart(canvas, width, height, dpr, data) {
|
|
|
+// const chart = echarts.init(canvas, null, {
|
|
|
+// width: width,
|
|
|
+// height: height,
|
|
|
+// devicePixelRatio: dpr // new
|
|
|
+// });
|
|
|
+// canvas.setChart(chart);
|
|
|
|
|
|
- var option = {
|
|
|
- xAxis : {
|
|
|
- type : 'category',
|
|
|
- splitNumber: 2,
|
|
|
- scale: true,
|
|
|
- show:false,
|
|
|
- splitLine:{
|
|
|
- show:false
|
|
|
- }
|
|
|
- },
|
|
|
- yAxis : {
|
|
|
- type : 'value',
|
|
|
- splitNumber: 2,
|
|
|
- scale: true,
|
|
|
- show:false,
|
|
|
- splitLine:{
|
|
|
- show:false
|
|
|
- }
|
|
|
- },
|
|
|
+// var option = {
|
|
|
+// xAxis : {
|
|
|
+// type : 'category',
|
|
|
+// splitNumber: 2,
|
|
|
+// scale: true,
|
|
|
+// show:false,
|
|
|
+// splitLine:{
|
|
|
+// show:false
|
|
|
+// }
|
|
|
+// },
|
|
|
+// yAxis : {
|
|
|
+// type : 'value',
|
|
|
+// splitNumber: 2,
|
|
|
+// scale: true,
|
|
|
+// show:false,
|
|
|
+// splitLine:{
|
|
|
+// show:false
|
|
|
+// }
|
|
|
+// },
|
|
|
|
|
|
- series: [{
|
|
|
- type: 'line',
|
|
|
- smooth: true,
|
|
|
- symbol: 'none',
|
|
|
- lineStyle: {
|
|
|
- color: '#D81E06',
|
|
|
- },
|
|
|
- data:data,
|
|
|
- areaStyle: {
|
|
|
- color: '#D81E06',
|
|
|
- },
|
|
|
- }]
|
|
|
- };
|
|
|
+// series: [{
|
|
|
+// type: 'line',
|
|
|
+// smooth: true,
|
|
|
+// symbol: 'none',
|
|
|
+// lineStyle: {
|
|
|
+// color: '#D81E06',
|
|
|
+// },
|
|
|
+// data:data,
|
|
|
+// areaStyle: {
|
|
|
+// color: '#D81E06',
|
|
|
+// },
|
|
|
+// }]
|
|
|
+// };
|
|
|
|
|
|
- chart.setOption(option);
|
|
|
- return chart;
|
|
|
-}
|
|
|
+// chart.setOption(option);
|
|
|
+// return chart;
|
|
|
+// }
|
|
|
|
|
|
Page({
|
|
|
|
|
@@ -54,11 +54,19 @@ Page({
|
|
|
// 页面配置
|
|
|
winWidth: 0,
|
|
|
winHeight: 0,
|
|
|
+ hidebreak: true,//下拉刷新
|
|
|
+ currentPage:1,//当前页
|
|
|
+ currentPage1:1,//上周实际当前页
|
|
|
+ currentPage2:1,//上周预测当前页
|
|
|
+ totalpages:0,//总页数
|
|
|
+ totalpages1:0,//上周实际总页数
|
|
|
+ totalpages2:0,//上周预测总页数
|
|
|
+ loading:false,
|
|
|
// tab切换
|
|
|
currentTab: 0,
|
|
|
- ec: {
|
|
|
- onInit: initChart
|
|
|
- },
|
|
|
+ // ec: {
|
|
|
+ // onInit: initChart
|
|
|
+ // },
|
|
|
realData:[
|
|
|
// {
|
|
|
// title:'BK0422',
|
|
@@ -188,56 +196,183 @@ Page({
|
|
|
that.getdeclpred()
|
|
|
that.getdecnpred()
|
|
|
},
|
|
|
+ //下周预测下拉刷新
|
|
|
+ onRefresh: function(e) {
|
|
|
+ this.setData({
|
|
|
+ currentPage: 1,
|
|
|
+ loading:true
|
|
|
+ })
|
|
|
+
|
|
|
+ this.getdecnpred()
|
|
|
+ },
|
|
|
+ //下周预测上拉刷新
|
|
|
+ scrolltolower:function() {
|
|
|
+ var that = this;
|
|
|
+ var tempCurrentPage = that.data.currentPage;
|
|
|
+ tempCurrentPage = tempCurrentPage + 1;
|
|
|
+ if(that.data.currentPage==that.data.totalpages){
|
|
|
+ wx.showLoading({title: '已经到底啦'})
|
|
|
+ setTimeout(function(){
|
|
|
+ wx.hideLoading()
|
|
|
+ },600);
|
|
|
+ return
|
|
|
+ }
|
|
|
+ that.setData({
|
|
|
+ currentPage: tempCurrentPage,
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ that.getdecnpred()
|
|
|
+
|
|
|
+},
|
|
|
+ //上周实际下拉刷新
|
|
|
+ onRefresh1: function(e) {
|
|
|
+ this.setData({
|
|
|
+ currentPage: 1,
|
|
|
+ loading:true
|
|
|
+ })
|
|
|
+ this.getdeclast()
|
|
|
+
|
|
|
+ },
|
|
|
+ //上周实际上拉刷新
|
|
|
+ scrolltolower1:function() {
|
|
|
+ var that = this;
|
|
|
+ var tempCurrentPage = that.data.currentPage1;
|
|
|
+ tempCurrentPage = tempCurrentPage + 1;
|
|
|
+ if(that.data.currentPage1==that.data.totalpages1){
|
|
|
+ wx.showLoading({title: '已经到底啦'})
|
|
|
+ setTimeout(function(){
|
|
|
+ wx.hideLoading()
|
|
|
+ },600);
|
|
|
+ return
|
|
|
+ }
|
|
|
+ that.setData({
|
|
|
+ currentPage1: tempCurrentPage,
|
|
|
+ })
|
|
|
+
|
|
|
+ that.getdeclast()
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+ //上周预测下拉刷新
|
|
|
+ onRefresh2: function(e) {
|
|
|
+ this.setData({
|
|
|
+ currentPage: 1,
|
|
|
+ loading:true
|
|
|
+ })
|
|
|
+ this.getdeclpred()
|
|
|
+ },
|
|
|
+ //上周预测上拉刷新
|
|
|
+ scrolltolower2:function() {
|
|
|
+ var that = this;
|
|
|
+ var tempCurrentPage = that.data.currentPage2;
|
|
|
+ tempCurrentPage = tempCurrentPage + 1;
|
|
|
+ if(that.data.currentPage2==that.data.totalpages2){
|
|
|
+ wx.showLoading({title: '已经到底啦'})
|
|
|
+ setTimeout(function(){
|
|
|
+ wx.hideLoading()
|
|
|
+ },600);
|
|
|
+ return
|
|
|
+ }
|
|
|
+ that.setData({
|
|
|
+ currentPage2: tempCurrentPage,
|
|
|
+ })
|
|
|
+
|
|
|
+ that.getdeclpred()
|
|
|
+
|
|
|
+ },
|
|
|
onPullDownRefresh: function () {
|
|
|
wx.showNavigationBarLoading()
|
|
|
var that = this;
|
|
|
this.onLoad(); //重新加载onLoad()
|
|
|
},
|
|
|
+
|
|
|
//获取上周实际
|
|
|
getdeclast:function(){
|
|
|
var that = this;
|
|
|
- var getinclast = wxRequest.getRequest(Api.getdeclast());
|
|
|
- wx.showLoading({title: '加载中…'})
|
|
|
- getinclast.then((res)=>{
|
|
|
+ var data={'currPage':that.data.currentPage1}
|
|
|
+ var getdeclast = wxRequest.getRequest(Api.getdeclast(),data);
|
|
|
+ var pageIndex = that.data.currentPage1;
|
|
|
+ if(pageIndex==1){
|
|
|
+ wx.showLoading({title: '加载中…'})
|
|
|
+ }
|
|
|
+ getdeclast.then((res)=>{
|
|
|
+ console.log(res)
|
|
|
wx.hideLoading()
|
|
|
wx.stopPullDownRefresh()
|
|
|
- // console.log(res)
|
|
|
if(res.statusCode==200){
|
|
|
- that.setData({
|
|
|
- realData:res.data.data
|
|
|
- })
|
|
|
+ if(pageIndex==1){
|
|
|
+ that.setData({
|
|
|
+ realData:res.data.data.incInfos,
|
|
|
+ totalpages1:res.data.data.pages,
|
|
|
+ loading:false
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ var realArray=that.data.realData.concat(res.data.data.incInfos)
|
|
|
+ that.setData({
|
|
|
+ realData:realArray
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
//获取上周预测
|
|
|
getdeclpred:function(){
|
|
|
var that = this;
|
|
|
- var getinclast = wxRequest.getRequest(Api.getdeclpred());
|
|
|
- wx.showLoading({title: '加载中…'})
|
|
|
- getinclast.then((res)=>{
|
|
|
+ var data={'currPage':that.data.currentPage2}
|
|
|
+ var getdeclpred = wxRequest.getRequest(Api.getdeclpred(),data);
|
|
|
+ var pageIndex = that.data.currentPage2;
|
|
|
+ if(pageIndex==1){
|
|
|
+ wx.showLoading({title: '加载中…'})
|
|
|
+ }
|
|
|
+ getdeclpred.then((res)=>{
|
|
|
wx.hideLoading()
|
|
|
wx.stopPullDownRefresh()
|
|
|
// console.log(res)
|
|
|
if(res.statusCode==200){
|
|
|
- that.setData({
|
|
|
- onperData:res.data.data
|
|
|
- })
|
|
|
+ if(pageIndex==1){
|
|
|
+ that.setData({
|
|
|
+ onperData:res.data.data.incInfos,
|
|
|
+ totalpages2:res.data.data.pages,
|
|
|
+ loading:false
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ var onperArray=that.data.onperData.concat(res.data.data.incInfos)
|
|
|
+ that.setData({
|
|
|
+ onperData:onperArray
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
//获取下周预测
|
|
|
getdecnpred:function(){
|
|
|
var that = this;
|
|
|
- var getinclast = wxRequest.getRequest(Api.getdecnpred());
|
|
|
- wx.showLoading({title: '加载中…'})
|
|
|
- getinclast.then((res)=>{
|
|
|
+ var data={'currPage':that.data.currentPage}
|
|
|
+ var getdecnpred = wxRequest.getRequest(Api.getdecnpred(),data);
|
|
|
+ var pageIndex = that.data.currentPage;
|
|
|
+ if(pageIndex==1){
|
|
|
+ wx.showLoading({title: '加载中…'})
|
|
|
+ }
|
|
|
+ getdecnpred.then((res)=>{
|
|
|
wx.hideLoading()
|
|
|
wx.stopPullDownRefresh()
|
|
|
// console.log(res)
|
|
|
if(res.statusCode==200){
|
|
|
- that.setData({
|
|
|
- uperData:res.data.data
|
|
|
- })
|
|
|
+ if(pageIndex==1){
|
|
|
+ that.setData({
|
|
|
+ uperData:res.data.data.incInfos,
|
|
|
+ totalpages:res.data.data.pages,
|
|
|
+ loading:false
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ var uperArray=that.data.uperData.concat(res.data.data.incInfos)
|
|
|
+ that.setData({
|
|
|
+ uperData:uperArray
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
},
|