index.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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://yrh.liuniu946.com",//'http://eb.shuibo.net',//请求地址配置
  14. baseURL:'https://hy.liuniu946.com',//请求地址配置
  15. // baseURL:'http://haoyue.frp.liuniu946.com',//请求地址配置
  16. urlFile:'/index',//项目部署所在文件夹
  17. userInfo: {}, //登录信息
  18. loginInterceptor:false,//是否打开强制登录
  19. // #ifdef H5 || MP-WEIXIN
  20. weichatInfo:{},//保存微信注册信息
  21. weichatObj:'',//微信对象
  22. // #endif
  23. latitude: '28.67307',
  24. longitude: '121.44297',
  25. chooseProvince: '',
  26. chooseCity: '',
  27. chooseDistrict: '',
  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. setChoose(state,provider) {
  45. state.chooseProvince = provider.chooseProvince
  46. state.chooseCity = provider.chooseCity
  47. state.chooseDistrict = provider.chooseDistrict
  48. console.log(state.chooseProvince,state.chooseCity,state.chooseDistrict,'dddddddddddddddddddd')
  49. },
  50. setDistrict(state,provider) {
  51. state.chooseDistrict = provider
  52. }
  53. },
  54. modules:{
  55. user
  56. },
  57. actions: {}
  58. })
  59. export default store