common.js 3.8 KB

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