enable set custom index background image

This commit is contained in:
RockYang
2024-06-27 10:49:31 +08:00
parent 739cd46539
commit 9343c73e0f
7 changed files with 64 additions and 60 deletions

View File

@@ -1,6 +1,6 @@
<template>
<div class="index-page" :style="{height: winHeight+'px'}">
<div :class="bgClass"></div>
<div class="index-bg" :style="{backgroundImage: 'url('+bgImgUrl+')'}"></div>
<div class="menu-box">
<el-menu
mode="horizontal"
@@ -65,7 +65,6 @@
<script setup>
// import * as THREE from 'three';
import {onMounted, ref} from "vue";
import {useRouter} from "vue-router";
import FooterBar from "@/components/FooterBar.vue";
@@ -84,17 +83,18 @@ const title = ref("Geek-AI 创作系统")
const logo = ref("/images/logo.png")
const slogan = ref("我辈之人,先干为敬,陪您先把 AI 用起来")
const licenseConfig = ref({})
// const size = Math.max(window.innerWidth * 0.5, window.innerHeight * 0.8)
const winHeight = window.innerHeight - 150
const bgClass = ref('fixed-bg')
const bgImgUrl = ref('')
const isLogin = ref(false)
onMounted(() => {
httpGet("/api/config/get?key=system").then(res => {
title.value = res.data.title
logo.value = res.data.logo
if (res.data.rand_bg) {
bgClass.value = "rand-bg"
if (res.data.index_bg_url) {
bgImgUrl.value = res.data.index_bg_url
} else {
bgImgUrl.value = "/images/index-bg.jpg"
}
if (res.data.slogan) {
slogan.value = res.data.slogan
@@ -126,24 +126,12 @@ onMounted(() => {
align-items baseline
padding-top 150px
.fixed-bg {
.index-bg {
position absolute
top 0
left 0
width 100vw
height 100vh
background-image url("~@/assets/img/ai-bg.jpg")
background-size: cover;
background-position: center;
}
.rand-bg {
position absolute
top 0
left 0
width 100vw
height 100vh
background-image url("https://api.dujin.org/bing/1920.php")
filter: blur(8px);
background-size: cover;
background-position: center;