common.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. $.ajaxSetup({
  2. cache: false
  3. });
  4. function search_ask() {
  5. var search = $("#search").val();
  6. if (search == "") {
  7. easyDialog.open({
  8. container : {
  9. content : '还未输入搜索内容'
  10. },
  11. follow : "search",
  12. followX : 0,
  13. followY : 42,
  14. autoClose : 1500,
  15. overlay : false
  16. });
  17. return false;
  18. }
  19. }
  20. function search_sory() {
  21. var search = $("#search_advisory").val();
  22. if (search == "") {
  23. easyDialog.open({
  24. container : {
  25. content : '还未输入搜索内容'
  26. },
  27. follow : "search",
  28. followX : -123,
  29. followY : 100,
  30. autoClose : 1500,
  31. overlay : false
  32. });
  33. return false;
  34. }
  35. }
  36. function login() {
  37. var username = $("#username").val();
  38. var password = $("#password").val();
  39. if (username == "" || password == ""){
  40. easyDialog.open({
  41. container : {
  42. content : '请输入用户名或者密码'
  43. },
  44. follow : "username",
  45. followX : 320,
  46. followY : 22,
  47. autoClose : 1500,
  48. overlay : false
  49. });
  50. return false;
  51. }
  52. }
  53. function login_index() {
  54. var username = $("#username").val();
  55. var password = $("#password").val();
  56. if (username == "" || password == ""){
  57. $("#erroTips").html("请输入用户名或者密码");
  58. $("#erroTips").show(1000);
  59. return false;
  60. }
  61. var form1 = $("#index_login_form");
  62. form1.submit();
  63. // var url="/ajax/login_index";
  64. //
  65. // $.ajax({
  66. // url:url,
  67. // type: "post",
  68. // cache: false,
  69. // dataType: "json",
  70. // data: {
  71. // username:username,
  72. // password:password
  73. // },
  74. // global: true,
  75. // success: function(data){
  76. //
  77. // if(!data.is_login){
  78. // $("#erroTips").html("帐号/邮箱或者密码错误!");
  79. //
  80. // $("#erroTips").show(1000);
  81. //
  82. // }else{
  83. // var form1 = $("#index_login_form");
  84. //
  85. // form1.submit();
  86. // }
  87. //
  88. // },
  89. // error:function(err){
  90. //
  91. // is=false;
  92. // }
  93. // });
  94. }
  95. $(function() {
  96. $('#search').focus(function(){
  97. var url="ajax/get_search_works";
  98. $('#search').autocomplete({
  99. source: url,
  100. 'select':function(ev,ui) {
  101. $('#search').val(ui.item.label);
  102. $('#searchform').submit();}
  103. });
  104. }).blur(function (){
  105. var url="ajax/get_search_works";
  106. $('#search').autocomplete({
  107. source: url,
  108. 'select':function(ev,ui) {
  109. $('#search').val(ui.item.label);
  110. $('#searchform').submit();}
  111. });
  112. });
  113. //系统信息
  114. $("a[id^='get_msg_']").click(function() {
  115. var msg = $(this).attr("data");
  116. var a = msg.split("_");
  117. document.getElementById("fromuid").value = a[0];
  118. document.getElementById("on_page").value = a[1];
  119. var form = document.getElementById("msgform");
  120. form.submit();
  121. });
  122. //我的订单
  123. $("a[id^='get_oder_']").click(function() {
  124. var msg = $(this).attr("data");
  125. document.getElementById("on_page").value = msg;
  126. $("#oderform").submit();
  127. });
  128. $("#pu").click(function() {
  129. $("#pu").addClass('now');
  130. $("#vip").removeClass('now');
  131. $("#question_e").show();
  132. $("#vip_question_e").hide();
  133. });
  134. $("#vip").click(function() {
  135. $("#pu").removeClass('now');
  136. $("#vip").addClass('now');
  137. $("#question_e").hide();
  138. $("#vip_question_e").show();
  139. });
  140. $("#user_action").click(function() {
  141. $("#user_action").addClass('now');
  142. $("#sys_action").removeClass('now');
  143. $("#user").show();
  144. $("#sys").hide();
  145. });
  146. $("#sys_action").click(function() {
  147. $("#user_action").removeClass('now');
  148. $("#sys_action").addClass('now');
  149. $("#user").hide();
  150. $("#sys").show();
  151. });
  152. })
  153. /**
  154. * 设置系统信息的读取时间
  155. *
  156. * @param val
  157. */
  158. function set_msg_time(val) {
  159. document.getElementById("time").value = val;
  160. }
  161. function set_oder_time(val) {
  162. document.getElementById("time").value = val;
  163. document.getElementById("on_page").value = 1;
  164. $("#oderform").submit();
  165. }