修正用户名显示逻辑进入服务列表页面自动刷新
This commit is contained in:
@@ -40,13 +40,6 @@ Component({
|
||||
iconPath: '/static/tabbar/insight.png',
|
||||
selectedIconPath: '/static/tabbar/insight_active.png',
|
||||
},
|
||||
{
|
||||
key: 'furniture_reception',
|
||||
text: '接待',
|
||||
pagePath: 'pages/furniture_reception/furniture_reception',
|
||||
iconPath: '/static/tabbar/reception.png',
|
||||
selectedIconPath: '/static/tabbar/reception_active.png',
|
||||
},
|
||||
{
|
||||
key: 'common_begin_reception',
|
||||
text: '开始接待',
|
||||
@@ -68,6 +61,13 @@ Component({
|
||||
iconPath: '/static/tabbar/ai_analysis.png',
|
||||
selectedIconPath: '/static/tabbar/ai_analysis_active.png',
|
||||
},
|
||||
{
|
||||
key: 'workbench',
|
||||
text: '工作台',
|
||||
pagePath: 'pages/workbench/workbench',
|
||||
iconPath: '/static/tabbar/team.png',
|
||||
selectedIconPath: '/static/tabbar/team_active.png',
|
||||
},
|
||||
{
|
||||
key: 'furniture_top_sales',
|
||||
text: '销冠',
|
||||
@@ -280,8 +280,8 @@ Component({
|
||||
'team': 'pages/team/team',
|
||||
'ucenter': 'pages/ucenter/ucenter',
|
||||
'meeting_summary': 'pages-subpackage/meeting_summary/meeting_summary',
|
||||
'furniture_reception': 'pages/furniture_reception/furniture_reception',
|
||||
'common_begin_reception': 'pages/furniture_reception/common_begin_reception',
|
||||
'workbench': 'pages/workbench/workbench',
|
||||
'furniture_customer': 'pages-subpackage/furniture_customer/furniture_customer',
|
||||
'ai_analysis': 'pages/ai_analysis/ai_analysis',
|
||||
'furniture_top_sales': 'pages/furniture_top_sales/furniture_top_sales'
|
||||
@@ -511,7 +511,7 @@ Component({
|
||||
const hasFurnitureRole = roles.includes('furniture');
|
||||
|
||||
if (isAdminFurniture || hasFurnitureRole) {
|
||||
const furnitureTabs = ['furniture_reception', 'furniture_customer', 'ai_analysis', 'ucenter'];
|
||||
const furnitureTabs = ['ai_analysis', 'workbench', 'ucenter'];
|
||||
console.log('[TabBar][allowed] furniture/admin_furniture role ->', furnitureTabs);
|
||||
return furnitureTabs;
|
||||
}
|
||||
|
||||
@@ -34,13 +34,6 @@ export default {
|
||||
roles: [],
|
||||
currentPath: '',
|
||||
allTabs: [
|
||||
{
|
||||
key: 'furniture_reception',
|
||||
text: '接待',
|
||||
pagePath: '/pages/furniture_reception/furniture_reception',
|
||||
iconPath: '/static/tabbar/reception.png',
|
||||
selectedIconPath: '/static/tabbar/reception_active.png',
|
||||
},
|
||||
{
|
||||
key: 'furniture_customer',
|
||||
text: '客户',
|
||||
@@ -77,6 +70,13 @@ export default {
|
||||
iconPath: '/static/tabbar/me.png',
|
||||
selectedIconPath: '/static/tabbar/me_active.png',
|
||||
},
|
||||
{
|
||||
key: 'workbench',
|
||||
text: '工作台',
|
||||
pagePath: '/pages/workbench/workbench',
|
||||
iconPath: '/static/tabbar/team.png',
|
||||
selectedIconPath: '/static/tabbar/team_active.png',
|
||||
},
|
||||
{
|
||||
key: 'ai_analysis',
|
||||
text: 'AI分析',
|
||||
@@ -96,36 +96,29 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
furnitureTabs() {
|
||||
// 强制返回所有家具角色的tab,使用与pages.json相同的路径格式
|
||||
// 与 pages.json 的 tabBar 一致:AI分析、工作台、我的
|
||||
return [
|
||||
{
|
||||
key: 'furniture_reception',
|
||||
text: '接待',
|
||||
pagePath: 'pages/furniture_reception/furniture_reception', // 移除开头的/
|
||||
iconPath: '/static/tabbar/reception.png',
|
||||
selectedIconPath: '/static/tabbar/reception_active.png',
|
||||
},
|
||||
{
|
||||
key: 'furniture_customer',
|
||||
text: '客户',
|
||||
pagePath: 'pages-subpackage/furniture_customer/furniture_customer', // 移除开头的/
|
||||
iconPath: '/static/tabbar/customer.png',
|
||||
selectedIconPath: '/static/tabbar/customer_active.png',
|
||||
},
|
||||
{
|
||||
key: 'ai_analysis',
|
||||
text: 'AI分析',
|
||||
pagePath: 'pages/ai_analysis/ai_analysis',
|
||||
pagePath: '/pages/ai_analysis/ai_analysis',
|
||||
iconPath: '/static/tabbar/ai_analysis.png',
|
||||
selectedIconPath: '/static/tabbar/ai_analysis_active.png',
|
||||
},
|
||||
{
|
||||
key: 'workbench',
|
||||
text: '工作台',
|
||||
pagePath: '/pages/workbench/workbench',
|
||||
iconPath: '/static/tabbar/team.png',
|
||||
selectedIconPath: '/static/tabbar/team_active.png',
|
||||
},
|
||||
{
|
||||
key: 'ucenter',
|
||||
text: '我的',
|
||||
pagePath: 'pages/ucenter/ucenter', // 移除开头的/
|
||||
pagePath: '/pages/ucenter/ucenter',
|
||||
iconPath: '/static/tabbar/me.png',
|
||||
selectedIconPath: '/static/tabbar/me_active.png',
|
||||
}
|
||||
},
|
||||
];
|
||||
},
|
||||
|
||||
@@ -134,7 +127,7 @@ export default {
|
||||
console.log('VISIBLE TABS CALC - THIS MUST SHOW IN H5');
|
||||
|
||||
// 简化逻辑:直接返回家具相关的tabs,跳过权限检查
|
||||
const furnitureKeys = ['furniture_reception', 'furniture_customer', 'ai_analysis', 'ucenter'];
|
||||
const furnitureKeys = ['ai_analysis', 'workbench', 'ucenter'];
|
||||
const result = furnitureKeys.map(key => {
|
||||
return this.allTabs.find(tab => tab.key === key);
|
||||
}).filter(Boolean);
|
||||
@@ -289,15 +282,15 @@ export default {
|
||||
console.log('GET ALLOWED KEYS - 简化版本,总是返回家具相关tabs');
|
||||
|
||||
// 简化逻辑:总是返回家具相关的tabs
|
||||
const furnitureTabs = ['furniture_reception', 'furniture_customer', 'ai_analysis', 'ucenter'];
|
||||
const furnitureTabs = ['ai_analysis', 'workbench', 'ucenter'];
|
||||
console.log('[TabBar][allowed] 简化逻辑 ->', furnitureTabs);
|
||||
return furnitureTabs;
|
||||
},
|
||||
// #ifdef H5
|
||||
toggleNativeTabs() {
|
||||
// H5 平台自定义 tabbar 不生效,直接根据角色显隐原生 tabbar 项
|
||||
// 当前位置顺序(根据 pages.json 中的 tabBar.list 顺序):接待、客户、AI分析、我的、团队、总结和统计…
|
||||
const ORDER = ['furniture_reception', 'furniture_customer', 'ai_analysis', 'ucenter', 'reception', 'customer', 'team', 'meeting_summary', 'common_begin_reception'];
|
||||
// 当前位置顺序(与 pages.json 的 tabBar.list 一致):AI分析、工作台、我的…
|
||||
const ORDER = ['ai_analysis', 'workbench', 'ucenter', 'reception', 'customer', 'team', 'meeting_summary', 'common_begin_reception'];
|
||||
const allowed = this.getAllowedKeys();
|
||||
// 限制重试次数,防止渲染时机未就绪
|
||||
this._h5TabRetries = (this._h5TabRetries || 0) + 1;
|
||||
@@ -326,10 +319,9 @@ export default {
|
||||
isInTabBar(pagePath) {
|
||||
// 检查页面路径是否在原生tabBar配置中
|
||||
const tabBarList = [
|
||||
'pages/furniture_reception/furniture_reception',
|
||||
'pages-subpackage/furniture_customer/furniture_customer',
|
||||
'pages/ai_analysis/ai_analysis',
|
||||
'pages/ucenter/ucenter'
|
||||
'pages/workbench/workbench',
|
||||
'pages/ucenter/ucenter',
|
||||
];
|
||||
const normalizedPath = pagePath.startsWith('/') ? pagePath.substring(1) : pagePath;
|
||||
const result = tabBarList.includes(normalizedPath);
|
||||
@@ -367,9 +359,8 @@ export default {
|
||||
const allElements = document.querySelectorAll('*');
|
||||
const tabElements = Array.from(allElements).filter(el =>
|
||||
el.textContent && (
|
||||
el.textContent.includes('接待') ||
|
||||
el.textContent.includes('客户') ||
|
||||
el.textContent.includes('AI分析') ||
|
||||
el.textContent.includes('工作台') ||
|
||||
el.textContent.includes('我的')
|
||||
)
|
||||
);
|
||||
@@ -406,9 +397,9 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
// 按文本内容排序:接待、客户、AI分析、我的
|
||||
// 按文本内容排序:AI分析、工作台、我的
|
||||
const sortedElements = tabElements.sort((a, b) => {
|
||||
const order = ['接待', '客户', 'AI分析', '我的'];
|
||||
const order = ['AI分析', '工作台', '我的'];
|
||||
const aIndex = order.findIndex(text => a.textContent.includes(text));
|
||||
const bIndex = order.findIndex(text => b.textContent.includes(text));
|
||||
return aIndex - bIndex;
|
||||
@@ -418,7 +409,7 @@ export default {
|
||||
|
||||
// 处理每个元素
|
||||
sortedElements.forEach((element, index) => {
|
||||
const keyMap = ['furniture_reception', 'furniture_customer', 'ai_analysis', 'ucenter'];
|
||||
const keyMap = ['ai_analysis', 'workbench', 'ucenter'];
|
||||
const key = keyMap[index];
|
||||
const shouldShow = allowed.includes(key);
|
||||
|
||||
|
||||
@@ -40,7 +40,12 @@
|
||||
</view>
|
||||
|
||||
<!-- 服务状态列表 -->
|
||||
<service-list-furniture v-if="activeTab === 'status'" class="service-status-container" :style="{ top: computedContentTop || contentTop }"></service-list-furniture>
|
||||
<service-list-furniture
|
||||
v-if="activeTab === 'status'"
|
||||
ref="serviceListRef"
|
||||
class="service-status-container"
|
||||
:style="{ top: computedContentTop || contentTop }"
|
||||
></service-list-furniture>
|
||||
|
||||
<!-- 开始接待表单 -->
|
||||
<common-begin-reception
|
||||
@@ -467,6 +472,21 @@ import ServiceListFurniture from "./serviceListFurniture.vue";
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 由宿主页 onShow / 分包就绪后调用。tab 页缓存时子列表的 mounted 不会重复执行,需在此主动拉取后端数据。
|
||||
*/
|
||||
refreshPageData() {
|
||||
this.$nextTick(() => {
|
||||
if (this.activeTab === 'status') {
|
||||
const list = this.$refs.serviceListRef;
|
||||
if (list && typeof list.onServiceStatusRefresh === 'function') {
|
||||
list.onServiceStatusRefresh();
|
||||
}
|
||||
} else if (this.activeTab === 'tag' && this.tagViewMode === 'list') {
|
||||
this.fetchTagList({ force: true });
|
||||
}
|
||||
});
|
||||
},
|
||||
applyIncomingTab(tab) {
|
||||
const allowed = ['status', 'reception', 'tag'];
|
||||
if (!allowed.includes(tab)) return;
|
||||
|
||||
@@ -82,13 +82,23 @@
|
||||
if (item.path) {
|
||||
// 判断是 tabBar 页面还是普通页面
|
||||
const tabBarPages = [
|
||||
'/pages/furniture_reception/furniture_reception',
|
||||
'/pages-subpackage/furniture_customer/furniture_customer',
|
||||
'/pages/furniture_top_sales/furniture_top_sales',
|
||||
'/pages/ucenter/ucenter'
|
||||
];
|
||||
|
||||
if (tabBarPages.includes(item.path)) {
|
||||
if (item.path === '/pages/furniture_reception/furniture_reception') {
|
||||
uni.navigateTo({
|
||||
url: item.path,
|
||||
fail: (err) => {
|
||||
console.error('跳转失败:', err);
|
||||
uni.showToast({
|
||||
title: '页面不存在',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
} else if (tabBarPages.includes(item.path)) {
|
||||
uni.switchTab({
|
||||
url: item.path,
|
||||
fail: (err) => {
|
||||
|
||||
13
pages.json
13
pages.json
@@ -10,6 +10,9 @@
|
||||
"path": "pages/furniture_reception/furniture_reception",
|
||||
"style": {
|
||||
"navigationStyle": "custom"
|
||||
},
|
||||
"componentPlaceholder": {
|
||||
"FurnitureReceptionImpl": "pages-subpackage/furniture_reception/furniture_reception-impl"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -440,12 +443,6 @@
|
||||
"borderStyle": "black",
|
||||
"backgroundColor": "#FFFFFF",
|
||||
"list": [
|
||||
{
|
||||
"pagePath": "pages/furniture_reception/furniture_reception",
|
||||
"iconPath": "static/tabbar/reception.png",
|
||||
"selectedIconPath": "static/tabbar/reception_active.png",
|
||||
"text": "接待"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/ai_analysis/ai_analysis",
|
||||
"iconPath": "static/tabbar/ai_analysis.png",
|
||||
@@ -454,8 +451,8 @@
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/workbench/workbench",
|
||||
"iconPath": "static/tabbar/team.svg",
|
||||
"selectedIconPath": "static/tabbar/team_active.svg",
|
||||
"iconPath": "static/tabbar/team.png",
|
||||
"selectedIconPath": "static/tabbar/team_active.png",
|
||||
"text": "工作台"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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
|
||||
})
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -528,7 +528,7 @@
|
||||
// 微信登录成功后跳转到首页
|
||||
setTimeout(() => {
|
||||
uni.switchTab({
|
||||
url: '/pages/furniture_reception/furniture_reception'
|
||||
url: '/pages/ai_analysis/ai_analysis'
|
||||
})
|
||||
}, 500);
|
||||
}).catch(err => {
|
||||
@@ -542,7 +542,7 @@
|
||||
// 即使获取用户信息失败,也要跳转
|
||||
setTimeout(() => {
|
||||
uni.switchTab({
|
||||
url: '/pages/furniture_reception/furniture_reception'
|
||||
url: '/pages/ai_analysis/ai_analysis'
|
||||
})
|
||||
}, 500);
|
||||
});
|
||||
|
||||
@@ -230,13 +230,13 @@
|
||||
console.warn('[Login] Failed to update global role info:', e);
|
||||
}
|
||||
|
||||
// 登录成功后跳转到首页(接待页面)
|
||||
// 登录成功后跳转到首页(tabBar 首页:AI分析)
|
||||
// 在微信小程序中增加延迟,确保store更新完全后再跳转
|
||||
// #ifdef MP-WEIXIN
|
||||
setTimeout(() => {
|
||||
console.log('[Login] Preparing to navigate after login, hasLogin:', store.hasLogin)
|
||||
uni.switchTab({
|
||||
url: '/pages/furniture_reception/furniture_reception',
|
||||
url: '/pages/ai_analysis/ai_analysis',
|
||||
success: () => {
|
||||
console.log('[Login] Navigation successful, checking login status after navigation')
|
||||
// 延迟检查,确保页面跳转完成后再检查状态
|
||||
@@ -253,7 +253,7 @@
|
||||
// #ifndef MP-WEIXIN
|
||||
setTimeout(() => {
|
||||
uni.switchTab({
|
||||
url: '/pages/furniture_reception/furniture_reception'
|
||||
url: '/pages/ai_analysis/ai_analysis'
|
||||
})
|
||||
}, 300)
|
||||
// #endif
|
||||
|
||||
4
unpackage/dist/build/mp-weixin/app.json
vendored
4
unpackage/dist/build/mp-weixin/app.json
vendored
@@ -100,8 +100,8 @@
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/workbench/workbench",
|
||||
"iconPath": "static/tabbar/team.svg",
|
||||
"selectedIconPath": "static/tabbar/team_active.svg",
|
||||
"iconPath": "static/tabbar/team.png",
|
||||
"selectedIconPath": "static/tabbar/team_active.png",
|
||||
"text": "工作台"
|
||||
},
|
||||
{
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user