2025-10-09 09:29:36 +08:00
|
|
|
|
// 每一个存储的模块,命名规则use开头,store结尾
|
|
|
|
|
|
import { defineStore } from 'pinia'
|
2025-10-21 10:20:57 +08:00
|
|
|
|
export const useGenerateStore = defineStore({
|
|
|
|
|
|
id: 'generate', // 必须指明唯一的pinia仓库的id
|
2025-10-09 09:29:36 +08:00
|
|
|
|
state: () => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
userData:{
|
|
|
|
|
|
title: '123123',
|
|
|
|
|
|
name: '123123',
|
|
|
|
|
|
describe: '',
|
|
|
|
|
|
id:'',
|
2025-10-21 13:46:27 +08:00
|
|
|
|
style:{
|
|
|
|
|
|
id:-1,
|
|
|
|
|
|
oldId:-1,//表示从生成页面返回回来,需要调整的样式id
|
|
|
|
|
|
},
|
2025-10-23 13:43:42 +08:00
|
|
|
|
model:{
|
|
|
|
|
|
id:-1,
|
|
|
|
|
|
}
|
2025-10-09 09:29:36 +08:00
|
|
|
|
},
|
|
|
|
|
|
queryList:[]
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
getters: {
|
|
|
|
|
|
// doubleCount: (state) => state.num * 2
|
|
|
|
|
|
},
|
|
|
|
|
|
actions: {
|
2025-10-21 13:46:27 +08:00
|
|
|
|
selectStyle(data:any) {
|
|
|
|
|
|
this.userData.style.id = data.id
|
2025-10-09 09:29:36 +08:00
|
|
|
|
console.log(this.userData)
|
|
|
|
|
|
},
|
2025-10-21 13:46:27 +08:00
|
|
|
|
//生成后去掉id 设置oldId来修改样式
|
|
|
|
|
|
useStyleGenerate(){
|
|
|
|
|
|
this.userData.style.oldId = this.userData.style.id
|
|
|
|
|
|
this.userData.style.id = -1
|
|
|
|
|
|
},
|
|
|
|
|
|
updateStyle(data){
|
|
|
|
|
|
console.log(data)
|
|
|
|
|
|
if(data.id == this.userData.style.oldId){
|
|
|
|
|
|
this.userData.style.oldId = -1
|
|
|
|
|
|
}
|
2025-10-23 13:43:42 +08:00
|
|
|
|
},
|
|
|
|
|
|
//模特相关
|
|
|
|
|
|
selectModel(data:any){
|
|
|
|
|
|
this.userData.model.id = data.id
|
|
|
|
|
|
console.log(this.userData)
|
2025-10-21 13:46:27 +08:00
|
|
|
|
}
|
2025-10-09 09:29:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|