支持背景图透明度自定义

This commit is contained in:
MarSeventh
2024-09-12 13:30:27 +08:00
parent 585f9f596f
commit 21a8a83f4d
19 changed files with 68 additions and 10 deletions

View File

@@ -254,15 +254,16 @@ API格式
环境变量增加`USER_CONFIG`JSON格式具体字段用途及内容规范见下表。
| 字段名 | 用途 | 类型 | 内容规范 |
| ----------- | -------------------- | ----------- | ------------------------------------------------------------ |
| loginBkImg | 自定义登录页面背景 | 列表/字符串 | 1、当字段类型为`列表`时,列表中元素为需要添加到轮播列表中的图片链接(列表中只有一张图时即为固定背景),形如`["1.jpg","2.jpg"]`<br />2、当字段类型为`字符串`时,目前**仅支持**字符串值为`bing`设置为该值时启用bing随机图片轮播模式。 |
| uploadBkImg | 自定义上传页面背景 | 列表/字符串 | 同上 |
| bkInterval | 轮播背景切换时间间隔 | 正整数 | 设置为背景图的轮播时间,默认`3000`,单位`ms`<br />例如你希望10s切换一次设置为`10000`即可。 |
| ownerName | 页内图床名称 | 字符串 | 只支持`字符串`类型,设置为你自定义的图床名称(默认为`Sanyue` |
| logoUrl | 页内图床Logo | 字符串 | 只支持`字符串`类型,设置为你自定义的图床Logo链接 |
| siteTitle | 网站标题 | 字符串 | 只支持`字符串`类型,设置为你自定义的网站标题 |
| siteIcon | 网站标 | 字符串 | 只支持`字符串`类型,设置为你自定义的网站图标链接 |
| 字段名 | 用途 | 类型 | 内容规范 |
| ----------- | -------------------- | ------------- | ------------------------------------------------------------ |
| loginBkImg | 自定义登录页面背景 | 列表/字符串 | 1、当字段类型为`列表`时,列表中元素为需要添加到轮播列表中的图片链接(列表中只有一张图时即为固定背景),形如`["1.jpg","2.jpg"]`<br />2、当字段类型为`字符串`时,目前**仅支持**字符串值为`bing`设置为该值时启用bing随机图片轮播模式。 |
| uploadBkImg | 自定义上传页面背景 | 列表/字符串 | 同上 |
| bkInterval | 轮播背景切换时间间隔 | 正整数 | 设置为背景图的轮播时间,默认`3000`,单位`ms`<br />例如你希望10s切换一次设置为`10000`即可。 |
| bkOpacity | 背景图透明度 | (0,1]的浮点数 | 展示的背景图透明度,默认为`1`<br />如果你觉得显示效果不佳,可以自定义,如`0.8` |
| ownerName | 页内图床名称 | 字符串 | 只支持`字符串`类型,设置为你自定义的图床名称(默认为`Sanyue` |
| logoUrl | 页内图床Logo | 字符串 | 只支持`字符串`类型,设置为你自定义的图床Logo链接 |
| siteTitle | 网站标 | 字符串 | 只支持`字符串`类型,设置为你自定义的网站标题 |
| siteIcon | 网站图标 | 字符串 | 只支持`字符串`类型,设置为你自定义的网站图标链接 |
> 整体示例:
>
@@ -336,11 +337,13 @@ API格式
- ~~图床名称和Logo自定义2024.8.26已完成)~~
- ~~网站标题和Icon自定义2024.8.26已完成)~~
- ~~背景切换时间自定义2024.9.11已完成)~~
- ~~背景透明度支持自定义2024.9.12已完成)~~
5. ~~增加随机图API2024.7.25已完成)~~
6. ~~完善多格式链接展示形式增加ubb格式链接支持2024.8.21已完成)~~
7. ~~完善登录逻辑后端增加认证码校验接口2024.8.21已完成)~~
8. ~~支持URL粘贴上传2024.8.23已完成)~~
9. ~~支持大于5MB的图片上传前自动压缩2024.8.26已完成)~~
10. 支持自定义压缩(上传前+存储端)
### 4.2Fix Bugs👻

1
css/908.2c1d343a.css Normal file
View File

@@ -0,0 +1 @@
.login[data-v-26cf9eb7]{display:flex;justify-content:center;align-items:center;height:100vh;transition:background-image 1s ease-in-out;background-size:cover;background-attachment:fixed}.login-container[data-v-26cf9eb7]{display:flex;flex-direction:column;justify-content:space-around;align-items:center;height:40vh;width:40vw;border-radius:12px;box-shadow:0 0 12px rgba(0,0,0,.12);background-color:hsla(0,0%,100%,.6);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);transition:all .3s ease}.login-container[data-v-26cf9eb7]:hover{box-shadow:0 0 12px 4px rgba(0,0,0,.24);transform:translateY(-5px)}.password-input[data-v-26cf9eb7]{margin-bottom:15px;width:30vw}.submit[data-v-26cf9eb7]{margin-top:10px}.background-image1[data-v-26cf9eb7],.background-image2[data-v-26cf9eb7]{position:fixed;top:0;left:0;width:100%;height:100%;-o-object-fit:cover;object-fit:cover;z-index:-1;opacity:0;transition:all 1s ease-in-out}

BIN
css/908.2c1d343a.css.gz Normal file

Binary file not shown.

1
css/913.fbe648d6.css Normal file

File diff suppressed because one or more lines are too long

BIN
css/913.fbe648d6.css.gz Normal file

Binary file not shown.

View File

