Merge branch 'master' of https://gitee.com/lvYeJu/lane-crawford-3
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
// 每一个存储的模块,命名规则use开头,store结尾
|
||||
import { defineStore } from 'pinia'
|
||||
import { useUserInfoStore } from './userInfo'
|
||||
export const useGenerateStore = defineStore({
|
||||
id: 'generate', // 必须指明唯一的pinia仓库的id
|
||||
state: () => {
|
||||
return {
|
||||
id: 'generate', // 必须指明唯一的pinia仓库的id
|
||||
state: () => {
|
||||
return {
|
||||
style: {
|
||||
id: '',
|
||||
oldId: '' //表示从生成页面返回回来,需要调整的样式id
|
||||
@@ -37,65 +38,86 @@ export const useGenerateStore = defineStore({
|
||||
},
|
||||
customerInfo: {
|
||||
customerId: '',
|
||||
visitRecordId:''
|
||||
visitRecordId: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
getters: {
|
||||
/** 顾客id */
|
||||
customerId: (state) => state.customerInfo.customerId,
|
||||
/** 进店记录id */
|
||||
visitRecordId: (state) => state.customerInfo.visitRecordId,
|
||||
/** 服装id */
|
||||
styleId: (state) => state.style.id || state.style.oldId,
|
||||
/** 模特照片id */
|
||||
modelPhotoId: (state) => state.model.id,
|
||||
/** 原始试穿id-优先AI魔改 */
|
||||
originalTryOnId: (state) => state.customizeInfo.tryOnId || state.originalTryOn.id,
|
||||
/** 顾客照片id */
|
||||
customerPhotoId: (state) => state.photoInfo.id,
|
||||
},
|
||||
actions: {
|
||||
selectStyle(data: any) {
|
||||
this.style.id = data.id
|
||||
console.log(this)
|
||||
},
|
||||
//生成后去掉id 设置oldId来修改样式
|
||||
useStyleGenerate() {
|
||||
if(!this.style.id)return
|
||||
this.style.oldId = this.style.id
|
||||
this.style.id = ''
|
||||
},
|
||||
updateStyle(data) {
|
||||
console.log(data)
|
||||
if (data.id == this.style.oldId) {
|
||||
this.style.oldId = ''
|
||||
}
|
||||
},
|
||||
//模特相关
|
||||
selectModel(data: any) {
|
||||
this.model.id = data.id
|
||||
},
|
||||
setIsGenerate(isGenerate: boolean) {
|
||||
this.isGenerate = isGenerate
|
||||
},
|
||||
/** 更新顾客照片信息 */
|
||||
updatePhotoInfo(data: any) {
|
||||
this.photoInfo.id = data.id || ""
|
||||
if (!data.photoUrl) this.photoInfo.url = ""
|
||||
this.photoInfo.file = null
|
||||
},
|
||||
/** 清空 AI魔改信息 */
|
||||
clearCustomizeInfo() {
|
||||
this.customizeInfo.inputText = ""
|
||||
this.customizeInfo.tryOnId = ""
|
||||
this.customizeInfo.tryOnUrl = ""
|
||||
this.customizeInfo.styleUrl = ""
|
||||
this.customizeInfo.isRegenerated = ""
|
||||
this.customizeInfo.isFavorite = false
|
||||
},
|
||||
setCustomerInfo(data: any) {
|
||||
this.customerInfo = data
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
getters: {
|
||||
/** 顾客id */
|
||||
customerId: (state) => state.customerInfo.customerId,
|
||||
/** 进店记录id */
|
||||
visitRecordId: (state) => state.customerInfo.visitRecordId,
|
||||
/** 服装id */
|
||||
styleId: (state) => state.style.id || state.style.oldId,
|
||||
/** 模特照片id */
|
||||
modelPhotoId: (state) => state.model.id,
|
||||
/** 原始试穿id-优先AI魔改 */
|
||||
originalTryOnId: (state) => state.customizeInfo.tryOnId || state.originalTryOn.id,
|
||||
/** 顾客照片id */
|
||||
customerPhotoId: (state) => state.photoInfo.id
|
||||
},
|
||||
actions: {
|
||||
selectStyle(data: any) {
|
||||
this.style.id = data.id
|
||||
console.log(this)
|
||||
},
|
||||
//生成后去掉id 设置oldId来修改样式
|
||||
useStyleGenerate() {
|
||||
if (!this.style.id) return
|
||||
this.style.oldId = this.style.id
|
||||
this.style.id = ''
|
||||
},
|
||||
updateStyle(data) {
|
||||
console.log(data)
|
||||
if (data.id == this.style.oldId) {
|
||||
this.style.oldId = ''
|
||||
}
|
||||
},
|
||||
//模特相关
|
||||
selectModel(data: any) {
|
||||
this.model.id = data.id
|
||||
},
|
||||
setIsGenerate(isGenerate: boolean) {
|
||||
this.isGenerate = isGenerate
|
||||
},
|
||||
clearProductData() {
|
||||
this.style = {
|
||||
id: '',
|
||||
oldId: ''
|
||||
}
|
||||
this.model = {
|
||||
id: ''
|
||||
}
|
||||
this.originalTryOn = {
|
||||
id: '',
|
||||
isLike: false,
|
||||
tryOnUrl: ''
|
||||
}
|
||||
this.isGenerate = false
|
||||
},
|
||||
/** 更新顾客照片信息 */
|
||||
updatePhotoInfo(data: any) {
|
||||
this.photoInfo.id = data.id || ''
|
||||
if (!data.photoUrl) this.photoInfo.url = ''
|
||||
this.photoInfo.file = null
|
||||
},
|
||||
/** 清空 AI魔改信息 */
|
||||
clearCustomizeInfo() {
|
||||
this.customizeInfo.inputText = ''
|
||||
this.customizeInfo.tryOnId = ''
|
||||
this.customizeInfo.tryOnUrl = ''
|
||||
this.customizeInfo.styleUrl = ''
|
||||
this.customizeInfo.isRegenerated = ''
|
||||
this.customizeInfo.isFavorite = false
|
||||
},
|
||||
//设置默认数据
|
||||
clearGenerateData() {
|
||||
this.clearProductData()
|
||||
this.updatePhotoInfo({})
|
||||
this.clearCustomizeInfo()
|
||||
},
|
||||
setCustomerInfo(data: any) {
|
||||
this.customerInfo = data
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user