Files
meida_front/pages/fittingRoom/index.vue
T
liguigong 738f56caad feat(fittingRoom): 优化试衣间页面布局和样式
- 调整页面结构,将轮播图组件移入 sticky 容器内
- 添加页面背景色 #ffffff
-为滚动区域添加 scroll 样式类
- 优化上传服饰页面结构,使用 s-layout 组件包裹内容
- 更新页面标题为“服饰上传”- 修改 manifest.json 中的 appid
- 调整 pages.json 中 uploadClothes 页面配置,自定义导航栏并禁用标题栏
2025-10-09 15:04:41 +08:00

218 lines
5.0 KiB
Vue

<template
><view>
<uv-sticky :customNavHeight="0" :offset-top="0">
<view class="uni-margin-wrap">
<!-- https://ext.dcloud.net.cn/plugin?id=22930-->
<hbxw-stack-carousel
:key="fittingRoomStore.testResults"
:autoplay="false"
:height="680"
:interval="15000"
:list="fittingRoomStore.testResults"
:width="430"
indicatorStyle="line"
loop
@change="handleChange"
@click="handleItemClick"
>
<template #default="{ item, index }">
<view class="custom-item">
<image
:src="item.tryOnResultUrl || '/static/uploads/loading12.gif'"
class="swiper-image"
mode="aspectFill"
/>
</view>
</template>
<template #indicator="{ currentIndex, total, handleClick }">
<view class="custom-indicators">
<view
v-for="i in total"
:key="i"
:class="{ active: currentIndex === i - 1 }"
class="custom-indicator"
@click="handleClick(i - 1)"
></view>
</view>
</template>
</hbxw-stack-carousel>
<s-select-mote />
<Clothespic />
</view>
<s-tabs />
</uv-sticky>
<view class="scroll">
<s-grid-clothes />
<view class="height1"></view>
</view>
</view>
</template>
<script setup>
import { onMounted, reactive } from 'vue';
import { onLoad, onPullDownRefresh, onUnload } from '@dcloudio/uni-app';
import sheep from '@/sheep';
import SSelectMote from './components/s-select-mote.vue';
import STabs from './components/STabs.vue';
import SGridClothes from './components/s-grid-clothes.vue';
import Clothespic from './components/Clothespic.vue'; // 隐藏原生tabBar
const fittingRoomStore = sheep.$store('fittingRoom');
let timer = null;
// sheep.$helper.toast('请选择是否同意协议');
// 隐藏原生tabBar
uni.hideTabBar({
fail: () => {},
});
function handleItemClick(index, item) {
console.log(index, item, '12');
}
onMounted(() => {
fittingRoomStore.getCategory();
fittingRoomStore.getCloths();
fittingRoomStore.getModelList();
timer = setInterval(() => {
// TODO: 检测到还有没生成图的, 获取最新数据
// fittingRoomStore.currentModel?.id &&
// fittingRoomStore.getTestResults(fittingRoomStore.currentModel?.id);
}, 6000);
});
onUnload(() => {
// 移除全局监听
clearInterval(timer);
});
const state = reactive({
info: [
{
image: 'https://picsum.photos/600/300?random=1',
},
{
image: 'https://picsum.photos/600/300?random=2',
},
{
image: 'https://picsum.photos/600/300?random=3',
},
],
current: 0,
});
function handleChange(index, oldIndex) {
// state.current = index;
console.log('---- change ----', index, oldIndex);
}
// const template = computed(() => sheep.$store('app').template?.home);
onLoad((options) => {
uni.setStorageSync('token', options?.token ?? '92d2805a85ca422e90dd7d50eef49a85');
console.log('🚀 ~ URL上的token ~ options?.token: ', options?.token);
});
// 下拉刷新
onPullDownRefresh(() => {
// sheep.$store('app').init();
if (fittingRoomStore.currentModel?.id) {
fittingRoomStore.getTestResults(fittingRoomStore.currentModel?.id).then(() => {
console.log('➤➤➤ ~ index.vue ~ L100');
uni.stopPullDownRefresh();
});
} else {
uni.stopPullDownRefresh();
}
});
// onPageScroll(() => {});
</script>
<style lang="scss" scoped>
.uni-margin-wrap {
width: 100%;
position: relative;
background: #ffffff;
}
.swiper {
height: 680rpx;
}
.swiper-item {
display: block;
height: 680rpx;
line-height: 300rpx;
text-align: center;
background: #ffffff;
}
.custom-item {
width: 100%;
height: 100%;
}
.swiper-image {
width: 430rpx;
height: 680rpx;
}
.swiper-item-card {
//width: 92% !important;
height: 100%;
margin: 0 4%;
overflow: hidden;
box-sizing: border-box;
display: flex;
align-items: flex-start;
justify-content: center;
}
.swiper-item-card-margin {
padding: 4% 0;
}
.height1 {
height: 400rpx;
}
.swiper-list {
margin-top: 40rpx;
margin-bottom: 0;
}
.uni-common-mt {
margin-top: 60rpx;
position: relative;
}
.info {
position: absolute;
right: 20rpx;
}
.uni-padding-wrap {
width: 550rpx;
padding: 0 100rpx;
}
.custom-indicators {
display: flex;
justify-content: center;
align-items: center;
.custom-indicator {
width: 10rpx;
height: 1px;
opacity: 0.5;
background: #fff;
margin: 0 5rpx;
}
.active {
width: 30rpx;
height: 1px;
background: #171717;
}
}
.scroll {
overflow-y: scroll;
}
</style>