zjh 5 年 前
コミット
4d4de2863c

+ 199 - 64
pages/drop/drop.js

@@ -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
+           })
+        }
+
       }
     })
   },

+ 1 - 0
pages/drop/drop.json

@@ -2,6 +2,7 @@
   "navigationStyle": "custom",
   "enablePullDownRefresh":true,
   "backgroundTextStyle": "dark",
+  "disableScroll":true,
   "usingComponents": {
     "navBar": "/components/navBar/navBar",
     "ec-canvas": "../../ec-canvas/ec-canvas"

+ 6 - 4
pages/drop/drop.wxml

@@ -5,10 +5,12 @@
   <view class="swiper-tab-list {{currentTab==1 ? 'on' : ''}}" data-current="1" bindtap="swichNav">上周实际榜</view>
     <view class="swiper-tab-list {{currentTab==2 ? 'on' : ''}}" data-current="2" bindtap="swichNav">上周预测榜</view>
 </view>
-
+<view class="break" hidden="{{hidebreak}}">
+  <view >刷新中……</view>
+</view>
 <swiper current="{{currentTab}}" class="swiper-box" duration="300"  style="height:{{winHeight - 48}}px" bindchange="bindChange">
   <swiper-item>
-    <scroll-view scroll-y style="height: 100%;">
+    <scroll-view scroll-y style="height: 100%;" refresher-default-style='white' bindscrolltolower="scrolltolower"  bindrefresherrefresh="onRefresh" refresher-triggered="{{loading}}" refresher-enabled="{{true}}"  lower-threshold="1">
       <view class="swiper-box-list">
         <view wx:for="{{uperData}}"class="swiper-box-view" wx:key="index" bindtap="open" data-row='{{item}}'>
           <view class="swiper-box-left">
@@ -29,7 +31,7 @@
     </scroll-view>
   </swiper-item>
   <swiper-item>
-    <scroll-view scroll-y style="height: 100%;">
+    <scroll-view scroll-y style="height: 100%;" refresher-default-style='white' bindscrolltolower="scrolltolower1"  bindrefresherrefresh="onRefresh1" refresher-triggered="{{loading}}" refresher-enabled="{{true}}"  lower-threshold="1">
       <view class="swiper-box-list">
         <view wx:for="{{realData}}"class="swiper-box-view" wx:key="index" bindtap="open" data-row='{{item}}'>
           <view class="swiper-box-left">
@@ -50,7 +52,7 @@
     </scroll-view>
   </swiper-item>
     <swiper-item>
-    <scroll-view scroll-y style="height: 100%;">
+    <scroll-view scroll-y style="height: 100%;" refresher-default-style='white' bindscrolltolower="scrolltolower2"  bindrefresherrefresh="onRefresh2" refresher-triggered="{{loading}}" refresher-enabled="{{true}}"  lower-threshold="1">
       <view class="swiper-box-list">
         <view wx:for="{{onperData}}"class="swiper-box-view" wx:key="index" bindtap="open" data-row='{{item}}'>
           <view class="swiper-box-left">

+ 6 - 3
pages/drop/drop.wxss

@@ -19,7 +19,10 @@ page {
   color: #D81E06;
   border-bottom: 5rpx solid #D81E06;
 }
-
+.break{
+  color: #fff;
+  text-align: center;
+}
 .swiper-box {
   display: block;
   height: 100%;
@@ -27,7 +30,7 @@ page {
   overflow: hidden;
   color: #fff;
 }
-.swiper-box .swiper-box-list{
+/* .swiper-box .swiper-box-list{
   overflow:auto;
   margin:auto;
   position:absolute;
@@ -35,7 +38,7 @@ page {
   bottom:0;
   left:0;
   right:0;
-}
+} */
 .swiper-box .swiper-box-view {
  display: flex;
  justify-content: space-between;

+ 14 - 12
pages/item/item.js

@@ -293,10 +293,10 @@ Page({
       onInit: true
     },
     realchartData:{
-      // actual:[572,556,3555,4744,552,576,3555],
-      // prediction:[572,556,3555,4744,552,576,3555],
+      // actual:[5372,5556,3555,4734,5567,5556,3545,null,null],
+      // prediction:[5722,5246,3555,4744,5542,5756,3755,2235,4556],
       // timeData : [
-      //   '2020/6/1', '2020/6/2', '2020/6/3', '2020/6/4', '2020/6/5', '2020/6/6', '2020/6/7'
+      //   '2020/6/1', '2020/6/2', '2020/6/3', '2020/6/4', '2020/6/5', '2020/6/6', '2020/6/7',"sss","dsd"
       // ],
       // color:"crimson"
     },
@@ -435,17 +435,18 @@ Page({
       var postbyiid = wxRequest.postRequest(Api.posthisfind(),data);
       wx.showLoading({title: '加载中…'})
       postbyiid.then((res)=>{
-      //  console.log(res)
+       console.log(res)
        wx.hideLoading()
        wx.stopPullDownRefresh()
         // console.log(that.recursion(res.data))
         if(res.statusCode==200){
           that.setData({
-           realchartData:that.recursion(res.data.data),
+          //  realchartData:that.recursion(res.data.data),
            newsData:res.data.data.news,
            follow:res.data.data.isFollowed ? "已关注":"关注"
           })
           // initChart(real.detail.canvas, real.detail.width, real.detail.height,real.detail.dpr,that.recursion(res.data.data));
+       
           this.actualComponent.init((canvas, width, height,dpr) => {
             // 初始化图表
             const Chart = echarts.init(canvas, null, {
@@ -486,7 +487,7 @@ Page({
           wx.stopPullDownRefresh()
           if(res.statusCode==200){
             that.setData({
-              nextchartData:that.recursion(res.data.data),
+              // nextchartData:that.recursion(res.data.data),
             })
             // initChart(under.detail.canvas, under.detail.width, under.detail.height,under.detail.dpr,that.recursion(res.data.data));
             this.underComponnet.init((canvas, width, height,dpr) => {
@@ -508,11 +509,12 @@ Page({
         b.unshift(row.actuals[i].close)
         c.unshift(row.actuals[i].pred)
         }
-        if(row.tag){
-          d="#D81E06"
-        }else{
-          d="#07c160"
-        }
+        // if(row.tag){
+        //   d="#D81E06"
+        // }else{
+        //   d="#07c160"
+        // }
+        d=this.data.object.color
 
       return {"timeData":a,"actual":b,"prediction":c,"color":d}
       },
@@ -642,7 +644,7 @@ Page({
             // },
       
             splitNumber: 5,//坐标轴的分割段数
-      
+            scale:true,
             splitLine: {//坐标轴在 grid 区域中的分隔线。
       
               show: true,

+ 150 - 16
pages/rise/rise.js

@@ -54,6 +54,14 @@ 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: {
@@ -188,6 +196,91 @@ Page({
     that.getinclpred()
     that.getincnpred()
   },
+  //下周预测下拉刷新
+  onRefresh: function(e) {
+    this.setData({
+      currentPage: 1,
+      loading:true
+    })
+    this.getincnpred()
+  },
+  //下周预测上拉刷新
+  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.getincnpred()
+
+},
+  //上周实际下拉刷新
+  onRefresh1: function(e) {
+    this.setData({
+      currentPage1: 1,
+      loading:true
+    
+    })
+    this.getinclast()
+  
+    },
+    //上周实际上拉刷新
+    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.getinclast()
+
+  
+  },
+  //上周预测下拉刷新
+  onRefresh2: function(e) {
+    this.setData({
+      currentPage2: 1,
+      loading:true
+    })
+    this.getinclpred()
+      },
+      //上周预测上拉刷新
+  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.getinclpred()
+    
+    },
   onPullDownRefresh: function () {
     wx.showNavigationBarLoading()
     var that = this;
@@ -197,48 +290,89 @@ Page({
   //获取上周实际
   getinclast:function(){
     var that = this;
-    var getinclast = wxRequest.getRequest(Api.getinclast());
-    wx.showLoading({title: '加载中…'})
+    var data={'currPage':that.data.currentPage1}
+    var getinclast = wxRequest.getRequest(Api.getinclast(),data);
+    var pageIndex = that.data.currentPage1;
+    if(pageIndex==1){
+      wx.showLoading({title: '加载中…'})
+    }
     getinclast.then((res)=>{
-      // console.log(res)
+      console.log(res)
       wx.hideLoading()
       wx.stopPullDownRefresh()
       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
+         })
+      }
       }
     })
   },
     //获取上周预测
     getinclpred:function(){
       var that = this;
-      var getinclast = wxRequest.getRequest(Api.getinclpred());
-      wx.showLoading({title: '加载中…'})
+      var data={'currPage':that.data.currentPage2}
+      var getinclast = wxRequest.getRequest(Api.getinclpred(),data);
+      var pageIndex = that.data.currentPage2;
+      if(pageIndex==1){
+        wx.showLoading({title: '加载中…'})
+      }
       getinclast.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
+           })
+        }
+
         }
       })
     },
       //获取下周预测
       getincnpred:function(){
         var that = this;
-    var getinclast = wxRequest.getRequest(Api.getincnpred());
-    wx.showLoading({title: '加载中…'})
+        var data={'currPage':that.data.currentPage}
+    var getinclast = wxRequest.getRequest(Api.getincnpred(),data);
+    var pageIndex = that.data.currentPage;
+    if(pageIndex==1){
+      wx.showLoading({title: '加载中…'})
+    }
     getinclast.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
+           })
+        }
+
       }
     })
   },

+ 1 - 0
pages/rise/rise.json

@@ -1,6 +1,7 @@
 {
   "navigationStyle": "custom",
   "enablePullDownRefresh":true,
+  "disableScroll":true,
   "backgroundTextStyle": "dark",
   "usingComponents": {
     "navBar": "/components/navBar/navBar",

+ 6 - 4
pages/rise/rise.wxml

@@ -5,10 +5,12 @@
   <view class="swiper-tab-list {{currentTab==1 ? 'on' : ''}}" data-current="1" bindtap="swichNav">上周实际榜</view>
     <view class="swiper-tab-list {{currentTab==2 ? 'on' : ''}}" data-current="2" bindtap="swichNav">上周预测榜</view>
 </view>
-
+<view class="break" hidden="{{hidebreak}}">
+  <view >刷新中……</view>
+</view>
 <swiper current="{{currentTab}}" class="swiper-box" duration="300"  style="height:{{winHeight - 48}}px" bindchange="bindChange">
   <swiper-item>
-    <scroll-view scroll-y style="height: 100%;">
+    <scroll-view scroll-y style="height: 100%;" refresher-default-style='white' bindscrolltolower="scrolltolower"  bindrefresherrefresh="onRefresh" refresher-triggered="{{loading}}" refresher-enabled="{{true}}"  lower-threshold="1" >
       <view class="swiper-box-list">
         <view wx:for="{{uperData}}"class="swiper-box-view" wx:key="index" bindtap="open" data-row='{{item}}'>
           <view class="swiper-box-left">
@@ -29,7 +31,7 @@
     </scroll-view>
   </swiper-item>
   <swiper-item>
-    <scroll-view scroll-y style="height: 100%;">
+    <scroll-view scroll-y style="height: 100%;" refresher-default-style='white' bindscrolltolower="scrolltolower1"  bindrefresherrefresh="onRefresh1" refresher-triggered="{{loading}}" refresher-enabled="{{true}}"  lower-threshold="1" >
       <view class="swiper-box-list">
         <view wx:for="{{realData}}"class="swiper-box-view" wx:key="index" bindtap="open" data-row='{{item}}'>
           <view class="swiper-box-left">
@@ -50,7 +52,7 @@
     </scroll-view>
   </swiper-item>
     <swiper-item>
-    <scroll-view scroll-y style="height: 100%;">
+    <scroll-view scroll-y style="height: 100%;" refresher-default-style='white' bindscrolltolower="scrolltolower2"  bindrefresherrefresh="onRefresh2" refresher-triggered="{{loading}}" refresher-enabled="{{true}}"  lower-threshold="1" >
       <view class="swiper-box-list">
         <view wx:for="{{onperData}}"class="swiper-box-view" wx:key="index" bindtap="open" data-row='{{item}}'>
           <view class="swiper-box-left">

+ 6 - 3
pages/rise/rise.wxss

@@ -13,7 +13,10 @@ page {
   width: 30%;
   color: #777;
 }
-
+.break{
+  color: #fff;
+  text-align: center;
+}
 .on {
   color: #D81E06;
   border-bottom: 5rpx solid #D81E06;
@@ -26,7 +29,7 @@ page {
   overflow: hidden;
   color: #fff;
 }
-.swiper-box .swiper-box-list{
+/* .swiper-box .swiper-box-list{
   overflow:auto;
   margin:auto;
   position:absolute;
@@ -34,7 +37,7 @@ page {
   bottom:0;
   left:0;
   right:0;
-}
+} */
 .swiper-box .swiper-box-view {
  display: flex;
  justify-content: space-between;

+ 1 - 0
project.config.json

@@ -20,6 +20,7 @@
 		"checkInvalidKey": true,
 		"checkSiteMap": true,
 		"uploadWithSourceMap": true,
+		"compileHotReLoad": false,
 		"babelSetting": {
 			"ignore": [],
 			"disablePlugins": [],