feat: 开发中...

This commit is contained in:
2023-04-09 22:45:00 +08:00
parent ae3a2f9c5d
commit 92f9601a9c
4 changed files with 32 additions and 17 deletions

View File

@@ -1,7 +1,7 @@
<script setup lang="ts">
import { onMounted, ref } from "vue";
import { ElMessage } from "element-plus";
import type { UploadRawFile, UploadRequestOptions } from "element-plus";
import type { UploadRequestOptions } from "element-plus";
import { api } from "@/api";
import type { AttachInfoResponseVO } from "@/swagger";
@@ -32,7 +32,7 @@ function loadPage(newPage: number) {
}
function uploadAttach(options: UploadRequestOptions) {
api.AttachController.createAttachForm(options.file).then((resp) => {
return api.AttachController.createAttachForm(options.file).then((resp) => {
const vo = resp.data;
if (vo.code === 200) {
ElMessage({
@@ -48,7 +48,6 @@ function uploadAttach(options: UploadRequestOptions) {
});
}
});
return false;
}
async function updateAttach(options: UploadRequestOptions) {
@@ -111,13 +110,13 @@ function deleteAttach(id: number) {
</template>
<p>
{{ attach.creator.nickname }} 首次创建于
{{ attach.createTime.toTimeString() }}
{{ attach.createTime.toLocaleString() }}
</p>
<p>
{{ attach.creator.nickname }} 最后修改于
{{ attach.updateTime.toTimeString() }}
{{ attach.updateTime.toLocaleString() }}
</p>
<div style="display: flex" class="attach-card-buttons">
<div class="attach-card-buttons">
<div style="flex-grow: 1"></div>
<el-upload
:http-request="updateAttach"
@@ -131,7 +130,11 @@ function deleteAttach(id: number) {
>
<el-button type="success">编辑</el-button>
</el-upload>
<el-button type="danger" @click="deleteAttach(attach.id)">
<el-button
type="danger"
@click="deleteAttach(attach.id)"
style="margin-left: 15px"
>
删除
</el-button>
<div style="flex-grow: 1"></div>
@@ -167,19 +170,19 @@ function deleteAttach(id: number) {
.attach-list {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
margin-left: 5px;
margin-right: 5px;
}
.attach-card {
margin-left: 12px;
margin-bottom: 15px;
max-width: 400px;
}
attach-card-buttons {
.attach-card-buttons {
display: flex;
}
.attach-card-buttons > * {
margin-left: 15px;
margin-top: 15px;
}
</style>

View File

@@ -52,5 +52,5 @@ export interface BlogUpdateRequireVO {
* @type {Array<string>}
* @memberof BlogUpdateRequireVO
*/
tags?: Array<string>;
tags: Array<string>;
}

View File

@@ -40,7 +40,6 @@ onMounted(() => {
editBlog.top = blog?.top;
editBlog.publish = blog?.publish;
editBlog.content = blog?.content ?? "";
tags.value = blog?.tags.toString();
} else {
ElMessage({
type: "error",