You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

68 regels
2.2 KiB

  1. /**
  2. * Created by wangxj on 2017/7/18.
  3. */
  4. var frame_height = $(window).height() - 95;
  5. $(".control-bar").height(frame_height);
  6. $("#main").height(frame_height);
  7. var iframe_hei = $(window).height() - 95;
  8. document.domain = domain_path;
  9. console.log(iframe_hei);
  10. $("#main").css("min-height", iframe_hei);
  11. $(document).ready(function () {
  12. activeMenu();
  13. //导航栏点击
  14. $("#top_menu").on('click', 'span', function () {
  15. var data_role = $(this).attr('data-action');
  16. activeMenu(data_role);
  17. });
  18. //菜单点击
  19. $(".colot_ttt").on('click', function () {
  20. $("#main").attr('src', $(this).attr('href'));
  21. })
  22. });
  23. window.onbeforeunload = function () {
  24. var main = $("#main");
  25. var data_role = $(main).attr('path_role');
  26. $.cookie('path_role', data_role, {path:"/",domain:domain_path});
  27. $.cookie('path_url', $(main).attr('src'), {path:"/",domain:domain_path});
  28. return null;
  29. };
  30. function activeMenu(id) {
  31. var path_url;
  32. if (id === undefined) {
  33. path_url = $.cookie('path_url');
  34. var path_role = $.cookie('path_role');
  35. if(path_role === undefined) {
  36. id = 104;
  37. }else{
  38. id = path_role;
  39. }
  40. }
  41. var selector = $('[data-role=' + id + ']');
  42. $('[data-control=menu-url]').removeClass('selected_menu');
  43. $(selector).addClass('selected_menu');
  44. //如果url中带了http,需要手动去除
  45. var url = path_url===undefined?$(selector).attr('href'):path_url;
  46. path_url = url.replace(/https?:\/\/[^\/]*/, '');
  47. if(path_url === '/zz-jd/outside_hotel_order_list.html')
  48. path_url = '/hotel/supplier-backend/index';
  49. //激活导航栏
  50. var main = $(selector).closest('.nav-item').attr('data-role');
  51. var top_menu = $("#top_menu");
  52. var nav = $(top_menu).find("span[data-role=" + main + "]");
  53. $(top_menu).find("span").removeClass('head_selected').addClass('select_hover');
  54. $(nav).removeClass('select_hover').addClass('head_selected');
  55. $(".nav-item").addClass('hidden');
  56. $(".nav-item[data-role='"+ main + "']").removeClass('hidden');
  57. $("#main")
  58. .attr('path_role', id)
  59. .attr("src", window.location.protocol + '//' + window.location.host + path_url);
  60. }