fix(fittingRoom):优化试衣间页面逻辑与组件交互

- 移除未使用的点击事件和相关函数
- 调整轮播图获取结果的定时器间隔从2秒至6秒
- 更新下拉刷新逻辑,仅在存在模型ID时请求数据
- 修改页面卸载钩子为onUnload并清理定时器- 禁用服饰上传页的下拉刷新功能
-优化网格组件中衣物切换判断条件
- 更新文件最后编辑时间和作者信息- 调整试衣间页面结构与样式高度单位统一为rpx- 注释掉部分冗余或调试用途的代码逻辑
- 全局函数updateToken语法规范化并移除初始化调用
This commit is contained in:
liguigong
2025-09-28 14:59:36 +08:00
parent 866c79bb6d
commit 67079a3799
10 changed files with 41 additions and 77 deletions
+20 -60
View File
@@ -1,5 +1,5 @@
<template>
<view v-if="template">
<view>
<view class="uni-margin-wrap">
<!-- https://ext.dcloud.net.cn/plugin?id=22930-->
<hbxw-stack-carousel
@@ -26,13 +26,13 @@
<s-tabs />
</uv-sticky>
<s-grid-clothes />
<view class="height1" @click="dian"></view>
<view class="height1"></view>
</view>
</template>
<script setup>
import { computed, onMounted, reactive, unMounted } from 'vue';
import { onLoad, onPageScroll, onPullDownRefresh } from '@dcloudio/uni-app';
import { computed, onMounted, reactive, ref } from 'vue';
import { onLoad, onPageScroll, onPullDownRefresh, onUnload } from '@dcloudio/uni-app';
import sheep from '@/sheep';
import SSelectMote from './components/s-select-mote.vue';
import STabs from './components/STabs.vue';
@@ -40,7 +40,7 @@
import Clothespic from './components/Clothespic.vue'; // 隐藏原生tabBar
const fittingRoomStore = sheep.$store('fittingRoom');
const timer = ref(null);
let timer = null;
// sheep.$helper.toast('请选择是否同意协议');
// 隐藏原生tabBar
@@ -58,10 +58,11 @@
fittingRoomStore.getModelList();
timer = setInterval(() => {
// TODO: 检测到还有没生成图的, 获取最新数据
fittingRoomStore.currentModel?.id && fittingRoomStore.getTestResults();
}, 2000);
// fittingRoomStore.currentModel?.id &&
// fittingRoomStore.getTestResults(fittingRoomStore.currentModel?.id);
}, 6000);
});
unMounted(() => {
onUnload(() => {
// 移除全局监听
clearInterval(timer);
});
@@ -84,68 +85,27 @@
console.log('---- change ----', index, oldIndex);
}
function dian() {
state.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',
},
{
image: 'https://picsum.photos/600/300?random=4',
},
{
image: 'https://picsum.photos/600/300?random=5',
},
];
}
const swiperChange = (e) => {
state.current = e.detail.current;
};
const template = computed(() => sheep.$store('app').template?.home);
// const template = computed(() => sheep.$store('app').template?.home);
onLoad((options) => {
// #ifdef MP
// 小程序识别二维码
if (options.scene) {
const sceneParams = decodeURIComponent(options.scene).split('=');
console.log('sceneParams=>', sceneParams);
options[sceneParams[0]] = sceneParams[1];
}
// #endif
uni.setStorageSync('token', options?.token ?? 'e84526c0f7a3457da54e663fb4396beb');
console.log('🚀 ~ URL上的token ~ options?.token: ', options?.token);
// 预览模板
if (options.templateId) {
sheep.$store('app').init(options.templateId);
}
// 解析分享信息
if (options.spm) {
$share.decryptSpm(options.spm);
}
// 进入指定页面(完整页面路径)
if (options.page) {
sheep.$router.go(decodeURIComponent(options.page));
}
});
// 下拉刷新
onPullDownRefresh(() => {
sheep.$store('app').init();
setTimeout(function () {
// sheep.$store('app').init();
if (fittingRoomStore.currentModel?.id) {
fittingRoomStore.getTestResults(fittingRoomStore.currentModel?.id).then(() => {
console.log('➤➤➤ ~ index.vue ~ L100');
uni.stopPullDownRefresh();
});
} else {
uni.stopPullDownRefresh();
}, 800);
}
});
onPageScroll(() => {});
// onPageScroll(() => {});
</script>
<style lang="scss" scoped>
@@ -192,7 +152,7 @@
}
.height1 {
height: 2000px;
height: 400rpx;
}
.swiper-list {