From 8ee015485bfd69afcc276e84a2998c64b0256458 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期三, 16 七月 2025 18:27:12 +0800
Subject: [PATCH] 前端
---
small-program/store/index.js | 30 +++++++++++++++++++++++++++++-
1 files changed, 29 insertions(+), 1 deletions(-)
diff --git a/small-program/store/index.js b/small-program/store/index.js
index 66686fa..6db6273 100644
--- a/small-program/store/index.js
+++ b/small-program/store/index.js
@@ -5,12 +5,18 @@
const navHeight = uni.getStorageSync('navHeight');
const statusbarHeight = uni.getStorageSync('statusbarHeight');
+const userInfo = uni.getStorageSync('userInfo');
+const token = uni.getStorageSync('token');
+const openid = uni.getStorageSync('openid');
const store = new Vuex.Store({
state: {
navHeight: navHeight || '',
- statusbarHeight: statusbarHeight || ''
+ statusbarHeight: statusbarHeight || '',
+ userInfo: userInfo || {},
+ token: token || '',
+ openid:token || ''
},
mutations: {
// 璁剧疆瀵艰埅鏍忛珮搴�
@@ -19,6 +25,28 @@
state.statusbarHeight = val.statusbarHeight
uni.setStorageSync('navHeight', val.navHeight);
uni.setStorageSync('statusbarHeight', val.statusbarHeight);
+ },
+ // 璁剧疆token
+ setToken(state, val) {
+ state.token = val
+ uni.setStorageSync('token', val);
+ },
+ // 璁剧疆token
+ setOpenid(state, val) {
+ state.openid = val
+ uni.setStorageSync('openid', val);
+ },
+ // 璁剧疆鐢ㄦ埛淇℃伅
+ setUserInfo(state, val) {
+ state.userInfo = val
+ uni.setStorageSync('userInfo', val);
+ },
+ // 娓呴櫎缂撳瓨鏁版嵁
+ empty(state) {
+ state.userInfo = ''
+ state.token = ''
+ uni.removeStorageSync('token');
+ uni.removeStorageSync('userInfo');
}
},
--
Gitblit v1.9.3