修正用户名显示逻辑进入服务列表页面自动刷新

This commit is contained in:
zhonghua.li
2026-04-17 08:12:56 +08:00
parent d74bc2ad1f
commit 18455a311d
14 changed files with 132 additions and 72 deletions

View File

@@ -445,7 +445,7 @@ export default {
} catch (e) {
console.warn('[AIAnalysis] 写入接待tab快捷跳转参数失败:', e);
}
uni.switchTab({
uni.navigateTo({
url: '/pages/furniture_reception/furniture_reception',
fail: (err) => {
console.error('[AIAnalysis] 快捷跳转接待页失败:', err);

View File

@@ -1,6 +1,10 @@
<template>
<view class="subpackage-host">
<FurnitureReceptionImpl v-if="implReady" :incomingTab="incomingTab" />
<FurnitureReceptionImpl
v-if="implReady"
ref="furnitureReceptionImpl"
:incomingTab="incomingTab"
/>
<view v-else class="loading">
<text v-if="error">{{ error }}</text>
<text v-else>正在加载接待模块...</text>
@@ -9,11 +13,16 @@
</template>
<script>
// 微信小程序pages.json 的 componentPlaceholder 注册分包组件requiredComponents / 分包异步化)
// #ifndef MP-WEIXIN
import FurnitureReceptionImpl from '@/pages-subpackage/furniture_reception/furniture_reception-impl.vue';
// #endif
export default {
components: {
// #ifndef MP-WEIXIN
FurnitureReceptionImpl
// #endif
},
data() {
return {
@@ -41,6 +50,8 @@ export default {
} catch (e) {
// ignore
}
// 底部 tab 等场景下页面会被缓存,子组件 mounted 不会再次执行,需每次显示时拉取最新数据
this.refreshImplDataIfReady();
},
methods: {
loadSubPackagePagesSubpackage() {
@@ -67,10 +78,23 @@ export default {
try {
await this.loadSubPackagePagesSubpackage();
this.implReady = true;
await this.$nextTick();
this.refreshImplDataIfReady();
} catch (e) {
console.error('[FurnitureReceptionHost] loadImpl failed:', e);
this.error = '接待模块加载失败,请重试';
}
},
refreshImplDataIfReady() {
if (!this.implReady) {
return;
}
this.$nextTick(() => {
const impl = this.$refs.furnitureReceptionImpl;
if (impl && typeof impl.refreshPageData === 'function') {
impl.refreshPageData();
}
});
}
}
};

View File

@@ -7,8 +7,8 @@
<uni-easyinput v-model="deviceBindForm.deviceCode" placeholder="请输入设备编号" />
</view>
<view class="device-bind-field">
<text class="device-bind-label">家长电话</text>
<uni-easyinput v-model="deviceBindForm.salesPhone" placeholder="请输入销售电话" type="number" />
<text class="device-bind-label">电话</text>
<uni-easyinput v-model="deviceBindForm.salesPhone" placeholder="请输入电话" type="number" />
</view>
<view class="device-bind-field">
<text class="device-bind-label">所属门店</text>

View File

@@ -9,7 +9,7 @@
</view>
<view class="logo-title">
<text class="uer-name" v-if="hasLogin">{{userInfo.nickname||userInfo.username||userInfo.mobile}}</text>
<text class="uer-name" v-if="hasLogin">{{headerDisplayName}}</text>
<text class="uer-name" v-else>{{$t('mine.notLogged')}}</text>
</view>
</view>
@@ -287,6 +287,13 @@
} catch (e) {
return {};
}
},
/** 与下方「用户名」卡片一致:优先后端登录名,避免 nickname 存成手机号时盖住真实用户名 */
headerDisplayName() {
const backend = (this.loginUserInfo && this.loginUserInfo.userName) || ''
if (backend) return backend
const u = this.userInfo || {}
return u.username || u.nickname || u.mobile || ''
}
},
methods: {
@@ -385,8 +392,12 @@
this[item.event]();
} else if (item.to) {
// 如果是 tabBar 页面,使用 switchTab
const tabBarPages = ['/pages/furniture_reception/furniture_reception', '/pages-subpackage/furniture_customer/furniture_customer', '/pages/ai_analysis/ai_analysis', '/pages/xixi/xixi', '/pages/ucenter/ucenter']
if (tabBarPages.includes(item.to)) {
const tabBarPages = ['/pages-subpackage/furniture_customer/furniture_customer', '/pages/ai_analysis/ai_analysis', '/pages/xixi/xixi', '/pages/ucenter/ucenter']
if (item.to === '/pages/furniture_reception/furniture_reception') {
uni.navigateTo({
url: item.to
})
} else if (tabBarPages.includes(item.to)) {
uni.switchTab({
url: item.to
})

View File

@@ -72,6 +72,13 @@ export default {
switchTabWithQuery(basePath, tab) {
if (basePath === '/pages/furniture_reception/furniture_reception') {
uni.setStorageSync('workbench-reception-tab', tab);
uni.navigateTo({
url: basePath,
fail: () => {
uni.showToast({ title: '跳转接待页失败', icon: 'none' });
},
});
return;
}
uni.switchTab({
url: basePath,