rise.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. import * as echarts from '../../ec-canvas/echarts';
  2. var app = getApp()
  3. function initChart(canvas, width, height, dpr, data) {
  4. const chart = echarts.init(canvas, null, {
  5. width: width,
  6. height: height,
  7. devicePixelRatio: dpr // new
  8. });
  9. canvas.setChart(chart);
  10. var option = {
  11. xAxis : {
  12. type : 'category',
  13. splitNumber: 2,
  14. scale: true,
  15. show:false,
  16. splitLine:{
  17.     show:false
  18.   }
  19. },
  20. yAxis : {
  21. type : 'value',
  22. splitNumber: 2,
  23. scale: true,
  24. show:false,
  25. splitLine:{
  26.     show:false
  27.    }
  28. },
  29. series: [{
  30. type: 'line',
  31. smooth: true,
  32. symbol: 'none',
  33. lineStyle: {
  34. color: '#D81E06',
  35. },
  36. data:data,
  37. areaStyle: {
  38. color: '#D81E06',
  39. },
  40. }]
  41. };
  42. chart.setOption(option);
  43. return chart;
  44. }
  45. Page({
  46. data: {
  47. // 页面配置
  48. winWidth: 0,
  49. winHeight: 0,
  50. // tab切换
  51. currentTab: 0,
  52. ec: {
  53. onInit: initChart
  54. },
  55. array:[
  56. {
  57. title:'BK0422',
  58. subtitle:"交运物流",
  59. Increase:"+1.22",
  60. digital:"33",
  61. color:'crimson',
  62. data:[52,56,355,444]
  63. },
  64. {
  65. title:'BK0738',
  66. subtitle:"多元金融",
  67. Increase:"+1.22",
  68. digital:"33",
  69. color:'crimson',
  70. data:[52,56,355,444]
  71. },
  72. {
  73. title:'BK0450',
  74. subtitle:"港口水运",
  75. Increase:"+1.22",
  76. digital:"33",
  77. color:'crimson',
  78. data:[52,56,355,444,52,56,355,444,52,56,355,444,2]
  79. },
  80. {
  81. title:'BK0734',
  82. subtitle:"珠宝首饰",
  83. Increase:"+1.22",
  84. digital:"33",
  85. color:'crimson',
  86. data:[52,56,355,44554]
  87. },
  88. {
  89. title:'BK0471',
  90. subtitle:"化纤行业",
  91. Increase:"+1.22",
  92. digital:"33",
  93. color:'crimson',
  94. data:[52,56,355,444]
  95. },
  96. {
  97. title:'BK0485',
  98. subtitle:"旅游酒店",
  99. Increase:"+1.22",
  100. digital:"33",
  101. color:'crimson',
  102. data:[52,56,355,444]
  103. },
  104. {
  105. title:'BK0475',
  106. subtitle:"银行",
  107. Increase:"+1.22",
  108. digital:"33",
  109. color:'crimson',
  110. data:[52,56,355,44554]
  111. },
  112. {
  113. title:'BK0473',
  114. subtitle:"券商信托",
  115. Increase:"+1.22",
  116. digital:"33",
  117. color:'crimson',
  118. data:[52,56,355,444]
  119. },
  120. {
  121. title:'BK0474',
  122. subtitle:"保险",
  123. Increase:"+1.22",
  124. color:'crimson',
  125. digital:"33",
  126. data:[52,56,355,444]
  127. },
  128. {
  129. title:'BK0478',
  130. subtitle:"有色金属",
  131. Increase:"+1.22",
  132. digital:"33",
  133. color:'crimson',
  134. data:[52,56,355,44554]
  135. },
  136. {
  137. title:'BK0738',
  138. subtitle:"多元金融",
  139. Increase:"+1.22",
  140. digital:"33",
  141. color:'crimson',
  142. data:[52,56,355,44554]
  143. }
  144. ]
  145. },
  146. onLoad: function() {
  147. var that = this;
  148. // 获取系统信息
  149. wx.getSystemInfo({
  150. success: function(res) {
  151. let navHeight,
  152. isiOS = res.system.indexOf('iOS') > -1
  153. if(isiOS){
  154. navHeight=44
  155. }else{
  156. navHeight=48
  157. }
  158. that.setData({
  159. winWidth: res.windowWidth,
  160. winHeight: res.windowHeight - res.statusBarHeight - navHeight
  161. });
  162. }
  163. });
  164. },
  165. // 滑动切换tab
  166. bindChange: function(e) {
  167. var that = this;
  168. that.setData({
  169. currentTab: e.detail.current
  170. });
  171. },
  172. // 点击tab切换
  173. swichNav: function(e) {
  174. var that = this;
  175. if (this.data.currentTab === e.target.dataset.current) {
  176. return false;
  177. } else {
  178. that.setData({
  179. currentTab: e.target.dataset.current
  180. })
  181. }
  182. },
  183. open: function (e) {
  184. console.log(e)
  185. wx.navigateTo({
  186. url: '../item/item?row='+JSON.stringify(e.currentTarget.dataset.row)
  187. });
  188. }
  189. })