import Vue from 'vue'
import Vuex from 'vuex'
import user from './model/user'
//引入axios模块(先下载`axios`--)
// import axios from 'axios'
import axios from 'axios'
//将axios挂载在vue原型链上
// Vue.prototype.$axios = axios;
Vue.prototype.$axios = axios
Vue.use(Vuex)

const store = new Vuex.Store({
	state: {
		baseURL: 'http://hjdz.qiniu1314.com', //请求地址配置 
		urlFile: '/index', //项目部署所在文件夹
		userInfo: {}, //登录信息
		loginInterceptor: false, //是否打开强制登录
		// #ifdef H5 || MP-WEIXIN
		weichatInfo: {}, //保存微信注册信息
		weichatObj: '', //微信对象
		// #endif
		latitude: '',
		longitude: '',
	},
	mutations: {
		//保存微信信息
		setWeiChatInfo(state, provider) {
			state.weichatInfo = provider;
		},
		//保存微信对象
		setWeiChatObj(state, provider) {
			state.weichatObj = provider;
		},
		setLat(state, provider) {
			state.latitude = provider
		},
		setLon(state, provider) {
			state.longitude = provider
		},
	},
	modules: {
		user
	},
	actions: {}
})

export default store
