common.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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].$refs.r1.address=uni.getStorageSync('windpowerstationName');
  53. page[page.length - 1].$refs.r1.FDC = uni.getStorageSync('windPowerStationId');
  54. page[page.length - 1].$refs.r1.windStationName = windpowerstationName.replace('风电场', '');
  55. page[page.length - 1].$refs.r1.getWeatherDataToday();
  56. page[page.length - 1].$refs.r1.getWeatherData7();
  57. page[page.length - 1].$refs.r1.getWeatherData();
  58. page[page.length - 1].$refs.r1.getWeatherData40();
  59. // page[page.length - 1].$vm.$children[0].getWeatherDataToday();
  60. // page[page.length - 1].$vm.$children[0].getWeatherData7();
  61. // page[page.length - 1].$vm.$children[0].getWeatherData();
  62. // page[page.length - 1].$vm.$children[0].getWeatherData40();
  63. }
  64. // uni.showModal({
  65. // title: '提示',
  66. // content: page,
  67. // success: function (res) {
  68. // if (res.confirm) {
  69. // console.log('用户点击确定');
  70. // } else if (res.cancel) {
  71. // console.log('用户点击取消');
  72. // }
  73. // }
  74. // });
  75. // uni.switchTab({
  76. // url: url,success: function(e) {
  77. // //if (page[0] == undefined || page[0] == null) return;
  78. // page[page.length-1].onLoad();
  79. // }
  80. // })
  81. }
  82. }
  83. let common = new Common();
  84. export default common;