2026-02-24 13:53:01 +08:00
|
|
|
|
// 每一个存储的模块,命名规则use开头,store结尾
|
|
|
|
|
|
import router from '@/router'
|
|
|
|
|
|
import { defineStore } from 'pinia'
|
|
|
|
|
|
import { ref, computed } from 'vue'
|
|
|
|
|
|
import { removeLocal, setLocal } from '@/utils/local'
|
|
|
|
|
|
import MyEvent from '@/utils/myEvent'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Agent 项目初始数据 store
|
|
|
|
|
|
export const useAgentStore = defineStore('agent', () => {
|
|
|
|
|
|
const initialProjectData = ref<{
|
|
|
|
|
|
text: string
|
|
|
|
|
|
images: Array<{ url: string; name: string }>
|
|
|
|
|
|
type: string
|
|
|
|
|
|
area: string
|
|
|
|
|
|
style: string
|
2026-03-02 11:29:07 +08:00
|
|
|
|
} | null>(null)
|
2026-02-24 13:53:01 +08:00
|
|
|
|
|
|
|
|
|
|
// 保存项目初始数据
|
|
|
|
|
|
const setInitialProjectData = (data: {
|
|
|
|
|
|
text: string
|
|
|
|
|
|
images: Array<{ url: string; name: string }>
|
|
|
|
|
|
type: string
|
|
|
|
|
|
area: string
|
|
|
|
|
|
style: string
|
|
|
|
|
|
}) => {
|
|
|
|
|
|
initialProjectData.value = data
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取项目初始数据
|
|
|
|
|
|
const getInitialProjectData = computed(() => initialProjectData.value)
|
|
|
|
|
|
|
|
|
|
|
|
// 清空项目初始数据
|
|
|
|
|
|
const clearInitialProjectData = () => {
|
|
|
|
|
|
initialProjectData.value = null
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
initialProjectData,
|
|
|
|
|
|
setInitialProjectData,
|
|
|
|
|
|
getInitialProjectData,
|
|
|
|
|
|
clearInitialProjectData
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|