Commit 4159857de8be27af85e8af0ba7024771c01c57f0
Merge branch 'perf/platform-info-custom' into 'main_dev'
fix: 修复平台定制部分信息设置后不生效 See merge request yunteng/thingskit-front!1047
Showing
5 changed files
with
67 additions
and
32 deletions
1 | 1 | <template> |
2 | - <div class="anticon" :class="getAppLogoClass" @click="goHome"> | |
2 | + <div class="anticon" :class="getAppLogoClass"> | |
3 | 3 | <img v-if="getLogo" :src="getLogo" /> |
4 | 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 | 11 | {{ getTitle }} |
7 | 12 | </div> |
8 | 13 | </div> |
... | ... | @@ -51,6 +56,8 @@ |
51 | 56 | const getTitle = computed(() => { |
52 | 57 | return userStore.platInfo?.name ?? title; |
53 | 58 | }); |
59 | + | |
60 | + const getTitleColor = computed(() => userStore.platInfo?.backgroundColor || '#377dff'); | |
54 | 61 | </script> |
55 | 62 | <style lang="less" scoped> |
56 | 63 | @prefix-cls: ~'@{namespace}-app-logo'; | ... | ... |
... | ... | @@ -29,8 +29,22 @@ import { PAGE_NOT_FOUND_ROUTE } from '/@/router/routes/basic'; |
29 | 29 | import { createLocalStorage } from '/@/utils/cache/index'; |
30 | 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 | 46 | interface UserState { |
33 | - platInfo: any; | |
47 | + platInfo: PlatInfoType; | |
34 | 48 | enterPriseInfo: any; |
35 | 49 | userInfo: Nullable<UserInfo>; |
36 | 50 | userUpdateInfo?: Nullable<UserUpdateInfo>; | ... | ... |
... | ... | @@ -6,7 +6,6 @@ |
6 | 6 | v-if="!sessionTimeout && showLocale" |
7 | 7 | /> |
8 | 8 | <AppDarkModeToggle class="absolute top-3 right-7 enter-x" v-if="!sessionTimeout" /> |
9 | - | |
10 | 9 | <span class="-enter-x xl:hidden"> |
11 | 10 | <!-- <AppLogo :alwaysShowTitle="true" /> --> |
12 | 11 | </span> |
... | ... | @@ -41,7 +40,7 @@ |
41 | 40 | </div> |
42 | 41 | </div> |
43 | 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 | 44 | <div |
46 | 45 | :class="`${prefixCls}-form`" |
47 | 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 | 50 | <RegisterForm /> |
52 | 51 | <MobileForm /> |
53 | 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 | 58 | </div> |
55 | 59 | </div> |
56 | 60 | </div> |
57 | 61 | </div> |
58 | 62 | </template> |
59 | 63 | <script lang="ts" setup> |
60 | - import { ref, onMounted } from 'vue'; | |
64 | + import { ref, onMounted, computed } from 'vue'; | |
61 | 65 | import { AppLocalePicker, AppDarkModeToggle } from '/@/components/Application'; |
62 | 66 | import LoginForm from './LoginForm.vue'; |
63 | 67 | import ForgetPasswordForm from './ForgetPasswordForm.vue'; |
... | ... | @@ -69,6 +73,7 @@ |
69 | 73 | import { useLocaleStore } from '/@/store/modules/locale'; |
70 | 74 | import defaultBackgroundImage from '/@/assets/svg/thingskit-login-background.svg'; |
71 | 75 | import { getPlatFormInfo } from '../../system/customize/hook/usePlatformInfo'; |
76 | + import { useUserStore } from '/@/store/modules/user'; | |
72 | 77 | |
73 | 78 | defineProps({ |
74 | 79 | sessionTimeout: { |
... | ... | @@ -84,6 +89,10 @@ |
84 | 89 | const localeStore = useLocaleStore(); |
85 | 90 | const showLocale = localeStore.getShowPicker; |
86 | 91 | |
92 | + const userStore = useUserStore(); | |
93 | + | |
94 | + const getPlatformInfo = computed(() => userStore.platInfo); | |
95 | + | |
87 | 96 | const show = ref(false); |
88 | 97 | |
89 | 98 | onMounted(() => { | ... | ... |
... | ... | @@ -56,7 +56,7 @@ export const schemas: FormSchema[] = [ |
56 | 56 | { |
57 | 57 | field: 'backgroundColor', |
58 | 58 | component: 'AutoComplete', |
59 | - label: '登录页背景颜色', | |
59 | + label: '平台名称颜色', | |
60 | 60 | colProps: { |
61 | 61 | span: 24, |
62 | 62 | }, |
... | ... | @@ -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 | 4 | import { createStorage } from '/@/utils/cache'; |
5 | 5 | import { Platform } from '/@/api/oem/model'; |
6 | 6 | import { PLATFORM_INFO_CACHE_KEY } from '/@/enums/cacheEnum'; |
7 | +import { useUserStore } from '/@/store/modules/user'; | |
7 | 8 | |
8 | 9 | enum DefaultPlatform { |
9 | 10 | LOGO = '/resource/img/logo.png', |
... | ... | @@ -19,6 +20,10 @@ export const setPlatFormInfo = (info: Recordable) => storage.set(PLATFORM_INFO_C |
19 | 20 | export const usePlatform = async () => { |
20 | 21 | const platformInfo = (await getPlatForm()) || {}; |
21 | 22 | |
23 | + const userStore = useUserStore(); | |
24 | + | |
25 | + userStore.setPlatInfo(platformInfo); | |
26 | + | |
22 | 27 | setPlatFormInfo(platformInfo); |
23 | 28 | const createLoadingEffect = () => { |
24 | 29 | const wrap = document.createElement('div'); | ... | ... |