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