Commit 058edc90b3c01f07d96874d911dfb4c45fffce42

Authored by fengtao
1 parent 3fdd7293

pref:优化登录页背景重复

Showing 1 changed file with 195 additions and 175 deletions
1 <template> 1 <template>
2 - <div :style="{ backgroundImage: 'url(' + (logoUrl !== undefined ? logoUrl : '') + ')',backgroundSize:'100% 100%;' }"  
3 - :class="prefixCls" class="relative w-full h-full px-4">  
4 - <AppLocalePicker class="absolute text-white top-4 right-4 enter-x xl:text-gray-600" :showText="false"  
5 - v-if="!sessionTimeout && showLocale" /> 2 + <div
  3 + style="background-size: 100% 100%"
  4 + :style="{ backgroundImage: 'url(' + (logoUrl !== undefined ? logoUrl : '') + ')' }"
  5 + :class="prefixCls"
  6 + class="relative w-full h-full px-4"
  7 + >
  8 + <AppLocalePicker
  9 + class="absolute text-white top-4 right-4 enter-x xl:text-gray-600"
  10 + :showText="false"
  11 + v-if="!sessionTimeout && showLocale"
  12 + />
6 <AppDarkModeToggle class="absolute top-3 right-7 enter-x" v-if="!sessionTimeout" /> 13 <AppDarkModeToggle class="absolute top-3 right-7 enter-x" v-if="!sessionTimeout" />
7 14
8 <span class="-enter-x xl:hidden"> 15 <span class="-enter-x xl:hidden">
@@ -14,20 +21,31 @@ @@ -14,20 +21,31 @@
14 <div class="hidden min-h-full pl-4 mr-4 xl:flex xl:flex-col xl:w-6/12"> 21 <div class="hidden min-h-full pl-4 mr-4 xl:flex xl:flex-col xl:w-6/12">
15 <!-- <AppLogo class="-enter-x" /> --> 22 <!-- <AppLogo class="-enter-x" /> -->
16 <div style="display: flex; margin-top: 10px"> 23 <div style="display: flex; margin-top: 10px">
17 - <img v-if="defaultLogo || getLogo" :src="defaultLogo || getLogo" style="width: 48px; height: 48px" /> 24 + <img
  25 + v-if="defaultLogo || getLogo"
  26 + :src="defaultLogo || getLogo"
  27 + style="width: 48px; height: 48px"
  28 + />
18 <img style="width: 48px; height: 48px" v-else src="/src/assets/images/logo.png" /> 29 <img style="width: 48px; height: 48px" v-else src="/src/assets/images/logo.png" />
19 - <div class="ml-2 truncate md:opacity-100" style=" 30 + <div
  31 + class="ml-2 truncate md:opacity-100"
  32 + style="
20 line-height: 45px; 33 line-height: 45px;
21 margin-left: 5px; 34 margin-left: 5px;
22 font-size: 24px; 35 font-size: 24px;
23 color: #fff; 36 color: #fff;
24 font-weight: 700; 37 font-weight: 700;
25 - "> 38 + "
  39 + >
26 {{ defaultTitle || getTitle }} 40 {{ defaultTitle || getTitle }}
27 </div> 41 </div>
28 </div> 42 </div>
29 <div v-if="ifCustom" class="my-auto"> 43 <div v-if="ifCustom" class="my-auto">
30 - <img :alt="title" src="../../../assets/svg/thingskit-login-background.svg" class="w-1/2 -mt-16 -enter-x" /> 44 + <img
  45 + :alt="title"
  46 + src="../../../assets/svg/thingskit-login-background.svg"
  47 + class="w-1/2 -mt-16 -enter-x"
  48 + />
31 <div class="mt-10 font-medium text-white -enter-x"> 49 <div class="mt-10 font-medium text-white -enter-x">
32 <span class="inline-block mt-4 text-3xl"> {{ t('sys.login.signInTitle') }}</span> 50 <span class="inline-block mt-4 text-3xl"> {{ t('sys.login.signInTitle') }}</span>
33 </div> 51 </div>
@@ -37,8 +55,10 @@ @@ -37,8 +55,10 @@
37 </div> 55 </div>
38 </div> 56 </div>
39 <div class="flex w-full h-full py-5 xl:h-auto xl:py-0 xl:my-0 xl:w-6/12"> 57 <div class="flex w-full h-full py-5 xl:h-auto xl:py-0 xl:my-0 xl:w-6/12">
40 - <div :class="`${prefixCls}-form`"  
41 - 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"> 58 + <div
  59 + :class="`${prefixCls}-form`"
  60 + 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"
  61 + >
