import * as echarts from '../../ec-canvas/echarts'; // var Api = require('../../api/urls.js'); var wxRequest = require('../../api/request.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 }, array:[], currentPage:1, uerId:wx.getStorageSync('openid') }, onLoad: function() { var that = this; // 获取关注的信息 // var data={ // userId:this.data.uerId, // currPage:this.data.currentPage // }; // var that = this; // wx.showLoading({title: '加载中…'}); this.getFollow(this.data.uerId,this.data.currentPage); // wxRequest.followList(data).then((res)=>{ // console.log(res); // wx.hideLoading() // if(res.statusCode==200){ // that.setData({ // array:res.data.data.incInfos // }) // }else{ // wx.showToast({ // title: '125', // icon: 'none' // }) // } // }) // 获取系统信息 wx.getSystemInfo({ success: function(res) { that.setData({ winWidth: res.windowWidth, winHeight: res.windowHeight }); } }); }, 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, userId:wx.getStorageSync('openid') }) that.getFollow(that.data.userId,that.data.currentPage); }, getFollow:function(userId,currentPage){ console.log(userId,currentPage); let data = { userId:userId, currPage:currentPage } var pageIndex = this.data.currentPage; if(pageIndex==1){ wx.showLoading({title: '加载中…'}) } wxRequest.followList(data).then((res)=>{ console.log(res); wx.hideLoading() if(res.statusCode==200){ if(pageIndex==1){ this.setData({ array:res.data.data.incInfos, totalpages:res.data.data.pages }) }else{ var array=this.data.array.concat(res.data.data.incInfos) this.setData({ array:array }) } }else{ wx.showToast({ title: '125', icon: 'none' }) } }) }, open: function (e) { console.log(e) wx.navigateTo({ url: '../item/item?row='+JSON.stringify(e.currentTarget.dataset.row) }); } })