feat(f增模特ittingRoom): 新选择与上传功能- 添加模特列表状态管理与当前模特选中逻辑- 实现获取模特列表及切换模特功能
- 新增上传模特图片接口及调用逻辑- 更新模特展示组件,支持动态显示模特缩略图 - 添加获取衣服分类接口及初始化调用- 配置.editorconfig统一代码风格 - 移除调试用的console.log及token写死逻辑 - 修复部分组件引用及生命周期调用问题
This commit is contained in:
@@ -21,15 +21,17 @@ const fittingRoom = defineStore({
|
||||
id: 'fittingRoom',
|
||||
state: () => ({
|
||||
visable: false, // 上传模特, 选模特的
|
||||
modelList: [], // 模特列表
|
||||
currentModel: {},
|
||||
type: true, // true: 我的衣橱, false: 衣服库
|
||||
tab: 0, // 对应下面tabs的序号
|
||||
tabs: ['全部', '上衣', '下装', '连衣裙', '外套', '套装', '发型'],
|
||||
disableTabs: [6], // 不允许上传图的tab索引
|
||||
clothes: [], // 接口返回的衣服数据
|
||||
clothes: [], // 接口返回的衣服数据
|
||||
currentClothes: [], // 当前选的衣服
|
||||
selectClothesType: 1, // 选中的衣服类型, 默认选中上衣
|
||||
selectPattern: pattern[0].value,
|
||||
sex: 'female',
|
||||
}),
|
||||
getters: {
|
||||
// 能上传图片的场景
|
||||
@@ -40,6 +42,11 @@ const fittingRoom = defineStore({
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
// 获取衣服分类
|
||||
async getCategory(templateId = null) {
|
||||
const httpResponse = await FittingRoomApi.getCategory();
|
||||
this.clothes = httpResponse.result || [];
|
||||
},
|
||||
// 获取衣服类型数据查询
|
||||
async getCloths(templateId = null) {
|
||||
const httpResponse = await FittingRoomApi.getClothList({
|
||||
@@ -47,16 +54,33 @@ const fittingRoom = defineStore({
|
||||
isPerson: this.type ? 'yes' : 'no',
|
||||
clothType: tabsMap[this.tab],
|
||||
});
|
||||
console.log('🚀 ~ getCloths 🐶33 ~ httpResponse: ', httpResponse.result);
|
||||
this.clothes = httpResponse.result || [];
|
||||
},
|
||||
// 获取模特数据查询
|
||||
async getModelList(templateId = null) {
|
||||
const httpResponse = await FittingRoomApi.getModelList({
|
||||
sex: this.sex,
|
||||
});
|
||||
let modelList = (httpResponse.result || []).slice(0, 4);
|
||||
this.modelList = modelList;
|
||||
this.currentModel = modelList?.[0] ?? {};
|
||||
},
|
||||
// 切换模特
|
||||
switchModels(item) {
|
||||
if (item.id === this.currentModel.id) {
|
||||
return;
|
||||
}
|
||||
// TODO:
|
||||
console.log('🚀 ~ switchModels 🐶70 ~ item: ', item);
|
||||
this.currentModel = item;
|
||||
},
|
||||
setVisable(visable) {
|
||||
console.log('🚀 ~ setVisable 🐶36 ~ visable: ', visable);
|
||||
console.log('🚀 ~ setVisable 🐶77 ~ visable: ', visable);
|
||||
this.visable = visable ?? !this.visable;
|
||||
},
|
||||
// 我的衣服库和衣橱的切换
|
||||
changeType(visable) {
|
||||
console.log('🚀 ~ setVisable 🐶40 ~ visable: ', visable);
|
||||
console.log('🚀 ~ setVisable 🐶82 ~ visable: ', visable);
|
||||
this.type = visable ?? !this.type;
|
||||
this.getCloths();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user