42 <LoginForm /> 62 <LoginForm />
43 <ForgetPasswordForm /> 63 <ForgetPasswordForm />
44 <RegisterForm /> 64 <RegisterForm />
@@ -50,213 +70,213 @@ @@ -50,213 +70,213 @@
50 </div> 70 </div>
51 </template> 71 </template>
52 <script lang="ts" setup> 72 <script lang="ts" setup>
53 -import { computed, ref, onMounted } from 'vue';  
54 -// import { AppLogo } from '/@/components/Application';  
55 -import { AppLocalePicker, AppDarkModeToggle } from '/@/components/Application';  
56 -import LoginForm from './LoginForm.vue';  
57 -import ForgetPasswordForm from './ForgetPasswordForm.vue';  
58 -import RegisterForm from './RegisterForm.vue';  
59 -import MobileForm from './MobileForm.vue';  
60 -import { useGlobSetting } from '/@/hooks/setting';  
61 -import { useI18n } from '/@/hooks/web/useI18n';  
62 -import { useDesign } from '/@/hooks/web/useDesign';  
63 -import { useLocaleStore } from '/@/store/modules/locale';  
64 -import { useUserStore } from '/@/store/modules/user';  
65 -import { getPlatForm } from '/@/api/oem/index';  
66 -  
67 -defineProps({  
68 - sessionTimeout: {  
69 - type: Boolean,  
70 - },  
71 -});  
72 -const defaultTitle = ref('');  
73 -const defaultLogo = ref('');  
74 -const logoUrl = ref('');  
75 -onMounted(async () => {  
76 - const res = await getPlatForm();  
77 - logoUrl.value = res?.background;  
78 - defaultTitle.value = res?.name;  
79 - defaultLogo.value = res?.logo;  
80 - if (logoUrl.value !== undefined) {  
81 - ifCustom.value = false;  
82 - } else {  
83 - const defaultLogo = 'src/assets/svg/login-bg.svg';  
84 - logoUrl.value = 'url(' + defaultLogo + ')';  
85 - }  
86 -});  
87 -  
88 -const userStore = useUserStore();  
89 -  
90 -const ifCustom = ref(true);  
91 -const getLogo = computed(() => {  
92 - return userStore.platInfo?.logo;  
93 -});  
94 -const { title } = useGlobSetting();  
95 -const getTitle = computed(() => {  
96 - // 设置icon  
97 - let link = (document.querySelector("link[rel*='icon']") ||  
98 - document.createElement('link')) as HTMLLinkElement;  
99 - link.type = 'image/x-icon';  
100 - link.rel = 'shortcut icon';  
101 - link.href = userStore.platInfo?.icon ?? '/favicon.ico';  
102 - document.getElementsByTagName('head')[0].appendChild(link);  
103 - logoUrl.value = userStore.platInfo?.background;  
104 - if (logoUrl.value !== undefined) {  
105 - ifCustom.value = false;  
106 - } else {  
107 - const defaultLogo = 'src/assets/svg/login-bg.svg';  
108 - logoUrl.value = 'url(' + defaultLogo + ')';  
109 - }  
110 - return userStore.platInfo?.name ?? title;  
111 -});  
112 -// const globSetting = useGlobSetting();  
113 -const { prefixCls } = useDesign('login');  
114 -const { t } = useI18n();  
115 -const localeStore = useLocaleStore();  
116 -const showLocale = localeStore.getShowPicker; 73 + import { computed, ref, onMounted } from 'vue';
  74 + // import { AppLogo } from '/@/components/Application';
  75 + import { AppLocalePicker, AppDarkModeToggle } from '/@/components/Application';
  76 + import LoginForm from './LoginForm.vue';
  77 + import ForgetPasswordForm from './ForgetPasswordForm.vue';
  78 + import RegisterForm from './RegisterForm.vue';
  79 + import MobileForm from './MobileForm.vue';
  80 + import { useGlobSetting } from '/@/hooks/setting';
  81 + import { useI18n } from '/@/hooks/web/useI18n';
  82 + import { useDesign } from '/@/hooks/web/useDesign';
  83 + import { useLocaleStore } from '/@/store/modules/locale';
  84 + import { useUserStore } from '/@/store/modules/user';
  85 + import { getPlatForm } from '/@/api/oem/index';
  86 +
  87 + defineProps({
  88 + sessionTimeout: {
  89 + type: Boolean,
  90 + },
  91 + });
  92 + const defaultTitle = ref('');
  93 + const defaultLogo = ref('');
  94 + const logoUrl = ref('');
  95 + onMounted(async () => {
  96 + const res = await getPlatForm();
  97 + logoUrl.value = res?.background;
  98 + defaultTitle.value = res?.name;
  99 + defaultLogo.value = res?.logo;
  100 + if (logoUrl.value !== undefined) {
  101 + ifCustom.value = false;
  102 + } else {
  103 + const defaultLogo = 'src/assets/svg/login-bg.svg';
  104 + logoUrl.value = 'url(' + defaultLogo + ')';
  105 + }
  106 + });
  107 +
  108 + const userStore = useUserStore();
  109 +
  110 + const ifCustom = ref(true);
  111 + const getLogo = computed(() => {
  112 + return userStore.platInfo?.logo;
  113 + });
  114 + const { title } = useGlobSetting();
  115 + const getTitle = computed(() => {
  116 + // 设置icon
  117 + let link = (document.querySelector("link[rel*='icon']") ||
  118 + document.createElement('link')) as HTMLLinkElement;
  119 + link.type = 'image/x-icon';
  120 + link.rel = 'shortcut icon';
  121 + link.href = userStore.platInfo?.icon ?? '/favicon.ico';
  122 + document.getElementsByTagName('head')[0].appendChild(link);
  123 + logoUrl.value = userStore.platInfo?.background;
  124 + if (logoUrl.value !== undefined) {
  125 + ifCustom.value = false;
  126 + } else {
  127 + const defaultLogo = 'src/assets/svg/login-bg.svg';
  128 + logoUrl.value = 'url(' + defaultLogo + ')';
  129 + }
  130 + return userStore.platInfo?.name ?? title;
  131 + });
  132 + // const globSetting = useGlobSetting();
  133 + const { prefixCls } = useDesign('login');
  134 + const { t } = useI18n();
  135 + const localeStore = useLocaleStore();
  136 + const showLocale = localeStore.getShowPicker;
