diff --git a/src/components/Blog_box.vue b/src/components/Blog_box.vue index 97bdd80..d110db7 100644 --- a/src/components/Blog_box.vue +++ b/src/components/Blog_box.vue @@ -1,4 +1,6 @@ @@ -73,7 +104,7 @@ const filterBlogs = () => { .tags { display: flex; - flex-wrap: wrap; /* 允许标签换行 */ + flex-wrap: wrap; /* 允许标签换行 */ gap: 10px; justify-content: center; /* 使标签居中 */ max-width: 1200px; @@ -119,4 +150,21 @@ const filterBlogs = () => { ::-webkit-scrollbar { display: none; } + +.fade-enter-active, +.fade-leave-active { + transition: opacity 0.5s ease, transform 0.5s ease; +} + +.fade-enter-from, +.fade-leave-to { + opacity: 0; + transform: translateY(20px); /* 从下方 20px 进入 */ +} + +.fade-enter-to, +.fade-leave-from { + opacity: 1; + transform: translateY(0); +} diff --git a/src/pages/Editor.vue b/src/pages/Editor.vue index 10605f4..dd4057e 100644 --- a/src/pages/Editor.vue +++ b/src/pages/Editor.vue @@ -236,7 +236,7 @@ const submitBlog = async () => { formData.append("title", title); formData.append("content", content); formData.append("allow_comments", allowComments); - formData.append("draft", true); + formData.append("draft", false); console.log(images); images.forEach((imgData) => { @@ -252,7 +252,7 @@ const submitBlog = async () => { }, }).then(response => { if (response.code === 0) { - swal.window('success', `提交成功, 博客id${response.blogId || '未找到blogId字段'}`, 'ok', '好的'); + swal.window('success', `提交成功, 博客id${response.blogId || '未找到blogId字段'}`,'', 'ok', '好的'); return; } swal.window('error', '提交失败', `code字段为${response.code}; 错误信息: ${response.message}`, 'ok', '好的'); diff --git a/src/pages/blogPages/SingleBlog_page.vue b/src/pages/blogPages/SingleBlog_page.vue index 6830045..6c79027 100644 --- a/src/pages/blogPages/SingleBlog_page.vue +++ b/src/pages/blogPages/SingleBlog_page.vue @@ -1,24 +1,157 @@ \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js index cc26c64..f4b8dea 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -31,6 +31,7 @@ import Editor from "../pages/Editor.vue"; import NotFound from "../pages/errorPages/notFound.vue"; import Test_page from "../pages/Test_page.vue"; +import SingleBlog_page from "../pages/blogPages/SingleBlog_page.vue"; const routes = [ {path: '/404', @@ -52,6 +53,11 @@ const routes = [ name: 'Blog', component: Blog_home, meta: {title: '博客'} + }, { + path: '/blog/:id', + name: 'Blogs', + component: SingleBlog_page, + meta: {title: '博客'} }, { path: '/projects', name: 'Projects', diff --git a/src/store/index.js b/src/store/index.js index 862e090..10c4fb4 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -12,6 +12,7 @@ const store = createStore({ editStore: {}, editAutoSave: {on: true, interval: 30000}, demosLocal: {}, + sessionStore: {}, }, mutations: { toggleTheme(state) { @@ -41,6 +42,12 @@ const store = createStore({ deleteLocalDemoValue(state, obj) { delete state.demosLocal[obj.demo][obj.value]; }, + setSessionValue(state, obj) { + state.sessionStore[obj.key] = {...state.sessionStore[obj.key], ...obj.value} + }, + deleteSessionValue(state, obj) { + delete state.sessionStore[obj.key][obj.value]; + }, saveEdit(state, obj) { state.editStore = {...state.editStore, ...obj}; }, diff --git a/src/utils/imageResource.js b/src/utils/imageResource.js index 36f8184..3ce3f6f 100644 --- a/src/utils/imageResource.js +++ b/src/utils/imageResource.js @@ -2,4 +2,8 @@ import {getDomain} from "./getDomain.js"; export function blogImage(id) { return `https://${getDomain()}/data/blog/images/${id}`; +} + +export function userProfile(id) { + return `https://${getDomain()}/data/user/profile/${id}` } \ No newline at end of file