common.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. }else if (page[page.length - 1].route == "components/monitor/MatrixMonitor") {
  48. page[page.length - 1].$vm.FDC= uni.getStorageSync('windPowerStationId');
  49. page[page.length - 1].$vm.windStationName = windpowerstationName.replace('风电场', '');
  50. }else if (page[page.length - 1].route == "pages/forecast/Forecast") {
  51. //page[page.length-1].$refs.r1.viewUserid();
  52. page[page.length - 1].$vm.$children[0].getWeatherDataToday();
  53. page[page.length - 1].$vm.$children[0].getWeatherData7();
  54. page[page.length - 1].$vm.$children[0].getWeatherData();
  55. page[page.length - 1].$vm.$children[0].getWeatherData40();
  56. page[page.length - 1].$vm.$children[0].address = windpowerstationName;
  57. if (windpowerstationName == "宁夏新能源公司") {
  58. page[page.length - 1].$vm.$children[0].windStationName = "麻黄山";
  59. page[page.length - 1].$vm.$children[0].FDC = "MHS_FDC";
  60. }
  61. if (windpowerstationName == "麻黄山风电场") {
  62. page[page.length - 1].$vm.$children[0].windStationName = "麻黄山";
  63. page[page.length - 1].$vm.$children[0].FDC = "MHS_FDC";
  64. }
  65. if (windpowerstationName == "牛首山风电场") {
  66. page[page.length - 1].$vm.$children[0].windStationName = "牛首山";
  67. page[page.length - 1].$vm.$children[0].FDC = "NSS_FDC";
  68. }
  69. if (windpowerstationName == "石板泉风电场") {
  70. page[page.length - 1].$vm.$children[0].windStationName = "石板泉";
  71. page[page.length - 1].$vm.$children[0].FDC = "SBQ_FDC";
  72. }
  73. if (windpowerstationName == "青山风电场") {
  74. page[page.length - 1].$vm.$children[0].windStationName = "青山";
  75. page[page.length - 1].$vm.$children[0].FDC = "QS_FDC";
  76. }
  77. if (windpowerstationName == "香山风电场") {
  78. page[page.length - 1].$vm.$children[0].windStationName = "香山";
  79. page[page.length - 1].$vm.$children[0].FDC = "XS_FDC";
  80. }
  81. if (windpowerstationName == "河北能源集团") {
  82. page[page.length - 1].$vm.$children[0].windStationName = "崇礼";
  83. page[page.length - 1].$vm.$children[0].FDC = "CL_FDC";
  84. }
  85. if (windpowerstationName == "崇礼风电场") {
  86. page[page.length - 1].$vm.$children[0].windStationName = "崇礼";
  87. page[page.length - 1].$vm.$children[0].FDC = "CL_FDC";
  88. }
  89. if (windpowerstationName == "康保风电场") {
  90. page[page.length - 1].$vm.$children[0].windStationName = "康保";
  91. page[page.length - 1].$vm.$children[0].FDC = "KB_FDC";
  92. }
  93. if (windpowerstationName == "代县风电场") {
  94. page[page.length - 1].$vm.$children[0].windStationName = "代县";
  95. page[page.length - 1].$vm.$children[0].FDC = "YMG_FDC";
  96. }
  97. uni.setStorageSync('windPowerStationId',page[page.length - 1].$vm.$children[0].FDC);
  98. }
  99. // uni.showModal({
  100. // title: '提示',
  101. // content: page,
  102. // success: function (res) {
  103. // if (res.confirm) {
  104. // console.log('用户点击确定');
  105. // } else if (res.cancel) {
  106. // console.log('用户点击取消');
  107. // }
  108. // }
  109. // });
  110. // uni.switchTab({
  111. // url: url,success: function(e) {
  112. // //if (page[0] == undefined || page[0] == null) return;
  113. // page[page.length-1].onLoad();
  114. // }
  115. // })
  116. }
  117. }
  118. let common = new Common();
  119. export default common;