countdown.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. $(function () {
  2. settime();
  3. });
  4. //验证码类型
  5. var sms_type;
  6. var smstype;
  7. var countdown=100;
  8. var indexRoute = $("#indexRoute").val();
  9. $("#countdown").css("backgroundColor","#fff")
  10. function settime() {
  11. if (countdown == 0) {
  12. $("#btn").hide();
  13. window.location.href=indexRoute;
  14. } else {
  15. countdown--;
  16. if(document.getElementById('countdown')){
  17. document.getElementById('countdown').innerHTML = countdown;
  18. }
  19. }
  20. setTimeout(function() {
  21. settime();
  22. },1000)
  23. }
  24. //用户名、帐号登录
  25. $('.loginUser').click(function(){
  26. $('label[for="user"]').addClass('select');
  27. $('label[for="pwd"]').removeClass('select');
  28. });
  29. $('.loginPwd').click(function(){
  30. $('label[for="pwd"]').addClass('select');
  31. $('label[for="user"]').removeClass('select');
  32. });
  33. $('.loginBtn').click(function(){
  34. var account = $("#user").val();
  35. var password = $("#pwd").val();
  36. var autoLogin = $("#autoLogin").val();
  37. if (account == "") {
  38. dialogDiv('请输入用户名','确定','Display');
  39. return false;
  40. }
  41. if (password == "") {
  42. dialogDiv('请输入密码','确定','Display');
  43. return false;
  44. }
  45. $.ajax({
  46. headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
  47. url: $("#form1").attr('action'),
  48. type: 'POST',
  49. dataType: 'json',
  50. data: {
  51. account:account,
  52. password:password,
  53. autoLogin:autoLogin,
  54. },
  55. success: function (result) {
  56. location.href=result.data.redirect_url;
  57. },
  58. error: function (errorData) {
  59. if (errorData.status==422) {//验证错误
  60. $.each(JSON.parse(errorData.responseText).errors,function (key,val) {
  61. dialogDiv(val[0],'确定','Display');
  62. return false;
  63. });
  64. }
  65. else if(errorData.status==400) {//业务错误
  66. dialogDiv(JSON.parse(errorData.responseText).message,'确定','Display');
  67. }
  68. }
  69. })
  70. });
  71. // 手机动态码登录
  72. var regularMobile = /^13[0-9]{9}$|14[0-9]{9}$|15[0-9]{9}$|18[0-9]{9}$|17[0-9]{9}$/; // 验证手机号正则
  73. $('#J_dologinByMobile').on('click', function() {
  74. var mobileValue = $.trim($('input[name=mobile]').val());
  75. var verfyCodeValue = $.trim($('input[name=verfy_code]').val());
  76. var isQuick = $("#is_quick").val();
  77. if (mobileValue == "") {
  78. dialogDiv('请输入手机号','确定','Display');
  79. $('input[name=mobile]').focus();
  80. return false;
  81. }
  82. if (mobileValue != "" && !regularMobile.test(mobileValue)) {
  83. dialogDiv('手机号码格式不正确','确定','Display');
  84. return false;
  85. }
  86. if (verfyCodeValue == "") {
  87. dialogDiv('请填写验证码','确定','Display');
  88. $('input[name=verfy_code]').focus();
  89. return false;
  90. }
  91. $.ajax({
  92. headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
  93. url: $("#form2").attr('action_to'),
  94. type: 'POST',
  95. dataType: 'json',
  96. data: {
  97. mobile:mobileValue,
  98. mobile_code:verfyCodeValue,
  99. },
  100. success: function (result) {
  101. location.href=result.data.redirect_url;
  102. },
  103. error: function (errorData) {
  104. if (errorData.status==422) {//验证错误
  105. $.each(JSON.parse(errorData.responseText).errors,function (key,val) {
  106. dialogDiv(val[0],'确定','Display');
  107. return false;
  108. });
  109. }
  110. else if(errorData.status==400) {//业务错误
  111. dialogDiv(JSON.parse(errorData.responseText).message,'确定','Display');
  112. }
  113. }
  114. })
  115. });
  116. //登录获取验证码
  117. $("#getverificode").click(function () {
  118. var is_reg = $("#is_reg").val();
  119. var is_status = $("#is_status").val();
  120. var mobileValue = $.trim($('#mobile').val());
  121. if (mobileValue == '') {
  122. dialogDiv('请输入手机号码','确定','Display');
  123. $('#mobile').focus();
  124. return false;
  125. };
  126. if (mobileValue != "" && !regularMobile.test(mobileValue)) {
  127. dialogDiv('请输入正确的手机号码','确定','Display');
  128. $('#mobile').focus();
  129. return false;
  130. }
  131. if(is_status==1){
  132. if(is_reg==1)
  133. {
  134. $.ajax({
  135. headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
  136. url: $("#form2").attr('action'),
  137. type: 'POST',
  138. dataType: 'json',
  139. data: {
  140. mobile:mobileValue,
  141. },
  142. success: function (result) {
  143. // 开始倒计时
  144. var countdownZZ = 60;
  145. function settime() {
  146. if (countdownZZ == 0) {
  147. $('#getverificode').prop("disabled", 0);
  148. $('#getverificode').removeClass('btn_disabled');
  149. $('#getverificode').html('获取验证码');
  150. $("#is_status").val(1);
  151. countdownZZ = 100;
  152. return;
  153. } else {
  154. $("#is_status").val(0);
  155. $('#getverificode').prop("disabled", !0);
  156. $('#getverificode').addClass('btn_disabled');
  157. $("#getverificode").css('font-size','18px')
  158. $('#getverificode').html('重新发送' + countdownZZ + '秒');
  159. countdownZZ--;
  160. }
  161. setTimeout(function() {
  162. settime()
  163. },1000)
  164. }
  165. settime();
  166. },
  167. error: function (errorData) {
  168. if (errorData.status==422) {//验证错误
  169. $.each(JSON.parse(errorData.responseText).errors,function (key,val) {
  170. dialogDiv(val[0],'确定','Display');
  171. return false;
  172. });
  173. }
  174. else if(errorData.status==400) {//业务错误
  175. dialogDiv(JSON.parse(errorData.responseText).message,'确定','Display');
  176. }
  177. }
  178. })
  179. }
  180. }
  181. });
  182. function Register() {
  183. window.location.href = $("#indexRegister").val();
  184. return false;
  185. }
  186. function Display() {
  187. $("#MyDiv").remove();
  188. $("#fade").remove();
  189. }
  190. function create_resume() {
  191. window.location.href = +"?m=Aio&c=Members&a=createresume";
  192. return false;
  193. }
  194. //身份证注册
  195. $("#cardreg").click(function () {
  196. var card_mobile = $.trim($("#mobile").val());
  197. var mobilevcode = $.trim($("#mobilevcode").val());
  198. if(card_mobile=="")
  199. {
  200. dialogDiv('手机号不能空','确定','refresh');
  201. $("#mobile").focus();
  202. return false;
  203. }
  204. if(mobilevcode == "")
  205. {
  206. dialogDiv('验证码不能空','确定','refresh');
  207. $("#mobilevcode").focus();
  208. return false;
  209. }
  210. $.ajax({
  211. type:"post",
  212. url:root + "?m=Aio&c=Members&a=register",
  213. dataType:"json",
  214. data:$("#card_reg").serialize(),
  215. success:function (res) {
  216. console.log(res);
  217. if(res.status)
  218. {
  219. window.location.href = res.data;
  220. }
  221. else
  222. {
  223. dialogDiv(res.msg,'确定','toback');
  224. }
  225. }
  226. })
  227. });
  228. $("#saveresume").click(function () {
  229. var username = $("input[name='username']").val();
  230. var education = $('#education').val();
  231. var salary = $("#salary").val();
  232. var email = $("#email").val();
  233. if(username == '' || username == null)
  234. {
  235. dialogDiv("姓名不能为空",'确定','refresh');
  236. return ;
  237. }
  238. else if(education == '' || education == null)
  239. {
  240. dialogDiv("学历不能为空",'确定','refresh');
  241. return ;
  242. }
  243. else if(salary == '' || salary == null)
  244. {
  245. dialogDiv("薪资不能为空",'确定','refresh');
  246. return ;
  247. }
  248. // else if(email =='' || email == null)
  249. // {
  250. // dialogDiv("email不能为空",'是','refresh');
  251. // return ;
  252. // }
  253. else
  254. {
  255. $.ajax({
  256. url:root + "?m=Aio&c=Members&a=createresume",
  257. type:'POST',
  258. dataType:"JSON",
  259. data:$("#createresume").serialize(),
  260. success:function (res) {
  261. if(parseInt(res.status))
  262. {
  263. dialogDiv(res.msg,'确定','savelocation');
  264. }
  265. else
  266. {
  267. dialogDiv(res.msg,'确定','refresh');
  268. }
  269. }
  270. })
  271. }
  272. });
  273. $("#saveresume2").click(function () {
  274. var username = $("input[name='username']").val();
  275. var education = $('#education').val();
  276. var salary = $("#salary").val();
  277. var email = $("#email").val();
  278. if(username == '' || username == null)
  279. {
  280. dialogDiv("姓名不能为空",'确定','refresh');
  281. return ;
  282. }
  283. else if(education == '' || education == null)
  284. {
  285. dialogDiv("学历不能为空",'确定','refresh');
  286. return ;
  287. }
  288. else if(salary == '' || salary == null)
  289. {
  290. dialogDiv("薪资不能为空",'确定','refresh');
  291. return ;
  292. }
  293. // else if(email =='' || email == null)
  294. // {
  295. // dialogDiv("email不能为空",'是','refresh');
  296. // return ;
  297. // }
  298. else
  299. {
  300. $.ajax({
  301. url:root + "?m=Aio&c=Members&a=editresume",
  302. type:'POST',
  303. dataType:"JSON",
  304. data:$("#editresume").serialize(),
  305. success:function (res) {
  306. if(parseInt(res.status))
  307. {
  308. dialogDiv(res.msg,'确定','savelocation');
  309. }
  310. else
  311. {
  312. dialogDiv(res.msg,'确定','refresh');
  313. }
  314. }
  315. })
  316. }
  317. });
  318. function savelocation() {
  319. window.location.href = root +"?m=Aio&c=Job&a=joblist&flag=1"
  320. }
  321. function toback() {
  322. window.history.go(-1);
  323. }
  324. function refresh() {
  325. window.location.reload();
  326. }
  327. /*底部导航选中事件 by zmy 2018 02 06*/
  328. window.onload=function(){
  329. urlinfo=window.location.href; //获取当前页面的url
  330. len=urlinfo.length;//获取url的长度
  331. offset=urlinfo.indexOf("?");//设置参数字符串开始的位置
  332. newsidinfo_first=urlinfo.substr(offset,len)//取出参数字符串
  333. newsidinfo = newsidinfo_first.replace('?','')
  334. newsidinfoarray = newsidinfo.split("&");//以&分隔形成参数数组
  335. var newsid;
  336. for(var i=0; i<newsidinfoarray.length; i++){
  337. if(newsidinfoarray[i].substring(0,2)=='c='){
  338. newsids=newsidinfoarray[i].split("=");//对获得的参数字符串按照“=”进行分割
  339. newsid=newsids[1];//得到参数值
  340. }
  341. }
  342. if((newsid=="Job")||(newsid=="job")){
  343. if(newsidinfo.indexOf("flag")!=-1){
  344. $(".foot-child").css('background','none');
  345. $('#zyjs').css('background','url(/Application/Aio/View/default/public/images/footer/footer-zyjs-hover.png) no-repeat');
  346. }else if(newsidinfo.indexOf("advice")!=-1){
  347. $(".foot-child").css('background','none');
  348. } else{
  349. $(".foot-child").css('background','none');
  350. $('#zxzw').css('background','url(/Application/Aio/View/default/public/images/footer/footer-zxzw-hover.png) no-repeat');
  351. }
  352. }else if((newsid=="Company")||(newsid=="company")){
  353. $(".foot-child").css('background','none');
  354. $('#mqzp').css('background','url(/Application/Aio/View/default/public/images/footer/footer-mqzp-hover.png) no-repeat');
  355. }else if((newsid=="News")||(newsid=="news")){
  356. $(".foot-child").css('background','none');
  357. $('#gkxx').css('background','url(/Application/Aio/View/default/public/images/footer/footer-gkxx-hover.png) no-repeat');
  358. }else if((newsid=="Qianren")||(newsid=="qianren")){
  359. $(".foot-child").css('background','none');
  360. $('#sbcx').css('background','url(/Application/Aio/View/default/public/images/footer/footer-sbcx-hover.png) no-repeat');
  361. }else if(newsid=="members"){
  362. if(newsidinfo.indexOf("index")!=-1){
  363. $(".foot-child").css('background','none');
  364. }else if(newsidinfo.indexOf("login")!=-1){
  365. $(".foot-child").css('background','none');
  366. }else if(newsidinfo.indexOf("personal")!=-1){
  367. $(".foot-child").css('background','none');
  368. }else if(newsidinfo.indexOf("register")!=-1){
  369. $(".foot-child").css('background','none');
  370. }else{
  371. $(".foot-child").css('background','none');
  372. $('#jldy').css('background','url(/Application/Aio/View/default/public/images/footer/footer-jldy-hover.png) no-repeat');
  373. }
  374. }
  375. }