From 069948b74951971dab9300908dd6347b697d8edd Mon Sep 17 00:00:00 2001 From: xiaozhi <1822691309@qq.com> Date: Sun, 7 Jun 2026 11:02:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BAtoken=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=B1=BB=EF=BC=8C=E5=8C=85=E6=8B=AC=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=88=A0=E9=99=A4=E5=92=8C=E8=8E=B7=E5=8F=96token?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/Auth.uts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 utils/Auth.uts diff --git a/utils/Auth.uts b/utils/Auth.uts new file mode 100644 index 0000000..4e4e286 --- /dev/null +++ b/utils/Auth.uts @@ -0,0 +1,26 @@ +export class Auth { + + static readonly TokenKey : string = "Admin-Token" + + /** + * 获取Token + */ + static getToken() : string { + const token = uni.getStorageSync(Auth.TokenKey) + return token == null ? "" : token as string + } + + /** + * 设置Token + */ + static setToken(token : string) : void { + uni.setStorageSync(Auth.TokenKey, token) + } + + /** + * 删除Token + */ + static removeToken() : void { + uni.removeStorageSync(Auth.TokenKey) + } +} \ No newline at end of file