From fc2df16e0802d591f258cb17c0b007358ef95cc7 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Mon, 20 Feb 2023 16:11:47 +0800
Subject: [PATCH] 刷新token

---
 src/utils/store.js |   53 +++++++++++++++++++++++++++--------------------------
 1 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/src/utils/store.js b/src/utils/store.js
index 77f571b..ad9ea82 100644
--- a/src/utils/store.js
+++ b/src/utils/store.js
@@ -1,6 +1,6 @@
 import {
     validatenull
-} from '@/utils/validate';
+} from '@/utils/validate'
 
 /**
  * 存储localStorage
@@ -10,15 +10,15 @@
         name,
         content,
         type,
-    } = params;
+    } = params
     let obj = {
         dataType: typeof (content),
         content: content,
         type: type,
         datetime: new Date().getTime()
     }
-    if (type) window.sessionStorage.setItem(name, JSON.stringify(obj));
-    else window.localStorage.setItem(name, JSON.stringify(obj));
+    if (type) window.sessionStorage.setItem(name, JSON.stringify(obj))
+    else window.localStorage.setItem(name, JSON.stringify(obj))
 }
 /**
  * 获取localStorage
@@ -28,30 +28,31 @@
     let {
         name,
         debug
-    } = params;
+    } = params
     let obj = {},
-        content;
-    obj = window.sessionStorage.getItem(name);
-    if (validatenull(obj)) obj = window.localStorage.getItem(name);
-    if (validatenull(obj)) return;
+        content
+    obj = window.sessionStorage.getItem(name)
+    console.log(obj, 456)
+    if (validatenull(obj)) obj = window.localStorage.getItem(name)
+    if (validatenull(obj)) return
     try {
-        obj = JSON.parse(obj);
-    } catch{
-        return obj;
+        obj = JSON.parse(obj)
+    } catch {
+        return obj
     }
     if (debug) {
-        return obj;
+        return obj
     }
     if (obj.dataType == 'string') {
-        content = obj.content;
+        content = obj.content
     } else if (obj.dataType == 'number') {
-        content = Number(obj.content);
+        content = Number(obj.content)
     } else if (obj.dataType == 'boolean') {
-        content = eval(obj.content);
+        content = eval(obj.content)
     } else if (obj.dataType == 'object') {
-        content = obj.content;
+        content = obj.content
     }
-    return content;
+    return content
 }
 /**
  * 删除localStorage
@@ -60,11 +61,11 @@
     let {
         name,
         type
-    } = params;
+    } = params
     if (type) {
-        window.sessionStorage.removeItem(name);
+        window.sessionStorage.removeItem(name)
     } else {
-        window.localStorage.removeItem(name);
+        window.localStorage.removeItem(name)
     }
 
 }
@@ -73,10 +74,10 @@
  * 获取全部localStorage
  */
 export const getAllStore = (params = {}) => {
-    let list = [];
+    let list = []
     let {
         type
-    } = params;
+    } = params
     if (type) {
         for (let i = 0; i <= window.sessionStorage.length; i++) {
             list.push({
@@ -98,7 +99,7 @@
 
         }
     }
-    return list;
+    return list
 
 }
 
@@ -106,9 +107,9 @@
  * 清空全部localStorage
  */
 export const clearStore = (params = {}) => {
-    let { type } = params;
+    let { type } = params
     if (type) {
-        window.sessionStorage.clear();
+        window.sessionStorage.clear()
     } else {
         window.localStorage.clear()
     }

--
Gitblit v1.9.3