top_footer.js
10.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
$(function () {
var nav = '<div class="responsive clearfix"><div class="left">欢迎来到农丰网! 请<a class="lay-in" href="#">登录</a> | <a href="#">免费注册</a></div><ul class="right"><li><a href="http://user.nong12.com/account/security.html"><span>账户中心</span></a></li><li class="more"><a href="http://user.nong12.com/"><span>我的农丰</span></a><span class="icon-more"></span><div class="mroe-list"><div class="list-a"><a href="http://user.nong12.com/purchase/order.html">已买到的商品</a><a href="http://user.nong12.com/purchase/favorite/product.html">我的收藏</a><a href="http://user.nong12.com/purchase/history.html">我的浏览</a></div></div></li><li class="more"><a href="http://shop.nong12.com/order/list.html"><span>销售中心 </span></a><span class="icon-more"></span><div class="mroe-list"><div class="list-a"><a href="http://shop.nong12.com/open/shop.html">我的店铺</a><a href="http://shop.nong12.com/order/list.html">已卖出的商品</a><a href="http://shop.nong12.com/seller/product/list/onsale.html">出售中的商品</a><a href="http://shop.nong12.com/seller/product/showCategory.html">免费发布商品</a></div></div></li><li><a href="http://www.nong12.com/purchase_list.html"><span>进货单</span><span class="num">(<span class="cart-num">0</span>)</span></a></li><li><a href="javascript:void(0)" onclick="IM.openWindow(\'农丰客服\',\'农丰客服\', \'\', \'\', \'\' , \'1\');"><span>客服服务</span></a></li><li><a href="http://www.nong12.com/helpcenter.html"><span>帮助中心</span></a></li></ul></div>';
var footer = '<div class="bg-F9"><div class="footer-view clearfix"><div class="left"><ul id="footer_cms"></ul></div><div class="right"><span class="icon-shield"></span><ul class="clearfix"><li><span class="icon-f-phone"></span><p>服务热线:<span class="text-phone">400-645-5158</span></p></li><li><span class="icon-f-customerservice"></span><p>服务时间:<span class="text-time">上午8:00 - 下午16:00</span></p></li><li><span class="icon-f-im"></span><a class="dili-im" href="javascript:void(0)" onclick="IM.openWindow(\'农丰客服\',\'农丰客服\', \'\', \'\', \'\' , \'1\');"><i></i>联系客服</a></li></ul></div></div></div><div class="footer-end"><p><a href="http://www.nong12.com/helpcenter/articles.html?categoryId=3&articleId=9">关于我们</a> |<a href="http://www.nong12.com/helpcenter/articles.html?categoryId=3&articleId=10">联系我们</a> |<a href="http://www.nong12.com/helpcenter/articles.html?categoryId=3&articleId=11">人才招聘</a> |<a href="http://www.nong12.com/helpcenter.html">帮助中心</a></p><p class="col-999"> Copyright © 2013-2015 nong12.com,All Rights Reserved 京ICP备15030623号</p><p class="col-999"> 版权所有 北京农丰吉瑞网络科技有限公司 | 地址:北京市朝阳区光华路甲8号院1号楼5层6-501A室 | 电话:010-65816529 </p></div>';
$('.pnr-top .nav').html(nav);
$('.footer').html(footer);
window.loginInfo = true;
//渲染hello头
jQuery.ajax({
type: "GET",
url: "https://passport.nong12.com/uc/ws/callHelloJSONP",
dataType: "jsonp",
cache: false,
success: function (data) {
if (data) {
if (data.isLogin) {
$(".responsive .left").remove();
$(".responsive .right").before("<div class='left'><a href='http://user.nong12.com/account/security.html' target='_blank'><span id='uname'>" + data.userName + "</span></a> 欢迎来到农丰网! <a href='https://passport.nong12.com/uc/loginService?ltype=logout'>退出</a></div>");
$("#right-login .state-success").show();
$("#userName").html(data.userName);
if(window.isRight){
jQuery.ajax({
type: "GET",
url: "http://user.nong12.com/api/userservice/getUserName.do",
dataType: "jsonp",
cache: false,
success: function (data) {
$("#my-face").attr("src", data.face);
}
});
window.loginInfo = true;
}
$(".responsive .left").append('<a class="h-user-msg" href="javascript:void(0)" id="notify"></a>');
IM.notification($("#notify"));
} else {
$(".responsive .left a").first().attr("href", DiliPath.loginPath + "?ReturnUrl=" + window.location.href);
$(".responsive .left a").last().attr("href", DiliPath.registPath);
window.loginInfo = false;
}
}
window.passportcon = true;
},
error: function () {
window.loginInfo = false;
return false;
}
});
$("#my-info").hover(function () {
if (!window.loginInfo) {
window.loginInfo = true;
PassportPopupLogin.settings.callbackFn = function () {
//window.location.reload();
// Edit By Lai Kui 修改右边登录异步刷新开始
jQuery.ajax({
type: "GET",
url: "https://passport.nong12.com/uc/ws/callHelloJSONP",
dataType: "jsonp",
cache: false,
success: function (data) {
if (data) {
if (data.isLogin) {
$(".responsive .left").remove();
$(".responsive .right").before("<div class='left'><a href='http://user.nong12.com/account/security.html' target='_blank'><span id='uname'>" + data.userName + "</span></a> 欢迎来到农丰网! <a href='https://passport.nong12.com/uc/loginService?ltype=logout'>退出</a></div>");
$("#right-login .state-success").show();
$("#userName").html(data.userName);
if(window.isRight){
jQuery.ajax({
type: "GET",
url: "http://user.nong12.com/api/userservice/getUserName.do",
dataType: "jsonp",
cache: false,
success: function (data) {
$("#my-face").attr("src", data.face);
}
});
window.loginInfo = true;
}
$(".responsive .left").append('<a class="h-user-msg" href="javascript:void(0)" id="notify"></a>');
IM.notification($("#notify"));
if(window.location.href.indexOf("cartList") < 0 && window.location.href.indexOf("purchase_list") < 0) {
cartTools.showCart();
}
} else {
$(".responsive .left a").first().attr("href", DiliPath.loginPath + "?ReturnUrl=" + window.location.href);
$(".responsive .left a").last().attr("href", DiliPath.registPath);
window.loginInfo = false;
}
}
},
error: function () {
window.loginInfo = false;
return false;
}
});
$("#right-login").html(' <div id="right-login" class="floatinglayer f-login"> <div class="triangle"></div> <div class="state-success" style="display:none"> <div class="state-head"> <a href="http://user.nong12.com/account/security.html" target="_blank"><img id="my-face" src="http://static.nong12.com/static/newStatic/pnr/dist/images/t-default.png" alt=""></a> <span> <a href="http://user.nong12.com/account/security.html" target="_blank"><span id="userName"></span></a><span>欢迎回到农丰网!</span> </span> </div> </div> </div>');
// 修改右边登录异步刷新结束
};
PassportPopupLogin.init();
if (window.passportcon) {
$("#right-login").html('<div class="triangle"></div><div class="f-hover-view"></div><iframe frameborder="0" scrolling="no" class="login-frame" src="https://passport.nong12.com/uc/newPopup/login.aspx?referUrl=http://www.nong12.com"></iframe>');
}
}
}, function () {
});
//渲染footer
jQuery.ajax({
type: "GET",
url: DiliPath.homePath + "common/footerJson.html",
dataType: "jsonp",
jsonp: "callFn",
jsonpCallback: 'success_jsonpCallback1' + (new Date()).getTime(),
success: function (data) {
if(data){
var html = [];
var iconArr = ["icon-we", "icon-aftersales", "icon-shopping", "icon-identity", "icon-novice"];
for (var i = 0; i < data.length; i++) {
var showIcon = data.length <= iconArr.length ? iconArr[i] : iconArr[0];
html.push("<li><span class='" + showIcon + "'></span><p>" + data[i].text + "</p><div class='f-list'>");
var vc = data[i].subNodes;
for (var j = 0; j < vc.length; j++) {
if (j == vc.length - 1) {
html.push("<a href='" + vc[j].link + "'>" + vc[j].text + "</a></div></li>");
} else {
html.push("<a href='" + vc[j].link + "'>" + vc[j].text + "</a>");
}
}
}
$("#footer_cms").html(html.join(""));
}
}
});
if ($("head").find("script[src*='jquery.lazyload']").size() > 0) {
$("body").find("img").each(function () {
$(this).lazyload({
effect: "fadeIn",
skip_invisible: false
});
});
}
});
function replaceAll(str, sptr, sptr1) {
while (str.indexOf(sptr) >= 0) {
str = str.replace(sptr, sptr1);
}
return str;
}
var otherTools = {
/**
* im
* @param sellerType
* @param sellerName
*/
imConnection: function (sellerType, sellerName) {
var type = 2;//2默认客服
var name = '农丰客服';
//第3方
if (sellerType == 30) {
type = 0;
name = sellerName;
}
var timestamp = (new Date()).valueOf();
var ht = (screen.height - 500) / 2;
var wt = (screen.width - 800) / 2;
var url = 'http://chat.nong12.com/launch/launch.action?uid=' + name + '&type=' + type + '&_t=' + timestamp;
var param = 'height=555,width=800,resizable=yes,top=' + ht + ',left=' + wt;
window.open(url, name, param);
}
};