<script setup>
import {onLaunch, onShow, onHide} from '@dcloudio/uni-app'
import {reactive, provide, inject} from 'vue'

//定义全局数据
const globalData = reactive({
  appName: '超邦手工单系统',
  appIcon: 'https://jl-td.oss-cn-chengdu.aliyuncs.com/uploads/20250325/77e65857af564c0dda57e1a195da19c3.png',
  statusBarH: '',
  customBarH: ''
})
provide('globalData', globalData)

onLaunch(() => {
  // console.log('App Launch')
  initSysInfo()
})
onShow(() => {
  // console.log('App Show')
})
onHide(() => {
  // console.log('App Hide')
})

const initSysInfo = () => {
  // 获取手机状态栏高度
  let statusBar = uni.getWindowInfo().statusBarHeight
  let customBar

  // 获取胶囊按钮的布局位置信息
  let menu = wx.getMenuButtonBoundingClientRect()
  // 导航栏高度 = 胶囊下距离 + 胶囊上距离 - 状态栏高度
  customBar = menu.bottom + menu.top - statusBar

  const globalData = inject('globalData')
  globalData.statusBarH = statusBar
  globalData.customBarH = customBar
}
</script>

<style lang="scss">
@import "/static/css/common.scss";
@import "/static/css/form.scss";
@import '/theme/theme.scss';

page {
  background-color: var(--pageBgColor);
}

</style>
