diff --git a/main.py b/main.py index 5ba4203..ff77e57 100644 --- a/main.py +++ b/main.py @@ -81,6 +81,14 @@ async def index(): return HTMLResponse(index_html) +@app.get('/banner') +async def banner(): + return { + 'detail': 'banner', + 'data': settings.UPLOAD_BANNERS.split(',') + } + + @app.get('/select') async def get_file(code: str, ip: str = Depends(error_ip_limit), s: AsyncSession = Depends(get_session)): # 查出数据库记录 diff --git a/settings.py b/settings.py index 005cc11..a4cb825 100644 --- a/settings.py +++ b/settings.py @@ -41,5 +41,7 @@ TITLE = config('TITLE', cast=str, default="文件快递柜") DESCRIPTION = config('DESCRIPTION', cast=str, default="FileCodeBox,文件快递柜,口令传送箱,匿名口令分享文本,文件等文件") # 网站关键词 KEYWORDS = config('KEYWORDS', cast=str, default="FileCodeBox,文件快递柜,口令传送箱,匿名口令分享文本,文件等文件") +# 上传页Banner图片 +UPLOAD_BANNERS = config('UPLOAD_BANNERS', cast=str, default=["/static/banners/img_1.png", "/static/banners/img_2.png"]) # 存储引擎 STORAGE_ENGINE = config('STORAGE_ENGINE', cast=str, default="filesystem") diff --git a/static/banners/img_1.png b/static/banners/img_1.png new file mode 100644 index 0000000..e1e315b Binary files /dev/null and b/static/banners/img_1.png differ diff --git a/static/banners/img_2.png b/static/banners/img_2.png new file mode 100644 index 0000000..e73e7d0 Binary files /dev/null and b/static/banners/img_2.png differ diff --git a/templates/index.html b/templates/index.html index 40bda6c..6507508 100644 --- a/templates/index.html +++ b/templates/index.html @@ -87,9 +87,18 @@ - + - + +
+ + + + 1 + + + +
@@ -133,6 +142,7 @@ placeholder="请输入内容,使用按钮存入" v-model="uploadData.text"> +
@@ -224,6 +234,7 @@ inputDisable: false, fileSizeLimit: '{{fileSizeLimit}}', pwd: localStorage.getItem('pwd') || '', + banners: [], uploadData: { style: '2', type: '1', @@ -265,6 +276,10 @@ } } }); + // 获取Banner + axios.get('/banner').then(res => { + this.banners = res.data.data + }) }, watch: { code: function (code) {