chat-app/src/App.vue

66 lines
1.8 KiB
Vue
Raw Normal View History

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