You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
565 B
30 lines
565 B
import Vue from 'vue'
|
|
import Vuex from 'vuex'
|
|
|
|
Vue.use(Vuex)
|
|
const store = new Vuex.Store({
|
|
state: {
|
|
hasLogin: false,
|
|
userInfo: {}
|
|
},
|
|
mutations: {
|
|
login(state, provider) {
|
|
state.hasLogin = true;
|
|
state.userInfo = provider;
|
|
// uni.setStorageSync({//缓存用户登陆状态
|
|
// key: 'userToken',
|
|
// data: provider
|
|
// })
|
|
uni.setStorageSync('userToken',res.data.userToken)
|
|
},
|
|
logout(state) {
|
|
state.hasLogin = false;
|
|
state.userInfo = {};
|
|
uni.removeStorage({
|
|
key: 'userToken'
|
|
})
|
|
}
|
|
}
|
|
})
|
|
|
|
export default store
|
|
|