Commit 721830c87437f9f47e945eed11ddcf780f683541

Authored by ww
1 parent c3c429ae

fix: 修复平台定制部分信息设置后不生效

1 <template> 1 <template>
2 - <div class="anticon" :class="getAppLogoClass" @click="goHome"> 2 + <div class="anticon" :class="getAppLogoClass">
3 <img v-if="getLogo" :src="getLogo" /> 3 <img v-if="getLogo" :src="getLogo" />
4 <img v-else src="/src/assets/images/logo.png" /> 4 <img v-else src="/src/assets/images/logo.png" />
5 - <div class="ml-2 truncate md:opacity-100" :class="getTitleClass" v-show="showTitle"> 5 + <div
  6 + class="ml-2 truncate md:opacity-100"
  7 + :class="getTitleClass"
  8 + v-show="showTitle"
  9 + :style="{ color: getTitleColor }"
  10 + >
6 {{ getTitle }} 11 {{ getTitle }}
7 </div> 12 </div>
8 </div> 13 </div>
@@ -51,6 +56,8 @@ @@ -51,6 +56,8 @@
51 const getTitle = computed(() => { 56 const getTitle = computed(() => {
52 return userStore.platInfo?.name ?? title; 57 return userStore.platInfo?.name ?? title;
53 }); 58 });
  59 +
  60 + const getTitleColor = computed(() => userStore.platInfo?.backgroundColor || '#377dff');
54 </script> 61 </script>
55 <style lang="less" scoped> 62 <style lang="less" scoped>
56 @prefix-cls: ~'@{namespace}-app-logo'; 63 @prefix-cls: ~'@{namespace}-app-logo';
@@ -29,8 +29,22 @@ import { PAGE_NOT_FOUND_ROUTE } from '/@/router/routes/basic'; @@ -29,8 +29,22 @@ import { PAGE_NOT_FOUND_ROUTE } from '/@/router/routes/basic';
29 import { createLocalStorage } from '/@/utils/cache/index'; 29 import { createLocalStorage } from '/@/utils/cache/index';
30 import { getEntitiesId } from '/@/api/dashboard/index'; 30 import { getEntitiesId } from '/@/api/dashboard/index';
31 31
  32 +interface PlatInfoType {
  33 + id: string;
  34 + creator: string;
  35 + createTime: string;
  36 + updater: string;
  37 + updateTime: string;
  38 + logo?: string;
  39 + name?: string;
  40 + backgroundColor: string;
  41 + copyright: string;
  42 + presentedOurselves: string;
  43 + domain: string;
  44 +}
  45 +
