public.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. $(function(){
  2. //导航
  3. var thead=$('header').clone(true);
  4. $('body').append(thead);
  5. thead.addClass('h_fix');
  6. $(window).scroll(function(){
  7. var scrolltop=$(document).scrollTop()
  8. if(scrolltop>500){
  9. $('.h_fix').slideDown(200);
  10. }else{
  11. $('.h_fix').slideUp(200);
  12. }
  13. });
  14. $(".pub_fix").after("<div class='right_cebian'>侧边导航</div>");
  15. $(".index_blur").click(function(){
  16. $(".pub_fix").animate({right:"-70px"},"slow",function(){
  17. $(".right_cebian").show("fast");
  18. });
  19. });
  20. $(".right_cebian").click(function(){
  21. $(".right_cebian").hide("fast");
  22. $(".pub_fix").animate({right:"20px"},"slow",function(){
  23. });
  24. });
  25. //二级导航
  26. $('.nav ul li').mouseenter(function(){
  27. $(this).find('.subnavigation').slideDown(100);
  28. });
  29. $('.nav ul li').mouseleave(function(){
  30. $(this).find('.subnavigation').slideUp(100);
  31. $('.nav ul li').stop(false,true);
  32. });
  33. //挂件
  34. $('.pendent_box').click(function(e){
  35. e.preventDefault();
  36. $("body,html").animate({scrollTop:0},1000)
  37. });
  38. //登陆页面
  39. var hht=$(window).height();
  40. $('.login').height(hht);
  41. $('#Lo_user').focus(function(){
  42. $(this).css({color:'#333333'})
  43. })
  44. $('#Lo_pass').focus(function(){
  45. $(this).val('').css({color:'#333333'});
  46. });
  47. $('#checks').attr('checked',true)
  48. $('#checks').click(function(){
  49. var Cheack=$(this).prop('checked')
  50. if(Cheack){
  51. $('#checks').attr('checked',true)
  52. $(this).parent().removeClass("lab_checkno").addClass("lab_check");
  53. $('#checkst').prop('checked',false);
  54. $('#checkst').parent().removeClass("lab_check").addClass("lab_checkno");
  55. }
  56. })
  57. $('#checkst').click(function(){
  58. var Cheack_no=$(this).prop('checked')
  59. if(Cheack_no){
  60. $(this).parent().removeClass("lab_checkno").addClass("lab_check");
  61. $('#checks').prop('checked',false);
  62. $('#checks').parent().removeClass("lab_check").addClass("lab_checkno");
  63. }
  64. })
  65. //点击x
  66. $('.log_del').click(function(){
  67. $('#Lo_user').val('');
  68. $('#Lo_user').focus();
  69. $('#Lo_user').css({color:'#333333'});
  70. })
  71. // 登陆事件
  72. $('.head_login').click(function(e){
  73. e.preventDefault();
  74. $('.login').fadeIn(800)
  75. $('#form_register').fadeOut(800)
  76. })
  77. $('.login_close').click(function(){
  78. $('.login').fadeOut(800)
  79. $('#form_register').fadeIn(800)
  80. })
  81. $('#form_login').submit(function(e){
  82. e.preventDefault();
  83. var Suser=$('#Lo_user').val();
  84. var Spass=$('#Lo_pass').val();
  85. var check_experts=$('#checks').prop('checked');
  86. var experts=check_experts?0:1;
  87. if(Suser==''||Spass==''||Suser=='用户名/邮箱/手机'||Spass=='请输入密码'){
  88. return false;
  89. }else{
  90. $.ajax({
  91. method: "POST",
  92. dataType: "json",
  93. url: globalConfig.context + "/signin",
  94. data: {
  95. "mobile": Suser,
  96. "password": Spass,
  97. "type": experts,
  98. "remember": false,
  99. },
  100. success: function (rest) {
  101. if (rest.error && rest.error.length) {
  102. $('#msg').val(rest.error[0].message);
  103. msg();
  104. } else {
  105. var data = rest.data;
  106. if (data && data.requestURI) {
  107. var path = globalConfig.context + data.requestURI;
  108. if (data.queryString) {
  109. path += '?' + data.queryString;
  110. }
  111. if (window.location.hash) {
  112. path += window.location.hash;
  113. }
  114. window.location.href = path;
  115. } else {
  116. window.location.href = globalConfig.context + "/user/account/index.html";
  117. }
  118. }
  119. }
  120. })
  121. }
  122. })
  123. //提示框渐隐函数
  124. function msg(){
  125. var lit=$('#msg').val();
  126. if(lit!==''){
  127. $('.smg').fadeIn(500)
  128. }
  129. setTimeout(function(){
  130. $('.smg').fadeOut(500)
  131. $('#msg').val('')
  132. },2000)
  133. }
  134. //在线客服
  135. (function(m, ei, q, i, a, j, s) {
  136. m[i] = m[i] || function() {
  137. (m[i].a = m[i].a || []).push(arguments)
  138. };
  139. j = ei.createElement(q),
  140. s = ei.getElementsByTagName(q)[0];
  141. j.async = true;
  142. j.charset = 'UTF-8';
  143. j.src = 'https://static.meiqia.com/dist/meiqia.js?_=t';
  144. s.parentNode.insertBefore(j, s);
  145. })(window, document, 'script', '_MEIQIA');
  146. _MEIQIA('entId', 77931);
  147. _MEIQIA('withoutBtn');
  148. })