import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
	www: 'http://www.pingguozhushou.shop',
	hasLogin:false,
	userInfo: {},
	baseInfo: {},//基础信息
  },
  mutations: {
	login(state) {
		state.hasLogin = true
		
	},
	loginOut(state) {
		state.hasLogin = false
		window.localStorage.removeItem('token');
		window.localStorage.removeItem('user');
	},
	setUserInfo(state,payload) {
		state.userInfo = payload
		window.localStorage.setItem('user', JSON.stringify(payload))
	},
	setBaseInfo(state,payload) {
		state.baseInfo = payload
	},
	jUserMoney(state,payload) {
		state.userInfo.money = (state.userInfo.money*1 + payload).toFixed(2)
	}
  },
  actions: {

  }
})
