feat(fittingRoom):优化试衣间轮播图逻辑与加载状态检测 swiper

- 新增CurrentIndex 状态管理当前轮播索引
- 移除数组反转逻辑,调整模特展示顺序
- 添加 generatingLoading 计算属性检测试穿结果生成状态
- 更新轮播图组件绑定状态为 store 中的 swiperCurrentIndex
- 修复轮播切换事件更新 store 状态的逻辑
- 调整定时任务检测条件为 generatingLoading 状态- 微调轮播图片样式位置
This commit is contained in:
liguigong
2025-10-10 15:05:59 +08:00
parent a8f7499253
commit 2201566768
2 changed files with 56 additions and 51 deletions
+7 -2
View File
@@ -21,6 +21,7 @@ export const pattern = [
const fittingRoom = defineStore({
id: 'fittingRoom',
state: () => ({
swiperCurrentIndex: 0,
visable: false, // 上传模特, 选模特的
modelList: [], // 模特列表
currentModel: {},
@@ -39,10 +40,13 @@ const fittingRoom = defineStore({
getters: {
// 能上传图片的场景
canUpload(state) {
console.log(this.type, this.tab, state.type, '123');
// 除了发型其他都能上传
return this.type && !this.disableTabs.includes(this.tab);
},
// 有没有试穿结果没生成的
generatingLoading(state) {
return this.testResults.some((item) => !item.tryOnResultUrl);
},
},
actions: {
// 获取衣服分类
@@ -61,7 +65,7 @@ const fittingRoom = defineStore({
pageSize: '30',
});
const result = httpResponse.data?.list ?? [];
result.reverse();
// result.reverse();
// 将模特放到最后一张
result.push({
id: 100000,
@@ -120,6 +124,7 @@ const fittingRoom = defineStore({
return;
}
this.getTestResults(this.currentModel.id);
this.swiperCurrentIndex = 0;
},
// 切换模特
switchModels(item) {