Commit fb63b2df by 梁建民

js

parent 9eb032c6
Showing with 17 additions and 18 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, { if (type == 1) {
var index = layer.load(1, {
offset: ['50%', "50%"], shade: false offset: ['50%', "50%"], shade: false
}); });
if (type == 1) {
$.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) {
......
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