fix(fittingRoom):优化试衣间页面逻辑与组件交互
- 移除未使用的点击事件和相关函数 - 调整轮播图获取结果的定时器间隔从2秒至6秒 - 更新下拉刷新逻辑,仅在存在模型ID时请求数据 - 修改页面卸载钩子为onUnload并清理定时器- 禁用服饰上传页的下拉刷新功能 -优化网格组件中衣物切换判断条件 - 更新文件最后编辑时间和作者信息- 调整试衣间页面结构与样式高度单位统一为rpx- 注释掉部分冗余或调试用途的代码逻辑 - 全局函数updateToken语法规范化并移除初始化调用
This commit is contained in:
@@ -1,29 +1,28 @@
|
||||
<!--
|
||||
* @Author: liguigong liguigong@shopline.com
|
||||
* @Date: 2025-09-19 16:26:36
|
||||
* @LastEditors:
|
||||
* @LastEditTime: 2025-09-27 16:37:29
|
||||
* @LastEditors: liguigong liguigong@shopline.com
|
||||
* @LastEditTime: 2025-09-28 14:54:34
|
||||
* @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 fittingRoomStore.clothes"
|
||||
:key="index"
|
||||
:index="item"
|
||||
>
|
||||
<uni-grid-item v-for="(item, index) in fittingRoomStore.clothes" :key="index" :index="item">
|
||||
<view class="grid-item-box" style="background-color: #fff">
|
||||
<view v-if="fittingRoomStore.currentClothes.some(v => v.clothId === item.clothId)" class="inUse">
|
||||
<view
|
||||
v-if="fittingRoomStore.currentClothes.some((v) => v.clothId === item.clothId)"
|
||||
class="inUse"
|
||||
>
|
||||
<view class="edit" @click="goEdit(item)">编辑</view>
|
||||
</view>
|
||||
|
||||
<template v-if="fittingRoomStore.canUpload && index === 0">
|
||||
<image
|
||||
:src="`/static/uploads/${fittingRoomStore.tab}.png`"
|
||||
class="clothes"
|
||||
mode="aspectFill"
|
||||
src="/static/uploads/1.png"
|
||||
@click="uploadFile"
|
||||
></image>
|
||||
</template>
|
||||
@@ -71,8 +70,10 @@
|
||||
}
|
||||
|
||||
function change(e) {
|
||||
fittingRoomStore.changeClothes(e.detail.index);
|
||||
console.log('🚀 ~ change 🐶63 ~ index: ', e.detail.index);
|
||||
if (e.detail.index?.clothId) {
|
||||
fittingRoomStore.changeClothes(e.detail.index);
|
||||
console.log('🚀 ~ change 🐶63 ~ index: ', e.detail.index);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
||||
+20
-60
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user