Files
smartDriveEEUniApp/pages/furniture_reception/furniture_reception.vue

86 lines
1.8 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="subpackage-host">
<component v-if="Impl" :is="Impl" :incomingTab="incomingTab" />
<view v-else class="loading">
<text v-if="error">{{ error }}</text>
<text v-else>正在加载接待模块...</text>
</view>
</view>
</template>
<script>
export default {
data() {
return {
Impl: null,
incomingTab: '',
error: ''
};
},
onLoad() {
this.loadImpl();
},
onShow() {
// tabBar 的 switchTab 不稳定携带 query因此从 storage 消费目标tab
try {
const allowed = ['status', 'reception', 'tag'];
const tab = (uni.getStorageSync('workbench-reception-tab') || '').toString();
if (allowed.includes(tab)) {
this.incomingTab = tab;
uni.removeStorageSync('workbench-reception-tab');
}
} catch (e) {
// ignore
}
},
methods: {
loadSubPackagePagesSubpackage() {
return new Promise((resolve, reject) => {
if (!uni || !uni.loadSubPackage) {
resolve();
return;
}
uni.loadSubPackage({
name: 'pages-subpackage',
success: resolve,
fail: () => {
// 兼容部分平台参数名差异
uni.loadSubPackage({
root: 'pages-subpackage',
success: resolve,
fail: reject
});
}
});
});
},
async loadImpl() {
try {
await this.loadSubPackagePagesSubpackage();
const mod = await import('@/pages-subpackage/furniture_reception/furniture_reception-impl.vue');
this.Impl = mod && (mod.default || mod);
} catch (e) {
console.error('[FurnitureReceptionHost] loadImpl failed:', e);
this.error = '接待模块加载失败,请重试';
}
}
}
};
</script>
<style>
.subpackage-host {
min-height: 100vh;
background-color: #F5F5F5;
}
.loading {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
color: #666;
font-size: 28rpx;
}
</style>