userCommon.bk.js
7.91 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
/**
* Created by moli on 15/5/26.
*/
$(function(){
var DiliPath = $.extend(DiliPath,
{
loginPath : "https://passport.nong12.com/uc/login.aspx",
registPath : "https://passport.nong12.com/regedit/regedit.aspx",
homePath : "http://www.nong12.com/",
logoOut : "https://passport.nong12.com/uc/loginService?ltype=logout",
userInfo : "http://user.nong12.com/account/security.html"
}
);
var View = {
headder : '<div class="info clearfix"><a href="#"><em id="uname">用户名</em></a><em>欢迎您来到农丰网!</em><div class="islogin">请'
+'<a href="#" class="hover-color-green">登录</a> <a href="#" class="hover-color-green">免费注册</a>'
+'</div> <div class="im" onclick="javascript:IM.openWindow(\'农丰客服\', \'农丰客服\', \'0\', \'\', \'\' , \'1\');$(\'#total\').text(0);$(\'.noti.new-msg-icon\').remove();"> <a class="h-user-msg" href="javascript:void(0)" id="notify"><div class="text" onclick="javascript:IM.openWindow(\'农丰客服\', \'农丰客服\', \'0\', \'\', \'\' , \'1\');$(\'#total\').text(0);$(\'.noti.new-msg-icon\').remove();"><em class="u-mail"></em>消息<b style="display:none"></b><span id="total">0</span></div></a>'
+'<div class="im-msgs"><div class="on-msg">暂无更多消息</div><div class="im-list"><ul>'
+'<li><a href="#">海州海参</a><span>29</span></li></ul> </div> </div> </div> </div> <div class="menu">'
+'<ul><li><a href="http://user.nong12.com/account/security.html">账户中心</a></li><li class="more"><a href="http://user.nong12.com/">采购中心<b class="icon-direction"></b></a>'
+'<div class="menu-list"><div class="menu-list-panel"><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/seller/setting/main.html">销售中心<b class="icon-direction"></b></a>'
+'<div class="menu-list"><div class="menu-list-panel"><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 class="color-green">(0)</span></a></li>'
+'<li><a href="javascript:void(0);" onclick="IM.openWindow(\'农丰客服\',\'农丰客服\', \'\', \'\', \'\' , \'1\');" >客服服务</a></li>'
+'<li><a href="http://www.nong12.com/helpcenter.html">帮助中心</a></li></ul></div></div>',
footer : '<div class="footer"><div class="helper-end"><div class="helper clearfix">'
+'<div class="help"><ul id="footer_cms"></ul></div><div class="contact"><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">上午9:00 - 晚上21:00</span></p></li>'
+'<li><span class="icon-f-im"></span><p class="dili-im" href=""><span class="icon-im-call"></span>联系我们</p></li>'
+'</ul></div></div></div><div class="dili site-width"><div class="about"><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></div>'
+'<p> Copyright © 2013-2014 nong12.com,All Rights Reserved 陕ICP备14002958号</p><p>版权所有 地利网络农业有限公司</p></div></div>'
};
var Methods = {
searchval : {type : "STORE"},
/* 依据data.dtype 发送ajax请求 */
http : function(url, success, error, data){
var parm = {
type : 'GET',
url : url,
dataType : "jsonp",
cache : false,
success : function(data){
success(data);
},
error : function(ero){
if(error){error(ero)};
}
};
if(data && data.dtype){
parm.jsonp = data.dtype;
}
if(data && data.call){
parm.jsonpCallback = data.call;
}
$.ajax(parm);
},
/* 初始化 需要使用的函数*/
init : function(){
$(".pnr-top .nav").prepend(View.headder);
$("body").append(View.footer);
//检查登陆
Methods.http("https://passport.nong12.com/uc/ws/callHelloJSONP", function(data){
Methods.isLogin(data);
}, function(){
window.loginInfo = false;
return false;
});
//加载底部
Methods.http("http://www.nong12.com/common/footerJson.html", function(data){
Methods.setFooter(data);
}, function(){
return false;
}, {dtype : "callFn", call : 'success_jsonpCallback1' + (new Date()).getTime()});
},
/* 判断是否登录 javascript:IM.openWindow('农丰客服', '农丰客服', '0', '', '' , '1');$('#total').text(0);$('.noti.new-msg-icon').remove();*/
isLogin : function(data){
if(data && data.isLogin){
$(".islogin").html("");
$(".islogin").html('<a href="'+DiliPath.logoOut+'" class="hover-color-green logout">退出</a>');
$(".header .info").prepend('<a href="'+DiliPath.userInfo+'" class="hover-color-green user-name" >'+data.userName+'</a>');
//IM 登陆检测
$("#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;
}
$(".nav .im").append('<a class="h-user-msg" href="javascript:void(0)" id="notify"></a>');
IM.notification($("#notify"));
window.loginInfo = true;
}else{
$(".islogin .hover-color-green").eq(0).attr("href", DiliPath.loginPath + "?ReturnUrl=" + window.location.href);
$(".islogin .hover-color-green").eq(1).attr("href", DiliPath.registPath);
window.loginInfo = false;
}
},
/* 动态设置底部HTML片段 */
setFooter : 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(""));
}
}
};
Methods.init();
});