Commit fb63b2df by 梁建民

js

parent 9eb032c6
Showing with 22 additions and 23 deletions
......@@ -20,19 +20,20 @@
return object[value];
},
getData: function (params, type, callback) {
var index=layer.load(1, {
offset: ['50%', "50%"], shade: false
});
if (type == 1) {
var index = layer.load(1, {
offset: ['50%', "50%"], shade: false
});
$.ajax({
type: "GET",
url: "https://api.ichunt.com/xht/companyinfo",
data: params,
xhrFields: {withCredentials: true},
success: function (data) {
layer.close(index);
if (data.err_code == 0) {
typeof callback == 'function' && callback(data);
layer.close(index);
}
}
});
......@@ -43,7 +44,6 @@
data: params,
xhrFields: {withCredentials: true},
success: function (data) {
layer.close(index);
if (data.err_code == 0) {
typeof callback == 'function' && callback(data);
}
......@@ -53,6 +53,18 @@
},
handleBind: function (opt) {
//menu
this.getData(null, 2, function (res) {
var html = [];
for (var i = 0; i < res.data.length; i++) {
html.push('<dd><a target="_blank" href="product_tep.html?id=' + (parseInt(i) + 1) + '">' + res.data[i].sample_name + '</a></dd>')
}
$("#menu").empty().append(html.join(''));
});
//nav hover
$(".pc-nav-wrap").find('li').hover(function () {
$(this).children('dl').slideDown('slow');
......@@ -139,20 +151,7 @@
}
});
if($("#temp").length > 0){
//menu
this.getData(null, 2, function (res) {
var html = [];
for (var i = 0; i < res.data.length; i++) {
html.push('<dd><a target="_blank" href="product_tep.html?id=' + (parseInt(i) + 1) + '">' + res.data[i].sample_name + '</a></dd>')
}
$("#menu").empty().append(html.join(''));
});
if ($("#temp").length > 0) {
//产品详情
var id = opt.getRequest('id');
if (id) {
......@@ -165,7 +164,7 @@
' <a href="javascript:;" class="bg"><img src="' + res.data.logo_pc + '" alt=""></a>' +
' <p>' + res.data.slogan + '</p>' +
' </div>');
html_cominfo.push('<p class="t1">' + res.data['company_info'].com_name + '</p>' +
' <div class="text">' +
' <p>' +
......@@ -177,14 +176,14 @@
' <span class="tx-2 lineBlock va-t">' + res.data['company_info'].build_time + '</span>' +
' </p>' +
' </div>');
html_cominfotext.push('<img src="' + res.data['company_img'][0].images + '" alt="">' +
' <div class="text">' + res.data['company_info']['com_desc'] + '</div>');
$("#company_bg_img").append(html_combg.join(''));
$("#company_info").append(html_cominfo.join(''));
$("#company_info_text").append(html_cominfotext.join(''));
});
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment