common.js 4.2 KB

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