12345678910111213141516171819202122232425262728293031323334353637 |
- export default {
- namespaced: true,
- state: () => ({
- token: uni.getStorageSync('token') || '',
- userInfo: JSON.parse(uni.getStorageSync('userInfo') || '{}'),
- lastLoginPhone: uni.getStorageSync('lastLoginPhone') || '',
- }),
- mutations: {
- updateUserInfo(state, userInfo) {
- state.userInfo = userInfo
- this.commit('m_user/saveUserInfoToStorage')
- },
- saveUserInfoToStorage(state) {
- uni.setStorageSync('userInfo', JSON.stringify(state.userInfo))
- },
- updateToken(state, token) {
- state.token = token
- this.commit('m_user/saveTokenToStorage')
- },
- saveTokenToStorage(state) {
- uni.setStorageSync('token', state.token)
- },
- updateLastLoginPhone(state, lastLoginPhone) {
- state.lastLoginPhone = lastLoginPhone
- this.commit('m_user/saveLastLoginPhoneToStorage')
- },
- saveLastLoginPhoneToStorage(state) {
- uni.setStorageSync('lastLoginPhone', state.lastLoginPhone)
- }
- },
- getters: {},
- }
|