123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953 |
- // var api = "http://kede.jishutao.com";
- var api = window.location.protocol+'//'+window.location.host;
- var avatarUploadHost = "http://kedejs.jishutao.com/upload";
- // var avatarUploadHost = "http://s.kedexinxi.com/upload";
- var newUrl = window.location.protocol+'//'+window.location.host+"/portal/newsDetails";
- var timeClick;
- // 底部导航
- $(".product-center").click(function() {
- $(".product-center>ul").fadeToggle("slow");
- });
- $("#txrzhtml .chengnuo-con")
- .parent()
- .css("display", "none");
- //手机导航汉堡按钮效果
- $(".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);
- });
- //导航栏下拉菜单
- var ab = $(".pc_nav>ul>li").eq(1);
- ab.mouseenter(function() {
- $(".product-serve")
- .stop()
- .slideDown("3000");
- });
- ab.siblings("li").mouseenter(function() {
- $(".product-serve")
- .stop()
- .slideUp("3000");
- });
- $(".product-serve").mouseleave(function() {
- $(".product-serve")
- .stop()
- .slideUp("3000");
- });
- //首页新闻模块切换
- 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();
- 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].setAttribute("data-_index", 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");
- }
- if(_index !== '2'){
- $('.page_activitiesPage').css({display:'none'})
- }else{
- $('.page_activitiesPage').css({display:'block'})
- }
- if (_index == 4) {
- timeClick = setInterval(function() {
- $("#right").click();
- }, 1000);
- } else {
- clearInterval(timeClick);
- }
- _y[_index].style.display = "block";
- _y[_index].classList.add("active");
- if (_f) {
- _f();
- }
- }
- for (var i = 0; i < _x.length; 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]) {
- 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 = window.location.protocol+'//'+window.location.host+"/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;
- case "?13":
- $(".product-a li")
- .eq(13)
- .click();
- break;
- case "?14":
- $(".product-a li")
- .eq(14)
- .click();
- break;
- case "?15":
- $(".product-a li")
- .eq(15)
- .click();
- break;
- case "?16":
- $(".product-a li")
- .eq(16)
- .click();
- break;
- case "?17":
- $(".product-a li")
- .eq(17)
- .click();
- break;
- case "?18":
- $(".product-a li")
- .eq(18)
- .click();
- break;
- case "?19":
- $(".product-a li")
- .eq(19)
- .click();
- break;
- case "?20":
- $(".product-a li")
- .eq(20)
- .click();
- break;
- case "?21":
- $(".product-a li")
- .eq(21)
- .click();
- break;
- case "?22":
- $(".product-a li")
- .eq(22)
- .click();
- break;
- case "?23":
- $(".product-a li")
- .eq(23)
- .click();
- break;
- case "?24":
- $(".product-a li")
- .eq(24)
- .click();
- break;
- case "?25":
- $(".product-a li")
- .eq(25)
- .click();
- break;
- case "?26":
- $(".product-a li")
- .eq(26)
- .click();
- break;
- case "?27":
- $(".product-a li")
- .eq(27)
- .click();
- break;
- case "?28":
- $(".product-a li")
- .eq(28)
- .click();
- break;
- case "?29":
- $(".product-a li")
- .eq(29)
- .click();
- break;
- case "?30":
- $(".product-a li")
- .eq(30)
- .click();
- break;
- case "?31":
- $(".product-a li")
- .eq(31)
- .click();
- break;
- case "?32":
- $(".product-a li")
- .eq(32)
- .click();
- break;
- case "?33":
- $(".product-a li")
- .eq(33)
- .click();
- break;
- case "?34":
- $(".product-a li")
- .eq(34)
- .click();
- break;
- default:
- break;
- }
- submit();
- function submit() {
- let name = "";
- let phone = "";
- $("#submitName").on("input", function() {
- name = $(this).val();
- });
- $("#submitPhone").on("input", function() {
- phone = $(this).val();
- });
- $("#submitGo").on("click", function() {
- if (
- $("#submitName")
- .val()
- .trim() == ""
- ) {
- alert("请输入姓名!");
- $("#submitPhone").val("");
- $("#submitName").val("");
- return;
- }
- if (
- $("#submitPhone")
- .val()
- .trim() == ""
- ) {
- alert("请输入联系方式!");
- $("#submitPhone").val("");
- $("#submitName").val("");
- return;
- }
- $.ajax({
- method: "post",
- dataType: "json",
- crossDomain: false,
- url: api + "/open/addVisitingCustomers",
- data: {
- name,
- mobile: phone
- },
- success: function(data) {
- if (data.error && data.error.length) {
- console.log("数据异常");
- } else {
- alert(`提交成功!`);
- $("#submitPhone").val("");
- $("#submitName").val("");
- $(".footer-submit").fadeOut();
- $(".infoDown").eq(1).fadeOut();
- }
- }
- });
- });
- $("#submit-close").on("click", function() {
- $(".footer-submit").fadeOut();
- $(".infoDown").eq(1).fadeOut();
- });
- }
- urlTo()
- function urlTo() {
- let index = window.location.search.split("=")[1]
- if(index == 3) {
- $(".secondary-menu>div>ul>li").eq(index).click()
- }
- }
- function activitiesPage1() {
- $.ajax({
- url: api + "/open/activity/list",
- data:{
- pageNo: 1,
- pageSize: 10,
- },
- type: "GET",
- dataType: "json",
- success: function(data) {
- if (data.error && data.error.length) {
- } else {
- if (data.data.list.length) {
- window.sessionStorage.setItem("total", data.data.totalCount);
- activitiesPage();
- }
- }
- }
- });
- }
- function activitiesPage() {
- var obj_2 = {
- obj_box: ".page_activitiesPage",
- total_item: +window.sessionStorage.getItem("total"), //总共数据
- per_num: 5, //每页显示数据
- current_page: 1, //当前页
- change_content: function(per_num, current_page) {
- per_num = per_num ? per_num : 10;
- current_page = current_page ? current_page : 1;
- $.ajax({
- url: api + "/open/activity/list",
- data:{
- pageNo: current_page,
- pageSize: per_num,
- },
- type: "GET",
- dataType: "json",
- success: function(data) {
- if (data.error && data.error.length) {
- alert("数据加载失败,请刷新页面");
- } else {
- var html = "";
- if (data.data.list.length) {
- let activeArrowSrc = $(".activeArrow").attr('src');
- let clientStyle = document.body.clientWidth < 989 ? '' : 'display:flex;align-items: center;';
- for (var i = 0; i < data.data.list.length; i++) {
- var activitiesList = data.data.list[i];
- var content = activitiesList.content.replace(/<.*?>/gi, "");
- html +=
- "<div style='padding-bottom: 30px'><div style="+clientStyle+"><span style='display:flex;align-items:center;white-space:nowrap;min-width: 297px;'><div style='font-size: 30px;color: #070707;font-weight: bolder;'>"+activitiesList.title+"</div>"+
- "<img style='padding-left:20px;width: 60px;height: auto;' src="+activeArrowSrc+"></span>"+
- "<div style='font-size:16px; color: #666;'>"+
- content+
- "</div>"+
- "</div>"+
- "<img style='padding-top:5px;padding-bottom:21px;width:100%;height:auto;' src="
- + avatarUploadHost + activitiesList.pictureUrl +
- "></div>"
- }
- window.sessionStorage.setItem("total", data.data.totalCount);
- } else {
- html =
- "<h4 style='text-align:center;margin-top:90px;color:#666' >暂无团队活动</h4>";
- $(".page_ctrl").css({
- display: "none"
- });
- }
- $(".group-activities").html(html);
- }
- }
- });
- }
- };
- //调用分页
- page_ctrl(obj_2);
- }
- activitiesPage1();
- });
|