|
@@ -0,0 +1,88 @@
|
|
|
+/**本地缓存 */
|
|
|
+var SessionOperation = {
|
|
|
+ type:'session',
|
|
|
+ setType:function(){
|
|
|
+ if(this.type == 'session'){
|
|
|
+ return window.sessionStorage;
|
|
|
+ }
|
|
|
+ if(this.type == 'local'){
|
|
|
+ return window.localStorage;
|
|
|
+ }
|
|
|
+ console.log('类型错误!');
|
|
|
+ },
|
|
|
+ set:function($key,$value){
|
|
|
+ this.setType().setItem($key,$value);
|
|
|
+ },
|
|
|
+ get:function($key){
|
|
|
+ return this.setType().getItem($key)
|
|
|
+ },
|
|
|
+ clearAll:function(){
|
|
|
+ if(this.type == 'session'){
|
|
|
+ window.sessionStorage.clear();
|
|
|
+ }
|
|
|
+ if(this.type == 'local'){
|
|
|
+ window.localStorage.clear();
|
|
|
+ }
|
|
|
+ console.log('类型错误!');
|
|
|
+ },
|
|
|
+ setToken:function(token){
|
|
|
+ this.set("TOKEN", token);
|
|
|
+ },
|
|
|
+ getToken:function(){
|
|
|
+ return this.get("TOKEN");
|
|
|
+ },
|
|
|
+ setUserId:function(userId){
|
|
|
+ this.set("userId", userId);
|
|
|
+ },
|
|
|
+ getUserId:function(){
|
|
|
+ return this.get("userId");
|
|
|
+ },
|
|
|
+ setPersonnelId:function(personnelId){
|
|
|
+ this.set("personnelId", personnelId);
|
|
|
+ },
|
|
|
+ getPersonnelId:function(){
|
|
|
+ return this.get("personnelId");
|
|
|
+ },
|
|
|
+ setUserDeps:function(userDeps){
|
|
|
+ this.set("UserDeps", userDeps);
|
|
|
+ },
|
|
|
+ getUserDeps:function(){
|
|
|
+ return this.get("UserDeps");
|
|
|
+ },
|
|
|
+ setRealName:function(realname){
|
|
|
+ this.set("RealName", realname);
|
|
|
+ },
|
|
|
+ getRealName:function(){
|
|
|
+ return this.get("RealName");
|
|
|
+ },
|
|
|
+ setUserName:function(username){
|
|
|
+ this.set("UserName", username);
|
|
|
+ },
|
|
|
+ getUserName:function(){
|
|
|
+ return this.get("UserName");
|
|
|
+ },
|
|
|
+ setOrgnizeId(id){
|
|
|
+ this.set("OrgnizeId", id);
|
|
|
+ },
|
|
|
+ getOrgnizeId(){
|
|
|
+ return this.get("OrgnizeId");
|
|
|
+ },
|
|
|
+ setOrgnizeName(name){
|
|
|
+ this.set("OrgnizeName", name);
|
|
|
+ },
|
|
|
+ getOrgnizeName(){
|
|
|
+ return this.get("OrgnizeName");
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+function getQueryVariable(variable){
|
|
|
+ var query = window.location.search.substring(1);
|
|
|
+ var vars = query.split("&");
|
|
|
+ for (var i=0;i<vars.length;i++) {
|
|
|
+ var pair = vars[i].split("=");
|
|
|
+ if(pair[0] == variable){
|
|
|
+ return pair[1];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return(false);
|
|
|
+}
|