attention.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. import * as echarts from '../../ec-canvas/echarts';
  2. // var Api = require('../../api/urls.js');
  3. var wxRequest = require('../../api/request.js')
  4. var app = getApp()
  5. function initChart(canvas, width, height, dpr, data) {
  6. const chart = echarts.init(canvas, null, {
  7. width: width,
  8. height: height,
  9. devicePixelRatio: dpr // new
  10. });
  11. canvas.setChart(chart);
  12. var option = {
  13. xAxis : {
  14. type : 'category',
  15. splitNumber: 2,
  16. scale: true,
  17. show:false,
  18. splitLine:{
  19.     show:false
  20.   }
  21. },
  22. yAxis : {
  23. type : 'value',
  24. splitNumber: 2,
  25. scale: true,
  26. show:false,
  27. splitLine:{
  28.     show:false
  29.    }
  30. },
  31. series: [{
  32. type: 'line',
  33. smooth: true,
  34. symbol: 'none',
  35. lineStyle: {
  36. color: '#D81E06',
  37. },
  38. data:data,
  39. areaStyle: {
  40. color: '#D81E06',
  41. },
  42. }]
  43. };
  44. chart.setOption(option);
  45. return chart;
  46. }
  47. Page({
  48. data: {
  49. // 页面配置
  50. winWidth: 0,
  51. winHeight: 0,
  52. // tab切换
  53. currentTab: 0,
  54. ec: {
  55. onInit: initChart
  56. },
  57. array:[],
  58. currentPage:1,
  59. uerId:wx.getStorageSync('openid')
  60. },
  61. onLoad: function() {
  62. var that = this;
  63. // 获取关注的信息
  64. var data={
  65. userId:this.data.uerId,
  66. currPage:this.data.currentPage
  67. };
  68. var that = this;
  69. wx.showLoading({title: '加载中…'});
  70. wxRequest.followList(data).then((res)=>{
  71. console.log(res);
  72. wx.hideLoading()
  73. if(res.statusCode==200){
  74. that.setData({
  75. array:res.data.data.incInfos
  76. })
  77. }else{
  78. wx.showToast({
  79. title: '125',
  80. icon: 'none'
  81. })
  82. }
  83. })
  84. // 获取系统信息
  85. wx.getSystemInfo({
  86. success: function(res) {
  87. that.setData({
  88. winWidth: res.windowWidth,
  89. winHeight: res.windowHeight
  90. });
  91. }
  92. });
  93. },
  94. scrolltolower:function() {
  95. var that = this;
  96. var tempCurrentPage = that.data.currentPage;
  97. tempCurrentPage = tempCurrentPage + 1;
  98. if(that.data.currentPage==that.data.totalpages){
  99. wx.showLoading({title: '已经到底啦'})
  100. setTimeout(function(){
  101. wx.hideLoading()
  102. },600);
  103. return
  104. }
  105. that.setData({
  106. currentPage: tempCurrentPage,
  107. })
  108. },
  109. getFollow:function(userId){
  110. },
  111. open: function (e) {
  112. console.log(e)
  113. wx.navigateTo({
  114. url: '../item/item?row='+JSON.stringify(e.currentTarget.dataset.row)
  115. });
  116. }
  117. })