微信小程序发布试用版本
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
|
||||
<view class="content">
|
||||
<!-- 标签页 -->
|
||||
<view class="tabs">
|
||||
<view class="tabs" :style="{ top: computedNavbarTop || navbarTop }">
|
||||
<view
|
||||
class="tab-item"
|
||||
:class="{ active: activeTab === 'status' }"
|
||||
@@ -40,7 +40,7 @@
|
||||
</view>
|
||||
|
||||
<!-- 服务状态列表 -->
|
||||
<service-list-furniture v-if="activeTab === 'status'" class="service-status-container"></service-list-furniture>
|
||||
<service-list-furniture v-if="activeTab === 'status'" class="service-status-container" :style="{ top: computedContentTop || contentTop }"></service-list-furniture>
|
||||
|
||||
<!-- 开始接待表单 -->
|
||||
<common-begin-reception
|
||||
@@ -54,6 +54,7 @@
|
||||
<!-- 标签管理 -->
|
||||
<scroll-view
|
||||
class="service-status-list tag-list"
|
||||
:style="{ top: computedContentTop || contentTop }"
|
||||
scroll-y
|
||||
v-if="activeTab === 'tag' && tagViewMode === 'list'"
|
||||
@scrolltolower="onTagListReachBottom">
|
||||
@@ -147,7 +148,7 @@
|
||||
</scroll-view>
|
||||
|
||||
<!-- 标签管理 - 添加/编辑标签表单 -->
|
||||
<view class="tag-management" v-if="activeTab === 'tag' && (tagViewMode === 'add' || tagViewMode === 'edit')">
|
||||
<view class="tag-management" :style="{ top: computedContentTop || contentTop }" v-if="activeTab === 'tag' && (tagViewMode === 'add' || tagViewMode === 'edit')">
|
||||
<!-- 添加标签表单 -->
|
||||
<scroll-view
|
||||
class="tag-form"
|
||||
@@ -276,6 +277,9 @@ import ServiceListFurniture from "./serviceListFurniture.vue";
|
||||
data() {
|
||||
return {
|
||||
activeTab: 'status',
|
||||
// 导航栏位置相关
|
||||
navbarTop: '88rpx', // 默认值,会在onLoad/onShow时动态计算
|
||||
contentTop: '160rpx', // 默认值,会在onLoad/onShow时动态计算
|
||||
receptionForm: {
|
||||
id: "",
|
||||
customerName: "",
|
||||
@@ -324,11 +328,152 @@ import ServiceListFurniture from "./serviceListFurniture.vue";
|
||||
showTagActionMenu: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 计算导航栏和内容区域的位置(使用计算属性确保响应式)
|
||||
computedNavbarTop() {
|
||||
console.log('[FurnitureReception][computedNavbarTop] 计算导航栏位置');
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
const statusBarHeight = systemInfo.statusBarHeight || 20;
|
||||
const navbarHeight = 44;
|
||||
const statusBarHeightRpx = statusBarHeight * 2;
|
||||
const navbarHeightRpx = navbarHeight * 2;
|
||||
const totalNavbarHeight = statusBarHeightRpx + navbarHeightRpx;
|
||||
const result = totalNavbarHeight + 'rpx';
|
||||
console.log('[FurnitureReception][computedNavbarTop] 计算结果:', {
|
||||
statusBarHeight,
|
||||
navbarHeight,
|
||||
totalNavbarHeight,
|
||||
result
|
||||
});
|
||||
return result;
|
||||
},
|
||||
computedContentTop() {
|
||||
console.log('[FurnitureReception][computedContentTop] 计算内容区域位置');
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
const statusBarHeight = systemInfo.statusBarHeight || 20;
|
||||
const navbarHeight = 44;
|
||||
const statusBarHeightRpx = statusBarHeight * 2;
|
||||
const navbarHeightRpx = navbarHeight * 2;
|
||||
const totalNavbarHeight = statusBarHeightRpx + navbarHeightRpx;
|
||||
const result = (totalNavbarHeight + 72) + 'rpx'; // tab栏高度72rpx
|
||||
console.log('[FurnitureReception][computedContentTop] 计算结果:', {
|
||||
statusBarHeight,
|
||||
navbarHeight,
|
||||
totalNavbarHeight,
|
||||
result
|
||||
});
|
||||
return result;
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
console.log('[FurnitureReception][onLoad] 页面加载');
|
||||
// 更新导航栏位置
|
||||
this.updateNavbarPosition();
|
||||
// 加载当前登录用户信息,填充销售姓名和电话
|
||||
this.loadCurrentUserInfo();
|
||||
},
|
||||
onShow() {
|
||||
console.log('[FurnitureReception][onShow] 页面显示');
|
||||
// 每次页面显示时都重新计算导航栏位置,确保通过导航菜单进入时也能正确显示
|
||||
// 使用 $nextTick 确保DOM更新后再设置样式
|
||||
this.$nextTick(() => {
|
||||
this.updateNavbarPosition();
|
||||
// 再次延迟更新,确保样式已应用
|
||||
setTimeout(() => {
|
||||
this.updateNavbarPosition();
|
||||
console.log('[FurnitureReception][onShow] 延迟更新后的位置:', {
|
||||
navbarTop: this.navbarTop,
|
||||
contentTop: this.contentTop,
|
||||
computedNavbarTop: this.computedNavbarTop,
|
||||
computedContentTop: this.computedContentTop
|
||||
});
|
||||
}, 50);
|
||||
});
|
||||
},
|
||||
onReady() {
|
||||
// 页面渲染完成后,检查tab栏是否显示
|
||||
console.log('[FurnitureReception][onReady] 页面渲染完成');
|
||||
console.log('[FurnitureReception][onReady] activeTab:', this.activeTab);
|
||||
console.log('[FurnitureReception][onReady] navbarTop:', this.navbarTop);
|
||||
console.log('[FurnitureReception][onReady] contentTop:', this.contentTop);
|
||||
console.log('[FurnitureReception][onReady] computedNavbarTop:', this.computedNavbarTop);
|
||||
console.log('[FurnitureReception][onReady] computedContentTop:', this.computedContentTop);
|
||||
|
||||
// 再次更新导航栏位置,确保渲染后位置正确
|
||||
this.updateNavbarPosition();
|
||||
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
console.log('[FurnitureReception][onReady] 系统信息:', {
|
||||
statusBarHeight: systemInfo.statusBarHeight,
|
||||
windowHeight: systemInfo.windowHeight,
|
||||
screenHeight: systemInfo.screenHeight
|
||||
});
|
||||
|
||||
// 检查tab栏元素是否存在和可见
|
||||
// #ifdef MP-WEIXIN
|
||||
setTimeout(() => {
|
||||
const query = uni.createSelectorQuery().in(this);
|
||||
query.select('.tabs').boundingClientRect((data) => {
|
||||
console.log('[FurnitureReception][onReady] tab栏元素信息:', data);
|
||||
if (!data) {
|
||||
console.error('[FurnitureReception][onReady] tab栏元素未找到!');
|
||||
} else {
|
||||
console.log('[FurnitureReception][onReady] tab栏位置:', {
|
||||
top: data.top,
|
||||
left: data.left,
|
||||
width: data.width,
|
||||
height: data.height,
|
||||
expectedTop: this.navbarTop,
|
||||
computedNavbarTop: this.computedNavbarTop,
|
||||
isVisible: data.width > 0 && data.height > 0,
|
||||
isOnScreen: data.top >= 0 && data.top < systemInfo.windowHeight
|
||||
});
|
||||
|
||||
// 如果tab栏不可见,强制更新位置
|
||||
if (data.width === 0 || data.height === 0 || data.top < 0) {
|
||||
console.warn('[FurnitureReception][onReady] tab栏不可见,强制更新位置');
|
||||
this.updateNavbarPosition();
|
||||
this.$forceUpdate();
|
||||
}
|
||||
}
|
||||
}).exec();
|
||||
}, 100);
|
||||
// #endif
|
||||
},
|
||||
methods: {
|
||||
// 计算并更新导航栏和内容区域的位置
|
||||
updateNavbarPosition() {
|
||||
console.log('[FurnitureReception][updateNavbarPosition] 开始更新导航栏位置');
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
const statusBarHeight = systemInfo.statusBarHeight || 20; // 默认20px
|
||||
const navbarHeight = 44; // navbar高度44px
|
||||
// 转换为rpx:1px = 2rpx(在375px设计稿下)
|
||||
const statusBarHeightRpx = statusBarHeight * 2;
|
||||
const navbarHeightRpx = navbarHeight * 2;
|
||||
const totalNavbarHeight = statusBarHeightRpx + navbarHeightRpx;
|
||||
|
||||
const navbarTop = totalNavbarHeight + 'rpx';
|
||||
const contentTop = (totalNavbarHeight + 72) + 'rpx'; // tab栏高度72rpx
|
||||
|
||||
console.log('[FurnitureReception][updateNavbarPosition] 更新导航栏位置:', {
|
||||
statusBarHeight: statusBarHeight,
|
||||
navbarHeight: navbarHeight,
|
||||
totalNavbarHeight: totalNavbarHeight,
|
||||
navbarTop: navbarTop,
|
||||
contentTop: contentTop,
|
||||
currentNavbarTop: this.navbarTop,
|
||||
currentContentTop: this.contentTop
|
||||
});
|
||||
|
||||
// 强制更新,确保响应式数据变化被检测到
|
||||
this.$set(this, 'navbarTop', navbarTop);
|
||||
this.$set(this, 'contentTop', contentTop);
|
||||
|
||||
// 在微信小程序中,可能需要强制更新视图
|
||||
// #ifdef MP-WEIXIN
|
||||
this.$forceUpdate();
|
||||
// #endif
|
||||
},
|
||||
/**
|
||||
* 加载当前登录用户信息,填充销售姓名和电话
|
||||
*/
|
||||
@@ -359,7 +504,20 @@ import ServiceListFurniture from "./serviceListFurniture.vue";
|
||||
}
|
||||
},
|
||||
goBack() {
|
||||
uni.navigateBack();
|
||||
// 检查页面栈,如果当前是第一个页面,则不能返回
|
||||
const pages = getCurrentPages();
|
||||
if (pages.length <= 1) {
|
||||
// 如果是第一个页面,不执行返回操作
|
||||
// 对于 tabBar 页面,通常不需要返回按钮,或者可以隐藏返回按钮
|
||||
console.log('[FurnitureReception][goBack] 当前是第一个页面,无法返回');
|
||||
return;
|
||||
}
|
||||
uni.navigateBack({
|
||||
fail: (err) => {
|
||||
console.error('[FurnitureReception][goBack] 返回失败:', err);
|
||||
// 如果返回失败,可能是页面栈问题,忽略错误
|
||||
}
|
||||
});
|
||||
},
|
||||
switchTab(tab) {
|
||||
this.activeTab = tab;
|
||||
@@ -818,20 +976,26 @@ import ServiceListFurniture from "./serviceListFurniture.vue";
|
||||
border-bottom: none !important;
|
||||
}
|
||||
|
||||
/* 标签页 - 使用绝对定位紧贴导航栏,消除红色空白区域 */
|
||||
/* 标签页 - 使用固定定位,确保显示在导航栏下方 */
|
||||
.tabs {
|
||||
display: flex;
|
||||
display: flex !important; /* 强制显示 */
|
||||
visibility: visible !important; /* 强制可见 */
|
||||
opacity: 1 !important; /* 强制不透明 */
|
||||
background-color: #FFFFFF;
|
||||
border-bottom: 1px solid #E0E0E0;
|
||||
padding: 0 16rpx;
|
||||
margin-top: 0;
|
||||
position: absolute;
|
||||
top: 88rpx;
|
||||
position: fixed; /* 改为fixed定位,确保始终可见 */
|
||||
/* 导航栏高度:statusBar + navbar,动态计算 */
|
||||
/* 使用内联样式动态设置top值 */
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 10; /* 确保标签页在最上层 */
|
||||
z-index: 999; /* 提高z-index确保在最上层 */
|
||||
height: 72rpx; /* 明确设置标签页高度 */
|
||||
box-sizing: border-box;
|
||||
align-items: center;
|
||||
/* 确保tab栏始终可见 */
|
||||
will-change: top; /* 优化渲染性能 */
|
||||
}
|
||||
|
||||
|
||||
@@ -863,9 +1027,9 @@ import ServiceListFurniture from "./serviceListFurniture.vue";
|
||||
|
||||
/* 服务状态列表容器 */
|
||||
.service-status-container {
|
||||
/* 使用绝对定位,从tab页底部开始,高度计算:100vh - 导航栏(88rpx) - tab页(72rpx) - 底部导航栏(96rpx) */
|
||||
/* 使用绝对定位,从tab页底部开始,高度计算:100vh - 导航栏 - tab页 - 底部导航栏(96rpx) */
|
||||
position: absolute;
|
||||
top: 160rpx; /* 导航栏(88rpx) + tab页(72rpx) = 160rpx */
|
||||
/* top值通过内联样式动态设置 */
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 96rpx; /* 底部导航栏高度 */
|
||||
@@ -873,9 +1037,9 @@ import ServiceListFurniture from "./serviceListFurniture.vue";
|
||||
|
||||
/* 标签管理列表区:使用绝对定位,与服务状态列表保持一致 */
|
||||
.tag-list {
|
||||
/* 使用绝对定位,从tab页底部开始,高度计算:100vh - 导航栏(88rpx) - tab页(72rpx) - 底部导航栏(96rpx) */
|
||||
/* 使用绝对定位,从tab页底部开始,高度计算:100vh - 导航栏 - tab页 - 底部导航栏(96rpx) */
|
||||
position: absolute;
|
||||
top: 160rpx; /* 导航栏(88rpx) + tab页(72rpx) = 160rpx */
|
||||
/* top值通过内联样式动态设置 */
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 96rpx; /* 底部导航栏高度 */
|
||||
@@ -1074,9 +1238,9 @@ import ServiceListFurniture from "./serviceListFurniture.vue";
|
||||
|
||||
/* 标签管理样式 - 添加表单 */
|
||||
.tag-management {
|
||||
/* 使用绝对定位,从tab页底部开始,高度计算:100vh - 导航栏(88rpx) - tab页(72rpx) - 底部导航栏(96rpx) */
|
||||
/* 使用绝对定位,从tab页底部开始,高度计算:100vh - 导航栏 - tab页 - 底部导航栏(96rpx) */
|
||||
position: absolute;
|
||||
top: 160rpx; /* 导航栏(88rpx) + tab页(72rpx) = 160rpx */
|
||||
/* top值通过内联样式动态设置 */
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 96rpx; /* 底部导航栏高度 */
|
||||
|
||||
Reference in New Issue
Block a user