|
@ -3,10 +3,13 @@ import { defineStore } from 'pinia' |
|
|
import { get } from "@/tools/request" |
|
|
import { get } from "@/tools/request" |
|
|
import dayjs from 'dayjs'; |
|
|
import dayjs from 'dayjs'; |
|
|
import { useRouter } from "vue-router" |
|
|
import { useRouter } from "vue-router" |
|
|
import type { blogInterface } from '@/api/blog'; |
|
|
|
|
|
|
|
|
import type { blogInterface,classticInterface } from '@/api/blog'; |
|
|
const router = useRouter() |
|
|
const router = useRouter() |
|
|
// 博客列表
|
|
|
// 博客列表
|
|
|
const bloglist = ref<blogInterface[]>([]) |
|
|
const bloglist = ref<blogInterface[]>([]) |
|
|
|
|
|
// 语录列表
|
|
|
|
|
|
const classticlist = ref<classticInterface[]>([]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const useAuthStore = defineStore("auth", () => { |
|
|
export const useAuthStore = defineStore("auth", () => { |
|
|
const tokenValue = ref("") |
|
|
const tokenValue = ref("") |
|
@ -21,18 +24,14 @@ export const useAuthStore = defineStore("auth", () => { |
|
|
|
|
|
|
|
|
// 语录列表接口
|
|
|
// 语录列表接口
|
|
|
export const classticContentStore = defineStore("classtic", () => { |
|
|
export const classticContentStore = defineStore("classtic", () => { |
|
|
interface classticInterface { |
|
|
|
|
|
id: number, |
|
|
|
|
|
header: string, |
|
|
|
|
|
text: string, |
|
|
|
|
|
descr: string |
|
|
|
|
|
} |
|
|
|
|
|
const classticlist = ref<classticInterface[]>([]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const classticList = async () => { |
|
|
const classticList = async () => { |
|
|
try { |
|
|
try { |
|
|
const response = await get("/classtics/list"); |
|
|
const response = await get("/classtics/list"); |
|
|
if (response) { |
|
|
if (response) { |
|
|
classticlist.value = response.data.data.map((item: any) => ({ |
|
|
|
|
|
|
|
|
classticlist.value = response.data.data.map((item: any,index:any) => ({ |
|
|
|
|
|
key:(index+1).toString(), |
|
|
id:item.id, |
|
|
id:item.id, |
|
|
header: item.header, |
|
|
header: item.header, |
|
|
text: item.text, |
|
|
text: item.text, |
|
@ -48,6 +47,34 @@ export const classticContentStore = defineStore("classtic", () => { |
|
|
return { classticlist, classticList } |
|
|
return { classticlist, classticList } |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
export const classticSearchStore=defineStore("chassticsearch",()=>{ |
|
|
|
|
|
const searchValue=reactive({ |
|
|
|
|
|
title:"" |
|
|
|
|
|
}) |
|
|
|
|
|
const classticSearch=async ()=>{ |
|
|
|
|
|
try { |
|
|
|
|
|
const response=await get( |
|
|
|
|
|
"/classtics/list/search", |
|
|
|
|
|
{header:searchValue.title} |
|
|
|
|
|
) |
|
|
|
|
|
if (response) { |
|
|
|
|
|
classticlist.value=response.data.data.map((items:any,index:any)=>({ |
|
|
|
|
|
key:(index+1).toString(), |
|
|
|
|
|
id:items.id, |
|
|
|
|
|
header: items.header, |
|
|
|
|
|
text: items.text, |
|
|
|
|
|
descr: items.descr |
|
|
|
|
|
})) |
|
|
|
|
|
}else{ |
|
|
|
|
|
console.log("classtic request is nulll") |
|
|
|
|
|
} |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
console.log("classtic request is error") |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return {classticSearch,searchValue} |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
// 链接接口
|
|
|
// 链接接口
|
|
|
export const comLinkContentStore = defineStore("comlink", () => { |
|
|
export const comLinkContentStore = defineStore("comlink", () => { |
|
|
interface comlinkInterface { |
|
|
interface comlinkInterface { |
|
|