feat(fittingRoom): 添加定时检测生成图状态功能
- 引入 unMounted 生命周期钩子 - 添加定时器检测生成图状态 - 在组件卸载时清除定时器- 注释掉调试用的 toast 提示 - 调整代码格式和注释内容
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, onMounted, reactive } from 'vue';
|
||||
import { computed, onMounted, reactive, unMounted } from 'vue';
|
||||
import { onLoad, onPageScroll, onPullDownRefresh } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
import SSelectMote from './components/s-select-mote.vue';
|
||||
@@ -40,8 +40,9 @@
|
||||
import Clothespic from './components/Clothespic.vue'; // 隐藏原生tabBar
|
||||
|
||||
const fittingRoomStore = sheep.$store('fittingRoom');
|
||||
const timer = ref(null);
|
||||
|
||||
sheep.$helper.toast('请选择是否同意协议');
|
||||
// sheep.$helper.toast('请选择是否同意协议');
|
||||
// 隐藏原生tabBar
|
||||
uni.hideTabBar({
|
||||
fail: () => {},
|
||||
@@ -55,6 +56,14 @@
|
||||
fittingRoomStore.getCategory();
|
||||
fittingRoomStore.getCloths();
|
||||
fittingRoomStore.getModelList();
|
||||
timer = setInterval(() => {
|
||||
// TODO: 检测到还有没生成图的, 获取最新数据
|
||||
fittingRoomStore.currentModel?.id && fittingRoomStore.getTestResults();
|
||||
}, 2000);
|
||||
});
|
||||
unMounted(() => {
|
||||
// 移除全局监听
|
||||
clearInterval(timer);
|
||||
});
|
||||
const state = reactive({
|
||||
info: [
|
||||
@@ -111,7 +120,7 @@
|
||||
// #endif
|
||||
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user