...
|
...
|
@@ -33,39 +33,79 @@ |
|
|
var uid;//用户ID
|
|
|
var setOut = "";
|
|
|
$(
|
|
|
function () {
|
|
|
//判定登录
|
|
|
var dataRequestUrl="http://m.yohobuy.com/passport/login/user";
|
|
|
function () {
|
|
|
//判定登录
|
|
|
var uid = null;
|
|
|
var clickBoxArr = {};
|
|
|
|
|
|
var vars = {},
|
|
|
hash,
|
|
|
i,
|
|
|
search = window.location.search,
|
|
|
hashes = search ? decodeURIComponent(search).slice(1).split('&') : [];
|
|
|
|
|
|
for (i = 0; i < hashes.length; i++) {
|
|
|
hash = hashes[i].split('=');
|
|
|
vars[hash[0]] = hash[1];
|
|
|
}
|
|
|
|
|
|
var isApp = !!vars.app_version || (vars.openrefer === 'app' && vars.uid);//判断是否是APP
|
|
|
//判定登录
|
|
|
|
|
|
if (!isApp) {
|
|
|
var dataRequestUrl = "http://m.yohobuy.com/passport/login/user";
|
|
|
$.getJSON(dataRequestUrl+"?callback=?",
|
|
|
function(json) {
|
|
|
if (json.code === 200) {
|
|
|
uid=json.data;
|
|
|
} else {
|
|
|
var url ='http://m.yohobuy.com/signin.html?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":'
|
|
|
+'/activity/favoriteAct/index.html'+'","param":{"from":"app"}},"requesturl":{"url":"","param":{}},"priority":"Y"}}';
|
|
|
window.location.href=url;
|
|
|
var url ='http://m.yohobuy.com/signin.html?refer=' + window.location.href;
|
|
|
//window.location.href=url;
|
|
|
if ($("#collocation-link").length <= 0) {
|
|
|
$("body").append('<a href=\'' + url + '\' style="display:none;" id="collocation-link">' +
|
|
|
'<span class="collocation-link"></span>' +
|
|
|
'</a>');
|
|
|
}
|
|
|
$(".collocation-link").click();
|
|
|
}
|
|
|
}
|
|
|
);
|
|
|
|
|
|
$(".good-c .add-btn").click(
|
|
|
function () {
|
|
|
var skn = $(this).parents("li").attr("sknNum");
|
|
|
$.ajax({
|
|
|
url: '/activity/favorite/addFavorite?productSkn=' + skn +'&uid=' + uid,
|
|
|
type: "get",
|
|
|
dataType: 'json',
|
|
|
success: function (data) {
|
|
|
if (data.code === 200) {
|
|
|
diaCover(data.message);
|
|
|
} else {
|
|
|
diaCover(data.message);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
var Request = new Object();
|
|
|
Request = GetRequest();
|
|
|
uid = Request['uid'];
|
|
|
if (!uid){
|
|
|
var locationUrl = window.location.href;
|
|
|
var url = locationUrl + '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"'
|
|
|
+ locationUrl +'","param":{"from":"app"}},"requesturl":{"url":"","param":{}},"priority":"Y"}}';
|
|
|
//window.location.href=url;
|
|
|
if ($("#collocation-link").length <= 0) {
|
|
|
$("body").append('<a href=\'' + url + '\' style="display:none;" id="collocation-link">' +
|
|
|
'<span class="collocation-link"></span>' +
|
|
|
'</a>');
|
|
|
}
|
|
|
);
|
|
|
$(".collocation-link").click();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$(".good-c .add-btn").click(
|
|
|
function () {
|
|
|
var skn = $(this).parents("li").attr("sknNum");
|
|
|
$.ajax({
|
|
|
url: '/activity/favorite/addFavorite?productSkn=' + skn +'&uid=' + uid,
|
|
|
type: "get",
|
|
|
dataType: 'json',
|
|
|
success: function (data) {
|
|
|
if (data.code === 200) {
|
|
|
diaCover(data.message);
|
|
|
} else {
|
|
|
diaCover(data.message);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
);
|
|
|
}
|
|
|
);
|
|
|
function diaCover(msg) {
|
|
|
clearTimeout(setOut);
|
...
|
...
|
@@ -73,7 +113,19 @@ |
|
|
$("body").append("<div class='diaCover-p'>" + msg + "</div>");
|
|
|
setOut = setTimeout("$('.diaCover-p').remove();",3000);
|
|
|
}
|
|
|
|
|
|
//获取url的uid
|
|
|
function GetRequest() {
|
|
|
var url = location.search; //获取url中"?"符后的字串
|
|
|
var theRequest = new Object();
|
|
|
if (url.indexOf("?") != -1) {
|
|
|
var str = url.substr(1);
|
|
|
strs = str.split("&");
|
|
|
for(var i = 0; i < strs.length; i ++) {
|
|
|
theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]);
|
|
|
}
|
|
|
}
|
|
|
return theRequest;
|
|
|
}
|
|
|
</script>
|
|
|
</head>
|
|
|
<body>
|
...
|
...
|
|