Skip to content

Commit 1c93894

Browse files
committed
add:上传页面新增banner
1 parent 1410086 commit 1c93894

File tree

5 files changed

+27
-2
lines changed

5 files changed

+27
-2
lines changed

main.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ async def index():
8181
return HTMLResponse(index_html)
8282

8383

84+
@app.get('/banner')
85+
async def banner():
86+
return {
87+
'detail': 'banner',
88+
'data': settings.UPLOAD_BANNERS.split(',')
89+
}
90+
91+
8492
@app.get('/select')
8593
async def get_file(code: str, ip: str = Depends(error_ip_limit), s: AsyncSession = Depends(get_session)):
8694
# 查出数据库记录

settings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,7 @@
4141
DESCRIPTION = config('DESCRIPTION', cast=str, default="FileCodeBox,文件快递柜,口令传送箱,匿名口令分享文本,文件等文件")
4242
# 网站关键词
4343
KEYWORDS = config('KEYWORDS', cast=str, default="FileCodeBox,文件快递柜,口令传送箱,匿名口令分享文本,文件等文件")
44+
# 上传页Banner图片
45+
UPLOAD_BANNERS = config('UPLOAD_BANNERS', cast=str, default=["/static/banners/img_1.png", "/static/banners/img_2.png"])
4446
# 存储引擎
4547
STORAGE_ENGINE = config('STORAGE_ENGINE', cast=str, default="filesystem")

static/banners/img_1.png

172 KB
Loading

static/banners/img_2.png

127 KB
Loading

templates/index.html

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,18 @@
8787
</el-col>
8888
</el-card>
8989
</el-row>
90-
<el-row v-else style="width:400px;height: 596px;margin: 6vh auto 0 auto">
90+
<el-row v-else style="width:400px;margin: 6vh auto 0 auto">
9191
<el-col :span="24">
92-
<el-card style="padding-top: 20px">
92+
<el-card :body-style="{ padding: '0px 0px 20px 0px' }">
93+
<div class="block" style="margin-bottom: 1rem">
94+
<el-carousel height="150px">
95+
<el-carousel-item v-for="item in banners" :key="item">
96+
<a href="" target="_blank">
97+
<img class="image" style="width: 400px" :src="item" alt="1">
98+
</a>
99+
</el-carousel-item>
100+
</el-carousel>
101+
</div>
93102
<el-row>
94103
<el-input style="width: 190px" placeholder="数量" v-model="uploadData.value"
95104
class="input-with-select">
@@ -133,6 +142,7 @@
133142
placeholder="请输入内容,使用按钮存入"
134143
v-model="uploadData.text">
135144
</el-input>
145+
136146
<div class="el-upload__tip">
137147
<el-button round @click="pageNum=0">
138148
<div class="el-icon-back"></div>
@@ -224,6 +234,7 @@ <h1 @click="copyText(file.code,0)" style="margin: 0;display: inline;cursor: poin
224234
inputDisable: false,
225235
fileSizeLimit: '{{fileSizeLimit}}',
226236
pwd: localStorage.getItem('pwd') || '',
237+
banners: [],
227238
uploadData: {
228239
style: '2',
229240
type: '1',
@@ -265,6 +276,10 @@ <h1 @click="copyText(file.code,0)" style="margin: 0;display: inline;cursor: poin
265276
}
266277
}
267278
});
279+
// 获取Banner
280+
axios.get('/banner').then(res => {
281+
this.banners = res.data.data
282+
})
268283
},
269284
watch: {
270285
code: function (code) {

0 commit comments

Comments
 (0)