用户信息持久化
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
1.长按识别下方二维码,添加【xxxx】
|
||||
</text>
|
||||
<view class='divider' style='margin-top: 28rpx' />
|
||||
<image :src=' assetsUrl("test_qrcode.png")' />
|
||||
<image :src=' assetsUrl("test_qrcode.png")' show-menu-by-longpress />
|
||||
<text class='step-title'>
|
||||
2.识别【xxxx】发您的二维码,即可入群
|
||||
</text>
|
||||
|
@@ -1,10 +1,6 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import type { UserState, providerType } from './types';
|
||||
import {
|
||||
getUserProfile,
|
||||
login as userLogin,
|
||||
logout as userLogout, login
|
||||
} from '@/api/user/index';
|
||||
import type { providerType, UserState } from './types';
|
||||
import { getUserProfile, login as userLogin, login, logout as userLogout } from '@/api/user/index';
|
||||
import { clearToken, setCompanyId, setToken } from '@/utils/auth';
|
||||
import type { LoginParams } from '@/api/user/types';
|
||||
|
||||
@@ -21,16 +17,20 @@ const useUserStore = defineStore('user', {
|
||||
birthday: ''
|
||||
}),
|
||||
|
||||
persist: true,
|
||||
|
||||
// persist: {
|
||||
// // 修改存储中使用的键名称,默认为当前 Store的 id
|
||||
// key: 'userState',
|
||||
// // 修改为 sessionStorage,默认为 localStorage
|
||||
// // storage: window.localStorage,
|
||||
// // 部分持久化状态的点符号路径数组,[]意味着没有状态被持久化(默认为undefined,持久化整个状态)
|
||||
// paths: undefined
|
||||
// },
|
||||
persist: {
|
||||
// 修改存储中使用的键名称,默认为当前 Store的 id
|
||||
key: 'userState',
|
||||
storage: {
|
||||
setItem(key, value) {
|
||||
uni.setStorageSync(key, value); // [!code warning]
|
||||
},
|
||||
getItem(key) {
|
||||
return uni.getStorageSync(key); // [!code warning]
|
||||
}
|
||||
},
|
||||
// 部分持久化状态的点符号路径数组,[]意味着没有状态被持久化(默认为undefined,持久化整个状态)
|
||||
paths: undefined
|
||||
},
|
||||
|
||||
getters: {
|
||||
userInfo(state: UserState): UserState {
|
||||
|
Reference in New Issue
Block a user