UnisKB/ui/src/components/login-layout/index.vue

57 lines
1.5 KiB
Vue
Raw Normal View History

2023-09-15 09:40:35 +00:00
<template>
2023-10-12 08:36:16 +00:00
<div class="login-warp flex-center">
<div class="login-container w-full h-full">
<el-row class="container w-full h-full">
2024-01-31 08:38:58 +00:00
<el-col :xs="0" :sm="0" :md="10" :lg="10" :xl="10" class="left-container">
2024-07-22 09:38:45 +00:00
<div class="login-image" :style="{ backgroundImage: `url(${loginImage})` }"></div>
2023-10-12 08:36:16 +00:00
</el-col>
2023-12-12 03:32:45 +00:00
<el-col :xs="24" :sm="24" :md="14" :lg="14" :xl="14" class="right-container flex-center">
2023-10-12 08:36:16 +00:00
<slot></slot>
</el-col>
</el-row>
2023-09-15 09:40:35 +00:00
</div>
2023-10-12 08:36:16 +00:00
</div>
2023-09-15 09:40:35 +00:00
</template>
<script setup lang="ts">
2024-07-16 09:32:27 +00:00
import { computed } from 'vue'
import { getThemeImg } from '@/utils/theme'
import useStore from '@/stores'
2024-07-22 09:38:45 +00:00
import { request } from '@/request'
2023-10-12 08:36:16 +00:00
defineOptions({ name: 'LoginLayout' })
2024-07-16 09:32:27 +00:00
const { user } = useStore()
const fileURL = computed(() => {
2024-07-16 09:39:15 +00:00
if (user.themeInfo?.loginImage) {
if (typeof user.themeInfo?.loginImage === 'string') {
return user.themeInfo?.loginImage
2024-07-16 09:32:27 +00:00
} else {
2024-07-16 09:39:15 +00:00
return URL.createObjectURL(user.themeInfo?.loginImage)
2024-07-16 09:32:27 +00:00
}
} else {
return ''
}
})
2024-07-22 09:38:45 +00:00
const loginImage = computed(() => {
2024-07-16 10:12:22 +00:00
if (user.themeInfo?.loginImage) {
2024-07-22 09:38:45 +00:00
return `${fileURL.value}`
2024-07-16 09:32:27 +00:00
} else {
2024-07-22 09:38:45 +00:00
return new URL(`../../assets/theme/${getThemeImg(user.themeInfo?.theme)}.jpg`, import.meta.url)
.href
2024-07-15 10:08:02 +00:00
}
})
2023-09-15 09:40:35 +00:00
</script>
<style lang="scss" scope>
.login-warp {
2023-10-12 08:36:16 +00:00
height: 100vh;
2023-09-15 09:40:35 +00:00
2023-10-12 08:36:16 +00:00
.login-image {
2024-07-16 09:32:27 +00:00
background-repeat: no-repeat;
background-position: center;
background-size: cover;
2023-10-12 08:36:16 +00:00
width: 100%;
height: 100%;
}
2023-09-15 09:40:35 +00:00
}
</style>