123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404 |
- 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);
- // 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',
- // },
- // }]
- // };
- // chart.setOption(option);
- // return chart;
- // }
- Page({
- data: {
- // 页面配置
- 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
- // },
- realData:[
- // {
- // title:'BK0422',
- // subtitle:"交运物流",
- // Increase:"+1.22",
- // digital:"33",
- // color:'crimson',
- // keep:"已关注",
- // data:[52,56,355,444]
- // },
- // {
- // title:'BK0738',
- // subtitle:"多元金融",
- // Increase:"+1.22",
- // digital:"33",
- // color:'crimson',
- // keep:"已关注",
- // data:[52,56,355,444]
- // },
- // {
- // title:'BK0450',
- // subtitle:"港口水运",
- // Increase:"+1.22",
- // digital:"33",
- // color:'crimson',
- // keep:"已关注",
- // data:[52,56,355,444,52,56,355,444,52,56,355,444,2]
- // },
- // {
- // title:'BK0734',
- // subtitle:"珠宝首饰",
- // Increase:"+1.22",
- // digital:"33",
- // color:'crimson',
- // keep:"关注",
- // data:[52,56,355,44554]
- // },
- // {
- // title:'BK0471',
- // subtitle:"化纤行业",
- // Increase:"+1.22",
- // digital:"33",
- // keep:"关注",
- // color:'crimson',
- // data:[52,56,355,444]
- // },
- // {
- // title:'BK0485',
- // subtitle:"旅游酒店",
- // Increase:"+1.22",
- // digital:"33",
- // color:'crimson',
- // keep:"关注",
- // data:[52,56,355,444]
- // },
- // {
- // title:'BK0475',
- // subtitle:"银行",
- // Increase:"+1.22",
- // digital:"33",
- // keep:"关注",
- // color:'crimson',
- // data:[52,56,355,44554]
- // },
- // {
- // title:'BK0473',
- // subtitle:"券商信托",
- // Increase:"+1.22",
- // digital:"33",
- // color:'crimson',
- // keep:"关注",
- // data:[52,56,355,444]
- // },
- // {
- // title:'BK0474',
- // subtitle:"保险",
- // Increase:"+1.22",
- // color:'crimson',
- // keep:"关注",
- // digital:"33",
- // data:[52,56,355,444]
- // },
- // {
- // title:'BK0478',
- // subtitle:"有色金属",
- // Increase:"+1.22",
- // keep:"关注",
- // digital:"33",
- // color:'crimson',
- // data:[52,56,355,44554]
- // },
- // {
- // title:'BK0738',
- // subtitle:"多元金融",
- // Increase:"+1.22",
- // digital:"33",
- // keep:"关注",
- // color:'crimson',
- // data:[52,56,355,44554]
- // }
- ],
- onperData:[],
- uperData:[],
- },
- onLoad: function() {
- var that = this;
- // 获取系统信息
- wx.getSystemInfo({
- success: function(res) {
- let navHeight,
- isiOS = res.system.indexOf('iOS') > -1
- if(isiOS){
- navHeight=44
- }else{
- navHeight=48
-
- }
- that.setData({
- winWidth: res.windowWidth,
- winHeight: res.windowHeight - res.statusBarHeight - navHeight
- });
- }
- });
- that.getinclast()
- 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;
- this.onLoad(); //重新加载onLoad()
- },
- //获取上周实际
- getinclast:function(){
- var that = this;
- 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)
- wx.hideLoading()
- wx.stopPullDownRefresh()
- if(res.statusCode==200){
- 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 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){
- 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 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){
- 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
- })
- }
- }
- })
- },
- // 滑动切换tab
- bindChange: function(e) {
- var that = this;
- that.setData({
- currentTab: e.detail.current
- });
- },
- // 点击tab切换
- swichNav: function(e) {
- var that = this;
- if (this.data.currentTab === e.target.dataset.current) {
- return false;
- } else {
- that.setData({
- currentTab: e.target.dataset.current
- })
- }
- },
- open: function (e) {
- // console.log(e)
- wx.navigateTo({
- url: '../item/item?row='+JSON.stringify(e.currentTarget.dataset.row)
- });
- }
- })
|