appConfig.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { configList } from '@/api/login'
  2. import Vue from 'vue'
  3. const appConfig = {
  4. namespaced: true,
  5. state: {
  6. configList: {} ,//系统配置,
  7. },
  8. mutations: {
  9. SET_CONFIGLIST: (state, configList) => {
  10. state.configList = configList
  11. },
  12. },
  13. actions: {
  14. // 获取配置信息
  15. ConfigList({ commit }) {
  16. configList({envCode: Vue.prototype.$PLATFORM}).then(res => {
  17. let { data } = res
  18. commit('SET_CONFIGLIST', data)
  19. //设置图标
  20. // #ifdef H5
  21. let url = data?.h5_tab_icon?.configValue
  22. let favicon = document.querySelector('link[rel="icon"]');
  23. if (favicon !== null) {
  24. favicon.href = url;
  25. } else {
  26. favicon = document.createElement("link");
  27. favicon.rel = "icon";
  28. favicon.href = url;
  29. document.head.appendChild(favicon);
  30. }
  31. // console.log('设置图标', favicon)
  32. // #endif
  33. })
  34. },
  35. }
  36. }
  37. export default appConfig