index.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import Vue from 'vue'
  2. import Vuex from 'vuex'
  3. import user from './model/user'
  4. //引入axios模块(先下载`axios`--)
  5. // import axios from 'axios'
  6. import axios from 'axios'
  7. //将axios挂载在vue原型链上
  8. // Vue.prototype.$axios = axios;
  9. Vue.prototype.$axios = axios
  10. Vue.use(Vuex)
  11. const store = new Vuex.Store({
  12. state: {
  13. baseURL: 'http://hjdz.qiniu1314.com', //请求地址配置
  14. urlFile: '/index', //项目部署所在文件夹
  15. userInfo: {}, //登录信息
  16. loginInterceptor: false, //是否打开强制登录
  17. // #ifdef H5 || MP-WEIXIN
  18. weichatInfo: {}, //保存微信注册信息
  19. weichatObj: '', //微信对象
  20. // #endif
  21. latitude: '',
  22. longitude: '',
  23. },
  24. mutations: {
  25. //保存微信信息
  26. setWeiChatInfo(state, provider) {
  27. state.weichatInfo = provider;
  28. },
  29. //保存微信对象
  30. setWeiChatObj(state, provider) {
  31. state.weichatObj = provider;
  32. },
  33. setLat(state, provider) {
  34. state.latitude = provider
  35. },
  36. setLon(state, provider) {
  37. state.longitude = provider
  38. },
  39. },
  40. modules: {
  41. user
  42. },
  43. actions: {}
  44. })
  45. export default store