diff --git a/src/components/blogs/HomePage.vue b/src/components/blogs/HomePage.vue index 86c4956..14f757a 100644 --- a/src/components/blogs/HomePage.vue +++ b/src/components/blogs/HomePage.vue @@ -44,18 +44,18 @@ - -

{{ panel.text }}

+

{{ classtic.text }}

- {{ - linkbutton.linktext + {{ + comlink.linktext }}
@@ -117,12 +117,12 @@ import APlayer from 'APlayer'; import { createEcharts } from "@/hooks/intex" import { useRouter, useRoute } from 'vue-router'; import iconComponents from "@/assets/index"; -import { panelContentStore,comLinkContentStore } from '@/stores'; +import { classticContentStore,comLinkContentStore } from '@/stores'; const router = useRouter() const route = useRoute() -const panelList=panelContentStore() -const comLinkList=comLinkContentStore() +const classticContent=classticContentStore() +const comLinkContent=comLinkContentStore() /** * 导航菜单 @@ -400,8 +400,8 @@ const random = ref(); onMounted(() => { scrollbar.value = document.querySelector('.simplebar-content-wrapper'); - panelList.panelData() - comLinkList.comLinkData() + classticContent.classticList() + comLinkContent.comLinkList() nextTick(() => { const authorElement = document.querySelector('.author'); if (authorElement) { diff --git a/src/stores/index.ts b/src/stores/index.ts index acef96f..3b0983f 100644 --- a/src/stores/index.ts +++ b/src/stores/index.ts @@ -20,21 +20,23 @@ export const useAuthStore = defineStore("auth", () => { }) // 语录列表接口 -export const panelContentStore = defineStore("panel", () => { - interface panelList { +export const classticContentStore = defineStore("classtic", () => { + interface classticInterface { id: number, header: string, - text: string + text: string, + descr: string } - const panels = ref([]) - const panelData = async () => { + const classticlist = ref([]) + const classticList = async () => { try { const response = await get("/classtics/list"); if (response) { - panels.value = response.data.data.map((item: any) => ({ + classticlist.value = response.data.data.map((item: any) => ({ id: item.id, header: item.header, text: item.text, + descr: item.descr })); } else { console.error("Response data structure is not as expected:"); @@ -43,22 +45,22 @@ export const panelContentStore = defineStore("panel", () => { console.error("Failed to fetch data", error); } } - return { panels, panelData } + return { classticlist, classticList } }) // 链接接口 export const comLinkContentStore = defineStore("comlink", () => { - interface comlinkList { + interface comlinkInterface { id: number, linktext: string, linkurl: string } - const linkbuttons = ref([]) - const comLinkData = async () => { + const comlinklist = ref([]) + const comLinkList = async () => { try { const response = await get("/comlink/list"); if (response) { - linkbuttons.value = response.data.data.map((items: any) => ({ + comlinklist.value = response.data.data.map((items: any) => ({ id: items.id, linktext: items.linktext, linkurl: items.linkurl @@ -78,13 +80,12 @@ export const comLinkContentStore = defineStore("comlink", () => { router.push(url); // 否则使用 Vue Router 的 push 方法导航 } } - return {linkbuttons,comLinkData,comLinkClick} + return { comlinklist, comLinkList, comLinkClick } }) // 博客列表接口 export const blogContentStore = defineStore("blog", () => { - - async function blogList() { + const blogList = async () => { try { const response = await get("/blogs/list"); if (response) { @@ -121,8 +122,6 @@ export const blogSearchStore = defineStore('blogsearch', () => { end_date: '' }); - - const onChange = (date: string, dateString: string[]) => { if (date && dateString.length === 2) { searchValue.start_date = dateString[0]; diff --git a/src/views/admin/classticmanage/ClassticManageView.vue b/src/views/admin/classticmanage/ClassticManageView.vue index fc685dc..adef83b 100644 --- a/src/views/admin/classticmanage/ClassticManageView.vue +++ b/src/views/admin/classticmanage/ClassticManageView.vue @@ -5,8 +5,13 @@ - 查询 - 新增 + 查询 + 新增 + +

Some contents...

+

Some contents...

+

Some contents...

+
@@ -16,11 +21,12 @@
删除 - +

确认删除吗?

- 编辑 + 编辑 预览
@@ -35,23 +41,62 @@ import { ref, reactive, onMounted } from 'vue'; import type { searchValue } from "@/api/admin" import { useRouter } from "vue-router" const router = useRouter() -import {classticContentStore} from "@/stores" +import { classticContentStore } from "@/stores" + +const addModal=reactive({ + addOpen:false, + addTitle:"", + modalMode:"" +}) +const modal=(mode:string)=>{ + addModal.modalMode=mode + if (mode === 'add') { + addModal.addTitle = '新增'; + } else if (mode === 'edit') { + addModal.addTitle = '编辑'; + } + addModal.addOpen = true; +} +const addhandleOk = () => { + addOpen.value = true; + addOpen.value = false; +}; +const edithandleOk=()=> { + // Logic for editing + console.log('Edit logic here'); + } + +const handleOk=()=> { + if (addModal.modalMode === 'add') { + // Handle add action + addhandleOk(); + } else if (addModal.modalMode === 'edit') { + // Handle edit action + edithandleOk(); + } + addModal.addOpen = false; + } + const searchList = reactive({ - classtictitle:"" + classtictitle: "" }) -const classticContent=classticContentStore() -const open = ref(false); +const classticContent = classticContentStore() +const deleteOpen = ref(false); const toDelete = reactive<{ key: string, id: number }>({ key: '', id: 0 }); const showModal = (key: string, id: number) => { - open.value = true; + deleteOpen.value = true; // 将需要删除的数据项的 key 和 id 存储到 ref 中,以便确认后使用 toDelete.key = key; toDelete.id = id; }; +const addOpen = ref(false); + + + // 新增单独跳转到一个页面 const blogAdd = function () { router.push('/admin/blogmanage/add')