jquery.wzp.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  1. (function($){
  2. /* 投递简历 电话联系 对应相应的职位 */
  3. function load_jobs(index,utype)
  4. {
  5. var _job = $($(".posit_details").get(index));
  6. if(utype=="2")
  7. {
  8. $(".job_btn_list > .add").attr("jobs_id", _job.attr("jobs_id"));
  9. $(".job_btn_list > .add").attr("jobs_name", _job.attr("jobs_name"));
  10. $(".job_btn_list > .add").attr("company_id", _job.attr("company_id"));
  11. $(".job_btn_list > .add").attr("company_name", _job.attr("company_name"));
  12. $(".job_btn_list > .add").attr("company_uid", _job.attr("company_uid"));
  13. }
  14. else
  15. {
  16. $(".job_btn_list > .add").attr("href",$('#cmsRoot').val()+'?m=Mobile&c=Members&a=login');
  17. }
  18. var isTel = $("#jobs_phone_code").attr('code');
  19. if (isTel > 0) {
  20. $(".job_btn_list > .tel").attr("pho", "tel:"+_job.attr("jobs_tel"));
  21. };
  22. }
  23. /* 滑动 效果 */
  24. function swipe_self()
  25. {
  26. var winWidth = window.innerWidth;
  27. var winHeight = window.innerHeight;
  28. var screenFix = function(){
  29. $("#poster_contain").css({
  30. width:winWidth+"px",
  31. height:winHeight+"px"
  32. });
  33. };
  34. screenFix();
  35. var orientationEvent = ('onorientationchange' in window) ? 'orientationchange' : 'resize';
  36. window.addEventListener(orientationEvent, function() {
  37. window.setTimeout(function(){
  38. screenFix();
  39. }, 600);
  40. }, false);
  41. $(".layer, .wx_layer").on("click", function(){
  42. $(this).hide();
  43. });
  44. var _indexSwipeUp=0;
  45. var _indexSwipe=0;
  46. // 滑动
  47. $("#poster_contain").swipeUp({
  48. index:_indexSwipeUp,
  49. childrenClass:".poster_wrap",
  50. init:function()
  51. {
  52. $(".arrow_con").addClass("show");
  53. setTimeout(function(){
  54. $($("#poster_contain .poster_wrap").get(_indexSwipeUp)).addClass("focus");
  55. }, 300);
  56. },
  57. afterSwipe:function(index)
  58. {
  59. var _pw = $("#poster_contain .poster_wrap");
  60. _pw.removeClass("focus");
  61. $(_pw.get(index)).addClass("focus");
  62. if(index == _pw.length-1){
  63. $(".arrow_con").removeClass("show");
  64. }else{
  65. $(".arrow_con").addClass("show");
  66. }
  67. var rewardHomeCon=$('.reward_home_con'),
  68. rewardHomeConLength=rewardHomeCon.length;
  69. if(rewardHomeConLength>0){
  70. if(rewardHomeCon.hasClass("homt_active")){
  71. rewardHomeCon.removeClass("homt_active");
  72. }
  73. var rewardPlus=$('.reward_plus');
  74. if(rewardPlus.hasClass("plus_animate")){
  75. rewardPlus.removeClass("plus_animate");
  76. }
  77. }
  78. if(index == 2){
  79. welfInterval = setInterval(function(){
  80. var _s = parseInt(Math.random()*6);
  81. $(".welf_bg > div").css({"-webkit-animation":"none"});
  82. $($(".welf_bg > div").get(_s)).css({"-webkit-animation":"fuli"+(_s%2)+" 1s ease-out"});
  83. }, 1000);
  84. }else{
  85. if(typeof(welfInterval) != "undefined"){
  86. clearInterval(welfInterval);
  87. }
  88. $(".welf_bg > div").css({"-webkit-animation":"none"});
  89. }
  90. }
  91. });
  92. // 职位滑动
  93. var _width = winWidth;
  94. _width = _width-30*2;
  95. $(".posit_details").css({width:_width+"px"})
  96. $(".posit_details img").css({width:_width+"px"})
  97. var _ulWidth = $(".posit_details").length * (_width+15) + 15;
  98. $(".posit_list_ul").css({width:_ulWidth+"px"});
  99. $(".posit_list_ul").swipe({
  100. index:_indexSwipe,
  101. width:_width + 15,
  102. afterSwipe:function(index)
  103. {
  104. load_jobs(index,utype);
  105. }
  106. });
  107. // 企业图片
  108. var swipePage = {
  109. winWidth: document.documentElement.clientWidth,
  110. agent: navigator.userAgent.toLowerCase(),
  111. _indexSwipeUp: 0,
  112. _indexSwipe: 0,
  113. otherPage: false,
  114. isOpen: false,
  115. init: function() {
  116. if (swipePage.versions.iPhone && (swipePage.versions.ucbrowser || swipePage.versions.amqqbrowser)) {
  117. $(".arrow_con, .job_btn_con").css({
  118. bottom: "50px"
  119. })
  120. }
  121. swipePage.swipeUpInit();
  122. swipePage.swipeInit()
  123. },
  124. swipeUpInit: function() {
  125. var infoidParam = getparam.getUrlParam("infoid"),
  126. b = $("#poster_contain .poster_wrap");
  127. if (infoidParam != undefined && infoidParam != "") {
  128. b.each(function(c) {
  129. if ($(this).hasClass("posit")) {
  130. swipePage._indexSwipeUp = c
  131. }
  132. })
  133. }
  134. var isWxBack = pageConfig.isWeixinBack;
  135. if (typeof isWxBack != "undefined" && isWxBack == "true") {
  136. b.each(function(c) {
  137. if ($(this).hasClass("praise")) {
  138. swipePage._indexSwipeUp = c;
  139. swipePage.isOpen = true
  140. }
  141. })
  142. }
  143. try {
  144. if (guideAppWeixilie.isShow()) {
  145. swipePage._indexSwipeUp = 1
  146. }
  147. swipePage.addBtn()
  148. } catch (e) {}
  149. if (localStorage) {
  150. swipePage.otherPage = window.localStorage.getItem("otherPage")
  151. }
  152. if (typeof swipePage.otherPage !== "undefined" && swipePage.otherPage === "true") {
  153. b.each(function(i) {
  154. if ($(this).hasClass("posit")) {
  155. swipePage._indexSwipeUp = i
  156. }
  157. });
  158. window.localStorage.setItem("otherPage", false)
  159. }
  160. swipePage.addBtn(".focus");
  161. $("#poster_contain").swipeUp({
  162. index: swipePage._indexSwipeUp,
  163. childrenClass: ".poster_wrap",
  164. init: function() {
  165. $(".arrow_con").addClass("show");
  166. setTimeout(function() {
  167. $(b.get(swipePage._indexSwipeUp)).addClass("focus")
  168. }, 300)
  169. },
  170. afterSwipe: function(index) {
  171. var _pw = $("#poster_contain .poster_wrap");
  172. _pw.removeClass("focus");
  173. $(_pw.get(index)).addClass("focus");
  174. if (index == _pw.length - 1) {
  175. $(".arrow_con").removeClass("show")
  176. } else {
  177. $(".arrow_con").addClass("show")
  178. }
  179. if (index == 2) {
  180. welfInterval = setInterval(function() {
  181. var _s = parseInt(Math.random() * 6);
  182. $(".welf_bg div").css({
  183. "-webkit-animation": "none",
  184. animation: "none"
  185. });
  186. $($(".welf_bg div").get(_s)).css({
  187. "-webkit-animation": "fuli" + _s % 2 + " 1s ease-out",
  188. animation: "fuli" + _s % 2 + " 1s ease-out"
  189. })
  190. }, 1e3)
  191. } else {
  192. if (typeof welfInterval != "undefined") {
  193. clearInterval(welfInterval)
  194. }
  195. $(".welf_bg div").css({
  196. "-webkit-animation": "none",
  197. animation: "none"
  198. })
  199. }
  200. if (userid == getparam.getUserInfo().uid) {
  201. var isshare = $(".poster_wrap.posit");
  202. var jianli = $(".poster_wrap.jianli");
  203. if (isshare.hasClass("focus") || jianli.hasClass("focus")) {
  204. $(".nav_btn_con,.reward_btn_modular").hide()
  205. } else {
  206. $(".nav_btn_con,.reward_btn_modular").show()
  207. }
  208. }
  209. try {
  210. guideAppWeixilie.init({
  211. index: index
  212. })
  213. } catch (e) {}
  214. }
  215. })
  216. },
  217. swipeInit: function() {
  218. var infoidParam = getparam.getUrlParam("infoid");
  219. if (infoidParam != "") {
  220. $(".posit_list_ul .posit_details").each(function(i) {
  221. if ($(this).attr("data-infoid") == infoidParam) {
  222. swipePage._indexSwipe = i;
  223. return false
  224. }
  225. })
  226. }
  227. var a = swipePage.winWidth;
  228. if (swipePage.versions.android && swipePage.versions.micromessenger) {
  229. if (window.devicePixelRatio > 1) {
  230. if (swipePage.agent.miuibrowser) {
  231. a = swipePage.winWidth
  232. } else {
  233. a = window.screen.width / window.devicePixelRatio
  234. }
  235. }
  236. }
  237. a = a - 30 * 2;
  238. var b = $(".posit_details").length * (a + 15) + 15;
  239. $(".posit_details").css({
  240. width: a + "px"
  241. });
  242. $(".posit_list_ul").css({
  243. width: b + "px"
  244. });
  245. if ($(".posit").length > 0) {
  246. $(".posit_list_ul").attr("data-indexNum", swipePage._indexSwipe);
  247. $(".posit_list_ul").swipe({
  248. index: swipePage._indexSwipe,
  249. width: a + 15,
  250. childrenClass: ".posit_details",
  251. afterSwipe: function(index) {
  252. var _job = $($(".posit_details").get(index));
  253. if (typeof weizhan !== "undefined" && typeof weizhan.reward !== "undefined" && typeof eval(weizhan.reward.setRewardJobBtn) == "function") {
  254. weizhan.reward.setRewardJobBtn(_job)
  255. } else {
  256. $(".job_btn_list > .add").attr("href", _job.attr("url"));
  257. var telNum = _job.attr("tel");
  258. var tel = telNum.replace("-", "");
  259. $(".job_btn_list > .tel").attr("href", "tel:" + _job.attr("tel").replace("-", ""))
  260. }
  261. }
  262. })
  263. }
  264. if ($(".imgs").length > 0) {
  265. $(".img_bg").css("width", a + "px");
  266. $(".img_bg img").css("width", a - 6 + "px");
  267. var imgWidth = $(".img_bg").length * (a + 15) + 15;
  268. $(".img_msg_con").css("width", imgWidth + "px");
  269. $(".imgs .img_msg_con").swipe({
  270. index: 0,
  271. width: a + 15,
  272. childrenClass: ".img_bg",
  273. afterSwipe: function(index) {}
  274. })
  275. }
  276. },
  277. screenFix: function() {
  278. var winWidth = document.documentElement.clientWidth,
  279. winHeight = window.innerHeight;
  280. $("#poster_contain").css({
  281. width: winWidth + "px",
  282. height: winHeight + "px"
  283. })
  284. },
  285. openApp: function() {
  286. guideApp.init();
  287. },
  288. replaceTel: function(obj) {
  289. var telNum = obj.href;
  290. var tel = telNum.replace("-", "");
  291. obj.removeAttribute("href");
  292. obj.setAttribute("href", tel)
  293. },
  294. addBtn: function(param) {
  295. if (typeof param == "undefined") {
  296. param = ""
  297. }
  298. var active_page = $(".poster_wrap" + param);
  299. var about_text = $(active_page).find(".about_us_msg");
  300. var about_text_p = $(active_page).find("p");
  301. if (about_text[0]) {
  302. var about_text_height = about_text[0].clientHeight;
  303. var about_text_width = $(".about_us_msg_p")[0].clientWidth;
  304. var i = about_text_p.length - 1;
  305. var str_temp = $(".about_us_msg_p p").text().replace(/\s/g, "");
  306. var tatolfontNum = str_temp.length;
  307. var a_temp = Math.round(about_text_height / 22);
  308. var b_temp = about_text_width / 13;
  309. var c_temp = Math.round(tatolfontNum / b_temp);
  310. if (a_temp < c_temp) {
  311. var more_html = '<div class="more_detail"><span>查看更多>></span></div>';
  312. var about_bottom = $(active_page).find(".about_bottom")[0];
  313. $(about_bottom).html(more_html);
  314. $(".more_detail").on("click", function() {
  315. Dialog.init(about_text.find("p"))
  316. })
  317. }
  318. }
  319. },
  320. versions: function() {
  321. var u = navigator.userAgent,
  322. app = navigator.appVersion;
  323. return {
  324. ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),
  325. android: u.indexOf("Android") > -1 || u.indexOf("Linux") > -1,
  326. iPhone: u.indexOf("iPhone") > -1,
  327. iPad: u.indexOf("iPad") > -1,
  328. ucbrowser: u.indexOf("ucbrowser") > -1,
  329. mqqbrowser: u.indexOf("mqqbrowser") > -1,
  330. micromessenger: u.indexOf("micromessenger") > -1
  331. }
  332. }()
  333. };
  334. var a = swipePage.winWidth;
  335. if (swipePage.versions.android && swipePage.versions.micromessenger) {
  336. if (window.devicePixelRatio > 1) {
  337. if (swipePage.agent.miuibrowser) {
  338. a = swipePage.winWidth
  339. } else {
  340. a = window.screen.width / window.devicePixelRatio
  341. }
  342. }
  343. }
  344. a = a - 30 * 2;
  345. if ($(".imgs").length > 0) {
  346. $(".img_bg").css("width", a + "px");
  347. $(".img_bg img").css("width", a - 6 + "px");
  348. var imgWidth = $(".img_bg").length * (a + 15) + 15;
  349. $(".img_msg_con").css("width", imgWidth + "px");
  350. $(".imgs .img_msg_con").swipe({
  351. index: 0,
  352. width: a + 15,
  353. childrenClass: ".img_bg",
  354. afterSwipe: function(index) {}
  355. })
  356. }
  357. // 企业简介更多
  358. if (typeof param == "undefined") {
  359. param = ""
  360. }
  361. var active_page = $(".poster_wrap_about_us");
  362. var about_text = $(active_page).find(".about_us_msg");
  363. var about_text_p = $(active_page).find("p");
  364. if (about_text[0]) {
  365. var about_text_height = about_text[0].clientHeight;
  366. var about_text_width = $(".about_us_msg_p")[0].clientWidth;
  367. var i = about_text_p.length - 1;
  368. var str_temp = $(".about_us_msg_p p").text().replace(/\s/g, "");
  369. var tatolfontNum = str_temp.length;
  370. var a_temp = Math.round(about_text_height / 22);
  371. var b_temp = about_text_width / 13;
  372. var c_temp = Math.round(tatolfontNum / b_temp);
  373. if (tatolfontNum > 120) { // a_temp < c_temp
  374. var more_html = '<div class="more_detail"><span>查看更多>></span></div>';
  375. var about_bottom = $(active_page).find(".about_bottom")[0];
  376. $(about_bottom).html(more_html);
  377. $(".more_detail").on("click", function() {
  378. $('.dialog_bg').show();
  379. $('.dia-arrow').on('click', function () {
  380. $('.dialog_bg').hide();
  381. });
  382. })
  383. }
  384. }
  385. //分享按钮
  386. $('.praise_share_btn').on('click',function(){
  387. var agent = navigator.userAgent.toLowerCase();
  388. if(agent.indexOf('micromessenger') < 0)
  389. {
  390. share_();
  391. }
  392. else
  393. {
  394. share();
  395. }
  396. });
  397. $(".layer, .wx_layer").on("click", function(){
  398. $(this).hide();
  399. });
  400. };
  401. // 点赞
  402. function praise(company_id)
  403. {
  404. $(".praise_btn_click").on('click',function(event)
  405. {
  406. setCookie('praise_'+company_id+'','1');
  407. if($(".praise_btn").hasClass('praise_btn_click')){
  408. $.getJSON("",{id:company_id},function(result){
  409. if(result.status==1){
  410. $("#praise_num").html(result.data);
  411. $(".praise_btn").addClass('on').removeClass('praise_btn_click');
  412. }
  413. });
  414. }
  415. });
  416. }
  417. function setCookie(name,value)
  418. {
  419. var Days = 30;
  420. var exp = new Date();
  421. exp.setTime(exp.getTime() + Days*24*60*60*1000);
  422. document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
  423. }
  424. //读取cookies
  425. function getCookie(name)
  426. {
  427. var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
  428. if(arr=document.cookie.match(reg))
  429. return unescape(arr[2]);
  430. else
  431. return null;
  432. }
  433. function delCookie(name)
  434. {
  435. var exp = new Date();
  436. exp.setTime(exp.getTime() - 1);
  437. var cval=getCookie(name);
  438. if(cval!=null)
  439. document.cookie= name + "="+cval+";expires="+exp.toGMTString();
  440. }
  441. /* 延时加载 time */
  442. function loading(time){
  443. var time=time?time:1000;
  444. setTimeout(function(){
  445. $("#load").hide();
  446. swipe_self();
  447. }, time);
  448. };
  449. /* 申请职位 弹出框 */
  450. function showFloatBox()
  451. {
  452. var width = window.innerWidth;
  453. var height = window.innerHeight;
  454. $("body").prepend("<div class=\"menu_bg_layer\"></div>");
  455. $(".menu_bg_layer").css({ height:height+'px',width: width+"px", position: "absolute",left:"0", top:"0","z-index":"999","background-color":"#000000"});
  456. $(".menu_bg_layer").css("opacity",0.3);
  457. };
  458. /* 申请职位 操作 */
  459. function jobs_apply()
  460. {
  461. $("#jobs_apply").on('click',function()
  462. {
  463. var href= $(this).attr("href")
  464. if(href=="javascript:;")
  465. {
  466. var jobs_id = $(this).attr("jobs_id");
  467. if(qscms.resume_id){
  468. $.getJSON(qscms.root+'?m=Mobile&c=AjaxPersonal&a=resume_apply',{jid:jobs_id},function(result){
  469. if(result.status==1){
  470. alert(result.msg);
  471. }else{
  472. alert(result.msg);
  473. }
  474. },'json');
  475. }else{
  476. alert('请选择简历');
  477. }
  478. }
  479. });
  480. };
  481. $("#jobs_phone").on('click',function() {
  482. var href= $(this).attr("pho");
  483. if(href){
  484. var result = href.replace('tel:','');
  485. }else{
  486. var result = '';
  487. }
  488. if(result=='') {
  489. var shopping = document.getElementById("jobs_phone");
  490. var phone = shopping.getAttribute("phone");
  491. showFloatBox();
  492. $("#jobs_phone_menu").show();
  493. var height = window.innerHeight;
  494. var choose_menu_h = document.getElementById('jobs_phone_menu').offsetHeight;
  495. var top_ = (height-choose_menu_h)/2;
  496. $("#jobs_phone_menu").css("top",top_+"px");
  497. $("#jobs_phone_menu").css({"opacity":1,"z-index":9999});
  498. $(".but_right,.menu_bg_layer").on('click', function(event) {
  499. $("#jobs_phone_menu").hide();
  500. $(".menu_bg_layer").remove();
  501. });
  502. } else {
  503. window.location.href=href;
  504. }
  505. });
  506. /* 左侧 菜单*/
  507. function left_menu()
  508. {
  509. // 显示菜单
  510. $(".nav_btn_con").on("touchstart", function(){
  511. $(".reward_manager_list_con, .reward_manager_list_con_bg").addClass("on");
  512. });
  513. // 隐藏菜单
  514. $(".reward_manager_list_con_bg").on("touchstart", function(){
  515. $(".reward_manager_list_con, .reward_manager_list_con_bg").removeClass("on");
  516. });
  517. };
  518. /* 显示分享 覆盖层 */
  519. function share(){
  520. $(".wx_layer").show();
  521. };
  522. function share_(){
  523. $(".layer").show();
  524. };
  525. loading();
  526. left_menu();
  527. load_jobs(0,utype);
  528. praise(company_id);
  529. jobs_apply();
  530. if(getCookie('praise_'+company_id+'')==1)
  531. {
  532. $(".praise_btn").addClass('on').removeClass('praise_btn_click');
  533. }
  534. })(jq);