feat: 开发中...

This commit is contained in:
2023-04-06 09:18:12 +08:00
parent b5eb9b468e
commit f8d2c94586
8 changed files with 81 additions and 37 deletions

View File

@@ -24,8 +24,8 @@ public class AttachEntity {
private Long id; private Long id;
@Setter @Setter
@Column(name = "name", nullable = false) @Column(name = "filename", nullable = false)
private String name; private String filename;
@Setter @Setter
@Column(name = "content_type", nullable = false) @Column(name = "content_type", nullable = false)

View File

@@ -50,7 +50,7 @@ public class AttachService implements IAttachService {
} }
log.info("prepare to save file: {}({} bytes)", file.getOriginalFilename(), file.getSize()); log.info("prepare to save file: {}({} bytes)", file.getOriginalFilename(), file.getSize());
AttachEntity attachEntity = new AttachEntity(); AttachEntity attachEntity = new AttachEntity();
attachEntity.setName(file.getOriginalFilename()); attachEntity.setFilename(file.getOriginalFilename());
attachEntity.setContentType(file.getContentType()); attachEntity.setContentType(file.getContentType());
attachEntity.setData(file.getBytes()); attachEntity.setData(file.getBytes());
attachEntity = attachRepo.save(attachEntity); attachEntity = attachRepo.save(attachEntity);
@@ -91,7 +91,7 @@ public class AttachService implements IAttachService {
return ResponseEntity return ResponseEntity
.ok() .ok()
.header("Cache-Control", "no-cache, no-store, must-revalidate") .header("Cache-Control", "no-cache, no-store, must-revalidate")
.header("Content-Disposition", String.format("attachment; filename=\"%s\"", entity.getName())) .header("Content-Disposition", String.format("attachment; filename=\"%s\"", entity.getFilename()))
.header("Pragma", "no-cache") .header("Pragma", "no-cache")
.header("Expires", "0") .header("Expires", "0")
.contentLength(localCacheFile.length()) .contentLength(localCacheFile.length())

View File

@@ -15,6 +15,10 @@ public class AttachInfoResponseVO {
@NotNull @NotNull
private Long id; private Long id;
@NotNull @NotNull
private String filename;
@NotNull
private String contentType;
@NotNull
private UserInfoResponseVO creator; private UserInfoResponseVO creator;
@NotNull @NotNull
private UserInfoResponseVO updater; private UserInfoResponseVO updater;

View File

@@ -0,0 +1,20 @@
<script setup lang="ts">
</script>
<template>
<div class="attach-contailer">
<div style="display: flex">
<div style="flex-grow: 1"></div>
<el-button type="primary">上传新附件</el-button>
<div style="flex-grow: 1"></div>
</div>
</div>
</template>
<style scoped>
.attach-contailer {
height: 100%;
width: 100%;
}
</style>

View File

@@ -7,13 +7,13 @@ import { api } from "@/api";
import router from "@/router"; import router from "@/router";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
let pageIndex = ref(0); let pageIndex = ref(1);
let pageSize = 2; let pageSize = 2;
let pageCount = 100; let pageCount = 100;
const blogs = ref<Array<BlogInfoResponseVO>>(); const blogs = ref<Array<BlogInfoResponseVO>>();
onMounted(() => { onMounted(() => {
changePage(1); loadPage(1);
}); });
function editBlog(blogID: number) { function editBlog(blogID: number) {
@@ -28,6 +28,7 @@ function deleteBlog(blogID: number) {
type: "success", type: "success",
message: "删除博客成功!", message: "删除博客成功!",
}); });
loadPage(pageIndex.value);
} else { } else {
ElMessage({ ElMessage({
type: "error", type: "error",
@@ -53,7 +54,7 @@ function showUpdater() {
console.log("showUpdater"); console.log("showUpdater");
} }
function changePage(newPage: number) { function loadPage(newPage: number) {
api.BlogController.getBlogInfoList(newPage - 1, pageSize).then((resp) => { api.BlogController.getBlogInfoList(newPage - 1, pageSize).then((resp) => {
const vo = resp.data; const vo = resp.data;
const page = vo.content; const page = vo.content;
@@ -140,7 +141,7 @@ function changePage(newPage: number) {
:hide-on-single-page="false" :hide-on-single-page="false"
:current-page="pageIndex" :current-page="pageIndex"
:page-count="pageCount" :page-count="pageCount"
@update:current-page="changePage" @update:current-page="loadPage"
/> />
<div style="flex-grow: 1"></div> <div style="flex-grow: 1"></div>
</div> </div>

View File

@@ -34,6 +34,7 @@ function changeCustomCSS(cssText: string) {
</script> </script>
<template> <template>
<el-form class="manage-container">
<el-input <el-input
class="imput-line" class="imput-line"
v-model="siteSetting.title" v-model="siteSetting.title"
@@ -47,6 +48,7 @@ function changeCustomCSS(cssText: string) {
type="textarea" type="textarea"
show-word-limit show-word-limit
maxlength="1024" maxlength="1024"
autosize
v-model="siteSetting.footer" v-model="siteSetting.footer"
placeholder="页脚文本支持HTML" placeholder="页脚文本支持HTML"
@change="changeFooterHTML(siteSetting.footer)" @change="changeFooterHTML(siteSetting.footer)"
@@ -59,9 +61,13 @@ function changeCustomCSS(cssText: string) {
placeholder="自定义CSS" placeholder="自定义CSS"
@change="changeCustomCSS(siteSetting.css)" @change="changeCustomCSS(siteSetting.css)"
/> />
</el-form>
</template> </template>
<style scoped> <style scoped>
.manage-container {
margin-right: 32px;
}
.imput-line { .imput-line {
margin-bottom: 5px; margin-bottom: 5px;
} }

View File

@@ -0,0 +1,7 @@
<script setup lang="ts"></script>
<template>
<div></div>
</template>
<style scoped></style>

View File

@@ -2,8 +2,10 @@
import { onMounted, ref } from "vue"; import { onMounted, ref } from "vue";
import { globalStore } from "@/api"; import { globalStore } from "@/api";
import SiteManageComponent from "@/components/manage/SiteManageComponent.vue"; import AttachManageComponent from "@/components/manage/AttachManageComponent.vue";
import BlogManageComponent from "@/components/manage/BlogManageComponent.vue"; import BlogManageComponent from "@/components/manage/BlogManageComponent.vue";
import SiteManageComponent from "@/components/manage/SiteManageComponent.vue";
import UserManageComponent from "@/components/manage/UserManageComponent.vue";
const activeName = ref<string>("site"); const activeName = ref<string>("site");
@@ -25,11 +27,15 @@ onMounted(() => {
<el-tab-pane label="网站设置" name="site"> <el-tab-pane label="网站设置" name="site">
<SiteManageComponent /> <SiteManageComponent />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="博文设置" name="third"> <el-tab-pane label="博文管理" name="third">
<BlogManageComponent /> <BlogManageComponent />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="用户设置" name="user">Config</el-tab-pane> <el-tab-pane label="附件管理" name="user">
<el-tab-pane label="评论设置" name="test">Role</el-tab-pane> <AttachManageComponent />
</el-tab-pane>
<el-tab-pane label="用户管理" name="test">
<UserManageComponent />
</el-tab-pane>
</el-tabs> </el-tabs>
</template> </template>