-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feat: customize login page images and backgrounds #8398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3082,8 +3082,18 @@ const message = { | |
| setDefault: 'Restaurar Padrão', | ||
| setHelper: 'As configurações atuais serão salvas. Deseja continuar?', | ||
| setDefaultHelper: 'Todas as configurações do painel serão restauradas para o padrão. Deseja continuar?', | ||
| reset: 'Redefinir', | ||
| revertHtml: 'Deseja restaurar {0} para a página padrão?', | ||
| logoGroup: 'Logo', | ||
| imageGroup: 'Imagem', | ||
| loginImage: 'Imagem da Página de Login', | ||
| loginImageHelper: 'Será exibida na página de login (Tamanho recomendado: 500x416px)', | ||
| loginBgType: 'Tipo de Fundo da Página de Login', | ||
| loginBgImage: 'Imagem de Fundo da Página de Login', | ||
| loginBgImageHelper: | ||
| 'Será exibida como imagem de fundo na página de login (Tamanho recomendado: 1920x1080px)', | ||
| loginBgColor: 'Cor de Fundo da Página de Login', | ||
| loginBgColorHelper: 'Será exibida como cor de fundo na página de login', | ||
| image: 'Imagem', | ||
| bgColor: 'Cor de Fundo', | ||
| }, | ||
| helper: { | ||
| wafTitle1: 'Mapa de Interceptação', | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The changes appear to be correcting typos and formatting errors within the translation strings of a messaging dialog. The most significant corrections include:
Overall, these modifications improve readability and grammatical accuracy of the translations within the context provided. |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,15 +2,23 @@ | |
| <div class="flex items-center justify-center min-h-screen relative bg-gray-100"> | ||
| <div | ||
| class="absolute inset-0 bg-cover bg-center bg-no-repeat" | ||
| :style="{ backgroundImage: `url(${backgroundImage})` }" | ||
| :style=" | ||
| globalStore.themeConfig.loginBgType === 'color' | ||
| ? { backgroundColor: globalStore.themeConfig.loginBackground } | ||
| : { backgroundImage: `url(${loadImage('loginBackground')})` } | ||
| " | ||
| ></div> | ||
| <div | ||
| :style="{ opacity: backgroundOpacity, width: containerWidth, height: containerHeight }" | ||
| class="bg-white shadow-lg relative z-10 border border-gray-200 flex overflow-hidden" | ||
| > | ||
| <div class="grid grid-cols-1 md:grid-cols-2 items-stretch w-full h-full"> | ||
| <div v-if="showLogo"> | ||
| <img :src="logoImage" class="max-w-full max-h-full object-contain" /> | ||
| <div v-if="showLogo" class="flex justify-center"> | ||
| <img | ||
| :src="loadImage('loginImage')" | ||
| class="max-w-full max-h-full object-cover bg-cover bg-center" | ||
| alt="1panel" | ||
| /> | ||
| </div> | ||
| <div :class="loginFormClass"> | ||
| <LoginForm ref="loginRef"></LoginForm> | ||
|
|
@@ -25,10 +33,8 @@ import LoginForm from './components/login-form.vue'; | |
| import { ref, onMounted } from 'vue'; | ||
| import { GlobalStore } from '@/store'; | ||
|
|
||
| const gStore = GlobalStore(); | ||
| const backgroundOpacity = ref(0.8); | ||
| const backgroundImage = ref(new URL('@/assets/images/1panel-login-bg.jpg', import.meta.url).href); | ||
| const logoImage = ref(new URL('@/assets/images/1panel-login.jpg', import.meta.url).href); | ||
| const globalStore = GlobalStore(); | ||
| const backgroundOpacity = ref(1); | ||
|
|
||
| const mySafetyCode = defineProps({ | ||
| code: { | ||
|
|
@@ -40,10 +46,32 @@ const mySafetyCode = defineProps({ | |
| const getStatus = async () => { | ||
| let code = mySafetyCode.code; | ||
| if (code != '') { | ||
| gStore.entrance = code; | ||
| globalStore.entrance = code; | ||
| } | ||
| }; | ||
|
|
||
| const loadImage = (name: string) => { | ||
| switch (name) { | ||
| case 'loginImage': | ||
| if (globalStore.themeConfig.loginImage === 'loginImage') { | ||
| return `/api/v2/images/loginImage?t=${Date.now()}`; | ||
| } | ||
| return new URL('@/assets/images/1panel-login.jpg', import.meta.url).href; | ||
| case 'loginBackground': | ||
| if (globalStore.themeConfig.loginBgType === 'image') { | ||
| if (globalStore.themeConfig.loginBackground === 'loginBackground') { | ||
| return `/api/v2/images/loginBackground?t=${Date.now()}`; | ||
| } | ||
| return new URL('@/assets/images/1panel-login-bg.jpg', import.meta.url).href; | ||
| } else if (globalStore.themeConfig.loginBgType === 'color') { | ||
| return globalStore.themeConfig.loginBackground; | ||
| } else { | ||
| return new URL('@/assets/images/1panel-login-bg.jpg', import.meta.url).href; | ||
| } | ||
| } | ||
| return ''; | ||
| }; | ||
|
|
||
| onMounted(() => { | ||
| getStatus(); | ||
| }); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The provided code has several issues and areas for improvement:
Here's an improved version of the code with some potential optimizations: import { ref, onMounted, defineComponent } from 'vue';
import LoginForm from './components/login-form.vue';
import { GlobalStore } from '@/store';
const globalStore = GlobalStore();
const showLogoVar =
process.env.NODE_ENV !== 'production' &&
window.location.host.toLowerCase().indexOf('.dev.') !== -1;
let imageUrl = '';
onMounted(() => {
if (process.env.IS_DEVELOPMENT && window.location.host.toLowerCase().indexOf('.dev.') !== -1) {
imageUrl = '/api/v2/images/dev_login-image.png?t=' + Date.now();
}
getStatus();
});In this version, we have removed the redundant reference to |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The provided code snippet seems to be part of a translation file for an interface in Indonesian. Here are some observations and suggestions:
Variable Names:
setDefault,setHelper, etc.) have been translated to their印尼 counterparts, which is appropriate.Reset Command:
Tetapkan Semula", suggesting that this function might now allow users to reset all settings back to default instead of just setting defaults.Undo HTML Content Placeholder:
{0}" within the "revertHtml" label remains intact, indicating it can still be used with a dynamic URL when applicable.New Logo Group:
Login Image Labels:
General Image and Background Color Labels:
Overall, the changes aim to expand the interface's localization while maintaining clarity and consistency in the translations. Additionally, incorporating new sections regarding specific login image properties aligns well with improving user experience on interfaces handling account authentication.