77 element-loading-background =" #F5F6F7"
88 ></div >
99
10- <div class =" login-container" :class =" { 'hide-login-container': showLoading }" >
11- <div class =" login-left" >
12- <img :src =" bg" alt =" " />
10+ <div
11+ ref =" loginContainer"
12+ class =" login-container"
13+ :class =" { 'hide-login-container': showLoading }"
14+ >
15+ <div v-if =" showLoginImage" class =" login-image-content" >
16+ <el-image class =" login-image" fit =" cover" :src =" bg" />
1317 </div >
1418 <div class =" login-content" >
1519 <div class =" login-right" >
7478</template >
7579
7680<script lang="ts" setup>
77- import { ref , computed } from ' vue'
81+ import { ref , computed , onMounted , nextTick } from ' vue'
7882import { useRouter } from ' vue-router'
7983import { useUserStore } from ' @/stores/user'
8084import { useI18n } from ' vue-i18n'
@@ -85,6 +89,7 @@ import { useAppearanceStoreWithOut } from '@/stores/appearance'
8589import loginImage from ' @/assets/blue/login-image_blue.png'
8690import Handler from ' ./xpack/Handler.vue'
8791import { toLoginSuccess } from ' @/utils/utils'
92+ import elementResizeDetectorMaker from ' element-resize-detector'
8893
8994const showLoading = ref (true )
9095const router = useRouter ()
@@ -105,7 +110,20 @@ const bg = computed(() => {
105110const loginBg = computed (() => {
106111 return appearanceStore .getLogin
107112})
113+ const loginContainerWidth = ref (0 )
114+ const loginContainer = ref ()
115+ const showLoginImage = computed <boolean >(() => {
116+ return ! (loginContainerWidth .value < 889 )
117+ })
108118
119+ onMounted (async () => {
120+ const erd = elementResizeDetectorMaker ()
121+ erd .listenTo (loginContainer .value , () => {
122+ nextTick (() => {
123+ loginContainerWidth .value = loginContainer .value ?.offsetWidth
124+ })
125+ })
126+ })
109127const rules = {
110128 username: [{ required: true , message: t (' common.your_account_email_address' ), trigger: ' blur' }],
111129 password: [{ required: true , message: t (' common.the_correct_password' ), trigger: ' blur' }],
@@ -136,17 +154,20 @@ const switchTab = (name: string) => {
136154 align-items : center ;
137155 justify-content : center ;
138156
139- .login-left {
140- display : flex ;
157+ .login-image-content {
158+ overflow : hidden ;
141159 height : 100% ;
142160 width : 40% ;
143- img {
161+ min-width : 400px ;
162+ .login-image {
163+ background-size : 100% 100% ;
164+ width : 100% ;
144165 height : 100% ;
145- max-width : 100% ;
146166 }
147167 }
148168
149169 .login-content {
170+ position : relative ;
150171 display : flex ;
151172 align-items : center ;
152173 justify-content : center ;
0 commit comments