2023-02-23
功能完善
This commit is contained in:
@@ -6,13 +6,16 @@ Vue.use(Vuex)
|
||||
const store = new Vuex.Store({
|
||||
state: {
|
||||
hasLogin: false,
|
||||
hasVip: false,
|
||||
userInfo: ''
|
||||
},
|
||||
mutations: {
|
||||
login(state, provider) {
|
||||
console.log(provider);
|
||||
if (provider && provider != undefined) {
|
||||
console.log("provider",provider);
|
||||
state.hasLogin = true;
|
||||
state.hasVip = true;
|
||||
uni.setStorage({ //缓存用户登陆状态
|
||||
key: 'userInfo',
|
||||
data: provider.userInfo
|
||||
@@ -24,6 +27,7 @@ const store = new Vuex.Store({
|
||||
},
|
||||
logout(state) {
|
||||
state.hasLogin = false;
|
||||
state.hasVip = false;
|
||||
state.userInfo = '';
|
||||
uni.removeStorage({
|
||||
key: 'userInfo'
|
||||
|
||||
Reference in New Issue
Block a user