common.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. page[page.length - 1].$vm.index_curve_columnar_windSpeed_power();
  48. } else if (page[page.length - 1].route == "components/monitor/MatrixMonitor") {
  49. page[page.length - 1].$vm.FDC = uni.getStorageSync('windPowerStationId');
  50. page[page.length - 1].$vm.windStationName = windpowerstationName.replace('风电场', '');
  51. } else if (page[page.length - 1].route == "pages/forecast/Forecast") {
  52. //#ifdef H5
  53. page[page.length - 1].$refs.r1.viewUserid();
  54. page[page.length - 1].$refs.r1.address = uni.getStorageSync('windpowerstationName');
  55. page[page.length - 1].$refs.r1.FDC = uni.getStorageSync('windPowerStationId');
  56. page[page.length - 1].$refs.r1.windStationName = windpowerstationName.replace('风电场', '');
  57. page[page.length - 1].$refs.r1.getWeatherDataToday();
  58. page[page.length - 1].$refs.r1.getWeatherData7();
  59. page[page.length - 1].$refs.r1.getWeatherData();
  60. page[page.length - 1].$refs.r1.getWeatherData40();
  61. //#endif
  62. //#ifdef APP-PLUS
  63. page[page.length - 1].$vm.$children[0].address = uni.getStorageSync('windpowerstationName');
  64. page[page.length - 1].$vm.$children[0].FDC = uni.getStorageSync('windPowerStationId');
  65. page[page.length - 1].$vm.$children[0].windStationName = windpowerstationName.replace('风电场', '');
  66. page[page.length - 1].$vm.$children[0].getWeatherDataToday();
  67. page[page.length - 1].$vm.$children[0].getWeatherData7();
  68. page[page.length - 1].$vm.$children[0].getWeatherData();
  69. page[page.length - 1].$vm.$children[0].getWeatherData40();
  70. //#endif
  71. }
  72. // uni.showModal({
  73. // title: '提示',
  74. // content: page,
  75. // success: function (res) {
  76. // if (res.confirm) {
  77. // console.log('用户点击确定');
  78. // } else if (res.cancel) {
  79. // console.log('用户点击取消');
  80. // }
  81. // }
  82. // });
  83. // uni.switchTab({
  84. // url: url,success: function(e) {
  85. // //if (page[0] == undefined || page[0] == null) return;
  86. // page[page.length-1].onLoad();
  87. // }
  88. // })
  89. }
  90. }
  91. let common = new Common();
  92. export default common;