...
|
...
|
@@ -80,7 +80,10 @@ |
80
|
80
|
// import { useUserStore } from '/@/store/modules/user';
|
81
|
81
|
import { getPlatForm } from '/@/api/oem/index';
|
82
|
82
|
import defaultShowLogoImg from '/@/assets/svg/login-bg.svg';
|
|
83
|
+ import defaultShowLogoDarkImg from '/@/assets/svg/login-bg-dark.svg';
|
83
|
84
|
import { useTitle } from '@vueuse/core';
|
|
85
|
+ import { createLocalStorage } from '/@/utils/cache';
|
|
86
|
+ // import {usePlatform} from '/@/views/system/customize/hook/usePlatformInfo'
|
84
|
87
|
|
85
|
88
|
defineProps({
|
86
|
89
|
sessionTimeout: {
|
...
|
...
|
@@ -91,8 +94,14 @@ |
91
|
94
|
const defaultTitle = ref('');
|
92
|
95
|
const defaultLogo = ref('');
|
93
|
96
|
const logoUrl = ref('');
|
|
97
|
+ // const userStore = useUserStore();
|
|
98
|
+ const storage = createLocalStorage();
|
|
99
|
+
|
94
|
100
|
onMounted(async () => {
|
95
|
|
- const res = await getPlatForm();
|
|
101
|
+ let res = storage.get('platformInfo');
|
|
102
|
+ if (res === '' || res === null) {
|
|
103
|
+ res = await getPlatForm();
|
|
104
|
+ }
|
96
|
105
|
logoUrl.value = res?.background;
|
97
|
106
|
defaultTitle.value = res?.name || title;
|
98
|
107
|
defaultLogo.value = res?.logo;
|
...
|
...
|
@@ -100,13 +109,38 @@ |
100
|
109
|
document.createElement('link')) as HTMLLinkElement;
|
101
|
110
|
link.type = 'image/x-icon';
|
102
|
111
|
link.rel = 'shortcut icon';
|
103
|
|
- link.href = res.icon ?? '/favicon.ico';
|
|
112
|
+ link.href = res?.icon ?? '/favicon.ico';
|
104
|
113
|
document.getElementsByTagName('head')[0].appendChild(link);
|
|
114
|
+ let defaultLogoBg = document.createElement('style');
|
|
115
|
+ let defaultLogoDarkBg = document.createElement('style');
|
105
|
116
|
if (logoUrl.value !== undefined) {
|
|
117
|
+ //企业自定义
|
106
|
118
|
ifCustom.value = false;
|
|
119
|
+ //默认图片
|
|
120
|
+ defaultLogoBg.innerHTML = `.vben-login::before{
|
|
121
|
+ background-image:url("");
|
|
122
|
+ position:absolute;
|
|
123
|
+ }`;
|
|
124
|
+ //切换黑暗模式图片
|
|
125
|
+ defaultLogoDarkBg.innerHTML = `html[data-theme='dark'] .vben-login::before{
|
|
126
|
+ background-image:url("");
|
|
127
|
+ position:absolute;
|
|
128
|
+ }`;
|
107
|
129
|
} else {
|
108
|
130
|
logoUrl.value = 'url(' + defaultShowLogoImg + ')';
|
|
131
|
+ //默认图片
|
|
132
|
+ defaultLogoBg.innerHTML = `.vben-login::before{
|
|
133
|
+ background-image:url(${defaultShowLogoImg});
|
|
134
|
+ position:absolute;
|
|
135
|
+ }`;
|
|
136
|
+ //切换黑暗模式图片
|
|
137
|
+ defaultLogoDarkBg.innerHTML = `html[data-theme='dark'] .vben-login::before{
|
|
138
|
+ background-image:url(${defaultShowLogoDarkImg});
|
|
139
|
+ position:absolute;
|
|
140
|
+ }`;
|
109
|
141
|
}
|
|
142
|
+ document.head.appendChild(defaultLogoBg);
|
|
143
|
+ document.head.appendChild(defaultLogoDarkBg);
|
110
|
144
|
});
|
111
|
145
|
|
112
|
146
|
// const userStore = useUserStore();
|
...
|
...
|
@@ -200,9 +234,8 @@ |
200
|
234
|
width: 100%;
|
201
|
235
|
height: 100%;
|
202
|
236
|
margin-left: -48%;
|
203
|
|
- background-image: v-bind(logourl);
|
204
|
|
- // background-image: url(/@/assets/svg/login-bg.svg);
|
205
|
237
|
background-position: 100%;
|
|
238
|
+ // background-image: url(/@/assets/svg/login-bg.svg);
|
206
|
239
|
background-repeat: no-repeat;
|
207
|
240
|
background-size: auto 100%;
|
208
|
241
|
content: '';
|
...
|
...
|
|