添加历史流程数据状态
All checks were successful
git提交控制 AiDA WEB-Node.js main 分支构建部署 / build (20.19.0) (push) Has been skipped
All checks were successful
git提交控制 AiDA WEB-Node.js main 分支构建部署 / build (20.19.0) (push) Has been skipped
This commit is contained in:
@@ -5,6 +5,7 @@ const store = createPinia()
|
||||
// 使用持久化插件(全局持久化)
|
||||
store.use(createPersistedState())
|
||||
export default store
|
||||
export * from './modules/h_generate'
|
||||
export * from './modules/generate'
|
||||
export * from './modules/overall'
|
||||
export * from './modules/userInfo'
|
||||
|
||||
67
src/stores/modules/h_generate.ts
Normal file
67
src/stores/modules/h_generate.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
// 每一个存储的模块,命名规则use开头,store结尾
|
||||
import { defineStore } from 'pinia'
|
||||
import MyEvent from '@/utils/myEvent'
|
||||
MyEvent.add('clear-generate-state', () => useHGenerateStore().clearGenerateData())
|
||||
|
||||
export const useHGenerateStore = defineStore({
|
||||
id: 'h_generate', // 必须指明唯一的pinia仓库的id
|
||||
state: () => {
|
||||
return {
|
||||
style: {
|
||||
id: '',
|
||||
url: ''
|
||||
},
|
||||
originalTryOn: {
|
||||
//生成穿好衣服的回参
|
||||
id: '',
|
||||
isLike: false, //是否喜欢
|
||||
tryOnUrl: ''
|
||||
},
|
||||
/** AI魔改信息 */
|
||||
customizeInfo: {
|
||||
inputText: '',
|
||||
count: 0,
|
||||
oldInputText: '',
|
||||
oldTryOnId: '',
|
||||
|
||||
tryOnId: '',
|
||||
tryOnUrl: '',
|
||||
styleUrl: '',
|
||||
isRegenerated: '',
|
||||
isFavorite: false
|
||||
},
|
||||
}
|
||||
},
|
||||
getters: {
|
||||
/** 服装id */
|
||||
styleId: (state) => state.style.id,
|
||||
/** 原始试穿id不包含魔改id */
|
||||
originalTryOnIdNoRein: (state) => state.originalTryOn.id,
|
||||
/** 原始试穿id-优先AI魔改 */
|
||||
originalTryOnId: (state) => state.customizeInfo.tryOnId || state.originalTryOn.id,
|
||||
},
|
||||
actions: {
|
||||
/** 清空 AI魔改信息 */
|
||||
clearCustomizeInfo() {
|
||||
this.customizeInfo.inputText = ''
|
||||
this.customizeInfo.count = 0
|
||||
this.customizeInfo.oldInputText = ''
|
||||
this.customizeInfo.oldTryOnId = ''
|
||||
this.customizeInfo.tryOnId = ''
|
||||
this.customizeInfo.tryOnUrl = ''
|
||||
this.customizeInfo.styleUrl = ''
|
||||
this.customizeInfo.isRegenerated = ''
|
||||
this.customizeInfo.isFavorite = false
|
||||
},
|
||||
uploadCustomizeInfo(data: object) {
|
||||
for (const key in data) {
|
||||
this.customizeInfo[key] = data[key]
|
||||
}
|
||||
},
|
||||
//设置默认数据
|
||||
clearGenerateData() {
|
||||
this.clearProductData()
|
||||
this.clearCustomizeInfo()
|
||||
},
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user