处理聊天在webview打开时底部tabbar

This commit is contained in:
wangyifeng 2025-03-14 17:05:05 +08:00
parent 3fe60616a5
commit cba592b87d
10 changed files with 93 additions and 43 deletions

2
components.d.ts vendored
View File

@ -30,6 +30,8 @@ declare module 'vue' {
LoginMessage: typeof import('./src/components/talk/message/LoginMessage.vue')['default']
Message: typeof import('./src/components/x-message/message/index.vue')['default']
MixedMessage: typeof import('./src/components/talk/message/MixedMessage.vue')['default']
NButton: typeof import('naive-ui')['NButton']
NIcon: typeof import('naive-ui')['NIcon']
PageAnimation: typeof import('./src/components/page-animation/index.vue')['default']
RevokeMessage: typeof import('./src/components/talk/message/RevokeMessage.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']

View File

@ -11,12 +11,12 @@ const userStore = useUserStore()
const root = document.documentElement
root.style.setProperty('--statusBarHeight', `${statusBarHeight.value}px`)
const handleWebview = () => {
let statusBarHeight = window?.plus?.navigator?.getStatusbarHeight()
let statusBarHeight_ = window?.plus?.navigator?.getStatusbarHeight()
const webview = plus.webview.currentWebview()
webview.setStyle({
top: statusBarHeight,
bottom: 0,
})
// webview.setStyle({
// top: statusBarHeight_,
// bottom: 0,
// })
// console.log(webview)
token.value = webview.token
}

View File

@ -2,8 +2,11 @@
<div class="choose-deps-page">
<zPaging ref="zPaging" :show-scrollbar="false">
<template #top>
<div :class="state.chooseMode === 3 ? 'top_bg': ''">
<customNavbar :class="state.chooseMode === 3 ? 'index_top_navbar': ''" :title="pageTitle"></customNavbar>
<div :class="state.chooseMode === 3 ? 'top_bg' : ''">
<customNavbar
:class="state.chooseMode === 3 ? 'index_top_navbar' : ''"
:title="pageTitle"
></customNavbar>
<div class="pl-[32rpx] pr-[32rpx] pt-[32rpx] pb-[32rpx]">
<customInput
:searchText="searchVal"
@ -14,33 +17,33 @@
</template>
<div class="choose-deps">
<div class="w-full pl-[32rpx] pr-[32rpx]">
<div
v-if="crumbs.length"
class="w-full overflow-x-auto mt-[22rpx] leading-[48rpx] text-[#2F2F2F] flex items-center no-scrollbar"
ref="crumbsContainer"
>
<div
v-if="crumbs.length"
class="w-full overflow-x-auto mt-[22rpx] leading-[48rpx] text-[#2F2F2F] flex items-center no-scrollbar"
ref="crumbsContainer"
v-for="(item, index) in crumbs"
class="flex items-center text-[28rpx] leading-[48rpx] whitespace-nowrap"
:class="[
index === crumbsIndex ? 'text-[#747474]' : 'text-[#46299D]',
index === 0 ? '' : 'ml-[12rpx]',
]"
@click="handleCrumbsClick(index)"
>
<div>{{ item.name }}</div>
<div
v-for="(item, index) in crumbs"
class="flex items-center text-[28rpx] leading-[48rpx] whitespace-nowrap"
:class="[
index === crumbsIndex ? 'text-[#747474]' : 'text-[#46299D]',
index === 0 ? '' : 'ml-[12rpx]',
]"
@click="handleCrumbsClick(index)"
v-if="index !== crumbs.length - 1"
class="ml-[20rpx] flex items-center mb-[2rpx]"
>
<div>{{ item.name }}</div>
<div
v-if="index !== crumbs.length - 1"
class="ml-[20rpx] flex items-center mb-[2rpx]"
>
<tm-icon
name="tmicon-angle-right"
:font-size="20"
:color="index !== crumbs.length - 1 ? '#7A58DE' : '#C1B4EA'"
></tm-icon>
</div>
<tm-icon
name="tmicon-angle-right"
:font-size="20"
:color="index !== crumbs.length - 1 ? '#7A58DE' : '#C1B4EA'"
></tm-icon>
</div>
</div>
</div>
<div
v-if="
(state.chooseMode === 1 || state.chooseMode === 2) &&
@ -460,6 +463,7 @@ import downDep from '@/static/image/chatList/downDep.png'
import downDepDis from '@/static/image/chatList/downDepDis.png'
import checkBox from '@/components/checkBox/index.vue'
import lodash from 'lodash'
import { handleSetWebviewStyle } from '@/utils/common'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
@ -990,6 +994,7 @@ const checkCurrentItem = (item) => {
}
onMounted(() => {
handleSetWebviewStyle()
init()
})
@ -1106,18 +1111,18 @@ const toUserDetail = (userItem) => {
height: 100%;
display: flex;
}
::v-deep .index_top_navbar .tmicon-angle-left{
color:#fff !important;
::v-deep .index_top_navbar .tmicon-angle-left {
color: #fff !important;
}
::v-deep .index_top_navbar .text-weight-b{
color:#fff !important;
::v-deep .index_top_navbar .text-weight-b {
color: #fff !important;
}
::v-deep .index_top_navbar .statusHeightTop > .noNvueBorder:first-child {
background: transparent !important;
border: none !important;
}
.top_bg{
.top_bg {
background: url('@/static/image/mine/page_top.png') no-repeat;
background-size: cover;
background-position: bottom center;

View File

@ -186,7 +186,7 @@ import customBtn from '@/components/custom-btn/custom-btn.vue'
import groupMemberList from '../chatSettings/components/groupMembersList.vue'
import avatarModule from '@/components/avatar-module/index.vue'
import { ref, watch, computed } from 'vue'
import { ref, watch, computed, onMounted } from 'vue'
import { onShow, onLoad } from '@dcloudio/uni-app'
import { useChatList } from '@/store/chatList/index.js'
import { useAuth } from '@/store/auth'
@ -195,6 +195,7 @@ import addCircle from '@/static/image/chatList/addCircle.png'
import cahtPopover from '@/static/image/chatList/cahtPopover.png'
import { ServeCreateGroup } from '@/api/group/index'
import { useGroupTypeStore } from '@/store/groupType'
import { handleSetWebviewStyle } from '@/utils/common'
const {
groupName,
@ -217,6 +218,10 @@ onLoad(()=> {
groupStore.$reset()
})
onMounted(() => {
handleSetWebviewStyle()
})
//
const groupType = computed(() => {
let group_type = ''

View File

@ -1315,6 +1315,19 @@ const isLeader = computed(() => {
})
onMounted(async () => {
if (typeof plus !== 'undefined') {
const webview = plus.webview.currentWebview()
webview.setStyle({
bottom: 0,
})
} else {
document.addEventListener('plusready', () => {
const webview = plus.webview.currentWebview()
webview.setStyle({
bottom: 0,
})
})
}
nextTick(() => {
state.value.mentionSelectHeight = pxTorPx(
uni.getSystemInfoSync().windowHeight * 0.86,

View File

@ -131,6 +131,7 @@ import addCircle from '@/static/image/chatList/addCircle.png'
import cahtPopover from '@/static/image/chatList/cahtPopover.png'
import zu3289 from '@/static/image/chatList/zu3289@2x.png'
import ZPaging from '@/uni_modules/z-paging/components/z-paging/z-paging.vue'
import { handleSetWebviewStyle } from '@/utils/common'
const paging = ref()
const isEmptyViewShow = ref(false)
const talkStore = useTalkStore()
@ -214,6 +215,7 @@ const toAddressBookPage = () => {
); */
onShow(() => {
handleSetWebviewStyle(true)
//
talkStore
.loadTalkList()

View File

@ -14,6 +14,12 @@
<script setup>
import searchList from './components/searchList.vue'
import { ServeSeachQueryAll } from '@/api/search/index'
import { onMounted } from 'vue'
import { handleSetWebviewStyle } from '@/utils/common'
onMounted(() => {
handleSetWebviewStyle()
})
//
const toMoreResultPage = (searchResultKey, searchText) => {

View File

@ -4,8 +4,8 @@ import { userInfoApi } from "@/api/user";
import {ref} from 'vue'
export const useAuth = createGlobalState(() => {
// const token = useStorage('token', '', uniStorage)
const token = ref("79b5c732d96d2b27a48a99dfd4a5566c43aaa5796242e854ebe3ffc198d6876b9628e7b764d9af65ab5dbb2d517ced88170491b74b048c0ba827c0d3741462cb89dc59ed46653a449af837a8262941caaef1334d640773710f8cd96473bacfb190cba595a5d6a9c87d70f0999a3ebb41147213b31b4bdccffca66a56acf3baab5af0154f0dce360079f37709f78e13711036899344bddb0fb4cf0f2890287cb62c3fcbe33368caa5e213624577be8b8420ab75b1f50775ee16142a4321c5d56995f37354a66a969da98d95ba6e65d142ed097e04b411c1ebad2f62866d0ec7e1838420530a9941dbbcd00490199f8b8942f76b6f248056e8ae1134eda922b6ba0e5d75a00b2e866b08fec48a0d1de7e6dff8d8a40ac1eb46bf79c6331a1a3cd43209d09865bc0ee5dc9c23d2413e0d85d2380202ce4de1e128063926efae4cb1")
const token = useStorage('token', '', uniStorage)
// const token = ref("79b5c732d96d2b27a48a99dfd4a5566c43aaa5796242e854ebe3ffc198d6876b9628e7b764d9af65ab5dbb2d517ced88170491b74b048c0ba827c0d3741462cb89dc59ed46653a449af837a8262941caaef1334d640773710f8cd96473bacfb190cba595a5d6a9c87d70f0999a3ebb41147213b31b4bdccffca66a56acf3baab5af0154f0dce360079f37709f78e13711036899344bddb0fb4cf0f2890287cb62c3fcbe33368caa5e213624577be8b8420ab75b1f50775ee16142a4321c5d56995f37354a66a969da98d95ba6e65d142ed097e04b411c1ebad2f62866d0ec7e1838420530a9941dbbcd00490199f8b8942f76b6f248056e8ae1134eda922b6ba0e5d75a00b2e866b08fec48a0d1de7e6dff8d8a40ac1eb46bf79c6331a1a3cd43209d09865bc0ee5dc9c23d2413e0d85d2380202ce4de1e128063926efae4cb1")
const refreshToken = useStorage('refreshToken', '', uniStorage)
const userInfo = useStorage('userInfo', {}, uniStorage)
const leaderList = useStorage('leaderList', [], uniStorage)

View File

@ -64,7 +64,7 @@ export function clipboard(text, callback) {
export async function clipboardImage(src, callback) {
const { state } = await navigator.permissions.query({
name: 'clipboard-write'
name: 'clipboard-write',
})
if (state != 'granted') return
@ -77,8 +77,8 @@ export async function clipboardImage(src, callback) {
if (blob.type == 'image/png') {
await navigator.clipboard.write([
new ClipboardItem({
[blob.type]: blob
})
[blob.type]: blob,
}),
])
return callback()
@ -112,7 +112,7 @@ export async function clipboardImage(src, callback) {
URL.revokeObjectURL(objectURL)
},
'image/png',
1
1,
)
}
} catch (err) {
@ -180,13 +180,13 @@ export function getVideoImage(file, time = 1) {
width: video.videoWidth,
height: video.videoHeight,
duration: video.duration,
file: null
file: null,
}
canvas.toBlob((blob) => {
data.file = new File([blob], 'image.jpeg', {
type: blob.type,
lastModified: Date.now()
lastModified: Date.now(),
})
URL.revokeObjectURL(objectURL)
@ -196,3 +196,20 @@ export function getVideoImage(file, time = 1) {
}
})
}
//处理webview样式
export function handleSetWebviewStyle(hasTabBar) {
const setWebviewStyle = () => {
const webview = plus.webview.currentWebview()
webview.setStyle({
bottom: hasTabBar ? webview.tabBarHeight : 0,
})
}
if (typeof plus !== 'undefined') {
setWebviewStyle()
} else {
document.addEventListener('plusready', () => {
setWebviewStyle()
})
}
}

View File

@ -7,7 +7,7 @@ const request = axios.create({
baseURL: import.meta.env.VITE_BASEURL,
// 请求超时时间
timeout: 10000
timeout: 60000
})
let once = false