app.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. const state = () => ({
  2. isPc: true,
  3. screen: 'pc',
  4. static: `${process.env.STATIC_URL}/pc`,
  5. loginVisiable: false,
  6. routePrefix: '', // 路由前缀
  7. themeName: 'normal',
  8. screenWidth: 0,
  9. showHeader: true,
  10. showFooter: true,
  11. })
  12. const mutations = {
  13. SET_SCREEN(state, width) {
  14. if (width > 768) {
  15. state.isPc = true
  16. state.screen = 'pc'
  17. } else {
  18. state.isPc = false
  19. state.screen = 'h5'
  20. }
  21. state.screenWidth = width
  22. state.static = `${process.env.STATIC_URL}/${state.screen}`
  23. },
  24. SHOW_LOGIN(state) {
  25. state.loginVisiable = true
  26. },
  27. HIDE_LOGIN(state) {
  28. state.loginVisiable = false
  29. },
  30. // 供应商模板类型
  31. SET_ROUTE_PREFIX(state, prefix) {
  32. state.routePrefix = prefix
  33. },
  34. // 设置主题
  35. SET_PAGE_THEME(state, name) {
  36. state.themeName = name
  37. },
  38. // hide layout
  39. HIDE_LAYOUT(state) {
  40. state.showHeader = false
  41. state.showFooter = false
  42. },
  43. SHOW_LAYOUT(state) {
  44. state.showHeader = true
  45. state.showFooter = true
  46. },
  47. }
  48. const actions = {}
  49. export default {
  50. namespaced: true,
  51. state,
  52. mutations,
  53. actions,
  54. }