/*
* @author: zhengwenbin
* @date: 2017-05-04 17:51:29
*/
/** ================================================ 服务承诺组件 star======================================================= */
comps.promisecomp = function(option) {
this.compid = option.compid;
this.needasyncinit = option.needasyncinit;
this.promisename = option.promisename;
this.imgsrc = option.imgsrc;
this.defineurl = option.defineurl;
}
comps.promisecomp.prototype.init = function(){
var that = this;
$("#" + that.compid + "_a").attr("href",that.defineurl);
$("#" + that.compid + "_name").html(that.promisename);
utils.ajaxloadcomplate(that);
}
/** ================================================ 服务承诺组件 end======================================================= */
/** ================================================ 订单查询组件 star======================================================= */
comps.ordersearchcomp = function(option) {
this.compid = option.compid;
this.needasyncinit = option.needasyncinit;
this.codeurl = option.codeurl;
this.ordersearchurl = option.ordersearchurl;
this.searchtitle = option.searchtitle;
}
comps.ordersearchcomp.prototype.init = function(){
var that = this;
utils.ajaxloadcomplate(that);
var needasyncinit = that.needasyncinit;
if (needasyncinit) {
$("#" + that.compid + "_btn").html(that.searchtitle);
}
that.bindsomeevent();
}
comps.ordersearchcomp.prototype.bindsomeevent=function(){
var that=this;
$("#"+that.compid+"_a").click(function(){
var phone = $("#"+that.compid+"_phone").val();
var reg = /^1\d{10}$/;
if(phone==null || phone ==""){
alert("请输入手机号");
return;
}else if(!reg.test(phone)){
alert("请输入正确的手机号");
return;
}
//$("#" + that.compid + "_a").attr("href",that.codeurl+"?phone="+phone);
//window.open(contextpath+that.codeurl+"?phone="+phone);
var url = contextpath+that.codeurl;
$.getjson(url,{phone:phone, rannum:math.random()},function(data){
if(data.flag=="sendregmsgfail"){
alert("短信验证码发送失败!");
return;
}else{
var sessionid = data.sessionid;
$("#"+that.compid).append("");
$("#sessionid").val(sessionid);
timeout(that);
}
})
});
$("#"+that.compid+"_btn").click(function(){
var phone = $("#"+that.compid+"_phone").val();
var code = $("#"+that.compid+"_code").val();
var sessionid = $("#sessionid").val();
if(sessionid == null ||sessionid =="undefine"){
sessionid = "";
}
var reg = /^1\d{10}$/;
if(phone==null || phone ==""){
alert("请输入手机号");
return;
}else if(!reg.test(phone)){
alert("请输入正确的手机号");
return;
}else if(code==null || code ==""){
alert("验证码不能为空");
return;
}
window.open(contextpath+that.ordersearchurl+"?phone="+phone+"&code="+code+"&sessionid="+sessionid);
})
}
var wait=60;
function timeout(o) {
if (wait == 0) {
//获取验证码按钮解除禁用
$("#"+o.compid+"_a").attr("disabled", false);
$("#"+o.compid+"_a").text("重新获取验证码");
wait = 60;
} else {
// 禁用获取验证码按钮
$("#"+o.compid+"_a").attr("disabled", true);
$("#"+o.compid+"_a").text(wait+"秒后重发");
wait--;
settimeout(function() {
timeout(o);
},
1000)
}
}
/** ================================================ 订单查询组件 end======================================================= */
/** ================================================ 频道组件 star======================================================= */
comps.channelcomp = function (config) {
this.compid = config.compid;
this.config = config;
};
comps.channelcomp.prototype.init = function () {
var that = this;
var compid = that.compid;
var needasyncinit = that.config.needasyncinit;
if (needasyncinit) {
that.ajaxloaddata();
}else {
utils.ajaxloadcomplate(that);
}
that.setstyles(compid);
};
comps.channelcomp.prototype.setstyles = function (compid) {
//导航下拉
var time = null;
var list = $("#"+compid+"_navlist");
var box = $("#"+compid+"_navbox");
var lista = list.find(".m-drop");
for(var i=0,j=lista.length;i标签
var newele = firchannelmodelele.clone();
//分类渲染
var channeluuid = channeldto.uuid;
var channelurl;
if (!channeldto.channelurl) {
channelurl = that.customurl + channeldto.pageuuid;
} else {
channelurl = channeldto.channelurl;
}
//获取循环的a标签
var aele = newele.find(".j_loopa").first();
aele.html(channeldto.channelname);
aele.attr("href", contextpath + channelurl);
//给a赋id属性,以便后续取子频道数据
aele.attr("id", channeluuid);
var recommendchannels = that.recommendchannels;
if(recommendchannels){
var channelarr = recommendchannels.split(";");
for(var j = 0;j< channelarr.length ;j++){
var recommendchannel = channelarr[j];
if(recommendchannel){
var uuid = recommendchannel.split("_")[0];
if(channeluuid == uuid){
aele.append("");
}
}
}
}
//获取子频道
var secchanneldtos = channeldto.childchannellist;
//有二级频道则遍历子频道,将二级频道渲染进页面
if (secchanneldtos) {
newele.attr("class", "m-drop");
if(secchannelele) {
var secchannelmodelele = $("#"+compid + "_secchannelmoudle");
//一个一级频道克隆一个二级频道框
var newsecele = secchannelmodelele.clone();
newsecele.attr("name", channeluuid + "_secchannel");
for (var j = 0;j敬请期待");
}
//二级频道图片
var imgele = asecele.find(".j_secchannelimg").first();
imgele.attr("src", secchannel.imgurl);
//二级频道内容
var pele = asecele.find(".j_secchannelname").first();
pele.html(secchannel.channelname);
newsecele.append(divsecele);
}
secchannelele.append(newsecele);
newsecele.find(".j_secchanneldiv").first().remove();
}
}
firchannelele.append(newele);
}
if(firchannelmodelele) {
//删除循环模板
firchannelmodelele.remove();
}
if(secchannelele) {
var secchannelmodelele = $("#"+compid + "_secchannelmoudle");
if(secchannelmodelele) {
secchannelmodelele.remove();
}
}
}
/** ================================================ 频道组件 end======================================================= */
/** ================================================ 品牌简介组件 star======================================================= */
comps.brandprofilecomp = function (config) {
this.compid = config.compid;
this.config = config;
};
comps.brandprofilecomp.prototype.init = function () {
var that = this;
utils.ajaxloadcomplate(that);
};
/** ================================================ 品牌简介组件 star======================================================= */
/** ================================================ 品牌实力简介组件 star======================================================= */
comps.brandstrengthcomp = function (config) {
this.compid = config.compid;
this.config = config;
};
comps.brandstrengthcomp.prototype.init = function () {
var that = this;
utils.ajaxloadcomplate(that);
};
/** ================================================ 品牌实力简介组件 star======================================================= */
/** ================================================ 技术专区组件 star======================================================= */
comps.techzonecomp = function (config) {
this.compid = config.compid;
this.config = config;
};
comps.techzonecomp.prototype.init = function () {
var that = this;
utils.ajaxloadcomplate(that);
};
/** ================================================ 技术专区组件 star======================================================= */