<script setup>
import { useStatus } from '@/store/status'
import { useUserStore } from '@/store'
import { useProvideUserModal } from '@/hooks'
import {useAuth} from "@/store/auth";
const {token} = useAuth()
import ws from '@/connect'
const { statusBarHeight } = useStatus()
const { uid, isShow } = useProvideUserModal()
const userStore = useUserStore()
const root = document.documentElement
root.style.setProperty('--statusBarHeight', `${statusBarHeight.value}px`)
const handleWebview = () => {
  let statusBarHeight_ = window?.plus?.navigator?.getStatusbarHeight()
  const webview = plus.webview.currentWebview()
  // webview.setStyle({
  //   top: statusBarHeight_,
  //   bottom: 0,
  // })
  console.log("webview", webview)
  token.value = webview.token
  userStore.loadSetting()
  ws.connect()
}
const init = () => {
  if (typeof plus !== 'undefined') {
    handleWebview()
  } else {
    document.addEventListener('plusready', () => {
      handleWebview()
    })
  }
}
init()
</script>
<style lang="scss">
@import '@/static/css/color.scss';
@import '@/static/css/font.scss';
/* #ifdef APP-NVUE */
@import '@/uni_modules/tmui/scss/nvue.css';
/* #endif */
/* #ifndef APP-NVUE */
@import '@/uni_modules/tmui/scss/noNvue.css';
/* #endif */
* {
  box-sizing: border-box;
}
/*解决阅览图片关闭按钮会显示在状态栏区域的问题*/
#u-a-p > div > div {
  margin-top: var(--statusBarHeight);
}
/*不显示滚动条的类*/
.no-scroll {
  -ms-overflow-style: none; /* IE 和 Edge */
  scrollbar-width: none; /* Firefox */
}
.no-scroll::-webkit-scrollbar {
  display: none; /* Webkit 浏览器 */
}
</style>
