|
|
@ -1,15 +1,20 @@ |
|
|
|
import { reactive, ref } from 'vue' |
|
|
|
import { defineStore } from 'pinia' |
|
|
|
import { get } from "@/tools/request" |
|
|
|
import { get, post, put } from "@/tools/request" |
|
|
|
import dayjs from 'dayjs'; |
|
|
|
import { useRouter } from "vue-router" |
|
|
|
import type { blogInterface,classticInterface } from '@/api/blog'; |
|
|
|
import type { blogInterface, classticInterface } from '@/api/admin'; |
|
|
|
const router = useRouter() |
|
|
|
// 博客列表
|
|
|
|
const bloglist = ref<blogInterface[]>([]) |
|
|
|
// 语录列表
|
|
|
|
const classticlist = ref<classticInterface[]>([]) |
|
|
|
|
|
|
|
// 语录新增
|
|
|
|
const classticadd=reactive({ |
|
|
|
header:"", |
|
|
|
text:"", |
|
|
|
descr:"" |
|
|
|
}) |
|
|
|
|
|
|
|
export const useAuthStore = defineStore("auth", () => { |
|
|
|
const tokenValue = ref("") |
|
|
@ -30,9 +35,9 @@ export const classticContentStore = defineStore("classtic", () => { |
|
|
|
try { |
|
|
|
const response = await get("/classtics/list"); |
|
|
|
if (response) { |
|
|
|
classticlist.value = response.data.data.map((item: any,index:any) => ({ |
|
|
|
key:(index+1).toString(), |
|
|
|
id:item.id, |
|
|
|
classticlist.value = response.data.data.map((item: any, index: any) => ({ |
|
|
|
key: (index + 1).toString(), |
|
|
|
id: item.id, |
|
|
|
header: item.header, |
|
|
|
text: item.text, |
|
|
|
descr: item.descr |
|
|
@ -46,35 +51,49 @@ export const classticContentStore = defineStore("classtic", () => { |
|
|
|
} |
|
|
|
return { classticlist, classticList } |
|
|
|
}) |
|
|
|
|
|
|
|
export const classticSearchStore=defineStore("chassticsearch",()=>{ |
|
|
|
const searchValue=reactive({ |
|
|
|
title:"" |
|
|
|
// 语录查询接口
|
|
|
|
export const classticSearchStore = defineStore("chassticsearch", () => { |
|
|
|
const searchValue = reactive({ |
|
|
|
title: "" |
|
|
|
}) |
|
|
|
const classticSearch=async ()=>{ |
|
|
|
const classticSearch = async () => { |
|
|
|
try { |
|
|
|
const response=await get( |
|
|
|
const response = await get( |
|
|
|
"/classtics/list/search", |
|
|
|
{header:searchValue.title} |
|
|
|
{ header: searchValue.title } |
|
|
|
) |
|
|
|
if (response) { |
|
|
|
classticlist.value=response.data.data.map((items:any,index:any)=>({ |
|
|
|
key:(index+1).toString(), |
|
|
|
id:items.id, |
|
|
|
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{ |
|
|
|
} else { |
|
|
|
console.log("classtic request is nulll") |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
console.log("classtic request is error") |
|
|
|
} |
|
|
|
} |
|
|
|
return {classticSearch,searchValue} |
|
|
|
return { classticSearch, searchValue } |
|
|
|
}) |
|
|
|
// 语录新增/编辑接口
|
|
|
|
export const classticAddStore=defineStore("classticadd",()=>{ |
|
|
|
const onSubmit=async ()=>{ |
|
|
|
await post("/classtics/add", |
|
|
|
{ |
|
|
|
header:classticadd.header, |
|
|
|
text:classticadd.text, |
|
|
|
descr:classticadd.descr |
|
|
|
} |
|
|
|
) |
|
|
|
} |
|
|
|
return {onSubmit,classticadd} |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
// 链接接口
|
|
|
|
export const comLinkContentStore = defineStore("comlink", () => { |
|
|
|
interface comlinkInterface { |
|
|
|
xxxxxxxxxx