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, // 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() }, onPullDownRefresh: function () { wx.showNavigationBarLoading() var that = this; this.onLoad(); //重新加载onLoad() }, //获取上周实际 getinclast:function(){ var that = this; var getinclast = wxRequest.getRequest(Api.getinclast()); wx.showLoading({title: '加载中…'}) getinclast.then((res)=>{ // console.log(res) wx.hideLoading() wx.stopPullDownRefresh() if(res.statusCode==200){ that.setData({ realData:res.data.data }) } }) }, //获取上周预测 getinclpred:function(){ var that = this; var getinclast = wxRequest.getRequest(Api.getinclpred()); wx.showLoading({title: '加载中…'}) getinclast.then((res)=>{ wx.hideLoading() wx.stopPullDownRefresh() // console.log(res) if(res.statusCode==200){ that.setData({ onperData:res.data.data }) } }) }, //获取下周预测 getincnpred:function(){ var that = this; var getinclast = wxRequest.getRequest(Api.getincnpred()); wx.showLoading({title: '加载中…'}) getinclast.then((res)=>{ wx.hideLoading() wx.stopPullDownRefresh() // console.log(res) if(res.statusCode==200){ that.setData({ uperData:res.data.data }) } }) }, // 滑动切换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) }); } })