前端用户中心功能完善
This commit is contained in:
@@ -80,8 +80,8 @@ define(['jquery', 'layer', 'message'], function ($, layer) {
|
||||
var obj = {},
|
||||
content;
|
||||
obj = window.sessionStorage.getItem(name);
|
||||
if (sent.validatenull(obj)) obj = window.localStorage.getItem(name);
|
||||
if (sent.validatenull(obj)) return;
|
||||
if (sent.utils.validatenull(obj)) obj = window.localStorage.getItem(name);
|
||||
if (sent.utils.validatenull(obj)) return;
|
||||
try {
|
||||
obj = JSON.parse(obj);
|
||||
} catch (error) {
|
||||
@@ -292,24 +292,24 @@ define(['jquery', 'layer', 'message'], function ($, layer) {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
validatenull: function (val) {
|
||||
if (typeof val == 'boolean') {
|
||||
},
|
||||
validatenull: function (val) {
|
||||
if (typeof val == 'boolean') {
|
||||
return false;
|
||||
}
|
||||
if (typeof val == 'number') {
|
||||
return false;
|
||||
}
|
||||
if (val instanceof Array) {
|
||||
if (val.length == 0) return true;
|
||||
} else if (val instanceof Object) {
|
||||
if (JSON.stringify(val) === '{}') return true;
|
||||
} else {
|
||||
if (val == 'null' || val == null || val == 'undefined' || val == undefined || val == '') return true;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (typeof val == 'number') {
|
||||
return false;
|
||||
}
|
||||
if (val instanceof Array) {
|
||||
if (val.length == 0) return true;
|
||||
} else if (val instanceof Object) {
|
||||
if (JSON.stringify(val) === '{}') return true;
|
||||
} else {
|
||||
if (val == 'null' || val == null || val == 'undefined' || val == undefined || val == '') return true;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
window.sent = sent;
|
||||
|
||||
Reference in New Issue
Block a user