|
@@ -335,11 +335,15 @@ function setCookie(cname,cvalue,exdays){
|
|
|
}
|
|
|
}
|
|
|
function getCookie(cname){
|
|
|
- var name = cname + "=";
|
|
|
- var ca = document.cookie.split(';');
|
|
|
- for(var i=0; i<ca.length; i++) {
|
|
|
- var c = ca[i].trim();
|
|
|
- if (c.indexOf(name)==0) { return c.substring(name.length,c.length); }
|
|
|
+ if (document.cookie) {
|
|
|
+ var name = cname + "=";
|
|
|
+ var ca = document.cookie.split(';');
|
|
|
+ for(var i=0; i<ca.length; i++) {
|
|
|
+ var c = ca[i].trim();
|
|
|
+ if (c && c.indexOf(name)===0) {
|
|
|
+ return c.substring(name.length,c.length);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
return "";
|
|
|
}
|
|
@@ -557,11 +561,11 @@ function setProductPrice(productList, productIds, userId, callback){
|
|
|
}
|
|
|
// 登录后返回登录前页面
|
|
|
function toBeforePath(){
|
|
|
- var beforePath = getCookie("loginBeforePath");
|
|
|
- if (!beforePath) {
|
|
|
- beforePath = '/index.html';
|
|
|
+ var loginBeforePath = getCookie("loginBeforePath");
|
|
|
+ if (loginBeforePath && loginBeforePath!=='undefined') {
|
|
|
+ window.location.href = loginBeforePath;
|
|
|
}
|
|
|
- window.location.href = beforePath;
|
|
|
+ window.location.href = '/index.html';
|
|
|
}
|
|
|
function toLogin() {//去登录
|
|
|
setCookie("loginBeforePath", window.location.href);
|