attention.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. },
  59. onLoad: function() {
  60. var that = this;
  61. // 获取关注的信息
  62. var userId={
  63. userId:wx.getStorageSync('openid')
  64. // userId:'ocVI541TGfnTChi5DlIa7beac2YM'
  65. }
  66. // console.log(userId);
  67. var that = this;
  68. // this.getFollow(userId);
  69. wx.showLoading({title: '加载中…'})
  70. wxRequest.followList(userId).then((res)=>{
  71. // console.log(res);
  72. // console.log(res.data.data);
  73. wx.hideLoading()
  74. if(res.statusCode==200){
  75. that.setData({
  76. array:res.data.data
  77. })
  78. // console.log(that.data.array);
  79. }else{
  80. wx.showToast({
  81. title: '125',
  82. icon: 'none'
  83. })
  84. }
  85. })
  86. // 获取系统信息
  87. wx.getSystemInfo({
  88. success: function(res) {
  89. that.setData({
  90. winWidth: res.windowWidth,
  91. winHeight: res.windowHeight
  92. });
  93. }
  94. });
  95. },
  96. getFollow:function(userId){
  97. },
  98. open: function (e) {
  99. console.log(e)
  100. wx.navigateTo({
  101. url: '../item/item?row='+JSON.stringify(e.currentTarget.dataset.row)
  102. });
  103. }
  104. })