///
var ec = {
utilities: {
banner: function () {
var imgs = $(".banner li");
var indexs = $(".banner-paging span");
var btnPre = $(".banner .btn-pre");
var btnNext = $(".banner .btn-next")
function InitMove(index) {
imgs.css({ "opacity": "0", "z-index": "1" });
$(indexs).find("em").removeClass("bg2");
$(imgs[index]).css({ "opacity": "1", "z-index": "100" });
$(indexs[index]).find("em").addClass("bg2");
};
InitMove(0);
var count = 1;
function fMove() {
if (count == imgs.length) {
count = 0;
}
InitMove(count);
count++;
};
var scollMove = setInterval(fMove, 15000);
$(".banner-list").hover(function () {
clearInterval(scollMove);
}, function () {
clearInterval(scollMove);
scollMove = setInterval(fMove, 15000);
})
indexs.hover(function () {
clearInterval(scollMove);
count = indexs.index(this)
InitMove(count);
count++;
scollMove = setInterval(fMove, 15000);
});
btnPre.click(function () {
clearInterval(scollMove);
count = count - 2;
if (count < 0)
count = indexs.length - 1;
fMove();
scollMove = setInterval(fMove, 15000);
});
btnNext.click(function () {
clearInterval(scollMove);
fMove();
scollMove = setInterval(fMove, 15000);
})
},
serviceShow: function (isShow) {
$(".float-contact").toggle(isShow);
$(".float-contact-mini").toggle(!isShow);
},
backTop: function () {
$('body,html').animate({ scrollTop: 0 }, 300); return false;
},
validateLoading: function (isload) {
$("#get_code").toggleClass("notclick", isload).html(isload ? L.G("正在发送...") : L.G("获取验证码"));
},
validateMsgBtn: function (s) {
var btnGetVCode = $("#get_code");
if (s > 0) {
btnGetVCode.html(L.G("重新获取") + "(" + s + ")");
btnGetVCode.addClass("notclick");
window.codeStart = setTimeout("ec.utilities.validateMsgBtn(" + (s - 1) + ");", 1000);
}
else {
btnGetVCode.html(L.G("获取验证码"));
btnGetVCode.removeClass("notclick");
}
},
showError: function (el, msg) {
var p = el.parent();
p.toggleClass("ilegal", !(!msg));
if (msg)
p.append("
" + msg + "
");
else
p.find("p").remove();
},
showError1: function (el, msg) {
ec.notify(msg, "question");
setTimeout(function () { el.removeClass("focus").find(".box").addClass("illegal"); }, 100);
},
getCountry: function () {
var r = [];
var data = this.countrySource;
data.forEach(
function (d) {
var name = L.isEn ? d.ename : d.cname;
r.push({ num: name, name: name });
});
return r;
},
getProvince: function (country) {
var data = this.countrySource;
var r = [];
if (country != "") {
var arr = [];
data.forEach(function (d) {
var name = L.isEn ? d.ename : d.cname;
if (name == country)
arr = d.children;
});
if (arr != null) {
arr.forEach(function (d) {
var name = L.isEn ? d.ename : d.cname;
r.push({ num: name, name: name });
});
}
};
return r;
},
getCity: function (country, province) {
var data = this.countrySource;
var r = [];
if (country != "" && province != "") {
var provinces = [];
data.forEach(function (d) {
var name = L.isEn ? d.ename : d.cname;
if (name == country)
provinces = d.children;
});
var citys = [];
provinces.forEach(function (d) {
var name = L.isEn ? d.ename : d.cname;
if (name == province)
citys = d.children;
});
if (citys != null) {
citys.forEach(function (d) {
var name = L.isEn ? d.ename : d.cname;
r.push({ num: name, name: name });
});
}
}
return r;
},
feedBackShow: function () {
ec.popup(L.G("建议与反馈"), L.route + "/feedback", 598, 478);
},
loading: function () {
var html = "";
$(window.document.body).append(html);
},
unLoading: function () {
$("#common_loading").remove();
},
zoomPic: function (url) {
var html = ""
$("body").append(html);
}
},
notify: function (msg, icon, sec) {
$.messager.notify(msg, sec || 5000, { icon: icon || "ok" });
},
confirm: function (title, msg, callback, icon) {
window.top.$.messager.show({
title: title,
msg: msg,
callback: callback,
modal: true,
draggable: false,
closable: false,
minimizable: false,
maximizable: false,
collapsible: false,
css: "window2 ",
icon: ""
});
},
popup: function (title, url, w, h) {
ke.openWindow(title, url, w || 650, h || 600, { modal: true, clickHide: false, css: 'window1 ', draggable: false, btnClose: true });
},
disable: function (selector, html, loading) {
var el = $(selector);
el.addClass("btn-loading");
var text = el.find("span");
if (loading)
el.append("");
if (html && text.length > 0)
text.html(html);
else if (html)
el.html(html);
},
enable: function (selector, html, loading) {
var el = $(selector);
var text = el.find("span");
el.removeClass("btn-loading");
if (loading)
el.find("ico-loading").remove();
if (html && text.length > 0)
text.html(html);
else if (html)
el.html(html);
},
hideWindow: function () {
var id = "ke_open_window";
ke.ui.destroy(window.top.ke.ui.find(id));
},
changeWindowH: function (h) {
var open = window.top.$("#ke_open_window");
var winHeight = $(window.top).height();
open.find(".panel-body").height(h);
if (winHeight > open.height())
open.css("top", (winHeight - open.height()) / 2);
},
open: {
address: function (type, title, callback, w, h, id) {
ec.popup(title, L.route + "/user/setting/address/add?type=" + type + "&callback=" + callback + "&id=" + (id || 0), w, h);
},
invoice: function (title, callback, id) {
ec.popup(title, L.route + "/user/setting/invoice/add" + "?callback=" + callback + "&id=" + (id || 0), 650, 631);
}
},
exit: function () {
new ec.api("account").post("exit", null, function () {
window.location.reload();
});
},
selectNav: function () {
var nav = $(".head-menu a");
var url = window.location.pathname;
nav.each(function (i, e) {
if ($(e).attr("href") == url) {
$(e).parents("li").addClass("active");
}
})
}
};
var L = {
isEn: false,
packs: [],
route: "",
G: function (txt) {
txt = txt.trim();
for (var i = 0; i < this.packs.length; i++) {
if (this.packs[i] == txt && i < this.packs.length - 1)
return this.packs[i + 1];
}
return txt;
}
}