rise.js 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. import * as echarts from '../../ec-canvas/echarts';
  2. var Api = require('../../utils/api.js');
  3. var wxRequest = require('../../utils/wxRequest.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. realData:[
  58. // {
  59. // title:'BK0422',
  60. // subtitle:"交运物流",
  61. // Increase:"+1.22",
  62. // digital:"33",
  63. // color:'crimson',
  64. // keep:"已关注",
  65. // data:[52,56,355,444]
  66. // },
  67. // {
  68. // title:'BK0738',
  69. // subtitle:"多元金融",
  70. // Increase:"+1.22",
  71. // digital:"33",
  72. // color:'crimson',
  73. // keep:"已关注",
  74. // data:[52,56,355,444]
  75. // },
  76. // {
  77. // title:'BK0450',
  78. // subtitle:"港口水运",
  79. // Increase:"+1.22",
  80. // digital:"33",
  81. // color:'crimson',
  82. // keep:"已关注",
  83. // data:[52,56,355,444,52,56,355,444,52,56,355,444,2]
  84. // },
  85. // {
  86. // title:'BK0734',
  87. // subtitle:"珠宝首饰",
  88. // Increase:"+1.22",
  89. // digital:"33",
  90. // color:'crimson',
  91. // keep:"关注",
  92. // data:[52,56,355,44554]
  93. // },
  94. // {
  95. // title:'BK0471',
  96. // subtitle:"化纤行业",
  97. // Increase:"+1.22",
  98. // digital:"33",
  99. // keep:"关注",
  100. // color:'crimson',
  101. // data:[52,56,355,444]
  102. // },
  103. // {
  104. // title:'BK0485',
  105. // subtitle:"旅游酒店",
  106. // Increase:"+1.22",
  107. // digital:"33",
  108. // color:'crimson',
  109. // keep:"关注",
  110. // data:[52,56,355,444]
  111. // },
  112. // {
  113. // title:'BK0475',
  114. // subtitle:"银行",
  115. // Increase:"+1.22",
  116. // digital:"33",
  117. // keep:"关注",
  118. // color:'crimson',
  119. // data:[52,56,355,44554]
  120. // },
  121. // {
  122. // title:'BK0473',
  123. // subtitle:"券商信托",
  124. // Increase:"+1.22",
  125. // digital:"33",
  126. // color:'crimson',
  127. // keep:"关注",
  128. // data:[52,56,355,444]
  129. // },
  130. // {
  131. // title:'BK0474',
  132. // subtitle:"保险",
  133. // Increase:"+1.22",
  134. // color:'crimson',
  135. // keep:"关注",
  136. // digital:"33",
  137. // data:[52,56,355,444]
  138. // },
  139. // {
  140. // title:'BK0478',
  141. // subtitle:"有色金属",
  142. // Increase:"+1.22",
  143. // keep:"关注",
  144. // digital:"33",
  145. // color:'crimson',
  146. // data:[52,56,355,44554]
  147. // },
  148. // {
  149. // title:'BK0738',
  150. // subtitle:"多元金融",
  151. // Increase:"+1.22",
  152. // digital:"33",
  153. // keep:"关注",
  154. // color:'crimson',
  155. // data:[52,56,355,44554]
  156. // }
  157. ],
  158. onperData:[],
  159. uperData:[],
  160. },
  161. onLoad: function() {
  162. var that = this;
  163. // 获取系统信息
  164. wx.getSystemInfo({
  165. success: function(res) {
  166. let navHeight,
  167. isiOS = res.system.indexOf('iOS') > -1
  168. if(isiOS){
  169. navHeight=44
  170. }else{
  171. navHeight=48
  172. }
  173. that.setData({
  174. winWidth: res.windowWidth,
  175. winHeight: res.windowHeight - res.statusBarHeight - navHeight
  176. });
  177. }
  178. });
  179. that.getinclast()
  180. that.getinclpred()
  181. that.getincnpred()
  182. },
  183. onPullDownRefresh: function () {
  184. wx.showNavigationBarLoading()
  185. var that = this;
  186. this.onLoad(); //重新加载onLoad()
  187. },
  188. //获取上周实际
  189. getinclast:function(){
  190. var that = this;
  191. var getinclast = wxRequest.getRequest(Api.getinclast());
  192. wx.showLoading({title: '加载中…'})
  193. getinclast.then((res)=>{
  194. // console.log(res)
  195. wx.hideLoading()
  196. wx.stopPullDownRefresh()
  197. if(res.statusCode==200){
  198. that.setData({
  199. realData:res.data.data
  200. })
  201. }
  202. })
  203. },
  204. //获取上周预测
  205. getinclpred:function(){
  206. var that = this;
  207. var getinclast = wxRequest.getRequest(Api.getinclpred());
  208. wx.showLoading({title: '加载中…'})
  209. getinclast.then((res)=>{
  210. wx.hideLoading()
  211. wx.stopPullDownRefresh()
  212. // console.log(res)
  213. if(res.statusCode==200){
  214. that.setData({
  215. onperData:res.data.data
  216. })
  217. }
  218. })
  219. },
  220. //获取下周预测
  221. getincnpred:function(){
  222. var that = this;
  223. var getinclast = wxRequest.getRequest(Api.getincnpred());
  224. wx.showLoading({title: '加载中…'})
  225. getinclast.then((res)=>{
  226. wx.hideLoading()
  227. wx.stopPullDownRefresh()
  228. // console.log(res)
  229. if(res.statusCode==200){
  230. that.setData({
  231. uperData:res.data.data
  232. })
  233. }
  234. })
  235. },
  236. // 滑动切换tab
  237. bindChange: function(e) {
  238. var that = this;
  239. that.setData({
  240. currentTab: e.detail.current
  241. });
  242. },
  243. // 点击tab切换
  244. swichNav: function(e) {
  245. var that = this;
  246. if (this.data.currentTab === e.target.dataset.current) {
  247. return false;
  248. } else {
  249. that.setData({
  250. currentTab: e.target.dataset.current
  251. })
  252. }
  253. },
  254. open: function (e) {
  255. // console.log(e)
  256. wx.navigateTo({
  257. url: '../item/item?row='+JSON.stringify(e.currentTarget.dataset.row)
  258. });
  259. }
  260. })