Compare commits

...

2 Commits

  1. 2
      jeecgboot-vue3-master/index.html
  2. 10
      jeecgboot-vue3-master/src/App.vue
  3. 4
      jeecgboot-vue3-master/src/components/Application/src/AppLogo.vue
  4. 9
      jeecgboot-vue3-master/src/hooks/setting/index.ts
  5. 35
      jeecgboot-vue3-master/src/store/modules/useSettingStore.ts

@ -10,7 +10,7 @@
/>
<title><%= title %></title>
<link rel="icon" href="/logo.png" />
<!-- <link rel="icon" href="/logo.png" /> -->
<!-- 全局配置 -->
<script>
window._CONFIG = {};

@ -11,6 +11,16 @@
import { AppProvider } from '/@/components/Application';
import { useTitle } from '/@/hooks/web/useTitle';
import { useLocale } from '/@/locales/useLocale';
import { useSettingStore } from '/@/store/modules/useSettingStore';
const { setting } = useSettingStore();
(function () {
const link = document.createElement('link');
link.rel = 'icon';
link.href = setting.logo;
const head = document.head || document.getElementsByTagName('head')[0];
head.appendChild(link);
})();
//
import 'dayjs/locale/zh-cn';

@ -5,7 +5,7 @@
<template>
<div class="anticon" :class="getAppLogoClass" @click="goHome">
<!-- <img src="../../../assets/images/logo.png" />-->
<img src="../../../assets/images/comp/appLogo.png" />
<img :src="setting.logo" />
<div class="ml-2 truncate md:opacity-100" :class="getTitleClass" v-show="showTitle">
{{ title }}
</div>
@ -19,6 +19,8 @@
import { useDesign } from '/@/hooks/web/useDesign';
import { PageEnum } from '/@/enums/pageEnum';
import { useUserStore } from '/@/store/modules/user';
import { useSettingStore } from '/@/store/modules/useSettingStore';
const { setting } = useSettingStore();
const props = defineProps({
/**

@ -2,6 +2,12 @@ import type { GlobConfig } from '/#/config';
import { getAppEnvConfig } from '/@/utils/env';
import { useSettingStore } from '/@/store/modules/useSettingStore';
import { store } from '/@/store';
const settingStore = useSettingStore(store);
export const useGlobSetting = (): Readonly<GlobConfig> => {
const {
VITE_GLOB_APP_TITLE,
@ -22,7 +28,7 @@ export const useGlobSetting = (): Readonly<GlobConfig> => {
}
// Take global configuration
const glob: Readonly<GlobConfig> = {
const glob: GlobConfig = {
title: VITE_GLOB_APP_TITLE,
domainUrl: VITE_GLOB_DOMAIN_URL,
apiUrl: VITE_GLOB_API_URL,
@ -35,5 +41,6 @@ export const useGlobSetting = (): Readonly<GlobConfig> => {
viewUrl: VITE_GLOB_ONLINE_VIEW_URL,
};
window._CONFIG['domianURL'] = VITE_GLOB_DOMAIN_URL;
Object.defineProperty(glob, 'title', settingStore.getDescriptor('name'));
return glob as Readonly<GlobConfig>;
};

@ -0,0 +1,35 @@
import { defineStore } from 'pinia';
import axios from 'axios';
const setting = {
id: '',
createBy: '',
createTime: '',
updateBy: '',
updateTime: '',
sysOrgCode: '',
name: '',
logo: '',
newsPage: '',
recordNumber: '',
copyright: '',
certificate: '',
composition: '',
};
async function getSetting(setting) {
console.count('请求---');
const res = await axios({ method: 'post', url: `${import.meta.env.VITE_GLOB_DOMAIN_URL}/sysconfiguration/sysConfiguration/findconfig` });
Object.assign(setting, res.data.result);
setting.logo = import.meta.env.VITE_GLOB_DOMAIN_URL + '/' + setting.logo;
}
export const useSettingStore = defineStore('setting', {
state: () => {
getSetting(setting);
const getDescriptor = (prop: string) => {
return { get: () => setting[prop] };
};
return { setting, getDescriptor };
},
});
Loading…
Cancel
Save