32 interface UserState { 46 interface UserState {
33 - platInfo: any; 47 + platInfo: PlatInfoType;
34 enterPriseInfo: any; 48 enterPriseInfo: any;
35 userInfo: Nullable<UserInfo>; 49 userInfo: Nullable<UserInfo>;
36 userUpdateInfo?: Nullable<UserUpdateInfo>; 50 userUpdateInfo?: Nullable<UserUpdateInfo>;
@@ -6,7 +6,6 @@ @@ -6,7 +6,6 @@
6 v-if="!sessionTimeout && showLocale" 6 v-if="!sessionTimeout && showLocale"
7 /> 7 />
8 <AppDarkModeToggle class="absolute top-3 right-7 enter-x" v-if="!sessionTimeout" /> 8 <AppDarkModeToggle class="absolute top-3 right-7 enter-x" v-if="!sessionTimeout" />
9 -  
10 <span class="-enter-x xl:hidden"> 9 <span class="-enter-x xl:hidden">
11 <!-- <AppLogo :alwaysShowTitle="true" /> --> 10 <!-- <AppLogo :alwaysShowTitle="true" /> -->
12 </span> 11 </span>
@@ -41,7 +40,7 @@ @@ -41,7 +40,7 @@
41 </div> 40 </div>
42 </div> 41 </div>
43 </div> 42 </div>
44 - <div class="flex w-full h-full py-5 xl:h-auto xl:py-0 xl:my-0 xl:w-6/12"> 43 + <div class="flex w-full h-full py-5 xl:h-auto xl:py-0 xl:my-0 xl:w-6/12 relative">
45 <div 44 <div
46 :class="`${prefixCls}-form`" 45 :class="`${prefixCls}-form`"
47 class="relative w-full px-5 py-8 mx-auto my-auto rounded-md shadow-md xl:ml-16 xl:bg-transparent sm:px-8 xl:p-4 xl:shadow-none sm:w-3/4 lg:w-2/4 xl:w-auto enter-x" 46 class="relative w-full px-5 py-8 mx-auto my-auto rounded-md shadow-md xl:ml-16 xl:bg-transparent sm:px-8 xl:p-4 xl:shadow-none sm:w-3/4 lg:w-2/4 xl:w-auto enter-x"
@@ -51,13 +50,18 @@ @@ -51,13 +50,18 @@
51 <RegisterForm /> 50 <RegisterForm />
52 <MobileForm /> 51 <MobileForm />
53 </div> 52 </div>
  53 + <div class="absolute bottom-8 w-full text-gray-400 flex flex-col items-center">
  54 + <span>{{ getPlatformInfo?.copyright }}</span>
  55 + <span>{{ getPlatformInfo?.presentedOurselves }}</span>
  56 + <!-- <span>{{ getPlatformInfo?.domain }}</span> -->
  57 + </div>
54 </div> 58 </div>
55 </div> 59 </div>
56 </div> 60 </div>
57 </div> 61 </div>
58 </template> 62 </template>
59 <script lang="ts" setup> 63 <script lang="ts" setup>
60 - import { ref, onMounted } from 'vue'; 64 + import { ref, onMounted, computed } from 'vue';
61 import { AppLocalePicker, AppDarkModeToggle } from '/@/components/Application'; 65 import { AppLocalePicker, AppDarkModeToggle } from '/@/components/Application';
62 import LoginForm from './LoginForm.vue'; 66 import LoginForm from './LoginForm.vue';
63 import ForgetPasswordForm from './ForgetPasswordForm.vue'; 67 import ForgetPasswordForm from './ForgetPasswordForm.vue';
@@ -69,6 +73,7 @@ @@ -69,6 +73,7 @@
69 import { useLocaleStore } from '/@/store/modules/locale'; 73 import { useLocaleStore } from '/@/store/modules/locale';
70 import defaultBackgroundImage from '/@/assets/svg/thingskit-login-background.svg'; 74 import defaultBackgroundImage from '/@/assets/svg/thingskit-login-background.svg';
71 import { getPlatFormInfo } from '../../system/customize/hook/usePlatformInfo'; 75 import { getPlatFormInfo } from '../../system/customize/hook/usePlatformInfo';
  76 + import { useUserStore } from '/@/store/modules/user';
72 77
73 defineProps({ 78 defineProps({
74 sessionTimeout: { 79 sessionTimeout: {
@@ -84,6 +89,10 @@ @@ -84,6 +89,10 @@
84 const localeStore = useLocaleStore(); 89 const localeStore = useLocaleStore();
85 const showLocale = localeStore.getShowPicker; 90 const showLocale = localeStore.getShowPicker;
86 91
  92 + const userStore = useUserStore();
  93 +
  94 + const getPlatformInfo = computed(() => userStore.platInfo);
  95 +
87 const show = ref(false); 96 const show = ref(false);
88 97
89 onMounted(() => { 98 onMounted(() => {
@@ -56,7 +56,7 @@ export const schemas: FormSchema[] = [ @@ -56,7 +56,7 @@ export const schemas: FormSchema[] = [
56 { 56 {
57 field: 'backgroundColor', 57 field: 'backgroundColor',
58 component: 'AutoComplete', 58 component: 'AutoComplete',
59 - label: '登录页背景颜色', 59 + label: '平台名称颜色',
60 colProps: { 60 colProps: {
61 span: 24, 61 span: 24,
62 }, 62 },
@@ -112,29 +112,29 @@ export const schemas: FormSchema[] = [ @@ -112,29 +112,29 @@ export const schemas: FormSchema[] = [
112 ]; 112 ];
113 }, 113 },
114 }, 114 },
115 - {  
116 - field: 'domain',  
117 - component: 'Input',  
118 - label: '绑定域名',  
119 - colProps: {  
120 - span: 24,  
121 - },  
122 - componentProps: {  
123 - maxLength: 100,  
124 - placeholder: '请输入绑定域名',  
125 - },  
126 - dynamicRules: () => {  
127 - return [  
128 - {  
129 - required: false,  
130 - validator: (_, value) => {  
131 - if (String(value).length > 100) {  
132 - return Promise.reject('字数不超过100个字');  
133 - }  
134 - return Promise.resolve();  
135 - },  
136 - },  
137 - ];  
138 - },  
139 - }, 115 + // {
  116 + // field: 'domain',
  117 + // component: 'Input',
  118 + // label: '绑定域名',
  119 + // colProps: {
  120 + // span: 24,
  121 + // },
  122 + // componentProps: {
  123 + // maxLength: 100,
  124 + // placeholder: '请输入绑定域名',
  125 + // },
  126 + // dynamicRules: () => {
  127 + // return [
  128 + // {
  129 + // required: false,
  130 + // validator: (_, value) => {
  131 + // if (String(value).length > 100) {
  132 + // return Promise.reject('字数不超过100个字');
  133 + // }
  134 + // return Promise.resolve();
  135 + // },
  136 + // },
  137 + // ];
  138 + // },
  139 + // },
140 ]; 140 ];
@@ -4,6 +4,7 @@ import darkThemeBgImage from '/@/assets/svg/login-bg-dark.svg'; @@ -4,6 +4,7 @@ import darkThemeBgImage from '/@/assets/svg/login-bg-dark.svg';
4 import { createStorage } from '/@/utils/cache'; 4 import { createStorage } from '/@/utils/cache';
5 import { Platform } from '/@/api/oem/model'; 5 import { Platform } from '/@/api/oem/model';
6 import { PLATFORM_INFO_CACHE_KEY } from '/@/enums/cacheEnum'; 6 import { PLATFORM_INFO_CACHE_KEY } from '/@/enums/cacheEnum';
  7 +import { useUserStore } from '/@/store/modules/user';
7 8
8 enum DefaultPlatform { 9 enum DefaultPlatform {
9 LOGO = '/resource/img/logo.png', 10 LOGO = '/resource/img/logo.png',
@@ -19,6 +20,10 @@ export const setPlatFormInfo = (info: Recordable) => storage.set(PLATFORM_INFO_C @@ -19,6 +20,10 @@ export const setPlatFormInfo = (info: Recordable) => storage.set(PLATFORM_INFO_C
19 export const usePlatform = async () => { 20 export const usePlatform = async () => {
20 const platformInfo = (await getPlatForm()) || {}; 21 const platformInfo = (await getPlatForm()) || {};
21 22
  23 + const userStore = useUserStore();
  24 +
  25 + userStore.setPlatInfo(platformInfo);
  26 +
22 setPlatFormInfo(platformInfo); 27 setPlatFormInfo(platformInfo);
23 const createLoadingEffect = () => { 28 const createLoadingEffect = () => {
24 const wrap = document.createElement('div'); 29 const wrap = document.createElement('div');