feat(fittingRoom): 实现衣服数据获取与tab切换功能
新增 fittingRoom 接口调用逻辑,支持根据 tab 类型加载对应衣服列表。 在 store 中增加 `clothes` 数据字段,并通过 `getCloths` 方法请求数据。页面组件中更新 tab 切换逻辑以触发数据刷新,并调整模板绑定方式。 添加 `tabsMap` 映射表用于匹配接口所需 clothType 参数。
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* @Author: liguigong liguigong@shopline.com
|
||||
* @Date: 2025-09-19 16:26:36
|
||||
* @LastEditors: liguigong liguigong@shopline.com
|
||||
* @LastEditTime: 2025-09-19 17:56:16
|
||||
* @LastEditTime: 2025-09-22 19:17:46
|
||||
* @FilePath: pages/fittingRoom/components/STabs.vue
|
||||
* @Description: 这是默认设置,可以在设置》工具》File Description中进行配置
|
||||
-->
|
||||
@@ -43,6 +43,7 @@
|
||||
|
||||
function changeTab(index) {
|
||||
console.log('当前选中的项:' + index);
|
||||
fittingRoom.changeTab(index);
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -1,21 +1,25 @@
|
||||
<!--
|
||||
* @Author: liguigong liguigong@shopline.com
|
||||
* @Date: 2025-09-19 16:26:36
|
||||
* @LastEditors:
|
||||
* @LastEditTime: 2025-09-19 22:34:40
|
||||
* @LastEditors: liguigong liguigong@shopline.com
|
||||
* @LastEditTime: 2025-09-22 19:35:35
|
||||
* @FilePath: pages/fittingRoom/components/s-grid-clothes.vue
|
||||
* @Description: 这是默认设置,可以在设置》工具》File Description中进行配置
|
||||
-->
|
||||
<template>
|
||||
<view class="tabContainer">
|
||||
<uni-grid :column="4" :highlight="true" :square="false" borderColor="#000" @change="change">
|
||||
<uni-grid-item v-for="(item, index) in 7" :key="index" :index="index + 100">
|
||||
<uni-grid-item
|
||||
v-for="(item, index) in fittingRoomStore.clothes"
|
||||
:key="index"
|
||||
:index="index + 100"
|
||||
>
|
||||
<view class="grid-item-box" style="background-color: #fff">
|
||||
<view v-if="index == 3" class="inUse">
|
||||
<view class="edit" @click="goEdit">编辑</view>
|
||||
</view>
|
||||
|
||||
<template v-if="fittingRoom.canUpload && index === 0">
|
||||
<template v-if="fittingRoomStore.canUpload && index === 0">
|
||||
<image
|
||||
class="clothes"
|
||||
mode="aspectFill"
|
||||
@@ -44,10 +48,10 @@
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
|
||||
const fittingRoom = sheep.$store('fittingRoom');
|
||||
const fittingRoomStore = sheep.$store('fittingRoom');
|
||||
|
||||
function selectPic(...data) {
|
||||
console.log(fittingRoom.tab);
|
||||
console.log(fittingRoomStore.tab);
|
||||
console.log('🚀 ~ selectPic 🐶47 ~ data: ', data);
|
||||
}
|
||||
|
||||
@@ -64,7 +68,7 @@
|
||||
}
|
||||
|
||||
function change(e) {
|
||||
fittingRoom.changeClothes();
|
||||
fittingRoomStore.changeClothes();
|
||||
console.log('🚀 ~ change 🐶25 ~ index: ', e.detail.index);
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user