feat(ui): 新增/优化界面样式、图标及交互组件
- 新增多个功能图标(箭头、盾牌、位置等) - 优化全局按钮、标签、输入框等组件样式 - 修复导航栏高度计算逻辑,适配微信小程序 - 优化消息页、订单页、个人中心等页面布局 - 修复微信支付配置及通知接口问题
这个提交包含在:
@@ -25,6 +25,57 @@ export function getWindowInfoSafe() {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一获取自定义导航栏精确尺寸(确保全站 TopBar 与页面吸顶元素 100% 零误差对齐,
|
||||
* 并防御微信开发者工具切换模拟器机型时 statusBarHeight 与胶囊 menu.top 不匹配的异常)
|
||||
*/
|
||||
export function getNavBarMetrics() {
|
||||
let statusBarHeight = 20;
|
||||
let navBarHeight = 44;
|
||||
let rightSpaceWidth = 16;
|
||||
let leftWidth = 50;
|
||||
|
||||
try {
|
||||
const sys = getWindowInfoSafe();
|
||||
const winWidth = (sys && sys.windowWidth) ? sys.windowWidth : 375;
|
||||
if (sys && sys.statusBarHeight) {
|
||||
statusBarHeight = sys.statusBarHeight;
|
||||
}
|
||||
// #ifdef MP-WEIXIN
|
||||
if (typeof uni.getMenuButtonBoundingClientRect === 'function') {
|
||||
const menu = uni.getMenuButtonBoundingClientRect();
|
||||
if (menu && menu.top > 0 && menu.height > 0 && menu.width > 0) {
|
||||
// 校验 statusBarHeight 与胶囊 top 的间距是否在合理范围 (4px~12px)
|
||||
// 若模拟器切换机型导致 statusBarHeight >= menu.top,则以胶囊真实物理位置反推,确保标题与胶囊永远同轴居中且不贴底
|
||||
let gap = menu.top - statusBarHeight;
|
||||
if (gap < 4 || gap > 12) {
|
||||
gap = 6;
|
||||
statusBarHeight = Math.max(20, menu.top - gap);
|
||||
}
|
||||
navBarHeight = menu.height + gap * 2;
|
||||
const rightMargin = (winWidth - menu.right) > 0 ? (winWidth - menu.right) : 7;
|
||||
rightSpaceWidth = menu.width + rightMargin * 2;
|
||||
leftWidth = Math.max(50, rightSpaceWidth);
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
} catch (e) {
|
||||
statusBarHeight = 20;
|
||||
navBarHeight = 44;
|
||||
rightSpaceWidth = 16;
|
||||
leftWidth = 50;
|
||||
}
|
||||
|
||||
return {
|
||||
statusBarHeight,
|
||||
navBarHeight,
|
||||
totalNavHeight: statusBarHeight + navBarHeight,
|
||||
rightSpaceWidth,
|
||||
leftWidth
|
||||
};
|
||||
}
|
||||
|
||||
export default {
|
||||
getWindowInfoSafe
|
||||
getWindowInfoSafe,
|
||||
getNavBarMetrics
|
||||
};
|
||||
|
||||
在新工单中引用
屏蔽一个用户