secode111.js 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663
  1. var api = window.location.protocol+'//'+window.location.host;
  2. var avatarUploadHost = "http://kedejs.jishutao.com/upload";
  3. var newUrl = window.location.protocol+'//'+window.location.host + "/portal/newsDetails";
  4. //手机导航汉堡按钮效果
  5. $(".hamburger").click(function() {
  6. $(this).toggleClass("is-active");
  7. $(this)
  8. .next()
  9. .slideToggle("1000");
  10. });
  11. //回到顶部
  12. $(".toTop").hide();
  13. $(window).scroll(function() {
  14. $(window).scrollTop() > 100
  15. ? $(".toTop").fadeIn(500)
  16. : $(".toTop").fadeOut(500);
  17. });
  18. $(".toTop").click(function(event) {
  19. $("html,body").animate({ scrollTop: "0px" }, 666);
  20. });
  21. //导航栏下拉菜单
  22. $(".product_nav").mouseover(function() {
  23. $(".product-serve")
  24. .stop()
  25. .slideDown("fast");
  26. });
  27. $(".product_nav").mouseleave(function() {
  28. $(".product-serve")
  29. .stop()
  30. .slideUp("fast");
  31. });
  32. //首页新闻模块切换
  33. Table(".news-fenlei>span", ".news-list-it");
  34. // 导航栏下标
  35. function dog_index() {
  36. var dog = document.querySelector(".nav-dog");
  37. var nav_li = document.querySelectorAll(".pc_nav>ul>li"); //所有的导航
  38. var dog_i = document.querySelector(".pc_nav>ul>.active"); //当前页面
  39. dog.style.cssText =
  40. "left:" + dog_i.offsetLeft + "px;width:" + dog_i.offsetWidth + "px;";
  41. for (var li_ = 0; li_ < nav_li.length; li_++) {
  42. nav_li[li_].onmouseover = function() {
  43. var lileft = this.offsetLeft;
  44. var liwidht = this.offsetWidth;
  45. dog.style.cssText = "left:" + lileft + "px;width:" + liwidht + "px;";
  46. };
  47. nav_li[li_].onmouseleave = function() {
  48. var liwidht = dog_i.offsetWidth;
  49. dog.style.cssText =
  50. "left:" + dog_i.offsetLeft + "px;width:" + liwidht + "px;";
  51. };
  52. }
  53. }
  54. // 导航排他
  55. function removeClass_active() {
  56. var nav_ls = document.querySelectorAll(".pc_nav>ul>li"); //获取导航栏
  57. for (var x = 0; x < nav_ls.length; x++) {
  58. nav_ls[x].classList.remove("active");
  59. }
  60. }
  61. // 导航识别
  62. function nav_() {
  63. var nav_li = document.querySelectorAll(".pc_nav>ul>li"); //获取导航栏
  64. var _i = document.querySelector(".app>div.index"); //首页
  65. var _a = document.querySelector(".app>div.about"); //关于我们
  66. var _at = document.querySelector(".app>div.about-cx"); //联系我们
  67. var _p = document.querySelector(".app>div.product"); //产品中心
  68. var _s = document.querySelector(".app>div.main-str"); //战略合作
  69. var _c = document.querySelector(".app>div.client"); //服务客户
  70. var _n = document.querySelector(".app>div.news"); //新闻列表
  71. if (_i !== null) {
  72. removeClass_active();
  73. nav_li[0].setAttribute("class", "active");
  74. dog_index();
  75. }
  76. //产品
  77. if (_p !== null) {
  78. removeClass_active();
  79. nav_li[1].classList.add("active");
  80. dog_index();
  81. Table(".pd-li", ".one", tedd); //调用切换卡
  82. tedd(); //调用二级切换卡
  83. }
  84. //战略
  85. if (_s !== null) {
  86. removeClass_active();
  87. nav_li[2].setAttribute("class", "active");
  88. dog_index();
  89. }
  90. //客户
  91. if (_c !== null) {
  92. removeClass_active();
  93. nav_li[3].setAttribute("class", "active");
  94. dog_index();
  95. shengfen();
  96. }
  97. if (_n !== null) {
  98. removeClass_active();
  99. nav_li[4].setAttribute("class", "active");
  100. dog_index();
  101. }
  102. if (_a !== null) {
  103. removeClass_active();
  104. nav_li[5].setAttribute("class", "active");
  105. dog_index();
  106. Table(".about-kede-secodn ul li", ".app>div.about>.container>div"); //调用切换卡
  107. Table(".period>div", ".history"); //
  108. dowla();
  109. }
  110. if (_at !== null) {
  111. removeClass_active();
  112. nav_li[6].setAttribute("class", "active");
  113. dog_index();
  114. }
  115. }
  116. nav_();
  117. //产品二级切换效果
  118. function tedd() {
  119. var _x = document.querySelectorAll(".one.active .product-a li");
  120. var _y = document.querySelectorAll(".one.active .p-dec-d");
  121. for (var i = 0; i < _x.length; i++) {
  122. _x[i].setAttribute("data-_index", i); //设置属性
  123. _x[i].addEventListener("click", function() {
  124. for (var j = 0; j < _x.length; j++) {
  125. _x[j].classList.remove("active"); //排他
  126. }
  127. this.classList.add("active");
  128. var _index = this.getAttribute("data-_index"); //获取下标
  129. for (var k = 0; k < _y.length; k++) {
  130. _y[k].style.display = "none";
  131. _y[k].classList.remove("active");
  132. }
  133. _y[_index].style.display = "block";
  134. _y[_index].classList.add("active");
  135. });
  136. }
  137. }
  138. // 通用切换卡效果
  139. function Table(x, y, z) {
  140. var _x = document.querySelectorAll(x);
  141. var _y = document.querySelectorAll(y);
  142. var _z = z;
  143. function test(_x, _y, _f) {
  144. for (var j = 0; j < _x.length; j++) {
  145. _x[j].classList.remove("active"); //排他
  146. }
  147. this.classList.add("active");
  148. var _index = this.getAttribute("data-_index"); //获取下标
  149. for (var k = 0; k < _y.length; k++) {
  150. _y[k].style.display = "none";
  151. _y[k].classList.remove("active");
  152. }
  153. _y[_index].style.display = "block";
  154. _y[_index].classList.add("active");
  155. if (_f) {
  156. _f();
  157. }
  158. }
  159. for (var i = 0; i < _x.length; i++) {
  160. _x[i].setAttribute("data-_index", i); //设置属性
  161. _x[i].addEventListener("click", test.bind(_x[i], _x, _y, _z));
  162. }
  163. }
  164. // 招聘职位下拉
  165. function dowla() {
  166. var butoon = document.querySelector(".dsanjiao");
  167. var parent_b = document.querySelector(".filtrate .shengfen");
  168. var flag = 0;
  169. butoon.addEventListener("click", function() {
  170. if (!flag) {
  171. flag = 1;
  172. parent_b.style.height = "127px";
  173. } else {
  174. flag = 0;
  175. parent_b.style.height = "59px";
  176. }
  177. });
  178. }
  179. // 服务客户筛选省份
  180. function shengfen() {
  181. var qu_yu = document.querySelectorAll(".quyu ul>li"); //获取区域
  182. var shengfen_ul = document.querySelector(".shengfen>ul"); //获取省份ul
  183. var provinceStatus = [
  184. {
  185. value: "7",
  186. key: "安徽"
  187. },
  188. {
  189. value: "15",
  190. key: "北京"
  191. },
  192. {
  193. value: "27",
  194. key: "重庆"
  195. },
  196. {
  197. value: "8",
  198. key: "福建"
  199. },
  200. {
  201. value: "30",
  202. key: "甘肃"
  203. },
  204. {
  205. value: "24",
  206. key: "广东"
  207. },
  208. {
  209. value: "20",
  210. key: "广西"
  211. },
  212. {
  213. value: "25",
  214. key: "贵州"
  215. },
  216. {
  217. value: "21",
  218. key: "海南"
  219. },
  220. {
  221. value: "13",
  222. key: "河北"
  223. },
  224. {
  225. value: "1",
  226. key: "黑龙江"
  227. },
  228. {
  229. value: "19",
  230. key: "河南"
  231. },
  232. {
  233. value: "22",
  234. key: "香港"
  235. },
  236. {
  237. value: "17",
  238. key: "湖北"
  239. },
  240. {
  241. value: "18",
  242. key: "湖南"
  243. },
  244. {
  245. value: "5",
  246. key: "江苏"
  247. },
  248. {
  249. value: "9",
  250. key: "江西"
  251. },
  252. {
  253. value: "3",
  254. key: "辽宁"
  255. },
  256. {
  257. value: "2",
  258. key: "吉林"
  259. },
  260. {
  261. value: "23",
  262. key: "澳门"
  263. },
  264. {
  265. value: "14",
  266. key: "内蒙古"
  267. },
  268. {
  269. value: "32",
  270. key: "宁夏"
  271. },
  272. {
  273. value: "31",
  274. key: "青海"
  275. },
  276. {
  277. value: "10",
  278. key: "山东"
  279. },
  280. {
  281. value: "4",
  282. key: "上海"
  283. },
  284. {
  285. value: "9",
  286. key: "山西"
  287. },
  288. {
  289. value: "34",
  290. key: "陕西"
  291. },
  292. {
  293. value: "29",
  294. key: "四川"
  295. },
  296. {
  297. value: "11",
  298. key: "台湾"
  299. },
  300. {
  301. value: "16",
  302. key: "天津"
  303. },
  304. {
  305. value: "33",
  306. key: "新疆"
  307. },
  308. {
  309. value: "28",
  310. key: "西藏"
  311. },
  312. {
  313. value: "26",
  314. key: "云南"
  315. },
  316. {
  317. value: "6",
  318. key: "浙江"
  319. }
  320. ];
  321. var quyuList = [
  322. {
  323. place: "全国",
  324. children: [
  325. "全部",
  326. "河南",
  327. "湖北",
  328. "湖南",
  329. "上海",
  330. "江苏",
  331. "浙江",
  332. "安徽",
  333. "福建",
  334. "江西",
  335. "山东",
  336. "台湾",
  337. "黑龙江",
  338. "吉林",
  339. "辽宁",
  340. "广东",
  341. "广西",
  342. "海南",
  343. "香港",
  344. "澳门",
  345. "北京",
  346. "天津",
  347. "山西",
  348. "河北",
  349. "内蒙古",
  350. "四川",
  351. "贵州",
  352. "云南",
  353. "重庆",
  354. "西藏",
  355. "陕西",
  356. "甘肃",
  357. "青海",
  358. "宁夏",
  359. "新疆"
  360. ]
  361. },
  362. {
  363. place: "华中",
  364. children: ["河南", "湖北", "湖南"]
  365. },
  366. {
  367. place: "华东",
  368. children: ["上海", "江苏", "浙江", "安徽", "福建", "江西", "山东", "台湾"]
  369. },
  370. {
  371. place: "东北",
  372. children: ["黑龙江", "吉林", "辽宁"]
  373. },
  374. {
  375. place: "华南",
  376. children: ["广东", "广西", "海南", "香港", "澳门"]
  377. },
  378. {
  379. place: "华北",
  380. children: ["北京", "天津", "山西", "河北", "内蒙古"]
  381. },
  382. {
  383. place: "西南",
  384. children: ["四川", "贵州", "云南", "重庆", "西藏"]
  385. },
  386. {
  387. place: "西北",
  388. children: ["陕西", "甘肃", "青海", "宁夏", "新疆"]
  389. }
  390. ];
  391. $(".quyu>ul").on("click", "li", function() {
  392. $(".quyu>ul>li").removeClass("active");
  393. $(this).addClass("active");
  394. var quyu = $(this).html();
  395. for (var q = 0; q < quyuList.length; q++) {
  396. if (quyu == quyuList[q].place) {
  397. var shengfenList = quyuList[q].children;
  398. let shengfenHtml = "";
  399. for (var s = 0; s < shengfenList.length; s++) {
  400. shengfenHtml += "<li>" + shengfenList[s] + "</li>";
  401. }
  402. $(".shengfen > ul").html(shengfenHtml);
  403. setTimeout(function() {
  404. $(".shengfen>ul>li")
  405. .eq(0)
  406. .click();
  407. }, 0); // 默认点击全国展示全部
  408. break;
  409. }
  410. }
  411. });
  412. $(".quyu>ul>li")
  413. .eq(0)
  414. .click(); // 默认进来区域是全国
  415. $(".shengfen > ul").on("click", "li", function() {
  416. $(".shengfen > ul > li").removeClass("active");
  417. $(this).addClass("active");
  418. if ($(this).html == "全部") {
  419. var province = undefined;
  420. } else {
  421. for (var p = 0; p < provinceStatus.length; p++) {
  422. if ($(this).html() == provinceStatus[p].key) {
  423. var province = provinceStatus[p].value;
  424. break;
  425. }
  426. }
  427. }
  428. $.ajax({
  429. method: "get",
  430. url: api + "/open/listCustomerCase",
  431. data: {
  432. province
  433. },
  434. success: function(data) {
  435. if (data.error && data.error.length) {
  436. alert("系统繁忙,请刷新页面");
  437. } else {
  438. var dataList = data.data.list;
  439. var html = "";
  440. if (dataList.length) {
  441. for (var d = 0; d < dataList.length; d++) {
  442. html +=
  443. "<div><img src=" +
  444. avatarUploadHost +
  445. dataList[d].pictureUrl +
  446. " /></div>";
  447. }
  448. $(".page_ctrl").css({
  449. display: "block"
  450. });
  451. window.sessionStorage.setItem("total", data.data.totalCount);
  452. window.sessionStorage.setItem("province", province);
  453. page()
  454. }else {
  455. var html = "<h4 style='text-align:center;margin-top:90px;color:#666' >暂无服务客户</h4>"
  456. $(".page_ctrl").css({
  457. display: "none"
  458. })
  459. }
  460. $(".client-item").html(html);
  461. }
  462. }
  463. });
  464. });
  465. }
  466. // 服务客户筛选省份end
  467. // 手机端二级联动
  468. function getClass(dom, string) {
  469. return dom.getElementsByClassName(string);
  470. }
  471. //构造器
  472. function MobileSelect(config) {
  473. this.mobileSelect;
  474. this.wheelsData = config.wheels;
  475. this.jsonType = false;
  476. this.cascadeJsonData = [];
  477. this.displayJson = [];
  478. this.cascade = false;
  479. this.startY;
  480. this.moveEndY;
  481. this.moveY;
  482. this.oldMoveY;
  483. this.offset = 0;
  484. this.offsetSum = 0;
  485. this.oversizeBorder;
  486. this.curDistance = [];
  487. this.clickStatus = false;
  488. this.isPC = true;
  489. this.init(config);
  490. }
  491. MobileSelect.prototype = {
  492. constructor: MobileSelect,
  493. init: function(config) {
  494. var _this = this;
  495. _this.keyMap = config.keyMap
  496. ? config.keyMap
  497. : { id: "id", value: "value", childs: "childs" };
  498. _this.checkDataType();
  499. _this.renderWheels(
  500. _this.wheelsData,
  501. config.cancelBtnText,
  502. config.ensureBtnText
  503. );
  504. _this.trigger = document.querySelector(config.trigger);
  505. if (!_this.trigger) {
  506. console.error(
  507. "mobileSelect has been successfully installed, but no trigger found on your page."
  508. );
  509. return false;
  510. }
  511. _this.wheel = getClass(_this.mobileSelect, "wheel");
  512. _this.slider = getClass(_this.mobileSelect, "selectContainer");
  513. _this.wheels = _this.mobileSelect.querySelector(".wheels");
  514. _this.liHeight = _this.mobileSelect.querySelector("li").offsetHeight;
  515. _this.ensureBtn = _this.mobileSelect.querySelector(".ensure");
  516. _this.cancelBtn = _this.mobileSelect.querySelector(".cancel");
  517. _this.grayLayer = _this.mobileSelect.querySelector(".grayLayer");
  518. _this.popUp = _this.mobileSelect.querySelector(".content");
  519. _this.callback = config.callback ? config.callback : function() {};
  520. _this.transitionEnd = config.transitionEnd
  521. ? config.transitionEnd
  522. : function() {};
  523. _this.initPosition = config.position ? config.position : [];
  524. _this.titleText = config.title ? config.title : "";
  525. _this.connector = config.connector ? config.connector : " ";
  526. _this.trigger.style.cursor = "pointer";
  527. _this.setStyle(config);
  528. _this.setTitle(_this.titleText);
  529. _this.checkIsPC();
  530. _this.checkCascade();
  531. if (_this.cascade) {
  532. _this.initCascade();
  533. }
  534. //定位 初始位置
  535. if (_this.initPosition.length < _this.slider.length) {
  536. var diff = _this.slider.length - _this.initPosition.length;
  537. for (var i = 0; i < diff; i++) {
  538. _this.initPosition.push(0);
  539. }
  540. }
  541. _this.setCurDistance(_this.initPosition);
  542. _this.addListenerAll();
  543. //按钮监听
  544. _this.cancelBtn.addEventListener("click", function() {
  545. _this.mobileSelect.classList.remove("mobileSelect-show");
  546. });
  547. _this.ensureBtn.addEventListener("click", function() {
  548. _this.mobileSelect.classList.remove("mobileSelect-show");
  549. var tempValue = "";
  550. for (var i = 0; i < _this.wheel.length; i++) {
  551. i == _this.wheel.length - 1
  552. ? (tempValue += _this.getInnerHtml(i))
  553. : (tempValue += _this.getInnerHtml(i) + _this.connector);
  554. }
  555. _this.trigger.innerHTML = tempValue;
  556. _this.callback(_this.getIndexArr(), _this.getValue());
  557. });
  558. _this.trigger.addEventListener("click", function() {
  559. _this.mobileSelect.classList.add("mobileSelect-show");
  560. });
  561. _this.grayLayer.addEventListener("click", function() {
  562. _this.mobileSelect.classList.remove("mobileSelect-show");
  563. });
  564. _this.popUp.addEventListener("click", function() {
  565. event.stopPropagation();
  566. });
  567. _this.fixRowStyle(); //修正列数
  568. },
  569. setTitle: function(string) {
  570. var _this = this;
  571. _this.titleText = string;
  572. _this.mobileSelect.querySelector(".title").innerHTML = _this.titleText;
  573. },
  574. setStyle: function(config) {
  575. var _this = this;
  576. if (config.ensureBtnColor) {
  577. _this.ensureBtn.style.color = config.ensureBtnColor;
  578. }
  579. if (config.cancelBtnColor) {
  580. _this.cancelBtn.style.color = config.cancelBtnColor;
  581. }
  582. if (config.titleColor) {
  583. _this.title = _this.mobileSelect.querySelector(".title");
  584. _this.title.style.color = config.titleColor;
  585. }
  586. if (config.textColor) {
  587. _this.panel = _this.mobileSelect.querySelector(".panel");
  588. _this.panel.style.color = config.textColor;
  589. }
  590. if (config.titleBgColor) {
  591. _this.btnBar = _this.mobileSelect.querySelector(".btnBar");
  592. _this.btnBar.style.backgroundColor = config.titleBgColor;
  593. }
  594. if (config.bgColor) {
  595. _this.panel = _this.mobileSelect.querySelector(".panel");
  596. _this.shadowMask = _this.mobileSelect.querySelector(".shadowMask");
  597. _this.panel.style.backgroundColor = config.bgColor;
  598. _this.shadowMask.style.background =
  599. "linear-gradient(to bottom, " +
  600. config.bgColor +
  601. ", rgba(255, 255, 255, 0), " +
  602. config.bgColor +
  603. ")";
  604. }
  605. },
  606. checkIsPC: function() {
  607. var _this = this;
  608. var sUserAgent = navigator.userAgent.toLowerCase();
  609. var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
  610. var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
  611. var bIsMidp = sUserAgent.match(/midp/i) == "midp";
  612. var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
  613. var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
  614. var bIsAndroid = sUserAgent.match(/android/i) == "android";
  615. var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
  616. var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
  617. if (
  618. bIsIphoneOs ||
  619. bIsMidp ||
  620. bIsUc7 ||
  621. bIsUc ||
  622. bIsAndroid ||
  623. bIsCE ||
  624. bIsWM
  625. ) {
  626. _this.isPC = false;
  627. }
  628. },
  629. show: function() {
  630. this.mobileSelect.classList.add("mobileSelect-show");
  631. },
  632. renderWheels: function(wheelsData, cancelBtnText, ensureBtnText) {
  633. var _this = this;
  634. var cancelText = cancelBtnText ? cancelBtnText : "取消";
  635. var ensureText = ensureBtnText ? ensureBtnText : "确认";
  636. _this.mobileSelect = document.createElement("div");
  637. _this.mobileSelect.className = "mobileSelect";
  638. _this.mobileSelect.innerHTML =
  639. '<div class="grayLayer"></div>' +
  640. '<div class="content">' +
  641. '<div class="btnBar">' +
  642. '<div class="fixWidth">' +
  643. '<div class="cancel">' +
  644. cancelText +
  645. "</div>" +
  646. '<div class="title"></div>' +
  647. '<div class="ensure">' +
  648. ensureText +
  649. "</div>" +
  650. "</div>" +
  651. "</div>" +
  652. '<div class="panel">' +
  653. '<div class="fixWidth">' +
  654. '<div class="wheels">' +
  655. "</div>" +
  656. '<div class="selectLine"></div>' +
  657. '<div class="shadowMask"></div>' +
  658. "</div>" +
  659. "</div>" +
  660. "</div>";
  661. document.body.appendChild(_this.mobileSelect);
  662. //根据数据长度来渲染
  663. var tempHTML = "";
  664. for (var i = 0; i < wheelsData.length; i++) {
  665. //列
  666. tempHTML += '<div class="wheel"><ul class="selectContainer">';
  667. if (_this.jsonType) {
  668. for (var j = 0; j < wheelsData[i].data.length; j++) {
  669. //行
  670. tempHTML +=
  671. '<li data-id="' +
  672. wheelsData[i].data[j][_this.keyMap.id] +
  673. '">' +
  674. wheelsData[i].data[j][_this.keyMap.value] +
  675. "</li>";
  676. }
  677. } else {
  678. for (var j = 0; j < wheelsData[i].data.length; j++) {
  679. //行
  680. tempHTML += "<li>" + wheelsData[i].data[j] + "</li>";
  681. }
  682. }
  683. tempHTML += "</ul></div>";
  684. }
  685. _this.mobileSelect.querySelector(".wheels").innerHTML = tempHTML;
  686. },
  687. addListenerAll: function() {
  688. var _this = this;
  689. for (var i = 0; i < _this.slider.length; i++) {
  690. //手势监听
  691. (function(i) {
  692. _this.addListenerWheel(_this.wheel[i], i);
  693. _this.addListenerLi(i);
  694. })(i);
  695. }
  696. },
  697. addListenerWheel: function(theWheel, index) {
  698. var _this = this;
  699. theWheel.addEventListener(
  700. "touchstart",
  701. function() {
  702. _this.touch(event, this.firstChild, index);
  703. },
  704. false
  705. );
  706. theWheel.addEventListener(
  707. "touchend",
  708. function() {
  709. _this.touch(event, this.firstChild, index);
  710. },
  711. false
  712. );
  713. theWheel.addEventListener(
  714. "touchmove",
  715. function() {
  716. _this.touch(event, this.firstChild, index);
  717. },
  718. false
  719. );
  720. if (_this.isPC) {
  721. //如果是PC端则再增加拖拽监听 方便调试
  722. theWheel.addEventListener(
  723. "mousedown",
  724. function() {
  725. _this.dragClick(event, this.firstChild, index);
  726. },
  727. false
  728. );
  729. theWheel.addEventListener(
  730. "mousemove",
  731. function() {
  732. _this.dragClick(event, this.firstChild, index);
  733. },
  734. false
  735. );
  736. theWheel.addEventListener(
  737. "mouseup",
  738. function() {
  739. _this.dragClick(event, this.firstChild, index);
  740. },
  741. true
  742. );
  743. }
  744. },
  745. addListenerLi: function(sliderIndex) {
  746. var _this = this;
  747. var curWheelLi = _this.slider[sliderIndex].getElementsByTagName("li");
  748. for (var j = 0; j < curWheelLi.length; j++) {
  749. (function(j) {
  750. curWheelLi[j].addEventListener(
  751. "click",
  752. function() {
  753. _this.singleClick(this, j, sliderIndex);
  754. },
  755. false
  756. );
  757. })(j);
  758. }
  759. },
  760. checkDataType: function() {
  761. var _this = this;
  762. if (typeof _this.wheelsData[0].data[0] == "object") {
  763. _this.jsonType = true;
  764. }
  765. },
  766. checkCascade: function() {
  767. var _this = this;
  768. if (_this.jsonType) {
  769. var node = _this.wheelsData[0].data;
  770. for (var i = 0; i < node.length; i++) {
  771. if (
  772. _this.keyMap.childs in node[i] &&
  773. node[i][_this.keyMap.childs].length > 0
  774. ) {
  775. _this.cascade = true;
  776. _this.cascadeJsonData = _this.wheelsData[0].data;
  777. break;
  778. }
  779. }
  780. } else {
  781. _this.cascade = false;
  782. }
  783. },
  784. generateArrData: function(targetArr) {
  785. var tempArr = [];
  786. var keyMap_id = this.keyMap.id;
  787. var keyMap_value = this.keyMap.value;
  788. for (var i = 0; i < targetArr.length; i++) {
  789. var tempObj = {};
  790. tempObj[keyMap_id] = targetArr[i][this.keyMap.id];
  791. tempObj[keyMap_value] = targetArr[i][this.keyMap.value];
  792. tempArr.push(tempObj);
  793. }
  794. return tempArr;
  795. },
  796. initCascade: function() {
  797. var _this = this;
  798. _this.displayJson.push(_this.generateArrData(_this.cascadeJsonData));
  799. if (_this.initPosition.length > 0) {
  800. _this.initDeepCount = 0;
  801. _this.initCheckArrDeep(_this.cascadeJsonData[_this.initPosition[0]]);
  802. } else {
  803. _this.checkArrDeep(_this.cascadeJsonData[0]);
  804. }
  805. _this.reRenderWheels();
  806. },
  807. initCheckArrDeep: function(parent) {
  808. var _this = this;
  809. if (parent) {
  810. if (
  811. _this.keyMap.childs in parent &&
  812. parent[_this.keyMap.childs].length > 0
  813. ) {
  814. _this.displayJson.push(
  815. _this.generateArrData(parent[_this.keyMap.childs])
  816. );
  817. _this.initDeepCount++;
  818. var nextNode =
  819. parent[_this.keyMap.childs][_this.initPosition[_this.initDeepCount]];
  820. if (nextNode) {
  821. _this.initCheckArrDeep(nextNode);
  822. } else {
  823. _this.checkArrDeep(parent[_this.keyMap.childs][0]);
  824. }
  825. }
  826. }
  827. },
  828. checkArrDeep: function(parent) {
  829. //检测子节点深度 修改 displayJson
  830. var _this = this;
  831. if (parent) {
  832. if (
  833. _this.keyMap.childs in parent &&
  834. parent[_this.keyMap.childs].length > 0
  835. ) {
  836. _this.displayJson.push(
  837. _this.generateArrData(parent[_this.keyMap.childs])
  838. ); //生成子节点数组
  839. _this.checkArrDeep(parent[_this.keyMap.childs][0]); //检测下一个子节点
  840. }
  841. }
  842. },
  843. checkRange: function(index, posIndexArr) {
  844. var _this = this;
  845. var deleteNum = _this.displayJson.length - 1 - index;
  846. for (var i = 0; i < deleteNum; i++) {
  847. _this.displayJson.pop(); //修改 displayJson
  848. }
  849. var resultNode;
  850. for (var i = 0; i <= index; i++) {
  851. if (i == 0) resultNode = _this.cascadeJsonData[posIndexArr[0]];
  852. else {
  853. resultNode = resultNode[_this.keyMap.childs][posIndexArr[i]];
  854. }
  855. }
  856. _this.checkArrDeep(resultNode);
  857. _this.reRenderWheels();
  858. _this.fixRowStyle();
  859. _this.setCurDistance(_this.resetPostion(index, posIndexArr));
  860. },
  861. resetPostion: function(index, posIndexArr) {
  862. var _this = this;
  863. var tempPosArr = posIndexArr;
  864. var tempCount;
  865. if (_this.slider.length > posIndexArr.length) {
  866. tempCount = _this.slider.length - posIndexArr.length;
  867. for (var i = 0; i < tempCount; i++) {
  868. tempPosArr.push(0);
  869. }
  870. } else if (_this.slider.length < posIndexArr.length) {
  871. tempCount = posIndexArr.length - _this.slider.length;
  872. for (var i = 0; i < tempCount; i++) {
  873. tempPosArr.pop();
  874. }
  875. }
  876. for (var i = index + 1; i < tempPosArr.length; i++) {
  877. tempPosArr[i] = 0;
  878. }
  879. return tempPosArr;
  880. },
  881. reRenderWheels: function() {
  882. var _this = this;
  883. //删除多余的wheel
  884. if (_this.wheel.length > _this.displayJson.length) {
  885. var count = _this.wheel.length - _this.displayJson.length;
  886. for (var i = 0; i < count; i++) {
  887. _this.wheels.removeChild(_this.wheel[_this.wheel.length - 1]);
  888. }
  889. }
  890. for (var i = 0; i < _this.displayJson.length; i++) {
  891. //列
  892. (function(i) {
  893. var tempHTML = "";
  894. if (_this.wheel[i]) {
  895. //console.log('插入Li');
  896. for (var j = 0; j < _this.displayJson[i].length; j++) {
  897. //行
  898. tempHTML +=
  899. '<li data-id="' +
  900. _this.displayJson[i][j][_this.keyMap.id] +
  901. '">' +
  902. _this.displayJson[i][j][_this.keyMap.value] +
  903. "</li>";
  904. }
  905. _this.slider[i].innerHTML = tempHTML;
  906. } else {
  907. var tempWheel = document.createElement("div");
  908. tempWheel.className = "wheel";
  909. tempHTML = '<ul class="selectContainer">';
  910. for (var j = 0; j < _this.displayJson[i].length; j++) {
  911. //行
  912. tempHTML +=
  913. '<li data-id="' +
  914. _this.displayJson[i][j][_this.keyMap.id] +
  915. '">' +
  916. _this.displayJson[i][j][_this.keyMap.value] +
  917. "</li>";
  918. }
  919. tempHTML += "</ul>";
  920. tempWheel.innerHTML = tempHTML;
  921. _this.addListenerWheel(tempWheel, i);
  922. _this.wheels.appendChild(tempWheel);
  923. }
  924. _this.addListenerLi(i);
  925. })(i);
  926. }
  927. },
  928. updateWheels: function(data) {
  929. var _this = this;
  930. if (_this.cascade) {
  931. _this.cascadeJsonData = data;
  932. _this.displayJson = [];
  933. _this.initCascade();
  934. if (_this.initPosition.length < _this.slider.length) {
  935. var diff = _this.slider.length - _this.initPosition.length;
  936. for (var i = 0; i < diff; i++) {
  937. _this.initPosition.push(0);
  938. }
  939. }
  940. _this.setCurDistance(_this.initPosition);
  941. _this.fixRowStyle();
  942. }
  943. },
  944. updateWheel: function(sliderIndex, data) {
  945. var _this = this;
  946. var tempHTML = "";
  947. if (_this.cascade) {
  948. console.error(
  949. "级联格式不支持updateWheel(),请使用updateWheels()更新整个数据源"
  950. );
  951. return false;
  952. } else if (_this.jsonType) {
  953. for (var j = 0; j < data.length; j++) {
  954. tempHTML +=
  955. '<li data-id="' +
  956. data[j][_this.keyMap.id] +
  957. '">' +
  958. data[j][_this.keyMap.value] +
  959. "</li>";
  960. }
  961. _this.wheelsData[sliderIndex] = { data: data };
  962. } else {
  963. for (var j = 0; j < data.length; j++) {
  964. tempHTML += "<li>" + data[j] + "</li>";
  965. }
  966. _this.wheelsData[sliderIndex] = data;
  967. }
  968. _this.slider[sliderIndex].innerHTML = tempHTML;
  969. _this.addListenerLi(sliderIndex);
  970. },
  971. fixRowStyle: function() {
  972. var _this = this;
  973. var width = (100 / _this.wheel.length).toFixed(2);
  974. for (var i = 0; i < _this.wheel.length; i++) {
  975. _this.wheel[i].style.width = width + "%";
  976. }
  977. },
  978. getIndex: function(distance) {
  979. return Math.round((2 * this.liHeight - distance) / this.liHeight);
  980. },
  981. getIndexArr: function() {
  982. var _this = this;
  983. var temp = [];
  984. for (var i = 0; i < _this.curDistance.length; i++) {
  985. temp.push(_this.getIndex(_this.curDistance[i]));
  986. }
  987. return temp;
  988. },
  989. getValue: function() {
  990. var _this = this;
  991. var temp = [];
  992. var positionArr = _this.getIndexArr();
  993. if (_this.cascade) {
  994. for (var i = 0; i < _this.wheel.length; i++) {
  995. temp.push(_this.displayJson[i][positionArr[i]]);
  996. }
  997. } else if (_this.jsonType) {
  998. for (var i = 0; i < _this.curDistance.length; i++) {
  999. temp.push(
  1000. _this.wheelsData[i].data[_this.getIndex(_this.curDistance[i])]
  1001. );
  1002. }
  1003. } else {
  1004. for (var i = 0; i < _this.curDistance.length; i++) {
  1005. temp.push(_this.getInnerHtml(i));
  1006. }
  1007. }
  1008. return temp;
  1009. },
  1010. calcDistance: function(index) {
  1011. return 2 * this.liHeight - index * this.liHeight;
  1012. },
  1013. setCurDistance: function(indexArr) {
  1014. var _this = this;
  1015. var temp = [];
  1016. for (var i = 0; i < _this.slider.length; i++) {
  1017. temp.push(_this.calcDistance(indexArr[i]));
  1018. _this.movePosition(_this.slider[i], temp[i]);
  1019. }
  1020. _this.curDistance = temp;
  1021. },
  1022. fixPosition: function(distance) {
  1023. return -(this.getIndex(distance) - 2) * this.liHeight;
  1024. },
  1025. movePosition: function(theSlider, distance) {
  1026. theSlider.style.webkitTransform = "translate3d(0," + distance + "px, 0)";
  1027. theSlider.style.transform = "translate3d(0," + distance + "px, 0)";
  1028. },
  1029. locatePostion: function(index, posIndex) {
  1030. this.curDistance[index] = this.calcDistance(posIndex);
  1031. this.movePosition(this.slider[index], this.curDistance[index]);
  1032. },
  1033. updateCurDistance: function(theSlider, index) {
  1034. this.curDistance[index] = parseInt(theSlider.style.transform.split(",")[1]);
  1035. },
  1036. getDistance: function(theSlider) {
  1037. return parseInt(theSlider.style.transform.split(",")[1]);
  1038. },
  1039. getInnerHtml: function(sliderIndex) {
  1040. var _this = this;
  1041. var index = _this.getIndex(_this.curDistance[sliderIndex]);
  1042. return _this.slider[sliderIndex].getElementsByTagName("li")[index]
  1043. .innerHTML;
  1044. },
  1045. touch: function(event, theSlider, index) {
  1046. var _this = this;
  1047. event = event || window.event;
  1048. switch (event.type) {
  1049. case "touchstart":
  1050. _this.startY = event.touches[0].clientY;
  1051. _this.oldMoveY = _this.startY;
  1052. break;
  1053. case "touchend":
  1054. _this.moveEndY = event.changedTouches[0].clientY;
  1055. _this.offsetSum = _this.moveEndY - _this.startY;
  1056. //修正位置
  1057. _this.updateCurDistance(theSlider, index);
  1058. _this.curDistance[index] = _this.fixPosition(_this.curDistance[index]);
  1059. _this.movePosition(theSlider, _this.curDistance[index]);
  1060. _this.oversizeBorder =
  1061. -(theSlider.getElementsByTagName("li").length - 3) * _this.liHeight;
  1062. //反弹
  1063. if (_this.curDistance[index] + _this.offsetSum > 2 * _this.liHeight) {
  1064. _this.curDistance[index] = 2 * _this.liHeight;
  1065. setTimeout(function() {
  1066. _this.movePosition(theSlider, _this.curDistance[index]);
  1067. }, 100);
  1068. } else if (
  1069. _this.curDistance[index] + _this.offsetSum <
  1070. _this.oversizeBorder
  1071. ) {
  1072. _this.curDistance[index] = _this.oversizeBorder;
  1073. setTimeout(function() {
  1074. _this.movePosition(theSlider, _this.curDistance[index]);
  1075. }, 100);
  1076. }
  1077. _this.transitionEnd(_this.getIndexArr(), _this.getValue());
  1078. if (_this.cascade) {
  1079. var tempPosArr = _this.getIndexArr();
  1080. tempPosArr[index] = _this.getIndex(_this.curDistance[index]);
  1081. _this.checkRange(index, tempPosArr);
  1082. }
  1083. break;
  1084. case "touchmove":
  1085. event.preventDefault();
  1086. _this.moveY = event.touches[0].clientY;
  1087. _this.offset = _this.moveY - _this.oldMoveY;
  1088. _this.updateCurDistance(theSlider, index);
  1089. _this.curDistance[index] = _this.curDistance[index] + _this.offset;
  1090. _this.movePosition(theSlider, _this.curDistance[index]);
  1091. _this.oldMoveY = _this.moveY;
  1092. break;
  1093. }
  1094. },
  1095. dragClick: function(event, theSlider, index) {
  1096. var _this = this;
  1097. event = event || window.event;
  1098. switch (event.type) {
  1099. case "mousedown":
  1100. _this.startY = event.clientY;
  1101. _this.oldMoveY = _this.startY;
  1102. _this.clickStatus = true;
  1103. break;
  1104. case "mouseup":
  1105. _this.moveEndY = event.clientY;
  1106. _this.offsetSum = _this.moveEndY - _this.startY;
  1107. //修正位置
  1108. _this.updateCurDistance(theSlider, index);
  1109. _this.curDistance[index] = _this.fixPosition(_this.curDistance[index]);
  1110. _this.movePosition(theSlider, _this.curDistance[index]);
  1111. _this.oversizeBorder =
  1112. -(theSlider.getElementsByTagName("li").length - 3) * _this.liHeight;
  1113. //反弹
  1114. if (_this.curDistance[index] + _this.offsetSum > 2 * _this.liHeight) {
  1115. _this.curDistance[index] = 2 * _this.liHeight;
  1116. setTimeout(function() {
  1117. _this.movePosition(theSlider, _this.curDistance[index]);
  1118. }, 100);
  1119. } else if (
  1120. _this.curDistance[index] + _this.offsetSum <
  1121. _this.oversizeBorder
  1122. ) {
  1123. _this.curDistance[index] = _this.oversizeBorder;
  1124. setTimeout(function() {
  1125. _this.movePosition(theSlider, _this.curDistance[index]);
  1126. }, 100);
  1127. }
  1128. _this.clickStatus = false;
  1129. _this.transitionEnd(_this.getIndexArr(), _this.getValue());
  1130. if (_this.cascade) {
  1131. var tempPosArr = _this.getIndexArr();
  1132. tempPosArr[index] = _this.getIndex(_this.curDistance[index]);
  1133. _this.checkRange(index, tempPosArr);
  1134. }
  1135. break;
  1136. case "mousemove":
  1137. event.preventDefault();
  1138. if (_this.clickStatus) {
  1139. _this.moveY = event.clientY;
  1140. _this.offset = _this.moveY - _this.oldMoveY;
  1141. _this.updateCurDistance(theSlider, index);
  1142. _this.curDistance[index] = _this.curDistance[index] + _this.offset;
  1143. _this.movePosition(theSlider, _this.curDistance[index]);
  1144. _this.oldMoveY = _this.moveY;
  1145. }
  1146. break;
  1147. }
  1148. },
  1149. singleClick: function(theLi, index, sliderIndex) {
  1150. var _this = this;
  1151. if (_this.cascade) {
  1152. var tempPosArr = _this.getIndexArr();
  1153. tempPosArr[sliderIndex] = index;
  1154. _this.checkRange(sliderIndex, tempPosArr);
  1155. } else {
  1156. _this.curDistance[sliderIndex] = (2 - index) * _this.liHeight;
  1157. _this.movePosition(theLi.parentNode, _this.curDistance[sliderIndex]);
  1158. }
  1159. }
  1160. };
  1161. if (typeof exports == "object") {
  1162. module.exports = MobileSelect;
  1163. } else if (typeof define == "function" && define.amd) {
  1164. define([], function() {
  1165. return MobileSelect;
  1166. });
  1167. } else {
  1168. window.MobileSelect = MobileSelect;
  1169. }
  1170. function jobs() {
  1171. var provinceStatus = [
  1172. {
  1173. value: "7",
  1174. key: "安徽"
  1175. },
  1176. {
  1177. value: "15",
  1178. key: "北京"
  1179. },
  1180. {
  1181. value: "27",
  1182. key: "重庆"
  1183. },
  1184. {
  1185. value: "8",
  1186. key: "福建"
  1187. },
  1188. {
  1189. value: "30",
  1190. key: "甘肃"
  1191. },
  1192. {
  1193. value: "24",
  1194. key: "广东"
  1195. },
  1196. {
  1197. value: "20",
  1198. key: "广西"
  1199. },
  1200. {
  1201. value: "25",
  1202. key: "贵州"
  1203. },
  1204. {
  1205. value: "21",
  1206. key: "海南"
  1207. },
  1208. {
  1209. value: "13",
  1210. key: "河北"
  1211. },
  1212. {
  1213. value: "1",
  1214. key: "黑龙江"
  1215. },
  1216. {
  1217. value: "19",
  1218. key: "河南"
  1219. },
  1220. {
  1221. value: "22",
  1222. key: "香港"
  1223. },
  1224. {
  1225. value: "17",
  1226. key: "湖北"
  1227. },
  1228. {
  1229. value: "18",
  1230. key: "湖南"
  1231. },
  1232. {
  1233. value: "5",
  1234. key: "江苏"
  1235. },
  1236. {
  1237. value: "9",
  1238. key: "江西"
  1239. },
  1240. {
  1241. value: "3",
  1242. key: "辽宁"
  1243. },
  1244. {
  1245. value: "2",
  1246. key: "吉林"
  1247. },
  1248. {
  1249. value: "23",
  1250. key: "澳门"
  1251. },
  1252. {
  1253. value: "14",
  1254. key: "内蒙古"
  1255. },
  1256. {
  1257. value: "32",
  1258. key: "宁夏"
  1259. },
  1260. {
  1261. value: "31",
  1262. key: "青海"
  1263. },
  1264. {
  1265. value: "10",
  1266. key: "山东"
  1267. },
  1268. {
  1269. value: "4",
  1270. key: "上海"
  1271. },
  1272. {
  1273. value: "9",
  1274. key: "山西"
  1275. },
  1276. {
  1277. value: "34",
  1278. key: "陕西"
  1279. },
  1280. {
  1281. value: "29",
  1282. key: "四川"
  1283. },
  1284. {
  1285. value: "11",
  1286. key: "台湾"
  1287. },
  1288. {
  1289. value: "16",
  1290. key: "天津"
  1291. },
  1292. {
  1293. value: "33",
  1294. key: "新疆"
  1295. },
  1296. {
  1297. value: "28",
  1298. key: "西藏"
  1299. },
  1300. {
  1301. value: "26",
  1302. key: "云南"
  1303. },
  1304. {
  1305. value: "6",
  1306. key: "浙江"
  1307. }
  1308. ];
  1309. $("#display-more").css({
  1310. display: "block"
  1311. });
  1312. var displayNum = 0;
  1313. var hr = '<hr style="border: 1px solid #ccc;">';
  1314. var provinceNum = 18;
  1315. var url = "http://kede.jishutao.com/open/listRecruitment";
  1316. // var url = window.globalConfig;
  1317. $.ajax({
  1318. method: "get",
  1319. dataType: "json",
  1320. crossDomain: false,
  1321. url,
  1322. data: {
  1323. province: 18
  1324. },
  1325. success: function(data) {
  1326. if (data.error && data.error.length) {
  1327. console.log("数据异常");
  1328. } else {
  1329. var arr = data.data.list;
  1330. var html = "";
  1331. var zhiwu = "";
  1332. displayNum = 0;
  1333. arr.forEach(function(item) {
  1334. html = html + "<div>" + item.content + "</div>" + hr;
  1335. zhiwu += `<li>${item.name}</li>`;
  1336. displayNum++;
  1337. });
  1338. if (displayNum >= 12) {
  1339. $("#display-more").css({
  1340. display: "block"
  1341. });
  1342. }
  1343. if (!html) {
  1344. $("#job").html(
  1345. '<p style="font-size: 24px;text-align: center;">暂无数据</p>'
  1346. );
  1347. $("#position").html(
  1348. '<p style="text-align: center;font-size: 20px;color: #666;">暂无职务</p>'
  1349. );
  1350. } else {
  1351. $("#job").html(html);
  1352. $("#position").html(zhiwu);
  1353. }
  1354. }
  1355. }
  1356. });
  1357. $("#province").on("click", "li", function(e) {
  1358. $("#province li").removeClass("active");
  1359. $(this).addClass("active");
  1360. var province = $(this).html();
  1361. provinceStatus.forEach(function(item) {
  1362. if (item.key == province) {
  1363. provinceNum = item.value;
  1364. }
  1365. });
  1366. var html = "";
  1367. var zhiwu = "";
  1368. displayNum = 0;
  1369. $.ajax({
  1370. method: "get",
  1371. dataType: "json",
  1372. crossDomain: false,
  1373. url,
  1374. data: {
  1375. province: provinceNum
  1376. },
  1377. success: function(data) {
  1378. if (data.error && data.error.length) {
  1379. console.log("数据异常");
  1380. } else {
  1381. var arr = data.data.list;
  1382. arr.forEach(function(item) {
  1383. html = html + "<div>" + item.content + "</div>" + hr;
  1384. zhiwu += `<li>${item.name}</li>`;
  1385. displayNum++;
  1386. });
  1387. if (displayNum) {
  1388. $("#display-more").css({
  1389. display: "block"
  1390. });
  1391. }
  1392. if (!html) {
  1393. $("#job").html(
  1394. '<p style="font-size: 24px;text-align: center;">暂无数据</p>'
  1395. );
  1396. $("#position").html(
  1397. '<p style="text-align: center;font-size: 20px;color: #666;">暂无职务</p>'
  1398. );
  1399. } else {
  1400. $("#job").html(html);
  1401. $("#position").html(zhiwu);
  1402. }
  1403. }
  1404. }
  1405. });
  1406. });
  1407. $("#position")
  1408. .off("click")
  1409. .on("click", "li", function(e) {
  1410. $("#position li").removeClass("active");
  1411. $(this).addClass("active");
  1412. var posHtml = "";
  1413. var jobStr = $(this).html();
  1414. $.ajax({
  1415. method: "get",
  1416. dataType: "json",
  1417. crossDomain: false,
  1418. url,
  1419. data: {
  1420. province: provinceNum,
  1421. name: jobStr
  1422. },
  1423. success: function(data) {
  1424. if (data.error && data.error.length) {
  1425. console.log("数据异常");
  1426. } else {
  1427. var arr = data.data.list;
  1428. arr.forEach(function(item) {
  1429. posHtml = posHtml + "<div>" + item.content + "</div>" + hr;
  1430. });
  1431. if (!posHtml) {
  1432. $("#job").html(
  1433. '<p style="font-size: 24px;text-align: center;">暂无数据</p>'
  1434. );
  1435. } else {
  1436. $("#job").html(posHtml);
  1437. }
  1438. }
  1439. }
  1440. });
  1441. });
  1442. }
  1443. // 合作机构请求
  1444. function cooperation() {
  1445. $.ajax({
  1446. url: api + "/open/listOrganization",
  1447. method: "get",
  1448. data: {
  1449. releaseStatus: 1,
  1450. pageSize: 16
  1451. },
  1452. success: function(res) {
  1453. if(res.error && res.error.length) {
  1454. alert("数据异常,请刷新页面!")
  1455. }else {
  1456. if(res.data.list.length) {
  1457. var html = ""
  1458. for(var i = 0; i < res.data.list.length; i++) {
  1459. html +=
  1460. "<li><img src=" +
  1461. avatarUploadHost +
  1462. res.data.list[i].pictureUrl +
  1463. " /></li>";
  1464. }
  1465. $(".strategic > div > ul").html(html);
  1466. window.sessionStorage.setItem("total", res.data.totalCount);
  1467. }else {
  1468. $(".strategic > div > ul").html(
  1469. '<p style="font-size: 24px;text-align: center;color:#666;line-height:550px">暂无数据</p>'
  1470. );
  1471. $(".page_3").css({
  1472. display: "none"
  1473. })
  1474. }
  1475. cooperationPage()
  1476. }
  1477. }
  1478. });
  1479. }
  1480. // 合作机构分页展示
  1481. function cooperationPage() {
  1482. var obj_3 = {
  1483. obj_box: ".page_3",
  1484. total_item: window.sessionStorage.getItem("total"), //总共数据
  1485. per_num: 16, //每页显示数据
  1486. current_page: 1, //当前页
  1487. change_content: function(per_num, current_page) {
  1488. per_num = per_num ? per_num : 16;
  1489. current_page = current_page ? current_page : 1;
  1490. total_item = window.sessionStorage.getItem("total");
  1491. $.ajax({
  1492. url: api + "/open/listOrganization",
  1493. data: {
  1494. pageSize: 16,
  1495. releaseStatus: 1,
  1496. pageNo: current_page,
  1497. },
  1498. method: "GET",
  1499. dataType: "json",
  1500. success: function(res) {
  1501. if (res.error && res.error.length) {
  1502. alert("数据异常,请刷新页面!");
  1503. } else {
  1504. if (res.data.list.length) {
  1505. var html = "";
  1506. for (var i = 0; i < res.data.list.length; i++) {
  1507. html +=
  1508. "<li><img src=" +
  1509. avatarUploadHost +
  1510. res.data.list[i].pictureUrl +
  1511. " /></li>";
  1512. }
  1513. $(".strategic > div > ul").html(html);
  1514. window.sessionStorage.setItem("total", res.data.totalCount);
  1515. } else {
  1516. $(".strategic > div > ul").html(
  1517. '<p style="font-size: 24px;text-align: center;color:#666;line-height:550px">暂无数据</p>'
  1518. );
  1519. $(".page_3").css({
  1520. display: "none"
  1521. });
  1522. }
  1523. }
  1524. }
  1525. });
  1526. }
  1527. };
  1528. //调用分页
  1529. page_ctrl(obj_3);
  1530. }
  1531. $(function() {
  1532. if (window.location.search.length <= 3 && window.location.search.length >= 2) {
  1533. $("html,body").animate({ scrollTop: "1200px" }, 500);
  1534. }
  1535. switch (window.location.search) {
  1536. case "?0":
  1537. $(".product-a li")
  1538. .eq(0)
  1539. .click();
  1540. break;
  1541. case "?1":
  1542. $(".product-a li")
  1543. .eq(1)
  1544. .click();
  1545. break;
  1546. case "?2":
  1547. $(".product-a li")
  1548. .eq(2)
  1549. .click();
  1550. break;
  1551. case "?3":
  1552. $(".product-a li")
  1553. .eq(3)
  1554. .click();
  1555. break;
  1556. case "?4":
  1557. $(".product-a li")
  1558. .eq(4)
  1559. .click();
  1560. break;
  1561. case "?5":
  1562. $(".product-a li")
  1563. .eq(5)
  1564. .click();
  1565. break;
  1566. case "?6":
  1567. $(".product-a li")
  1568. .eq(6)
  1569. .click();
  1570. break;
  1571. case "?7":
  1572. $(".product-a li")
  1573. .eq(7)
  1574. .click();
  1575. break;
  1576. case "?8":
  1577. $(".product-a li")
  1578. .eq(8)
  1579. .click();
  1580. break;
  1581. case "?9":
  1582. $(".product-a li")
  1583. .eq(9)
  1584. .click();
  1585. break;
  1586. case "?10":
  1587. $(".product-a li")
  1588. .eq(10)
  1589. .click();
  1590. break;
  1591. case "?11":
  1592. $(".product-a li")
  1593. .eq(11)
  1594. .click();
  1595. break;
  1596. case "?12":
  1597. $(".product-a li")
  1598. .eq(12)
  1599. .click();
  1600. break;
  1601. default:
  1602. break;
  1603. }
  1604. });