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
+3 -3
View File
@@ -8,12 +8,12 @@
fail: () => {}, fail: () => {},
}); });
window.updateToken=function(newToken) { window.updateToken = function (newToken) {
console.log('Token updated via global function:', newToken); console.log('Token updated via global function:', newToken);
uni.setStorageSync('token', newToken); uni.setStorageSync('token', newToken);
} };
// 加载Shopro底层依赖 // 加载Shopro底层依赖
ShoproInit(); // ShoproInit();
}); });
onShow(() => { onShow(() => {
+1 -1
View File
@@ -60,7 +60,7 @@
"path": "pages/uploadClothes/index", "path": "pages/uploadClothes/index",
"style": { "style": {
"navigationBarTitleText": "服饰上传", "navigationBarTitleText": "服饰上传",
"enablePullDownRefresh": true "enablePullDownRefresh": false
}, },
"meta": { "meta": {
"sync": true, "sync": true,
+12 -11
View File
@@ -1,29 +1,28 @@
<!-- <!--
* @Author: liguigong liguigong@shopline.com * @Author: liguigong liguigong@shopline.com
* @Date: 2025-09-19 16:26:36 * @Date: 2025-09-19 16:26:36
* @LastEditors: * @LastEditors: liguigong liguigong@shopline.com
* @LastEditTime: 2025-09-27 16:37:29 * @LastEditTime: 2025-09-28 14:54:34
* @FilePath: pages/fittingRoom/components/s-grid-clothes.vue * @FilePath: pages/fittingRoom/components/s-grid-clothes.vue
* @Description: 这是默认设置,可以在设置工具File Description中进行配置 * @Description: 这是默认设置,可以在设置工具File Description中进行配置
--> -->
<template> <template>
<view class="tabContainer"> <view class="tabContainer">
<uni-grid :column="4" :highlight="true" :square="false" borderColor="#000" @change="change"> <uni-grid :column="4" :highlight="true" :square="false" borderColor="#000" @change="change">
<uni-grid-item <uni-grid-item v-for="(item, index) in fittingRoomStore.clothes" :key="index" :index="item">
v-for="(item, index) in fittingRoomStore.clothes"
:key="index"
:index="item"
>
<view class="grid-item-box" style="background-color: #fff"> <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 class="edit" @click="goEdit(item)">编辑</view>
</view> </view>
<template v-if="fittingRoomStore.canUpload && index === 0"> <template v-if="fittingRoomStore.canUpload && index === 0">
<image <image
:src="`/static/uploads/${fittingRoomStore.tab}.png`"
class="clothes" class="clothes"
mode="aspectFill" mode="aspectFill"
src="/static/uploads/1.png"
@click="uploadFile" @click="uploadFile"
></image> ></image>
</template> </template>
@@ -71,8 +70,10 @@
} }
function change(e) { function change(e) {
fittingRoomStore.changeClothes(e.detail.index); if (e.detail.index?.clothId) {
console.log('🚀 ~ change 🐶63 ~ index: ', e.detail.index); fittingRoomStore.changeClothes(e.detail.index);
console.log('🚀 ~ change 🐶63 ~ index: ', e.detail.index);
}
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
+20 -60
View File
@@ -1,5 +1,5 @@
<template> <template>
<view v-if="template"> <view>
<view class="uni-margin-wrap"> <view class="uni-margin-wrap">
<!-- https://ext.dcloud.net.cn/plugin?id=22930--> <!-- https://ext.dcloud.net.cn/plugin?id=22930-->
<hbxw-stack-carousel <hbxw-stack-carousel
@@ -26,13 +26,13 @@
<s-tabs /> <s-tabs />
</uv-sticky> </uv-sticky>
<s-grid-clothes /> <s-grid-clothes />
<view class="height1" @click="dian"></view> <view class="height1"></view>
</view> </view>
</template> </template>
<script setup> <script setup>
import { computed, onMounted, reactive, unMounted } from 'vue'; import { computed, onMounted, reactive, ref } from 'vue';
import { onLoad, onPageScroll, onPullDownRefresh } from '@dcloudio/uni-app'; import { onLoad, onPageScroll, onPullDownRefresh, onUnload } from '@dcloudio/uni-app';
import sheep from '@/sheep'; import sheep from '@/sheep';
import SSelectMote from './components/s-select-mote.vue'; import SSelectMote from './components/s-select-mote.vue';
import STabs from './components/STabs.vue'; import STabs from './components/STabs.vue';
@@ -40,7 +40,7 @@
import Clothespic from './components/Clothespic.vue'; // 隐藏原生tabBar import Clothespic from './components/Clothespic.vue'; // 隐藏原生tabBar
const fittingRoomStore = sheep.$store('fittingRoom'); const fittingRoomStore = sheep.$store('fittingRoom');
const timer = ref(null); let timer = null;
// sheep.$helper.toast('请选择是否同意协议'); // sheep.$helper.toast('请选择是否同意协议');
// 隐藏原生tabBar // 隐藏原生tabBar
@@ -58,10 +58,11 @@
fittingRoomStore.getModelList(); fittingRoomStore.getModelList();
timer = setInterval(() => { timer = setInterval(() => {
// TODO: 检测到还有没生成图的, 获取最新数据 // TODO: 检测到还有没生成图的, 获取最新数据
fittingRoomStore.currentModel?.id && fittingRoomStore.getTestResults(); // fittingRoomStore.currentModel?.id &&
}, 2000); // fittingRoomStore.getTestResults(fittingRoomStore.currentModel?.id);
}, 6000);
}); });
unMounted(() => { onUnload(() => {
// 移除全局监听 // 移除全局监听
clearInterval(timer); clearInterval(timer);
}); });
@@ -84,68 +85,27 @@
console.log('---- change ----', index, oldIndex); console.log('---- change ----', index, oldIndex);
} }
function dian() { // const template = computed(() => sheep.$store('app').template?.home);
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);
onLoad((options) => { 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'); uni.setStorageSync('token', options?.token ?? 'e84526c0f7a3457da54e663fb4396beb');
console.log('🚀 ~ URL上的token ~ options?.token: ', options?.token); 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(() => { onPullDownRefresh(() => {
sheep.$store('app').init(); // sheep.$store('app').init();
setTimeout(function () { if (fittingRoomStore.currentModel?.id) {
fittingRoomStore.getTestResults(fittingRoomStore.currentModel?.id).then(() => {
console.log('➤➤➤ ~ index.vue ~ L100');
uni.stopPullDownRefresh();
});
} else {
uni.stopPullDownRefresh(); uni.stopPullDownRefresh();
}, 800); }
}); });
onPageScroll(() => {}); // onPageScroll(() => {});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -192,7 +152,7 @@
} }
.height1 { .height1 {
height: 2000px; height: 400rpx;
} }
.swiper-list { .swiper-list {
+5 -2
View File
@@ -1,8 +1,8 @@
/** /**
* @Author: liguigong liguigong@shopline.com * @Author: liguigong liguigong@shopline.com
* @Date: 2025-09-23 09:41:10 * @Date: 2025-09-23 09:41:10
* @LastEditors: * @LastEditors: liguigong liguigong@shopline.com
* @LastEditTime: 2025-09-27 15:48:31 * @LastEditTime: 2025-09-28 14:36:48
* @FilePath: sheep/api/fittingRoom/index.js * @FilePath: sheep/api/fittingRoom/index.js
* @Description: 这是默认设置,可以在设置》工具》File Description中进行配置 * @Description: 这是默认设置,可以在设置》工具》File Description中进行配置
*/ */
@@ -113,6 +113,9 @@ const FittingRoomApi = {
url: '/digital/on-record/page', url: '/digital/on-record/page',
method: 'GET', method: 'GET',
params: data, params: data,
custom: {
showLoading: false,
},
}); });
}, },
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB