index.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. chooseProvince: '',
  29. chooseCity: '',
  30. chooseDistrict: '',
  31. },
  32. mutations: {
  33. //保存微信信息
  34. setWeiChatInfo(state, provider) {
  35. state.weichatInfo = provider;
  36. },
  37. //保存微信对象
  38. setWeiChatObj(state, provider) {
  39. state.weichatObj = provider;
  40. },
  41. setLat(state, provider) {
  42. state.latitude = provider
  43. },
  44. setLon(state, provider) {
  45. state.longitude = provider
  46. },
  47. setChoose(state,provider) {
  48. state.chooseProvince = provider.chooseProvince
  49. state.chooseCity = provider.chooseCity
  50. state.chooseDistrict = provider.chooseDistrict
  51. console.log(state.chooseProvince,state.chooseCity,state.chooseDistrict,'dddddddddddddddddddd')
  52. },
  53. setDistrict(state,provider) {
  54. state.chooseDistrict = provider
  55. }
  56. },
  57. modules: {
  58. user
  59. },
  60. actions: {}
  61. })
  62. export default store