1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663 |
- var api = window.location.protocol+'//'+window.location.host;
- var avatarUploadHost = "http://kedejs.jishutao.com/upload";
- var newUrl = window.location.protocol+'//'+window.location.host + "/portal/newsDetails";
- //手机导航汉堡按钮效果
- $(".hamburger").click(function() {
- $(this).toggleClass("is-active");
- $(this)
- .next()
- .slideToggle("1000");
- });
- //回到顶部
- $(".toTop").hide();
- $(window).scroll(function() {
- $(window).scrollTop() > 100
- ? $(".toTop").fadeIn(500)
- : $(".toTop").fadeOut(500);
- });
- $(".toTop").click(function(event) {
- $("html,body").animate({ scrollTop: "0px" }, 666);
- });
- //导航栏下拉菜单
- $(".product_nav").mouseover(function() {
- $(".product-serve")
- .stop()
- .slideDown("fast");
- });
- $(".product_nav").mouseleave(function() {
- $(".product-serve")
- .stop()
- .slideUp("fast");
- });
- //首页新闻模块切换
- Table(".news-fenlei>span", ".news-list-it");
- // 导航栏下标
- function dog_index() {
- var dog = document.querySelector(".nav-dog");
- var nav_li = document.querySelectorAll(".pc_nav>ul>li"); //所有的导航
- var dog_i = document.querySelector(".pc_nav>ul>.active"); //当前页面
- dog.style.cssText =
- "left:" + dog_i.offsetLeft + "px;width:" + dog_i.offsetWidth + "px;";
- for (var li_ = 0; li_ < nav_li.length; li_++) {
- nav_li[li_].onmouseover = function() {
- var lileft = this.offsetLeft;
- var liwidht = this.offsetWidth;
- dog.style.cssText = "left:" + lileft + "px;width:" + liwidht + "px;";
- };
- nav_li[li_].onmouseleave = function() {
- var liwidht = dog_i.offsetWidth;
- dog.style.cssText =
- "left:" + dog_i.offsetLeft + "px;width:" + liwidht + "px;";
- };
- }
- }
- // 导航排他
- function removeClass_active() {
- var nav_ls = document.querySelectorAll(".pc_nav>ul>li"); //获取导航栏
- for (var x = 0; x < nav_ls.length; x++) {
- nav_ls[x].classList.remove("active");
- }
- }
- // 导航识别
- function nav_() {
- var nav_li = document.querySelectorAll(".pc_nav>ul>li"); //获取导航栏
- var _i = document.querySelector(".app>div.index"); //首页
- var _a = document.querySelector(".app>div.about"); //关于我们
- var _at = document.querySelector(".app>div.about-cx"); //联系我们
- var _p = document.querySelector(".app>div.product"); //产品中心
- var _s = document.querySelector(".app>div.main-str"); //战略合作
- var _c = document.querySelector(".app>div.client"); //服务客户
- var _n = document.querySelector(".app>div.news"); //新闻列表
- if (_i !== null) {
- removeClass_active();
- nav_li[0].setAttribute("class", "active");
- dog_index();
- }
- //产品
- if (_p !== null) {
- removeClass_active();
- nav_li[1].classList.add("active");
- dog_index();
- Table(".pd-li", ".one", tedd); //调用切换卡
- tedd(); //调用二级切换卡
- }
- //战略
- if (_s !== null) {
- removeClass_active();
- nav_li[2].setAttribute("class", "active");
- dog_index();
- }
- //客户
- if (_c !== null) {
- removeClass_active();
- nav_li[3].setAttribute("class", "active");
- dog_index();
- shengfen();
- }
- if (_n !== null) {
- removeClass_active();
- nav_li[4].setAttribute("class", "active");
- dog_index();
- }
- if (_a !== null) {
- removeClass_active();
- nav_li[5].setAttribute("class", "active");
- dog_index();
- Table(".about-kede-secodn ul li", ".app>div.about>.container>div"); //调用切换卡
- Table(".period>div", ".history"); //
- dowla();
- }
- if (_at !== null) {
- removeClass_active();
- nav_li[6].setAttribute("class", "active");
- dog_index();
- }
- }
- nav_();
- //产品二级切换效果
- function tedd() {
- var _x = document.querySelectorAll(".one.active .product-a li");
- var _y = document.querySelectorAll(".one.active .p-dec-d");
- for (var i = 0; i < _x.length; i++) {
- _x[i].setAttribute("data-_index", i); //设置属性
- _x[i].addEventListener("click", function() {
- for (var j = 0; j < _x.length; j++) {
- _x[j].classList.remove("active"); //排他
- }
- this.classList.add("active");
- var _index = this.getAttribute("data-_index"); //获取下标
- for (var k = 0; k < _y.length; k++) {
- _y[k].style.display = "none";
- _y[k].classList.remove("active");
- }
- _y[_index].style.display = "block";
- _y[_index].classList.add("active");
- });
- }
- }
- // 通用切换卡效果
- function Table(x, y, z) {
- var _x = document.querySelectorAll(x);
- var _y = document.querySelectorAll(y);
- var _z = z;
- function test(_x, _y, _f) {
- for (var j = 0; j < _x.length; j++) {
- _x[j].classList.remove("active"); //排他
- }
- this.classList.add("active");
- var _index = this.getAttribute("data-_index"); //获取下标
- for (var k = 0; k < _y.length; k++) {
- _y[k].style.display = "none";
- _y[k].classList.remove("active");
- }
- _y[_index].style.display = "block";
- _y[_index].classList.add("active");
- if (_f) {
- _f();
- }
- }
- for (var i = 0; i < _x.length; i++) {
- _x[i].setAttribute("data-_index", i); //设置属性
- _x[i].addEventListener("click", test.bind(_x[i], _x, _y, _z));
- }
- }
- // 招聘职位下拉
- function dowla() {
- var butoon = document.querySelector(".dsanjiao");
- var parent_b = document.querySelector(".filtrate .shengfen");
- var flag = 0;
- butoon.addEventListener("click", function() {
- if (!flag) {
- flag = 1;
- parent_b.style.height = "127px";
- } else {
- flag = 0;
- parent_b.style.height = "59px";
- }
- });
- }
- // 服务客户筛选省份
- function shengfen() {
- var qu_yu = document.querySelectorAll(".quyu ul>li"); //获取区域
- var shengfen_ul = document.querySelector(".shengfen>ul"); //获取省份ul
- var provinceStatus = [
- {
- value: "7",
- key: "安徽"
- },
- {
- value: "15",
- key: "北京"
- },
- {
- value: "27",
- key: "重庆"
- },
- {
- value: "8",
- key: "福建"
- },
- {
- value: "30",
- key: "甘肃"
- },
- {
- value: "24",
- key: "广东"
- },
- {
- value: "20",
- key: "广西"
- },
- {
- value: "25",
- key: "贵州"
- },
- {
- value: "21",
- key: "海南"
- },
- {
- value: "13",
- key: "河北"
- },
- {
- value: "1",
- key: "黑龙江"
- },
- {
- value: "19",
- key: "河南"
- },
- {
- value: "22",
- key: "香港"
- },
- {
- value: "17",
- key: "湖北"
- },
- {
- value: "18",
- key: "湖南"
- },
- {
- value: "5",
- key: "江苏"
- },
- {
- value: "9",
- key: "江西"
- },
- {
- value: "3",
- key: "辽宁"
- },
- {
- value: "2",
- key: "吉林"
- },
- {
- value: "23",
- key: "澳门"
- },
- {
- value: "14",
- key: "内蒙古"
- },
- {
- value: "32",
- key: "宁夏"
- },
- {
- value: "31",
- key: "青海"
- },
- {
- value: "10",
- key: "山东"
- },
- {
- value: "4",
- key: "上海"
- },
- {
- value: "9",
- key: "山西"
- },
- {
- value: "34",
- key: "陕西"
- },
- {
- value: "29",
- key: "四川"
- },
- {
- value: "11",
- key: "台湾"
- },
- {
- value: "16",
- key: "天津"
- },
- {
- value: "33",
- key: "新疆"
- },
- {
- value: "28",
- key: "西藏"
- },
- {
- value: "26",
- key: "云南"
- },
- {
- value: "6",
- key: "浙江"
- }
- ];
- var quyuList = [
- {
- place: "全国",
- children: [
- "全部",
- "河南",
- "湖北",
- "湖南",
- "上海",
- "江苏",
- "浙江",
- "安徽",
- "福建",
- "江西",
- "山东",
- "台湾",
- "黑龙江",
- "吉林",
- "辽宁",
- "广东",
- "广西",
- "海南",
- "香港",
- "澳门",
- "北京",
- "天津",
- "山西",
- "河北",
- "内蒙古",
- "四川",
- "贵州",
- "云南",
- "重庆",
- "西藏",
- "陕西",
- "甘肃",
- "青海",
- "宁夏",
- "新疆"
- ]
- },
- {
- place: "华中",
- children: ["河南", "湖北", "湖南"]
- },
- {
- place: "华东",
- children: ["上海", "江苏", "浙江", "安徽", "福建", "江西", "山东", "台湾"]
- },
- {
- place: "东北",
- children: ["黑龙江", "吉林", "辽宁"]
- },
- {
- place: "华南",
- children: ["广东", "广西", "海南", "香港", "澳门"]
- },
- {
- place: "华北",
- children: ["北京", "天津", "山西", "河北", "内蒙古"]
- },
- {
- place: "西南",
- children: ["四川", "贵州", "云南", "重庆", "西藏"]
- },
- {
- place: "西北",
- children: ["陕西", "甘肃", "青海", "宁夏", "新疆"]
- }
- ];
- $(".quyu>ul").on("click", "li", function() {
- $(".quyu>ul>li").removeClass("active");
- $(this).addClass("active");
- var quyu = $(this).html();
- for (var q = 0; q < quyuList.length; q++) {
- if (quyu == quyuList[q].place) {
- var shengfenList = quyuList[q].children;
- let shengfenHtml = "";
- for (var s = 0; s < shengfenList.length; s++) {
- shengfenHtml += "<li>" + shengfenList[s] + "</li>";
- }
- $(".shengfen > ul").html(shengfenHtml);
- setTimeout(function() {
- $(".shengfen>ul>li")
- .eq(0)
- .click();
- }, 0); // 默认点击全国展示全部
- break;
- }
- }
- });
- $(".quyu>ul>li")
- .eq(0)
- .click(); // 默认进来区域是全国
- $(".shengfen > ul").on("click", "li", function() {
- $(".shengfen > ul > li").removeClass("active");
- $(this).addClass("active");
- if ($(this).html == "全部") {
- var province = undefined;
- } else {
- for (var p = 0; p < provinceStatus.length; p++) {
- if ($(this).html() == provinceStatus[p].key) {
- var province = provinceStatus[p].value;
- break;
- }
- }
- }
- $.ajax({
- method: "get",
- url: api + "/open/listCustomerCase",
- data: {
- province
- },
- success: function(data) {
- if (data.error && data.error.length) {
- alert("系统繁忙,请刷新页面");
- } else {
- var dataList = data.data.list;
- var html = "";
- if (dataList.length) {
- for (var d = 0; d < dataList.length; d++) {
- html +=
- "<div><img src=" +
- avatarUploadHost +
- dataList[d].pictureUrl +
- " /></div>";
- }
- $(".page_ctrl").css({
- display: "block"
- });
- window.sessionStorage.setItem("total", data.data.totalCount);
- window.sessionStorage.setItem("province", province);
- page()
- }else {
- var html = "<h4 style='text-align:center;margin-top:90px;color:#666' >暂无服务客户</h4>"
- $(".page_ctrl").css({
- display: "none"
- })
- }
- $(".client-item").html(html);
- }
- }
- });
- });
- }
- // 服务客户筛选省份end
- // 手机端二级联动
- function getClass(dom, string) {
- return dom.getElementsByClassName(string);
- }
- //构造器
- function MobileSelect(config) {
- this.mobileSelect;
- this.wheelsData = config.wheels;
- this.jsonType = false;
- this.cascadeJsonData = [];
- this.displayJson = [];
- this.cascade = false;
- this.startY;
- this.moveEndY;
- this.moveY;
- this.oldMoveY;
- this.offset = 0;
- this.offsetSum = 0;
- this.oversizeBorder;
- this.curDistance = [];
- this.clickStatus = false;
- this.isPC = true;
- this.init(config);
- }
- MobileSelect.prototype = {
- constructor: MobileSelect,
- init: function(config) {
- var _this = this;
- _this.keyMap = config.keyMap
- ? config.keyMap
- : { id: "id", value: "value", childs: "childs" };
- _this.checkDataType();
- _this.renderWheels(
- _this.wheelsData,
- config.cancelBtnText,
- config.ensureBtnText
- );
- _this.trigger = document.querySelector(config.trigger);
- if (!_this.trigger) {
- console.error(
- "mobileSelect has been successfully installed, but no trigger found on your page."
- );
- return false;
- }
- _this.wheel = getClass(_this.mobileSelect, "wheel");
- _this.slider = getClass(_this.mobileSelect, "selectContainer");
- _this.wheels = _this.mobileSelect.querySelector(".wheels");
- _this.liHeight = _this.mobileSelect.querySelector("li").offsetHeight;
- _this.ensureBtn = _this.mobileSelect.querySelector(".ensure");
- _this.cancelBtn = _this.mobileSelect.querySelector(".cancel");
- _this.grayLayer = _this.mobileSelect.querySelector(".grayLayer");
- _this.popUp = _this.mobileSelect.querySelector(".content");
- _this.callback = config.callback ? config.callback : function() {};
- _this.transitionEnd = config.transitionEnd
- ? config.transitionEnd
- : function() {};
- _this.initPosition = config.position ? config.position : [];
- _this.titleText = config.title ? config.title : "";
- _this.connector = config.connector ? config.connector : " ";
- _this.trigger.style.cursor = "pointer";
- _this.setStyle(config);
- _this.setTitle(_this.titleText);
- _this.checkIsPC();
- _this.checkCascade();
- if (_this.cascade) {
- _this.initCascade();
- }
- //定位 初始位置
- if (_this.initPosition.length < _this.slider.length) {
- var diff = _this.slider.length - _this.initPosition.length;
- for (var i = 0; i < diff; i++) {
- _this.initPosition.push(0);
- }
- }
- _this.setCurDistance(_this.initPosition);
- _this.addListenerAll();
- //按钮监听
- _this.cancelBtn.addEventListener("click", function() {
- _this.mobileSelect.classList.remove("mobileSelect-show");
- });
- _this.ensureBtn.addEventListener("click", function() {
- _this.mobileSelect.classList.remove("mobileSelect-show");
- var tempValue = "";
- for (var i = 0; i < _this.wheel.length; i++) {
- i == _this.wheel.length - 1
- ? (tempValue += _this.getInnerHtml(i))
- : (tempValue += _this.getInnerHtml(i) + _this.connector);
- }
- _this.trigger.innerHTML = tempValue;
- _this.callback(_this.getIndexArr(), _this.getValue());
- });
- _this.trigger.addEventListener("click", function() {
- _this.mobileSelect.classList.add("mobileSelect-show");
- });
- _this.grayLayer.addEventListener("click", function() {
- _this.mobileSelect.classList.remove("mobileSelect-show");
- });
- _this.popUp.addEventListener("click", function() {
- event.stopPropagation();
- });
- _this.fixRowStyle(); //修正列数
- },
- setTitle: function(string) {
- var _this = this;
- _this.titleText = string;
- _this.mobileSelect.querySelector(".title").innerHTML = _this.titleText;
- },
- setStyle: function(config) {
- var _this = this;
- if (config.ensureBtnColor) {
- _this.ensureBtn.style.color = config.ensureBtnColor;
- }
- if (config.cancelBtnColor) {
- _this.cancelBtn.style.color = config.cancelBtnColor;
- }
- if (config.titleColor) {
- _this.title = _this.mobileSelect.querySelector(".title");
- _this.title.style.color = config.titleColor;
- }
- if (config.textColor) {
- _this.panel = _this.mobileSelect.querySelector(".panel");
- _this.panel.style.color = config.textColor;
- }
- if (config.titleBgColor) {
- _this.btnBar = _this.mobileSelect.querySelector(".btnBar");
- _this.btnBar.style.backgroundColor = config.titleBgColor;
- }
- if (config.bgColor) {
- _this.panel = _this.mobileSelect.querySelector(".panel");
- _this.shadowMask = _this.mobileSelect.querySelector(".shadowMask");
- _this.panel.style.backgroundColor = config.bgColor;
- _this.shadowMask.style.background =
- "linear-gradient(to bottom, " +
- config.bgColor +
- ", rgba(255, 255, 255, 0), " +
- config.bgColor +
- ")";
- }
- },
- checkIsPC: function() {
- var _this = this;
- var sUserAgent = navigator.userAgent.toLowerCase();
- var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
- var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
- var bIsMidp = sUserAgent.match(/midp/i) == "midp";
- var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
- var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
- var bIsAndroid = sUserAgent.match(/android/i) == "android";
- var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
- var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
- if (
- bIsIphoneOs ||
- bIsMidp ||
- bIsUc7 ||
- bIsUc ||
- bIsAndroid ||
- bIsCE ||
- bIsWM
- ) {
- _this.isPC = false;
- }
- },
- show: function() {
- this.mobileSelect.classList.add("mobileSelect-show");
- },
- renderWheels: function(wheelsData, cancelBtnText, ensureBtnText) {
- var _this = this;
- var cancelText = cancelBtnText ? cancelBtnText : "取消";
- var ensureText = ensureBtnText ? ensureBtnText : "确认";
- _this.mobileSelect = document.createElement("div");
- _this.mobileSelect.className = "mobileSelect";
- _this.mobileSelect.innerHTML =
- '<div class="grayLayer"></div>' +
- '<div class="content">' +
- '<div class="btnBar">' +
- '<div class="fixWidth">' +
- '<div class="cancel">' +
- cancelText +
- "</div>" +
- '<div class="title"></div>' +
- '<div class="ensure">' +
- ensureText +
- "</div>" +
- "</div>" +
- "</div>" +
- '<div class="panel">' +
- '<div class="fixWidth">' +
- '<div class="wheels">' +
- "</div>" +
- '<div class="selectLine"></div>' +
- '<div class="shadowMask"></div>' +
- "</div>" +
- "</div>" +
- "</div>";
- document.body.appendChild(_this.mobileSelect);
- //根据数据长度来渲染
- var tempHTML = "";
- for (var i = 0; i < wheelsData.length; i++) {
- //列
- tempHTML += '<div class="wheel"><ul class="selectContainer">';
- if (_this.jsonType) {
- for (var j = 0; j < wheelsData[i].data.length; j++) {
- //行
- tempHTML +=
- '<li data-id="' +
- wheelsData[i].data[j][_this.keyMap.id] +
- '">' +
- wheelsData[i].data[j][_this.keyMap.value] +
- "</li>";
- }
- } else {
- for (var j = 0; j < wheelsData[i].data.length; j++) {
- //行
- tempHTML += "<li>" + wheelsData[i].data[j] + "</li>";
- }
- }
- tempHTML += "</ul></div>";
- }
- _this.mobileSelect.querySelector(".wheels").innerHTML = tempHTML;
- },
- addListenerAll: function() {
- var _this = this;
- for (var i = 0; i < _this.slider.length; i++) {
- //手势监听
- (function(i) {
- _this.addListenerWheel(_this.wheel[i], i);
- _this.addListenerLi(i);
- })(i);
- }
- },
- addListenerWheel: function(theWheel, index) {
- var _this = this;
- theWheel.addEventListener(
- "touchstart",
- function() {
- _this.touch(event, this.firstChild, index);
- },
- false
- );
- theWheel.addEventListener(
- "touchend",
- function() {
- _this.touch(event, this.firstChild, index);
- },
- false
- );
- theWheel.addEventListener(
- "touchmove",
- function() {
- _this.touch(event, this.firstChild, index);
- },
- false
- );
- if (_this.isPC) {
- //如果是PC端则再增加拖拽监听 方便调试
- theWheel.addEventListener(
- "mousedown",
- function() {
- _this.dragClick(event, this.firstChild, index);
- },
- false
- );
- theWheel.addEventListener(
- "mousemove",
- function() {
- _this.dragClick(event, this.firstChild, index);
- },
- false
- );
- theWheel.addEventListener(
- "mouseup",
- function() {
- _this.dragClick(event, this.firstChild, index);
- },
- true
- );
- }
- },
- addListenerLi: function(sliderIndex) {
- var _this = this;
- var curWheelLi = _this.slider[sliderIndex].getElementsByTagName("li");
- for (var j = 0; j < curWheelLi.length; j++) {
- (function(j) {
- curWheelLi[j].addEventListener(
- "click",
- function() {
- _this.singleClick(this, j, sliderIndex);
- },
- false
- );
- })(j);
- }
- },
- checkDataType: function() {
- var _this = this;
- if (typeof _this.wheelsData[0].data[0] == "object") {
- _this.jsonType = true;
- }
- },
- checkCascade: function() {
- var _this = this;
- if (_this.jsonType) {
- var node = _this.wheelsData[0].data;
- for (var i = 0; i < node.length; i++) {
- if (
- _this.keyMap.childs in node[i] &&
- node[i][_this.keyMap.childs].length > 0
- ) {
- _this.cascade = true;
- _this.cascadeJsonData = _this.wheelsData[0].data;
- break;
- }
- }
- } else {
- _this.cascade = false;
- }
- },
- generateArrData: function(targetArr) {
- var tempArr = [];
- var keyMap_id = this.keyMap.id;
- var keyMap_value = this.keyMap.value;
- for (var i = 0; i < targetArr.length; i++) {
- var tempObj = {};
- tempObj[keyMap_id] = targetArr[i][this.keyMap.id];
- tempObj[keyMap_value] = targetArr[i][this.keyMap.value];
- tempArr.push(tempObj);
- }
- return tempArr;
- },
- initCascade: function() {
- var _this = this;
- _this.displayJson.push(_this.generateArrData(_this.cascadeJsonData));
- if (_this.initPosition.length > 0) {
- _this.initDeepCount = 0;
- _this.initCheckArrDeep(_this.cascadeJsonData[_this.initPosition[0]]);
- } else {
- _this.checkArrDeep(_this.cascadeJsonData[0]);
- }
- _this.reRenderWheels();
- },
- initCheckArrDeep: function(parent) {
- var _this = this;
- if (parent) {
- if (
- _this.keyMap.childs in parent &&
- parent[_this.keyMap.childs].length > 0
- ) {
- _this.displayJson.push(
- _this.generateArrData(parent[_this.keyMap.childs])
- );
- _this.initDeepCount++;
- var nextNode =
- parent[_this.keyMap.childs][_this.initPosition[_this.initDeepCount]];
- if (nextNode) {
- _this.initCheckArrDeep(nextNode);
- } else {
- _this.checkArrDeep(parent[_this.keyMap.childs][0]);
- }
- }
- }
- },
- checkArrDeep: function(parent) {
- //检测子节点深度 修改 displayJson
- var _this = this;
- if (parent) {
- if (
- _this.keyMap.childs in parent &&
- parent[_this.keyMap.childs].length > 0
- ) {
- _this.displayJson.push(
- _this.generateArrData(parent[_this.keyMap.childs])
- ); //生成子节点数组
- _this.checkArrDeep(parent[_this.keyMap.childs][0]); //检测下一个子节点
- }
- }
- },
- checkRange: function(index, posIndexArr) {
- var _this = this;
- var deleteNum = _this.displayJson.length - 1 - index;
- for (var i = 0; i < deleteNum; i++) {
- _this.displayJson.pop(); //修改 displayJson
- }
- var resultNode;
- for (var i = 0; i <= index; i++) {
- if (i == 0) resultNode = _this.cascadeJsonData[posIndexArr[0]];
- else {
- resultNode = resultNode[_this.keyMap.childs][posIndexArr[i]];
- }
- }
- _this.checkArrDeep(resultNode);
- _this.reRenderWheels();
- _this.fixRowStyle();
- _this.setCurDistance(_this.resetPostion(index, posIndexArr));
- },
- resetPostion: function(index, posIndexArr) {
- var _this = this;
- var tempPosArr = posIndexArr;
- var tempCount;
- if (_this.slider.length > posIndexArr.length) {
- tempCount = _this.slider.length - posIndexArr.length;
- for (var i = 0; i < tempCount; i++) {
- tempPosArr.push(0);
- }
- } else if (_this.slider.length < posIndexArr.length) {
- tempCount = posIndexArr.length - _this.slider.length;
- for (var i = 0; i < tempCount; i++) {
- tempPosArr.pop();
- }
- }
- for (var i = index + 1; i < tempPosArr.length; i++) {
- tempPosArr[i] = 0;
- }
- return tempPosArr;
- },
- reRenderWheels: function() {
- var _this = this;
- //删除多余的wheel
- if (_this.wheel.length > _this.displayJson.length) {
- var count = _this.wheel.length - _this.displayJson.length;
- for (var i = 0; i < count; i++) {
- _this.wheels.removeChild(_this.wheel[_this.wheel.length - 1]);
- }
- }
- for (var i = 0; i < _this.displayJson.length; i++) {
- //列
- (function(i) {
- var tempHTML = "";
- if (_this.wheel[i]) {
- //console.log('插入Li');
- for (var j = 0; j < _this.displayJson[i].length; j++) {
- //行
- tempHTML +=
- '<li data-id="' +
- _this.displayJson[i][j][_this.keyMap.id] +
- '">' +
- _this.displayJson[i][j][_this.keyMap.value] +
- "</li>";
- }
- _this.slider[i].innerHTML = tempHTML;
- } else {
- var tempWheel = document.createElement("div");
- tempWheel.className = "wheel";
- tempHTML = '<ul class="selectContainer">';
- for (var j = 0; j < _this.displayJson[i].length; j++) {
- //行
- tempHTML +=
- '<li data-id="' +
- _this.displayJson[i][j][_this.keyMap.id] +
- '">' +
- _this.displayJson[i][j][_this.keyMap.value] +
- "</li>";
- }
- tempHTML += "</ul>";
- tempWheel.innerHTML = tempHTML;
- _this.addListenerWheel(tempWheel, i);
- _this.wheels.appendChild(tempWheel);
- }
- _this.addListenerLi(i);
- })(i);
- }
- },
- updateWheels: function(data) {
- var _this = this;
- if (_this.cascade) {
- _this.cascadeJsonData = data;
- _this.displayJson = [];
- _this.initCascade();
- if (_this.initPosition.length < _this.slider.length) {
- var diff = _this.slider.length - _this.initPosition.length;
- for (var i = 0; i < diff; i++) {
- _this.initPosition.push(0);
- }
- }
- _this.setCurDistance(_this.initPosition);
- _this.fixRowStyle();
- }
- },
- updateWheel: function(sliderIndex, data) {
- var _this = this;
- var tempHTML = "";
- if (_this.cascade) {
- console.error(
- "级联格式不支持updateWheel(),请使用updateWheels()更新整个数据源"
- );
- return false;
- } else if (_this.jsonType) {
- for (var j = 0; j < data.length; j++) {
- tempHTML +=
- '<li data-id="' +
- data[j][_this.keyMap.id] +
- '">' +
- data[j][_this.keyMap.value] +
- "</li>";
- }
- _this.wheelsData[sliderIndex] = { data: data };
- } else {
- for (var j = 0; j < data.length; j++) {
- tempHTML += "<li>" + data[j] + "</li>";
- }
- _this.wheelsData[sliderIndex] = data;
- }
- _this.slider[sliderIndex].innerHTML = tempHTML;
- _this.addListenerLi(sliderIndex);
- },
- fixRowStyle: function() {
- var _this = this;
- var width = (100 / _this.wheel.length).toFixed(2);
- for (var i = 0; i < _this.wheel.length; i++) {
- _this.wheel[i].style.width = width + "%";
- }
- },
- getIndex: function(distance) {
- return Math.round((2 * this.liHeight - distance) / this.liHeight);
- },
- getIndexArr: function() {
- var _this = this;
- var temp = [];
- for (var i = 0; i < _this.curDistance.length; i++) {
- temp.push(_this.getIndex(_this.curDistance[i]));
- }
- return temp;
- },
- getValue: function() {
- var _this = this;
- var temp = [];
- var positionArr = _this.getIndexArr();
- if (_this.cascade) {
- for (var i = 0; i < _this.wheel.length; i++) {
- temp.push(_this.displayJson[i][positionArr[i]]);
- }
- } else if (_this.jsonType) {
- for (var i = 0; i < _this.curDistance.length; i++) {
- temp.push(
- _this.wheelsData[i].data[_this.getIndex(_this.curDistance[i])]
- );
- }
- } else {
- for (var i = 0; i < _this.curDistance.length; i++) {
- temp.push(_this.getInnerHtml(i));
- }
- }
- return temp;
- },
- calcDistance: function(index) {
- return 2 * this.liHeight - index * this.liHeight;
- },
- setCurDistance: function(indexArr) {
- var _this = this;
- var temp = [];
- for (var i = 0; i < _this.slider.length; i++) {
- temp.push(_this.calcDistance(indexArr[i]));
- _this.movePosition(_this.slider[i], temp[i]);
- }
- _this.curDistance = temp;
- },
- fixPosition: function(distance) {
- return -(this.getIndex(distance) - 2) * this.liHeight;
- },
- movePosition: function(theSlider, distance) {
- theSlider.style.webkitTransform = "translate3d(0," + distance + "px, 0)";
- theSlider.style.transform = "translate3d(0," + distance + "px, 0)";
- },
- locatePostion: function(index, posIndex) {
- this.curDistance[index] = this.calcDistance(posIndex);
- this.movePosition(this.slider[index], this.curDistance[index]);
- },
- updateCurDistance: function(theSlider, index) {
- this.curDistance[index] = parseInt(theSlider.style.transform.split(",")[1]);
- },
- getDistance: function(theSlider) {
- return parseInt(theSlider.style.transform.split(",")[1]);
- },
- getInnerHtml: function(sliderIndex) {
- var _this = this;
- var index = _this.getIndex(_this.curDistance[sliderIndex]);
- return _this.slider[sliderIndex].getElementsByTagName("li")[index]
- .innerHTML;
- },
- touch: function(event, theSlider, index) {
- var _this = this;
- event = event || window.event;
- switch (event.type) {
- case "touchstart":
- _this.startY = event.touches[0].clientY;
- _this.oldMoveY = _this.startY;
- break;
- case "touchend":
- _this.moveEndY = event.changedTouches[0].clientY;
- _this.offsetSum = _this.moveEndY - _this.startY;
- //修正位置
- _this.updateCurDistance(theSlider, index);
- _this.curDistance[index] = _this.fixPosition(_this.curDistance[index]);
- _this.movePosition(theSlider, _this.curDistance[index]);
- _this.oversizeBorder =
- -(theSlider.getElementsByTagName("li").length - 3) * _this.liHeight;
- //反弹
- if (_this.curDistance[index] + _this.offsetSum > 2 * _this.liHeight) {
- _this.curDistance[index] = 2 * _this.liHeight;
- setTimeout(function() {
- _this.movePosition(theSlider, _this.curDistance[index]);
- }, 100);
- } else if (
- _this.curDistance[index] + _this.offsetSum <
- _this.oversizeBorder
- ) {
- _this.curDistance[index] = _this.oversizeBorder;
- setTimeout(function() {
- _this.movePosition(theSlider, _this.curDistance[index]);
- }, 100);
- }
- _this.transitionEnd(_this.getIndexArr(), _this.getValue());
- if (_this.cascade) {
- var tempPosArr = _this.getIndexArr();
- tempPosArr[index] = _this.getIndex(_this.curDistance[index]);
- _this.checkRange(index, tempPosArr);
- }
- break;
- case "touchmove":
- event.preventDefault();
- _this.moveY = event.touches[0].clientY;
- _this.offset = _this.moveY - _this.oldMoveY;
- _this.updateCurDistance(theSlider, index);
- _this.curDistance[index] = _this.curDistance[index] + _this.offset;
- _this.movePosition(theSlider, _this.curDistance[index]);
- _this.oldMoveY = _this.moveY;
- break;
- }
- },
- dragClick: function(event, theSlider, index) {
- var _this = this;
- event = event || window.event;
- switch (event.type) {
- case "mousedown":
- _this.startY = event.clientY;
- _this.oldMoveY = _this.startY;
- _this.clickStatus = true;
- break;
- case "mouseup":
- _this.moveEndY = event.clientY;
- _this.offsetSum = _this.moveEndY - _this.startY;
- //修正位置
- _this.updateCurDistance(theSlider, index);
- _this.curDistance[index] = _this.fixPosition(_this.curDistance[index]);
- _this.movePosition(theSlider, _this.curDistance[index]);
- _this.oversizeBorder =
- -(theSlider.getElementsByTagName("li").length - 3) * _this.liHeight;
- //反弹
- if (_this.curDistance[index] + _this.offsetSum > 2 * _this.liHeight) {
- _this.curDistance[index] = 2 * _this.liHeight;
- setTimeout(function() {
- _this.movePosition(theSlider, _this.curDistance[index]);
- }, 100);
- } else if (
- _this.curDistance[index] + _this.offsetSum <
- _this.oversizeBorder
- ) {
- _this.curDistance[index] = _this.oversizeBorder;
- setTimeout(function() {
- _this.movePosition(theSlider, _this.curDistance[index]);
- }, 100);
- }
- _this.clickStatus = false;
- _this.transitionEnd(_this.getIndexArr(), _this.getValue());
- if (_this.cascade) {
- var tempPosArr = _this.getIndexArr();
- tempPosArr[index] = _this.getIndex(_this.curDistance[index]);
- _this.checkRange(index, tempPosArr);
- }
- break;
- case "mousemove":
- event.preventDefault();
- if (_this.clickStatus) {
- _this.moveY = event.clientY;
- _this.offset = _this.moveY - _this.oldMoveY;
- _this.updateCurDistance(theSlider, index);
- _this.curDistance[index] = _this.curDistance[index] + _this.offset;
- _this.movePosition(theSlider, _this.curDistance[index]);
- _this.oldMoveY = _this.moveY;
- }
- break;
- }
- },
- singleClick: function(theLi, index, sliderIndex) {
- var _this = this;
- if (_this.cascade) {
- var tempPosArr = _this.getIndexArr();
- tempPosArr[sliderIndex] = index;
- _this.checkRange(sliderIndex, tempPosArr);
- } else {
- _this.curDistance[sliderIndex] = (2 - index) * _this.liHeight;
- _this.movePosition(theLi.parentNode, _this.curDistance[sliderIndex]);
- }
- }
- };
- if (typeof exports == "object") {
- module.exports = MobileSelect;
- } else if (typeof define == "function" && define.amd) {
- define([], function() {
- return MobileSelect;
- });
- } else {
- window.MobileSelect = MobileSelect;
- }
- function jobs() {
- var provinceStatus = [
- {
- value: "7",
- key: "安徽"
- },
- {
- value: "15",
- key: "北京"
- },
- {
- value: "27",
- key: "重庆"
- },
- {
- value: "8",
- key: "福建"
- },
- {
- value: "30",
- key: "甘肃"
- },
- {
- value: "24",
- key: "广东"
- },
- {
- value: "20",
- key: "广西"
- },
- {
- value: "25",
- key: "贵州"
- },
- {
- value: "21",
- key: "海南"
- },
- {
- value: "13",
- key: "河北"
- },
- {
- value: "1",
- key: "黑龙江"
- },
- {
- value: "19",
- key: "河南"
- },
- {
- value: "22",
- key: "香港"
- },
- {
- value: "17",
- key: "湖北"
- },
- {
- value: "18",
- key: "湖南"
- },
- {
- value: "5",
- key: "江苏"
- },
- {
- value: "9",
- key: "江西"
- },
- {
- value: "3",
- key: "辽宁"
- },
- {
- value: "2",
- key: "吉林"
- },
- {
- value: "23",
- key: "澳门"
- },
- {
- value: "14",
- key: "内蒙古"
- },
- {
- value: "32",
- key: "宁夏"
- },
- {
- value: "31",
- key: "青海"
- },
- {
- value: "10",
- key: "山东"
- },
- {
- value: "4",
- key: "上海"
- },
- {
- value: "9",
- key: "山西"
- },
- {
- value: "34",
- key: "陕西"
- },
- {
- value: "29",
- key: "四川"
- },
- {
- value: "11",
- key: "台湾"
- },
- {
- value: "16",
- key: "天津"
- },
- {
- value: "33",
- key: "新疆"
- },
- {
- value: "28",
- key: "西藏"
- },
- {
- value: "26",
- key: "云南"
- },
- {
- value: "6",
- key: "浙江"
- }
- ];
- $("#display-more").css({
- display: "block"
- });
- var displayNum = 0;
- var hr = '<hr style="border: 1px solid #ccc;">';
- var provinceNum = 18;
- var url = "http://kede.jishutao.com/open/listRecruitment";
- // var url = window.globalConfig;
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url,
- data: {
- province: 18
- },
- success: function(data) {
- if (data.error && data.error.length) {
- console.log("数据异常");
- } else {
- var arr = data.data.list;
- var html = "";
- var zhiwu = "";
- displayNum = 0;
- arr.forEach(function(item) {
- html = html + "<div>" + item.content + "</div>" + hr;
- zhiwu += `<li>${item.name}</li>`;
- displayNum++;
- });
- if (displayNum >= 12) {
- $("#display-more").css({
- display: "block"
- });
- }
- if (!html) {
- $("#job").html(
- '<p style="font-size: 24px;text-align: center;">暂无数据</p>'
- );
- $("#position").html(
- '<p style="text-align: center;font-size: 20px;color: #666;">暂无职务</p>'
- );
- } else {
- $("#job").html(html);
- $("#position").html(zhiwu);
- }
- }
- }
- });
- $("#province").on("click", "li", function(e) {
- $("#province li").removeClass("active");
- $(this).addClass("active");
- var province = $(this).html();
- provinceStatus.forEach(function(item) {
- if (item.key == province) {
- provinceNum = item.value;
- }
- });
- var html = "";
- var zhiwu = "";
- displayNum = 0;
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url,
- data: {
- province: provinceNum
- },
- success: function(data) {
- if (data.error && data.error.length) {
- console.log("数据异常");
- } else {
- var arr = data.data.list;
- arr.forEach(function(item) {
- html = html + "<div>" + item.content + "</div>" + hr;
- zhiwu += `<li>${item.name}</li>`;
- displayNum++;
- });
- if (displayNum) {
- $("#display-more").css({
- display: "block"
- });
- }
- if (!html) {
- $("#job").html(
- '<p style="font-size: 24px;text-align: center;">暂无数据</p>'
- );
- $("#position").html(
- '<p style="text-align: center;font-size: 20px;color: #666;">暂无职务</p>'
- );
- } else {
- $("#job").html(html);
- $("#position").html(zhiwu);
- }
- }
- }
- });
- });
- $("#position")
- .off("click")
- .on("click", "li", function(e) {
- $("#position li").removeClass("active");
- $(this).addClass("active");
- var posHtml = "";
- var jobStr = $(this).html();
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url,
- data: {
- province: provinceNum,
- name: jobStr
- },
- success: function(data) {
- if (data.error && data.error.length) {
- console.log("数据异常");
- } else {
- var arr = data.data.list;
- arr.forEach(function(item) {
- posHtml = posHtml + "<div>" + item.content + "</div>" + hr;
- });
- if (!posHtml) {
- $("#job").html(
- '<p style="font-size: 24px;text-align: center;">暂无数据</p>'
- );
- } else {
- $("#job").html(posHtml);
- }
- }
- }
- });
- });
- }
- // 合作机构请求
- function cooperation() {
- $.ajax({
- url: api + "/open/listOrganization",
- method: "get",
- data: {
- releaseStatus: 1,
- pageSize: 16
- },
- success: function(res) {
- if(res.error && res.error.length) {
- alert("数据异常,请刷新页面!")
- }else {
- if(res.data.list.length) {
- var html = ""
- for(var i = 0; i < res.data.list.length; i++) {
- html +=
- "<li><img src=" +
- avatarUploadHost +
- res.data.list[i].pictureUrl +
- " /></li>";
- }
- $(".strategic > div > ul").html(html);
- window.sessionStorage.setItem("total", res.data.totalCount);
- }else {
- $(".strategic > div > ul").html(
- '<p style="font-size: 24px;text-align: center;color:#666;line-height:550px">暂无数据</p>'
- );
- $(".page_3").css({
- display: "none"
- })
- }
- cooperationPage()
- }
- }
- });
- }
- // 合作机构分页展示
- function cooperationPage() {
- var obj_3 = {
- obj_box: ".page_3",
- total_item: window.sessionStorage.getItem("total"), //总共数据
- per_num: 16, //每页显示数据
- current_page: 1, //当前页
- change_content: function(per_num, current_page) {
- per_num = per_num ? per_num : 16;
- current_page = current_page ? current_page : 1;
- total_item = window.sessionStorage.getItem("total");
- $.ajax({
- url: api + "/open/listOrganization",
- data: {
- pageSize: 16,
- releaseStatus: 1,
- pageNo: current_page,
- },
- method: "GET",
- dataType: "json",
- success: function(res) {
- if (res.error && res.error.length) {
- alert("数据异常,请刷新页面!");
- } else {
- if (res.data.list.length) {
- var html = "";
- for (var i = 0; i < res.data.list.length; i++) {
- html +=
- "<li><img src=" +
- avatarUploadHost +
- res.data.list[i].pictureUrl +
- " /></li>";
- }
- $(".strategic > div > ul").html(html);
- window.sessionStorage.setItem("total", res.data.totalCount);
- } else {
- $(".strategic > div > ul").html(
- '<p style="font-size: 24px;text-align: center;color:#666;line-height:550px">暂无数据</p>'
- );
- $(".page_3").css({
- display: "none"
- });
- }
- }
- }
- });
- }
- };
- //调用分页
- page_ctrl(obj_3);
- }
- $(function() {
- if (window.location.search.length <= 3 && window.location.search.length >= 2) {
- $("html,body").animate({ scrollTop: "1200px" }, 500);
- }
- switch (window.location.search) {
- case "?0":
- $(".product-a li")
- .eq(0)
- .click();
- break;
- case "?1":
- $(".product-a li")
- .eq(1)
- .click();
- break;
- case "?2":
- $(".product-a li")
- .eq(2)
- .click();
- break;
- case "?3":
- $(".product-a li")
- .eq(3)
- .click();
- break;
- case "?4":
- $(".product-a li")
- .eq(4)
- .click();
- break;
- case "?5":
- $(".product-a li")
- .eq(5)
- .click();
- break;
- case "?6":
- $(".product-a li")
- .eq(6)
- .click();
- break;
- case "?7":
- $(".product-a li")
- .eq(7)
- .click();
- break;
- case "?8":
- $(".product-a li")
- .eq(8)
- .click();
- break;
- case "?9":
- $(".product-a li")
- .eq(9)
- .click();
- break;
- case "?10":
- $(".product-a li")
- .eq(10)
- .click();
- break;
- case "?11":
- $(".product-a li")
- .eq(11)
- .click();
- break;
- case "?12":
- $(".product-a li")
- .eq(12)
- .click();
- break;
- default:
- break;
- }
- });
|