Commit 5ec053f383f0314bf56dc259d0e2a16d44c53d2c

Authored by fengtao
1 parent b6e36c09

pref:优化登录页背景图重复

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