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.
42 lines
702 B
42 lines
702 B
import Vue from 'vue'
|
|
import Vuex from 'vuex'
|
|
Vue.use(Vuex)
|
|
const store = new Vuex.Store({
|
|
state: {
|
|
hasLogin: false,
|
|
userInfo: {},
|
|
source:'phone',
|
|
share:''
|
|
},
|
|
mutations: {
|
|
login(state, provider) {
|
|
state.hasLogin = true;
|
|
// state.source = source
|
|
state.userInfo = provider;
|
|
uni.setStorageSync('userInfo',provider)
|
|
|
|
uni.setStorage({ //缓存用户登陆状态
|
|
key: 'userInfo',
|
|
data: provider
|
|
})
|
|
},
|
|
logout(state) {
|
|
state.hasLogin = false;
|
|
state.userInfo = {};
|
|
uni.removeStorageSync('userInfo')
|
|
uni.removeStorage({
|
|
key: 'userInfo'
|
|
})
|
|
},
|
|
shareHandle(state,value){
|
|
state.share = value;
|
|
}
|
|
},
|
|
actions: {
|
|
|
|
}
|
|
})
|
|
|
|
export default store
|
|
|
|
|
|
|