Commit fb63b2df by 梁建民

js

parent 9eb032c6
Showing with 22 additions and 23 deletions
...@@ -20,19 +20,20 @@ ...@@ -20,19 +20,20 @@
return object[value]; return object[value];
}, },
getData: function (params, type, callback) { getData: function (params, type, callback) {
var index=layer.load(1, {
offset: ['50%', "50%"], shade: false
});
if (type == 1) { if (type == 1) {
var index = layer.load(1, {
offset: ['50%', "50%"], shade: false
});
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: "https://api.ichunt.com/xht/companyinfo", url: "https://api.ichunt.com/xht/companyinfo",
data: params, data: params,
xhrFields: {withCredentials: true}, xhrFields: {withCredentials: true},
success: function (data) { success: function (data) {
layer.close(index);
if (data.err_code == 0) { if (data.err_code == 0) {
typeof callback == 'function' && callback(data); typeof callback == 'function' && callback(data);
layer.close(index);
} }
} }
}); });
...@@ -43,7 +44,6 @@ ...@@ -43,7 +44,6 @@
data: params, data: params,
xhrFields: {withCredentials: true}, xhrFields: {withCredentials: true},
success: function (data) { success: function (data) {
layer.close(index);
if (data.err_code == 0) { if (data.err_code == 0) {
typeof callback == 'function' && callback(data); typeof callback == 'function' && callback(data);
} }
...@@ -53,6 +53,18 @@ ...@@ -53,6 +53,18 @@
}, },
handleBind: function (opt) { 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 //nav hover
$(".pc-nav-wrap").find('li').hover(function () { $(".pc-nav-wrap").find('li').hover(function () {
$(this).children('dl').slideDown('slow'); $(this).children('dl').slideDown('slow');
...@@ -139,20 +151,7 @@ ...@@ -139,20 +151,7 @@
} }
}); });
if($("#temp").length > 0){ 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(''));
});
//产品详情 //产品详情
var id = opt.getRequest('id'); var id = opt.getRequest('id');
if (id) { if (id) {
...@@ -165,7 +164,7 @@ ...@@ -165,7 +164,7 @@
' <a href="javascript:;" class="bg"><img src="' + res.data.logo_pc + '" alt=""></a>' + ' <a href="javascript:;" class="bg"><img src="' + res.data.logo_pc + '" alt=""></a>' +
' <p>' + res.data.slogan + '</p>' + ' <p>' + res.data.slogan + '</p>' +
' </div>'); ' </div>');
html_cominfo.push('<p class="t1">' + res.data['company_info'].com_name + '</p>' + html_cominfo.push('<p class="t1">' + res.data['company_info'].com_name + '</p>' +
' <div class="text">' + ' <div class="text">' +
' <p>' + ' <p>' +
...@@ -177,14 +176,14 @@ ...@@ -177,14 +176,14 @@
' <span class="tx-2 lineBlock va-t">' + res.data['company_info'].build_time + '</span>' + ' <span class="tx-2 lineBlock va-t">' + res.data['company_info'].build_time + '</span>' +
' </p>' + ' </p>' +
' </div>'); ' </div>');
html_cominfotext.push('<img src="' + res.data['company_img'][0].images + '" alt="">' + html_cominfotext.push('<img src="' + res.data['company_img'][0].images + '" alt="">' +
' <div class="text">' + res.data['company_info']['com_desc'] + '</div>'); ' <div class="text">' + res.data['company_info']['com_desc'] + '</div>');
$("#company_bg_img").append(html_combg.join('')); $("#company_bg_img").append(html_combg.join(''));
$("#company_info").append(html_cominfo.join('')); $("#company_info").append(html_cominfo.join(''));
$("#company_info_text").append(html_cominfotext.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