app.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import {
  2. getCity
  3. } from '@/api/address';
  4. const state = {
  5. // 城市id
  6. city: "",
  7. // 语言包
  8. lang: "zh-cn",
  9. //首页浮层广告弹出次数
  10. indexFloatLayerNum: 0,
  11. //广告显示次数
  12. indexTopAdNum: 0,
  13. // 定位区域
  14. locationRegion: null,
  15. //判断首页广告显示
  16. is_show:false
  17. }
  18. const mutations = {
  19. SET_CITY: (state, value) => {
  20. state.city = value;
  21. },
  22. SET_LANG: (state, value) => {
  23. state.lang = value;
  24. },
  25. SET_FLOAT_LAYER: (state, value) => {
  26. state.indexFloatLayerNum = value;
  27. },
  28. SET_INDEXTOPADNUM: (state, value) => {
  29. state.indexTopAdNum = value;
  30. },
  31. SET_LOCATION_REGION: (state, value) => {
  32. state.locationRegion = value;
  33. },
  34. IS_SHOW_JUDGE:(state, value)=>{
  35. state.is_show = value;
  36. }
  37. }
  38. const actions = {
  39. setCity({
  40. commit
  41. }, value) {
  42. commit('SET_CITY', value)
  43. },
  44. lang({
  45. commit
  46. }, value) {
  47. commit('SET_LANG', value)
  48. },
  49. get_city({
  50. commit
  51. }, item) {
  52. return new Promise((resolve, reject) => {
  53. return getCity({}).then(res => {
  54. resolve(res)
  55. }).catch(err => {
  56. reject(err)
  57. })
  58. })
  59. },
  60. is_show({commit}, item) {
  61. commit('IS_SHOW_JUDGE', item.is_show)
  62. },
  63. }
  64. export default {
  65. namespaced: true,
  66. state,
  67. mutations,
  68. actions
  69. }