// 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 += "
" + shengfenList[s] + "";
}
$(".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 +=
"";
}
$(".page_ctrl").css({
display: "block"
});
window.sessionStorage.setItem("total", data.data.totalCount);
window.sessionStorage.setItem("province", province);
page();
} else {
var html =
"暂无服务客户
";
$(".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 =
'' +
'' +
'
' +
'
' +
'
' +
cancelText +
"
" +
'
' +
'
' +
ensureText +
"
" +
"
" +
"
" +
'
' +
'
' +
'
' +
"
" +
'
' +
'
' +
"
" +
"
" +
"
";
document.body.appendChild(_this.mobileSelect);
//根据数据长度来渲染
var tempHTML = "";
for (var i = 0; i < wheelsData.length; i++) {
//列
tempHTML += '';
if (_this.jsonType) {
for (var j = 0; j < wheelsData[i].data.length; j++) {
//行
tempHTML +=
'- ' +
wheelsData[i].data[j][_this.keyMap.value] +
"
";
}
} else {
for (var j = 0; j < wheelsData[i].data.length; j++) {
//行
tempHTML += "- " + wheelsData[i].data[j] + "
";
}
}
tempHTML += "
";
}
_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 +=
'' +
_this.displayJson[i][j][_this.keyMap.value] +
"";
}
_this.slider[i].innerHTML = tempHTML;
} else {
var tempWheel = document.createElement("div");
tempWheel.className = "wheel";
tempHTML = '';
for (var j = 0; j < _this.displayJson[i].length; j++) {
//行
tempHTML +=
'- ' +
_this.displayJson[i][j][_this.keyMap.value] +
"
";
}
tempHTML += "
";
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 +=
'' +
data[j][_this.keyMap.value] +
"";
}
_this.wheelsData[sliderIndex] = { data: data };
} else {
for (var j = 0; j < data.length; j++) {
tempHTML += "" + data[j] + "";
}
_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 = '
';
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 + "" + item.content + "
" + hr;
zhiwu += `${item.name}`;
displayNum++;
});
if (displayNum >= 12) {
$("#display-more").css({
display: "block"
});
}
if (!html) {
$("#job").html(
'暂无数据
'
);
$("#position").html(
'暂无职务
'
);
} 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 + "" + item.content + "
" + hr;
zhiwu += `${item.name}`;
displayNum++;
});
if (displayNum) {
$("#display-more").css({
display: "block"
});
}
if (!html) {
$("#job").html(
'暂无数据
'
);
$("#position").html(
'暂无职务
'
);
} 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 + "" + item.content + "
" + hr;
});
if (!posHtml) {
$("#job").html(
'暂无数据
'
);
} 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 +=
"";
}
$(".strategic > div > ul").html(html);
window.sessionStorage.setItem("total", res.data.totalCount);
} else {
$(".strategic > div > ul").html(
'暂无数据
'
);
$(".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 +=
"";
}
$(".strategic > div > ul").html(html);
window.sessionStorage.setItem("total", res.data.totalCount);
} else {
$(".strategic > div > ul").html(
'暂无数据
'
);
$(".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 +=
""+activitiesList.title+"
"+
""+
"
"+
content+
"
"+
"
"+
"
"
}
window.sessionStorage.setItem("total", data.data.totalCount);
} else {
html =
"暂无团队活动
";
$(".page_ctrl").css({
display: "none"
});
}
$(".group-activities").html(html);
}
}
});
}
};
//调用分页
page_ctrl(obj_2);
}
activitiesPage1();
});