支持背景切换时间自定义

This commit is contained in:
MarSeventh
2024-09-11 10:05:25 +08:00
parent 113ae41e6e
commit 95b8a49799
19 changed files with 66 additions and 9 deletions

View File

@@ -254,14 +254,15 @@ API格式
环境变量增加`USER_CONFIG`JSON格式具体字段用途及内容规范见下表。
| 字段名 | 用途 | 类型 | 内容规范 |
| ----------- | ------------------ | ----------- | ------------------------------------------------------------ |
| loginBkImg | 自定义登录页面背景 | 列表/字符串 | 1、当字段类型为`列表`时,列表中元素为需要添加到轮播列表中的图片链接(列表中只有一张图时即为固定背景),形如`["1.jpg","2.jpg"]`<br />2、当字段类型为`字符串`时,目前**仅支持**字符串值为`bing`设置为该值时启用bing随机图片轮播模式。 |
| uploadBkImg | 自定义上传页面背景 | 列表/字符串 | 同上 |
| ownerName | 页内图床名称 | 字符串 | 只支持`字符串`类型,设置为你自定义的图床名称(默认为`Sanyue` |
| logoUrl | 页内图床Logo | 字符串 | 只支持`字符串`类型,设置为你自定义的图床Logo链接 |
| siteTitle | 网站标题 | 字符串 | 只支持`字符串`类型,设置为你自定义的网站标题 |
| siteIcon | 网站标 | 字符串 | 只支持`字符串`类型,设置为你自定义的网站图标链接 |
| 字段名 | 用途 | 类型 | 内容规范 |
| ----------- | -------------------- | ----------- | ------------------------------------------------------------ |
| loginBkImg | 自定义登录页面背景 | 列表/字符串 | 1、当字段类型为`列表`时,列表中元素为需要添加到轮播列表中的图片链接(列表中只有一张图时即为固定背景),形如`["1.jpg","2.jpg"]`<br />2、当字段类型为`字符串`时,目前**仅支持**字符串值为`bing`设置为该值时启用bing随机图片轮播模式。 |
| uploadBkImg | 自定义上传页面背景 | 列表/字符串 | 同上 |
| bkInterval | 轮播背景切换时间间隔 | 正整数 | 设置为背景图的轮播时间,默认`3000`,单位`ms`。<br />例如你希望10s切换一次设置为`10000`即可。 |
| ownerName | 页内图床名称 | 字符串 | 只支持`字符串`类型,设置为你自定义的图床名称(默认为`Sanyue` |
| logoUrl | 页内图床Logo | 字符串 | 只支持`字符串`类型,设置为你自定义的图床Logo链接 |
| siteTitle | 网站标 | 字符串 | 只支持`字符串`类型,设置为你自定义的网站标题 |
| siteIcon | 网站图标 | 字符串 | 只支持`字符串`类型,设置为你自定义的网站图标链接 |
> 整体示例:
>
@@ -334,6 +335,7 @@ API格式
- ~~登录页面和上传页面背景图自定义2024.8.25已完成)~~
- ~~图床名称和Logo自定义2024.8.26已完成)~~
- ~~网站标题和Icon自定义2024.8.26已完成)~~
- ~~背景切换时间自定义2024.9.11已完成)~~
5. ~~增加随机图API2024.7.25已完成)~~
6. ~~完善多格式链接展示形式增加ubb格式链接支持2024.8.21已完成)~~
7. ~~完善登录逻辑后端增加认证码校验接口2024.8.21已完成)~~

1
css/834.e9bb2709.css Normal file

File diff suppressed because one or more lines are too long

BIN
css/834.e9bb2709.css.gz Normal file

Binary file not shown.

1
css/941.3c48f314.css Normal file
View File

@@ -0,0 +1 @@
.login[data-v-7facb7cf]{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-7facb7cf]{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-7facb7cf]:hover{box-shadow:0 0 12px 4px rgba(0,0,0,.24);transform:translateY(-5px)}.password-input[data-v-7facb7cf]{margin-bottom:15px;width:30vw}.submit[data-v-7facb7cf]{margin-top:10px}.background-image1[data-v-7facb7cf],.background-image2[data-v-7facb7cf]{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/941.3c48f314.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.cee299eb.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.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>

Binary file not shown.

2
js/834.f2609deb.js Normal file

File diff suppressed because one or more lines are too long

BIN
js/834.f2609deb.js.gz Normal file

Binary file not shown.

1
js/834.f2609deb.js.map Normal file

File diff suppressed because one or more lines are too long

BIN
js/834.f2609deb.js.map.gz Normal file

Binary file not shown.

2
js/941.5c2bbe42.js Normal file
View File

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

BIN
js/941.5c2bbe42.js.gz Normal file

Binary file not shown.

1
js/941.5c2bbe42.js.map Normal file

File diff suppressed because one or more lines are too long

BIN
js/941.5c2bbe42.js.map.gz Normal file

Binary file not shown.

46
js/app.307bc667.js Normal file

File diff suppressed because one or more lines are too long

BIN
js/app.307bc667.js.gz Normal file

Binary file not shown.

1
js/app.307bc667.js.map Normal file

File diff suppressed because one or more lines are too long

BIN
js/app.307bc667.js.map.gz Normal file

Binary file not shown.