timeInput.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /**
  2. * 时间插件类
  3. */
  4. define(['meteoDir/other/DatePicker/WdatePicker',
  5. 'meteoDir/other/meteoVideo/meteoVideo'], function (wdt, video) {
  6. var time = {
  7. input: null,
  8. count: 0, //用来记录当前有多少功能开启了时间轴
  9. init: function () {
  10. var content = "<div class='meteo-time-boxone'>" +
  11. "<iframe frameborder='0' class='cover-iframe'></iframe>" +
  12. "<div id='meteo-time-box' class='cover-content'></div>" +
  13. "</div>";
  14. $('body').append(content);
  15. $('.meteo-time-boxone').hide();
  16. video.init('meteo-time-box', function () {
  17. // $(".meteo-title-left").draggable()
  18. $(".meteo-title-left").dragmove($('.meteo-time-boxone'));
  19. })
  20. ONEMAP.C.publisher.subscribe(function (option) { //全屏动画
  21. if (option) {
  22. $(".meteo-time-boxone").animate({ //时间轴
  23. top: "120%"
  24. }, 400)
  25. var top = $('.meteo-legend-box').css('top'); //色标
  26. top = parseInt(top) + 64;
  27. $(".meteo-legend-box").animate({
  28. top: top + 'px'
  29. }, 400)
  30. } else {
  31. $(".meteo-time-boxone").animate({ //时间轴
  32. top: "78%"
  33. }, 400)
  34. var top = $('.meteo-legend-box').css('top'); //色标
  35. top = parseInt(top) - 64;
  36. $(".meteo-legend-box").animate({
  37. top: top + 'px'
  38. }, 400)
  39. }
  40. }, 'layout::fullMap');
  41. },
  42. open: function (isSea) {
  43. // if (time.count == 0) //第一次开启时间轴时重置时间(现在改为每次都重置时间
  44. video.clearTime(isSea);
  45. time.count++;
  46. // video.initTime();
  47. $('.meteo-time-boxone').show();
  48. },
  49. close: function () {
  50. time.count--;
  51. if (time.count == 0){
  52. $('.meteo-time-boxone').hide();
  53. video.stop();
  54. }
  55. },
  56. getTime: function () {
  57. var myTime = $('#meteo-video-query-startDate').val();
  58. myTime = myTime.split('/').join('-');
  59. myTime = myTime.length > 15 ? myTime.substring(0, 16) : myTime;
  60. return myTime;
  61. },
  62. getVti: function () {
  63. var vti = $('.meteo-video-progress-nowtime').html();
  64. return vti;
  65. },
  66. timeUpdate: function () {
  67. for (var key in meteo.f) {
  68. if (meteo.f[key].update) meteo.f[key].update();
  69. }
  70. },
  71. updateOdate: function (e) {
  72. video.updateQbTime();
  73. },
  74. clearOdate: function (e) {
  75. video.clearTime(false);
  76. }
  77. }
  78. return time;
  79. });