attention.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. wxRequest.followList(userId).then((res)=>{
  70. console.log(res);
  71. console.log(res.data.data);
  72. if(res.statusCode==200){
  73. that.setData({
  74. array:res.data.data
  75. })
  76. console.log(that.data.array);
  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. getFollow:function(userId){
  95. },
  96. open: function (e) {
  97. console.log(e)
  98. wx.navigateTo({
  99. url: '../item/item?row='+JSON.stringify(e.currentTarget.dataset.row)
  100. });
  101. }
  102. })