This commit is contained in:
aihe 2024-02-21 20:23:38 +08:00
parent 806fc7f132
commit 2abc8ffd30
3 changed files with 55 additions and 0 deletions

17
session/index.js Normal file
View File

@ -0,0 +1,17 @@
import { XTOKEN_KEY, USERINFO_KEY } from "./key"
export const setSessionXToken = (val = '')=> {
uni.setStorageSync(XTOKEN_KEY, val)
}
export const getSessionXToken = ()=> {
uni.getStorageSync(XTOKEN_KEY)
}
export const setSessionUserInfo = (val = {})=> {
uni.setStorageSync(USERINFO_KEY, val)
}
export const getSessionXToken = ()=> {
uni.getStorageSync(USERINFO_KEY,)
}

2
session/key.js Normal file
View File

@ -0,0 +1,2 @@
export const XTOKEN_KEY = 'XTOKEN_KEY'
export const USERINFO_KEY = 'USERINFO_KEY'

36
store/user.js Normal file
View File

@ -0,0 +1,36 @@
export default {
state: {
user: {
info: {},
token: '',
}
},
mutations: {
userLogin(state, provider) {
state.user.token = '';
state.user.info = {}
},
userLogout(state) {
state.user.token = '';
state.user.info = {}
},
},
getters: {
getUserInfo(state) {
return state.user
}
},
actions: {
getUserOpenId: async function({
commit,
state
}, options) {
},
getPhoneNumber: function({
commit
}, options) {
}
}
}