@@ -1 +1 @@
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/logo.png"><title>Sanyue ImgHub</title><script defer="defer" src="/js/app.307bc667.js"></script><link href="/css/app.def7ef9b.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but sanyue_imghub doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/logo.png"><title>Sanyue ImgHub</title><script defer="defer" src="/js/app.3e48b5e4.js"></script><link href="/css/app.def7ef9b.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but sanyue_imghub doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>

Binary file not shown.

2
js/908.7bfed73e.js Normal file
View File

@@ -0,0 +1,2 @@
"use strict";(self["webpackChunksanyue_imghub"]=self["webpackChunksanyue_imghub"]||[]).push([[908],{2908:function(s,t,e){e.r(t),e.d(t,{default:function(){return m}});var i=e(47),a=(e(5331),e(9648),e(2105)),n=(e(9092),e(6768)),l=e(5130);const o={class:"login"},r={class:"login-container"};function g(s,t,e,g,c,u){const h=a.WK,p=i.S2;return(0,n.uX)(),(0,n.CE)("div",o,[t[3]||(t[3]=(0,n.Lk)("img",{id:"bg1",class:"background-image1",alt:"Background Image"},null,-1)),t[4]||(t[4]=(0,n.Lk)("img",{id:"bg2",class:"background-image2",alt:"Background Image"},null,-1)),(0,n.Lk)("div",r,[t[2]||(t[2]=(0,n.Lk)("h1",null,"Login",-1)),(0,n.bF)(h,{class:"password-input",modelValue:c.password,"onUpdate:modelValue":t[0]||(t[0]=s=>c.password=s),placeholder:"输入认证码,若未设置留空即可~",type:"password","show-password":"",onKeyup:(0,l.jR)(u.login,["enter","native"])},null,8,["modelValue","onKeyup"]),(0,n.bF)(p,{class:"submit",type:"primary",onClick:u.login},{default:(0,n.k6)((()=>t[1]||(t[1]=[(0,n.eW)("登录")]))),_:1},8,["onClick"])])])}e(4114);var c=e(4570),u=e.n(c),h=e(4373),p=e(782),d={data(){return{password:"",writtenPass:"",bingWallPaperIndex:0,customWallPaperIndex:0}},computed:{...(0,p.L8)(["userConfig","bingWallPapers"]),bkInterval(){return this.userConfig?.bkInterval||3e3},bkOpacity(){return this.userConfig?.bkOpacity||1}},mounted(){const s=document.getElementById("bg1"),t=document.getElementById("bg2");"bing"===this.userConfig?.loginBkImg?this.$store.dispatch("fetchBingWallPapers").then((()=>{s.src=this.bingWallPapers[this.bingWallPaperIndex]?.url,s.onload=()=>{s.style.opacity=this.bkOpacity},setInterval((()=>{let e=0!=s.style.opacity?s:t,i=0!=s.style.opacity?t:s;e.style.opacity=0,this.bingWallPaperIndex=(this.bingWallPaperIndex+1)%this.bingWallPapers.length,i.src=this.bingWallPapers[this.bingWallPaperIndex]?.url,i.onload=()=>{i.style.opacity=this.bkOpacity}}),this.bkInterval)})):this.userConfig?.loginBkImg instanceof Array&&this.userConfig?.loginBkImg?.length>1?(s.src=this.userConfig.loginBkImg[this.customWallPaperIndex],s.onload=()=>{s.style.opacity=this.bkOpacity},setInterval((()=>{let e=0!=s.style.opacity?s:t,i=0!=s.style.opacity?t:s;e.style.opacity=0,this.customWallPaperIndex=(this.customWallPaperIndex+1)%this.userConfig.loginBkImg.length,i.src=this.userConfig.loginBkImg[this.customWallPaperIndex],i.onload=()=>{i.style.opacity=this.bkOpacity}}),this.bkInterval)):this.userConfig?.loginBkImg instanceof Array&&1==this.userConfig?.loginBkImg?.length?(s.src=this.userConfig.loginBkImg[0],s.onload=()=>{s.style.opacity=this.bkOpacity}):(s.src="https://imgbed.sanyue.site/file/0dbd5add3605a0b2e8994.jpg",s.onload=()=>{s.style.opacity=this.bkOpacity})},methods:{login(){""===this.password?this.writtenPass="unset":this.writtenPass=this.password,h.A.post("/login",{authCode:this.password}).then((s=>{200===s.status?(u().set("authCode",this.writtenPass,"14d"),this.$router.push("/"),this.$message.success("登录成功~")):this.$message.error("登录失败,请检查认证码是否正确~")})).catch((s=>{this.$message.error("登录失败,请检查认证码是否正确~")}))}}},y=e(1241);const b=(0,y.A)(d,[["render",g],["__scopeId","data-v-26cf9eb7"]]);var m=b}}]);
//# sourceMappingURL=908.7bfed73e.js.map

BIN
js/908.7bfed73e.js.gz Normal file

Binary file not shown.

1
js/908.7bfed73e.js.map Normal file

File diff suppressed because one or more lines are too long

BIN
js/908.7bfed73e.js.map.gz Normal file

Binary file not shown.

2
js/913.a30ce20e.js Normal file

File diff suppressed because one or more lines are too long

BIN
js/913.a30ce20e.js.gz Normal file

Binary file not shown.

1
js/913.a30ce20e.js.map Normal file

File diff suppressed because one or more lines are too long

BIN
js/913.a30ce20e.js.map.gz Normal file

Binary file not shown.

46
js/app.3e48b5e4.js Normal file

File diff suppressed because one or more lines are too long

BIN
js/app.3e48b5e4.js.gz Normal file

Binary file not shown.

1
js/app.3e48b5e4.js.map Normal file

File diff suppressed because one or more lines are too long

BIN
js/app.3e48b5e4.js.map.gz Normal file

Binary file not shown.