index.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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://xhg.duolio.cn', //请求地址配置
  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. forcedLogin: false, //是否需要强制登录
  25. hasLogin: false,
  26. userName: "",
  27. userId: '',
  28. token: '',
  29. pointId: '',
  30. },
  31. mutations: {
  32. //保存微信信息
  33. setWeiChatInfo(state, provider) {
  34. state.weichatInfo = provider;
  35. },
  36. //保存微信对象
  37. setWeiChatObj(state, provider) {
  38. state.weichatObj = provider;
  39. },
  40. setLat(state, provider) {
  41. state.latitude = provider
  42. },
  43. setLon(state, provider) {
  44. state.longitude = provider
  45. },
  46. },
  47. modules: {
  48. user
  49. },
  50. actions: {}
  51. })
  52. export default store