index.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. // #ifdef H5
  14. baseURL: 'https://xxl.liuniu946.com', //请求地址配置
  15. // #endif
  16. // #ifdef MP
  17. baseURL: 'https://xxl.liuniu946.com', //请求地址配置
  18. // #endif
  19. urlFile: '/index', //项目部署所在文件夹
  20. userInfo: {}, //登录信息
  21. loginInterceptor: false, //是否打开强制登录
  22. // #ifdef H5 || MP-WEIXIN
  23. weichatInfo: {}, //保存微信注册信息
  24. weichatObj: '', //微信对象
  25. // #endif
  26. latitude: '28.67307',
  27. longitude: '121.44297',
  28. },
  29. mutations: {
  30. //保存微信信息
  31. setWeiChatInfo(state, provider) {
  32. state.weichatInfo = provider;
  33. },
  34. //保存微信对象
  35. setWeiChatObj(state, provider) {
  36. state.weichatObj = provider;
  37. },
  38. setLat(state, provider) {
  39. state.latitude = provider
  40. },
  41. setLon(state, provider) {
  42. state.longitude = provider
  43. },
  44. },
  45. modules: {
  46. user
  47. },
  48. actions: {}
  49. })
  50. export default store