public.js 4.4 KB

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