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

@ -3,6 +3,11 @@
* bug修复修复移动端修改聊天标题不生效的问题
* Bug修复修复用户注册不显示用户名的问题
* Bug修复修复管理后台拖动排序不生效的问题
* 功能优化:允许用户设置自定义首页背景图片
* 功能新增:**支持AI解读 PDF, Word, Excel等文件**
* 功能优化:优化聊天界面的用户上传文件的列表样式
* 功能新增:支持微信等社交媒体登录
## v4.0.9
* 环境升级:升级 Golang 到 go1.22.4

View File

@ -226,5 +226,5 @@ type SystemConfig struct {
SdNegPrompt string `json:"sd_neg_prompt"` // SD 默认反向提示词
RandBg bool `json:"rand_bg"` // 前端首页是否启用随机背景
IndexBgURL string `json:"index_bg_url"` // 前端首页背景图片
}

View File

Before

Width:  |  Height:  |  Size: 388 KiB

After

Width:  |  Height:  |  Size: 388 KiB

View File

@ -3,14 +3,12 @@
display flex
width 100%
.el-input {
width 50%
.el-input,.el-select,.el-switch {
margin-right 10px
}
.info {
margin-left 6px
margin-top 2px
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 MiB

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;

View File

@ -33,32 +33,42 @@
</el-input>
</el-form-item>
<el-form-item label="开放注册" prop="enabled_register">
<el-switch v-model="system['enabled_register']"/>
<el-tooltip
effect="dark"
content="关闭注册之后只能通过管理后台添加用户"
raw-content
placement="right"
>
<el-icon>
<InfoFilled/>
</el-icon>
</el-tooltip>
<el-form-item label="首页背景图" prop="logo">
<div class="tip-input">
<el-input v-model="system['index_bg_url']" placeholder="网站首页背景图片">
<template #append>
<el-upload
:auto-upload="true"
:show-file-list="false"
@click="beforeUpload('index_bg_url')"
:http-request="uploadImg"
>
<el-icon class="uploader-icon">
<UploadFilled/>
</el-icon>
</el-upload>
</template>
</el-input>
<el-button type="primary" @click="system.index_bg_url = 'https://api.dujin.org/bing/1920.php'">使用动态背景</el-button>
</div>
</el-form-item>
<el-form-item label="动态背景">
<el-switch v-model="system['rand_bg']"/>
<el-tooltip
effect="dark"
content="打开之后前端首页将使用随机壁纸作为背景图"
raw-content
placement="right"
>
<el-icon>
<InfoFilled/>
</el-icon>
</el-tooltip>
<el-form-item label="开放注册" prop="enabled_register">
<div class="tip-input">
<el-switch v-model="system['enabled_register']"/>
<div class="info">
<el-tooltip
effect="dark"
content="关闭注册之后只能通过管理后台添加用户"
raw-content
placement="right"
>
<el-icon>
<InfoFilled/>
</el-icon>
</el-tooltip>
</div>
</div>
</el-form-item>
<el-form-item label="注册方式" prop="register_ways">
@ -211,17 +221,21 @@
</el-tab-pane>
<el-tab-pane label="众筹支付">
<el-form-item label="启用众筹功能" prop="enabled_reward">
<el-switch v-model="system['enabled_reward']"/>
<el-tooltip
effect="dark"
content="如果关闭次功能将不在用户菜单显示众筹二维码"
raw-content
placement="right"
>
<el-icon>
<InfoFilled/>
</el-icon>
</el-tooltip>
<div class="tip-input">
<el-switch v-model="system['enabled_reward']"/>
<div class="info">
<el-tooltip
effect="dark"
content="如果关闭次功能将不在用户菜单显示众筹二维码"
raw-content
placement="right"
>
<el-icon>
<InfoFilled/>
</el-icon>
</el-tooltip>
</div>
</div>
</el-form-item>
<div v-if="system['enabled_reward']">
@ -534,7 +548,6 @@ const onUploadImg = (files, callback) => {
.el-icon {
font-size 16px
margin-left 10px
cursor pointer
}