123
This commit is contained in:
@@ -1,15 +1,4 @@
|
|||||||
// import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
// 测试 模拟请求
|
|
||||||
import { useOverallStore } from '@/stores'
|
|
||||||
const request = (config: any) => {
|
|
||||||
return new Promise(res => {
|
|
||||||
if (config.loading) useOverallStore().setLoading(true)
|
|
||||||
setTimeout(() => {
|
|
||||||
res({})
|
|
||||||
if (config.loading) useOverallStore().setLoading(false)
|
|
||||||
}, 1000)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成试穿效果
|
* 生成试穿效果
|
||||||
@@ -24,17 +13,6 @@ const request = (config: any) => {
|
|||||||
* @param data.isRegenerated 是否重新生成 0-否,1-是
|
* @param data.isRegenerated 是否重新生成 0-否,1-是
|
||||||
*/
|
*/
|
||||||
export function generateTryOnEffect(data: Object) {
|
export function generateTryOnEffect(data: Object) {
|
||||||
return new Promise(resolve => {
|
|
||||||
setTimeout(() => {
|
|
||||||
resolve({
|
|
||||||
tryOnId: 1,
|
|
||||||
tryOnUrl: "http://118.31.39.42:3000/falls/1.png",
|
|
||||||
styleUrl: "http://118.31.39.42:3000/falls/1.png",
|
|
||||||
isRegenerated: 0,
|
|
||||||
isFavorite: 0,
|
|
||||||
})
|
|
||||||
}, 1000)
|
|
||||||
})
|
|
||||||
return request({
|
return request({
|
||||||
url: '/api/try-on-effects/generate',
|
url: '/api/try-on-effects/generate',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
@@ -49,16 +27,6 @@ export function generateTryOnEffect(data: Object) {
|
|||||||
* @param data.file 顾客照片文件
|
* @param data.file 顾客照片文件
|
||||||
*/
|
*/
|
||||||
export function uploadCustomerPhoto(data: FormData) {
|
export function uploadCustomerPhoto(data: FormData) {
|
||||||
return new Promise(resolve => {
|
|
||||||
useOverallStore().setLoading(true)
|
|
||||||
setTimeout(() => {
|
|
||||||
resolve({
|
|
||||||
visitRecordId: "2",
|
|
||||||
defaultImageUrl: URL.createObjectURL(data.get('file')),
|
|
||||||
})
|
|
||||||
useOverallStore().setLoading(false)
|
|
||||||
}, 1000)
|
|
||||||
})
|
|
||||||
return request({
|
return request({
|
||||||
url: '/api/customer-photos/upload',
|
url: '/api/customer-photos/upload',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
@@ -93,11 +61,6 @@ export function cancelTryOnEffectFavorite(tryOnId: string | number) {
|
|||||||
* @param customerId 客户id
|
* @param customerId 客户id
|
||||||
*/
|
*/
|
||||||
export function getCustomerPhotos(customerId: string | number) {
|
export function getCustomerPhotos(customerId: string | number) {
|
||||||
return new Promise(resolve => {
|
|
||||||
setTimeout(() => {
|
|
||||||
resolve([{ visitRecordId: 1 }, { visitRecordId: 2 }, { visitRecordId: 3 }])
|
|
||||||
}, 1000)
|
|
||||||
})
|
|
||||||
if (!customerId) return Promise.reject('客户id不能为空');
|
if (!customerId) return Promise.reject('客户id不能为空');
|
||||||
return request({
|
return request({
|
||||||
url: `/api/visit-records/customer/${customerId}`,
|
url: `/api/visit-records/customer/${customerId}`,
|
||||||
@@ -112,23 +75,13 @@ export function deleteCustomerPhoto(visitRecordId: string | number) {
|
|||||||
return request({
|
return request({
|
||||||
url: `/api/visit-records/${visitRecordId}`,
|
url: `/api/visit-records/${visitRecordId}`,
|
||||||
method: 'delete',
|
method: 'delete',
|
||||||
loading: true,
|
// loading: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
/** 查询收藏列表
|
/** 查询收藏列表
|
||||||
* @param visitRecordId 进店记录id
|
* @param visitRecordId 进店记录id
|
||||||
*/
|
*/
|
||||||
export function getTryOnEffectFavoriteList(visitRecordId: string | number) {
|
export function getTryOnEffectFavoriteList(visitRecordId: string | number) {
|
||||||
return new Promise(resolve => {
|
|
||||||
setTimeout(() => {
|
|
||||||
resolve([
|
|
||||||
{ tryOnId: 1, tryOnUrl: 'http://118.31.39.42:3000/falls/1.png', styleUrl: 'http://118.31.39.42:3000/falls/1.png' },
|
|
||||||
{ tryOnId: 2, tryOnUrl: 'http://118.31.39.42:3000/falls/2.png', styleUrl: 'http://118.31.39.42:3000/falls/2.png' },
|
|
||||||
{ tryOnId: 3, tryOnUrl: 'http://118.31.39.42:3000/falls/3.png', styleUrl: 'http://118.31.39.42:3000/falls/3.png' },
|
|
||||||
{ tryOnId: 4, tryOnUrl: 'http://118.31.39.42:3000/falls/4.png', styleUrl: 'http://118.31.39.42:3000/falls/4.png' }
|
|
||||||
])
|
|
||||||
}, 1000)
|
|
||||||
})
|
|
||||||
if (!visitRecordId) return Promise.reject('进店记录id不能为空');
|
if (!visitRecordId) return Promise.reject('进店记录id不能为空');
|
||||||
return request({
|
return request({
|
||||||
url: `/api/try-on-effects/favorites/${visitRecordId}`,
|
url: `/api/try-on-effects/favorites/${visitRecordId}`,
|
||||||
@@ -139,16 +92,6 @@ export function getTryOnEffectFavoriteList(visitRecordId: string | number) {
|
|||||||
* @param styleId 服装id
|
* @param styleId 服装id
|
||||||
*/
|
*/
|
||||||
export function getTryOnEffectStyleList(styleId: string | number) {
|
export function getTryOnEffectStyleList(styleId: string | number) {
|
||||||
return new Promise(resolve => {
|
|
||||||
setTimeout(() => {
|
|
||||||
resolve([
|
|
||||||
{ tryOnId: 1, tryOnUrl: 'http://118.31.39.42:3000/falls/1.png', styleUrl: 'http://118.31.39.42:3000/falls/1.png' },
|
|
||||||
{ tryOnId: 2, tryOnUrl: 'http://118.31.39.42:3000/falls/2.png', styleUrl: 'http://118.31.39.42:3000/falls/2.png' },
|
|
||||||
{ tryOnId: 3, tryOnUrl: 'http://118.31.39.42:3000/falls/3.png', styleUrl: 'http://118.31.39.42:3000/falls/3.png' },
|
|
||||||
{ tryOnId: 4, tryOnUrl: 'http://118.31.39.42:3000/falls/4.png', styleUrl: 'http://118.31.39.42:3000/falls/4.png' }
|
|
||||||
])
|
|
||||||
}, 1000)
|
|
||||||
})
|
|
||||||
if (!styleId) return Promise.reject('服装id不能为空');
|
if (!styleId) return Promise.reject('服装id不能为空');
|
||||||
return request({
|
return request({
|
||||||
url: `/api/try-on-effects/style/${styleId}`,
|
url: `/api/try-on-effects/style/${styleId}`,
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ export const useGenerateStore = defineStore({
|
|||||||
},
|
},
|
||||||
/** AI魔改信息 */
|
/** AI魔改信息 */
|
||||||
customizeInfo: {
|
customizeInfo: {
|
||||||
inputText:"",
|
inputText: "",
|
||||||
|
|
||||||
tryOnId: "",
|
tryOnId: "",
|
||||||
tryOnUrl: "",
|
tryOnUrl: "",
|
||||||
styleUrl: "",
|
styleUrl: "",
|
||||||
@@ -39,15 +39,15 @@ export const useGenerateStore = defineStore({
|
|||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
/** 顾客id */
|
/** 顾客id */
|
||||||
customerId: (state) => state.userData.style.id,
|
customerId: (state) => 1,
|
||||||
/** 进店记录id */
|
/** 进店记录id */
|
||||||
visitRecordId: (state) => state.userData.style.id,
|
visitRecordId: (state) => 1,
|
||||||
/** 服装id */
|
/** 服装id */
|
||||||
styleId: (state) => state.userData.style.id,
|
styleId: (state) => 1,
|
||||||
/** 模特照片id */
|
/** 模特照片id */
|
||||||
modelPhotoId: (state) => state.userData.model.id,
|
modelPhotoId: (state) => 1,
|
||||||
/** 原始试穿id */
|
/** 原始试穿id */
|
||||||
originalTryOnId: (state) => state.userData.style.id,
|
originalTryOnId: (state) => 1,
|
||||||
/** 顾客照片id */
|
/** 顾客照片id */
|
||||||
customerPhotoId: (state) => state.photoInfo.id,
|
customerPhotoId: (state) => state.photoInfo.id,
|
||||||
},
|
},
|
||||||
@@ -78,14 +78,14 @@ export const useGenerateStore = defineStore({
|
|||||||
this.photoInfo.url = data.defaultImageUrl || ""
|
this.photoInfo.url = data.defaultImageUrl || ""
|
||||||
this.photoInfo.file = null
|
this.photoInfo.file = null
|
||||||
},
|
},
|
||||||
/** 更新AI魔改信息 */
|
/** 清空 AI魔改信息 */
|
||||||
clearCustomizeInfo(data: any) {
|
clearCustomizeInfo() {
|
||||||
this.customizeInfo.inputText = data.inputText || ""
|
this.customizeInfo.inputText = ""
|
||||||
this.customizeInfo.tryOnId = data.tryOnId || ""
|
this.customizeInfo.tryOnId = ""
|
||||||
this.customizeInfo.tryOnUrl = data.tryOnUrl || ""
|
this.customizeInfo.tryOnUrl = ""
|
||||||
this.customizeInfo.styleUrl = data.styleUrl || ""
|
this.customizeInfo.styleUrl = ""
|
||||||
this.customizeInfo.isRegenerated = data.isRegenerated || ""
|
this.customizeInfo.isRegenerated = ""
|
||||||
this.customizeInfo.isFavorite = data.isFavorite || ""
|
this.customizeInfo.isFavorite = false
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -12,7 +12,8 @@ console.log(import.meta.env.VITE_APP_URL,123)
|
|||||||
const service = axios.create({
|
const service = axios.create({
|
||||||
baseURL: import.meta.env.VITE_APP_URL, // api的base_url
|
baseURL: import.meta.env.VITE_APP_URL, // api的base_url
|
||||||
// baseURL: import.meta.env.VITE_APP_URL, // api的base_url
|
// baseURL: import.meta.env.VITE_APP_URL, // api的base_url
|
||||||
timeout: 5000 // 请求超时时间
|
timeout: 5000, // 请求超时时间
|
||||||
|
loading: false,
|
||||||
})
|
})
|
||||||
axios.defaults.headers.post["Content-Type"] = "application/json";
|
axios.defaults.headers.post["Content-Type"] = "application/json";
|
||||||
axios.defaults.headers.post['lang'] = 'en'; //配置语言请求头
|
axios.defaults.headers.post['lang'] = 'en'; //配置语言请求头
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
// 跳过上传
|
// 跳过上传
|
||||||
const handleFinish = () => {
|
const handleFinish = () => {
|
||||||
generateStore.updatePhotoInfo({})
|
generateStore.updatePhotoInfo({})
|
||||||
generateStore.clearCustomizeInfo({})
|
generateStore.clearCustomizeInfo()
|
||||||
router.push({ name: 'customize' })
|
router.push({ name: 'customize' })
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
formData.append('file', fileData.file)
|
formData.append('file', fileData.file)
|
||||||
uploadCustomerPhoto(formData).then((res) => {
|
uploadCustomerPhoto(formData).then((res) => {
|
||||||
generateStore.updatePhotoInfo(res)
|
generateStore.updatePhotoInfo(res)
|
||||||
generateStore.clearCustomizeInfo({})
|
generateStore.clearCustomizeInfo()
|
||||||
router.push({ name: 'customize' })
|
router.push({ name: 'customize' })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user