attention.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. wx.getSystemInfo({
  63. success: function(res) {
  64. that.setData({
  65. winWidth: res.windowWidth,
  66. winHeight: res.windowHeight
  67. });
  68. }
  69. });
  70. // 获取关注的信息
  71. var userId={
  72. userId:wx.getStorageSync('openid')
  73. // userId:'ocVI541TGfnTChi5DlIa7beac2YM'
  74. }
  75. console.log(userId);
  76. this.getFollow(userId);
  77. },
  78. getFollow:function(userId){
  79. var that = this;
  80. wxRequest.followList(userId).then((res)=>{
  81. console.log(res);
  82. console.log(res.data.data);
  83. if(res.statusCode==200){
  84. that.setData({
  85. array:res.data.data
  86. })
  87. console.log(that.data.array);
  88. }else{
  89. wx.showToast({
  90. title: '125',
  91. icon: 'none'
  92. })
  93. }
  94. })
  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. })