common.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. class Common {
  2. constructor() {
  3. }
  4. //跳转
  5. navTo(url) {
  6. uni.navigateTo({
  7. url: url
  8. })
  9. }
  10. goback(url) {
  11. var page = getCurrentPages();
  12. //debugger
  13. console.log(page);
  14. console.log(url);
  15. let windpowerstationName = uni.getStorageSync('windpowerstationName');
  16. page[page.length - 1].$vm.address = windpowerstationName;
  17. // if(windpowerstationName=="宁夏新能源公司"){
  18. // if(page[page.length-1].route=="components/weatherProphethomepage/WeatherProphethomepage"){
  19. // page[page.length-1].$vm.FDC="MHS_FDC";
  20. // }else{
  21. // page[page.length-1].$vm.FDC="0";
  22. // }
  23. // }
  24. // if(windpowerstationName=="麻黄山风电场"){
  25. // page[page.length-1].$vm.FDC="MHS_FDC";
  26. // }
  27. // if(windpowerstationName=="牛首山风电场"){
  28. // page[page.length-1].$vm.FDC="NSS_FDC";
  29. // }
  30. // if(windpowerstationName=="石板泉风电场"){
  31. // page[page.length-1].$vm.FDC="SBQ_FDC";
  32. // }
  33. // if(windpowerstationName=="青山风电场"){
  34. // page[page.length-1].$vm.FDC="QS_FDC";
  35. // }
  36. // if(windpowerstationName=="香山风电场"){
  37. // page[page.length-1].$vm.FDC="XS_FDC";
  38. // }
  39. //首页
  40. if (page[page.length - 1].route == "pages/index/Index") {
  41. page[page.length - 1].$vm.FDC= uni.getStorageSync('windPowerStationId');
  42. page[page.length - 1].$vm.target_comprehensive_indicators();
  43. page[page.length - 1].$vm.target_windSpeed_power();
  44. page[page.length - 1].$vm.index_windturbine_status();
  45. page[page.length - 1].$vm.index_electricQuantity();
  46. page[page.length - 1].$vm.index_target_basic_indicators();
  47. }
  48. if (page[page.length - 1].route == "pages/forecast/Forecast") {
  49. //page[page.length-1].$refs.r1.viewUserid();
  50. page[page.length - 1].$vm.$children[0].getWeatherDataToday();
  51. page[page.length - 1].$vm.$children[0].getWeatherData7();
  52. page[page.length - 1].$vm.$children[0].getWeatherData();
  53. page[page.length - 1].$vm.$children[0].getWeatherData40();
  54. page[page.length - 1].$vm.$children[0].address = windpowerstationName;
  55. if (windpowerstationName == "宁夏新能源公司") {
  56. page[page.length - 1].$vm.$children[0].windStationName = "麻黄山";
  57. page[page.length - 1].$vm.$children[0].FDC = "MHS_FDC";
  58. }
  59. if (windpowerstationName == "麻黄山风电场") {
  60. page[page.length - 1].$vm.$children[0].windStationName = "麻黄山";
  61. page[page.length - 1].$vm.$children[0].FDC = "MHS_FDC";
  62. }
  63. if (windpowerstationName == "牛首山风电场") {
  64. page[page.length - 1].$vm.$children[0].windStationName = "牛首山";
  65. page[page.length - 1].$vm.$children[0].FDC = "NSS_FDC";
  66. }
  67. if (windpowerstationName == "石板泉风电场") {
  68. page[page.length - 1].$vm.$children[0].windStationName = "石板泉";
  69. page[page.length - 1].$vm.$children[0].FDC = "SBQ_FDC";
  70. }
  71. if (windpowerstationName == "青山风电场") {
  72. page[page.length - 1].$vm.$children[0].windStationName = "青山";
  73. page[page.length - 1].$vm.$children[0].FDC = "QS_FDC";
  74. }
  75. if (windpowerstationName == "香山风电场") {
  76. page[page.length - 1].$vm.$children[0].windStationName = "香山";
  77. page[page.length - 1].$vm.$children[0].FDC = "XS_FDC";
  78. }
  79. if (windpowerstationName == "河北能源集团") {
  80. page[page.length - 1].$vm.$children[0].windStationName = "崇礼";
  81. page[page.length - 1].$vm.$children[0].FDC = "CL_FDC";
  82. }
  83. if (windpowerstationName == "崇礼风电场") {
  84. page[page.length - 1].$vm.$children[0].windStationName = "崇礼";
  85. page[page.length - 1].$vm.$children[0].FDC = "CL_FDC";
  86. }
  87. if (windpowerstationName == "康保风电场") {
  88. page[page.length - 1].$vm.$children[0].windStationName = "康保";
  89. page[page.length - 1].$vm.$children[0].FDC = "KB_FDC";
  90. }
  91. if (windpowerstationName == "代县风电场") {
  92. page[page.length - 1].$vm.$children[0].windStationName = "代县";
  93. page[page.length - 1].$vm.$children[0].FDC = "YMG_FDC";
  94. }
  95. uni.setStorageSync('windPowerStationId',page[page.length - 1].$vm.$children[0].FDC);
  96. }
  97. // uni.showModal({
  98. // title: '提示',
  99. // content: page,
  100. // success: function (res) {
  101. // if (res.confirm) {
  102. // console.log('用户点击确定');
  103. // } else if (res.cancel) {
  104. // console.log('用户点击取消');
  105. // }
  106. // }
  107. // });
  108. // uni.switchTab({
  109. // url: url,success: function(e) {
  110. // //if (page[0] == undefined || page[0] == null) return;
  111. // page[page.length-1].onLoad();
  112. // }
  113. // })
  114. }
  115. }
  116. let common = new Common();
  117. export default common;