本次更新主要内容: 1. 新增举报功能,支持举报信息和评价,包含防重复提交和频控保护 2. 新增我的举报页面,展示用户提交的举报记录 3. 新增平台客服弹窗,支持微信在线客服和电话客服 4. 优化消息通知,支持跳转业务页面 5. 新增举报原因字典配置,支持自定义举报原因 6. 修复服务电话默认值问题,移除硬编码兜底 7. 新增相关图标和页面组件,完善用户体验
79 行
2.1 KiB
JavaScript
79 行
2.1 KiB
JavaScript
/**
|
|
* 顶部导航栏与胶囊避让度量工具
|
|
* 规范化统一各页面的 Topbar 状态栏高度、导航栏高度及微信小程序右上角胶囊避让
|
|
*/
|
|
|
|
/**
|
|
* 获取当前设备与平台环境下的导航栏尺寸度量
|
|
* @returns {Object} 包含 statusBarHeight, navBarHeight, capsulePadding, capsuleWidth, capsuleHeight, capsuleTop, totalHeight
|
|
*/
|
|
export function getNavMetrics() {
|
|
let statusBarHeight = 0
|
|
let navBarHeight = 44
|
|
let capsulePadding = 0
|
|
let capsuleWidth = 0
|
|
let capsuleHeight = 32
|
|
let capsuleTop = 6
|
|
let capsuleRight = 0
|
|
|
|
try {
|
|
// #ifdef H5
|
|
// 浏览器环境下通常无需模拟系统状态栏,状态栏高度置 0,导航栏高度固定 44px
|
|
statusBarHeight = 0
|
|
navBarHeight = 44
|
|
capsulePadding = 0
|
|
// #endif
|
|
|
|
// #ifndef H5
|
|
let sys = null
|
|
if (typeof uni.getWindowInfo === 'function') {
|
|
sys = uni.getWindowInfo()
|
|
} else if (typeof uni.getSystemInfoSync === 'function') {
|
|
sys = uni.getSystemInfoSync()
|
|
}
|
|
if (sys && sys.statusBarHeight) {
|
|
statusBarHeight = sys.statusBarHeight
|
|
}
|
|
|
|
// #ifdef MP-WEIXIN || MP
|
|
if (typeof uni.getMenuButtonBoundingClientRect === 'function') {
|
|
const menu = uni.getMenuButtonBoundingClientRect()
|
|
if (menu && menu.width && menu.top) {
|
|
capsuleWidth = menu.width
|
|
capsuleHeight = menu.height
|
|
capsuleTop = menu.top
|
|
const winWidth = (sys && sys.windowWidth) ? sys.windowWidth : 375
|
|
capsuleRight = winWidth - menu.right
|
|
// 右侧避让距离 = 胶囊宽度 + 胶囊右边距 + 左右视觉留白间隙(8px)
|
|
capsulePadding = (winWidth - menu.left) + 8
|
|
|
|
// 胶囊垂直居中时的标准导航条高度:上下边距对称 (menu.top - statusBarHeight) * 2 + menu.height
|
|
const barH = (menu.top - statusBarHeight) * 2 + menu.height
|
|
if (barH >= 38 && barH <= 64) {
|
|
navBarHeight = barH
|
|
}
|
|
} else {
|
|
capsulePadding = 96
|
|
}
|
|
}
|
|
// #endif
|
|
// #endif
|
|
} catch (e) {
|
|
capsulePadding = 0
|
|
}
|
|
|
|
return {
|
|
statusBarHeight,
|
|
navBarHeight,
|
|
capsulePadding,
|
|
capsuleWidth,
|
|
capsuleHeight,
|
|
capsuleTop,
|
|
totalHeight: statusBarHeight + navBarHeight,
|
|
}
|
|
}
|
|
|
|
export default {
|
|
getNavMetrics,
|
|
}
|