117 // const title = computed(() => globSetting?.title ?? ''); 137 // const title = computed(() => globSetting?.title ?? '');
118 </script> 138 </script>
119 <style lang="less"> 139 <style lang="less">
120 -@prefix-cls: ~'@{namespace}-login';  
121 -@logo-prefix-cls: ~'@{namespace}-app-logo';  
122 -@countdown-prefix-cls: ~'@{namespace}-countdown-input';  
123 -@dark-bg: #293146; 140 + @prefix-cls: ~'@{namespace}-login';
  141 + @logo-prefix-cls: ~'@{namespace}-app-logo';
  142 + @countdown-prefix-cls: ~'@{namespace}-countdown-input';
  143 + @dark-bg: #293146;
124 144
125 -html[data-theme='dark'] {  
126 - .@{prefix-cls} {  
127 - background-color: @dark-bg; 145 + html[data-theme='dark'] {
  146 + .@{prefix-cls} {
  147 + background-color: @dark-bg;
128 148
129 - &::before {  
130 - background-image: url(/@/assets/svg/login-bg-dark.svg);  
131 - } 149 + &::before {
  150 + background-image: url(/@/assets/svg/login-bg-dark.svg);
  151 + }
132 152
133 - .ant-input,  
134 - .ant-input-password {  
135 - background-color: #232a3b;  
136 - } 153 + .ant-input,
  154 + .ant-input-password {
  155 + background-color: #232a3b;
  156 + }
137 157
138 - .ant-btn:not(.ant-btn-link):not(.ant-btn-primary) {  
139 - border: 1px solid #4a5569;  
140 - } 158 + .ant-btn:not(.ant-btn-link):not(.ant-btn-primary) {
  159 + border: 1px solid #4a5569;
  160 + }
141 161
142 - &-form {  
143 - background: transparent !important;  
144 - } 162 + &-form {
  163 + background: transparent !important;
  164 + }
145 165
146 - .app-iconify {  
147 - color: #fff; 166 + .app-iconify {
  167 + color: #fff;
  168 + }
148 } 169 }
149 - }  
150 170
151 - input.fix-auto-fill,  
152 - .fix-auto-fill input {  
153 - -webkit-text-fill-color: #c9d1d9 !important;  
154 - box-shadow: inherit !important;  
155 - }  
156 -}  
157 -  
158 -.@{prefix-cls} {  
159 - min-height: 100%;  
160 - overflow: hidden;  
161 -  
162 - @media (max-width: @screen-xl) {  
163 - background-color: #293146;  
164 -  
165 - .@{prefix-cls}-form {  
166 - background-color: #fff; 171 + input.fix-auto-fill,
  172 + .fix-auto-fill input {
  173 + -webkit-text-fill-color: #c9d1d9 !important;
  174 + box-shadow: inherit !important;
167 } 175 }
168 } 176 }
169 177
170 - &::before {  
171 - position: absolute;  
172 - top: 0;  
173 - left: 0;  
174 - width: 100%;  
175 - height: 100%;  
176 - margin-left: -48%;  
177 - background-image: v-bind(logoUrl);  
178 - // background-image: url(/@/assets/svg/login-bg.svg);  
179 - background-position: 100%;  
180 - background-repeat: no-repeat;  
181 - background-size: auto 100%;  
182 - content: ''; 178 + .@{prefix-cls} {
  179 + min-height: 100%;
  180 + overflow: hidden;
183 181
184 @media (max-width: @screen-xl) { 182 @media (max-width: @screen-xl) {
185 - display: none;  
186 - }  
187 - }  
188 -  
189 - .@{logo-prefix-cls} {  
190 - position: absolute;  
191 - top: 12px;  
192 - height: 30px; 183 + background-color: #293146;
193 184
194 - &__title {  
195 - font-size: 16px;  
196 - color: #fff; 185 + .@{prefix-cls}-form {
  186 + background-color: #fff;
  187 + }
197 } 188 }
198 189
199 - img {  
200 - width: 32px; 190 + &::before {
  191 + position: absolute;
  192 + top: 0;
  193 + left: 0;
  194 + width: 100%;
  195 + height: 100%;
  196 + margin-left: -48%;
  197 + background-image: v-bind(logoUrl);
  198 + // background-image: url(/@/assets/svg/login-bg.svg);
  199 + background-position: 100%;
  200 + background-repeat: no-repeat;
  201 + background-size: auto 100%;
  202 + content: '';
  203 +
  204 + @media (max-width: @screen-xl) {
  205 + display: none;
  206 + }
201 } 207 }
202 - }  
203 208
204 - .container {  
205 .@{logo-prefix-cls} { 209 .@{logo-prefix-cls} {
206 - display: flex;  
207 - width: 60%;  
208 - height: 80px; 210 + position: absolute;
  211 + top: 12px;
  212 + height: 30px;
209 213
210 &__title { 214 &__title {
211 - font-size: 24px; 215 + font-size: 16px;
212 color: #fff; 216 color: #fff;
213 } 217 }
214 218
215 img { 219 img {
216 - width: 48px; 220 + width: 32px;
217 } 221 }
218 } 222 }
219 - }  
220 223
221 - &-sign-in-way {  
222 - .anticon {  
223 - font-size: 22px;  
224 - color: #888;  
225 - cursor: pointer; 224 + .container {
  225 + .@{logo-prefix-cls} {
  226 + display: flex;
  227 + width: 60%;
  228 + height: 80px;
  229 +
  230 + &__title {
  231 + font-size: 24px;
  232 + color: #fff;
  233 + }
226 234
227 - &:hover {  
228 - color: @primary-color; 235 + img {
  236 + width: 48px;
  237 + }
229 } 238 }
230 } 239 }
231 - }  
232 240
233 - input:not([type='checkbox']) {  
234 - min-width: 360px; 241 + &-sign-in-way {
  242 + .anticon {
  243 + font-size: 22px;
  244 + color: #888;
  245 + cursor: pointer;
235 246
236 - @media (max-width: @screen-xl) {  
237 - min-width: 320px; 247 + &:hover {
  248 + color: @primary-color;
  249 + }
  250 + }
238 } 251 }
239 252
240 - @media (max-width: @screen-lg) {  
241 - min-width: 260px;  
242 - } 253 + input:not([type='checkbox']) {
  254 + min-width: 360px;
243 255
244 - @media (max-width: @screen-md) {  
245 - min-width: 240px;  
246 - } 256 + @media (max-width: @screen-xl) {
  257 + min-width: 320px;
  258 + }
  259 +
  260 + @media (max-width: @screen-lg) {
  261 + min-width: 260px;
  262 + }
  263 +
  264 + @media (max-width: @screen-md) {
  265 + min-width: 240px;
  266 + }
247 267
248 - @media (max-width: @screen-sm) {  
249 - min-width: 160px; 268 + @media (max-width: @screen-sm) {
  269 + min-width: 160px;
  270 + }
250 } 271 }
251 - }  
252 272
253 - .@{countdown-prefix-cls} input {  
254 - min-width: unset;  
255 - } 273 + .@{countdown-prefix-cls} input {
  274 + min-width: unset;
  275 + }
256 276
257 - .ant-divider-inner-text {  
258 - font-size: 12px;  
259 - color: @text-color-secondary; 277 + .ant-divider-inner-text {
  278 + font-size: 12px;
  279 + color: @text-color-secondary;
  280 + }
260 } 281 }
261 -}  
262 </style> 282 </style>