|
|
@ -92,11 +92,6 @@ const ensureAIchat = () => { |
|
|
|
}; |
|
|
|
|
|
|
|
// 获取次数 |
|
|
|
// const UserCount = ref(0); |
|
|
|
// const getUserCount = async () => { |
|
|
|
// const result = await getUserCountAPI({ token: localStorage.getItem('localToken') }); |
|
|
|
// UserCount.value = result.data.hasCount; |
|
|
|
// }; |
|
|
|
const UserCount = computed(() => chatStore.UserCount) |
|
|
|
|
|
|
|
|
|
|
@ -281,20 +276,6 @@ setTimeout(() => { |
|
|
|
fnGetToken() |
|
|
|
}, 800) |
|
|
|
|
|
|
|
// const tabContainer = tabContent.value |
|
|
|
// let befortop = 0 |
|
|
|
// tabContainer.addEventListener('scroll', () => { |
|
|
|
// const aftertop = tabContainer.scrollTop |
|
|
|
// if (aftertop - befortop > 0) { |
|
|
|
// console.log('向下滚动') |
|
|
|
// isScrolling.value = true |
|
|
|
// } else { |
|
|
|
// console.log('向上滚动') |
|
|
|
// isScrolling.value = false |
|
|
|
// } |
|
|
|
// befortop = aftertop |
|
|
|
// }) |
|
|
|
|
|
|
|
const heightListener = () => { |
|
|
|
const tabContainer = tabContent.value; |
|
|
|
let befortop = 0; |
|
|
@ -330,87 +311,6 @@ const heightListener = () => { |
|
|
|
|
|
|
|
const throttledHeightListener = _.throttle(heightListener, 500, { trailing: false }); |
|
|
|
|
|
|
|
// 优化后的输入框焦点处理方法 |
|
|
|
// const handleInputFocus = () => { |
|
|
|
// console.log('设置输入框焦点监听'); |
|
|
|
// const inputElement = document.querySelector('#input'); |
|
|
|
// if (!inputElement) return; |
|
|
|
|
|
|
|
// // 判断是否为移动设备 |
|
|
|
// const isMobileDevice = /phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone/i.test( |
|
|
|
// navigator.userAgent |
|
|
|
// ); |
|
|
|
// console.log('是否为移动设备:', isMobileDevice, navigator.userAgent); |
|
|
|
|
|
|
|
// if (isMobileDevice) { |
|
|
|
// console.log('检测到移动设备,应用键盘适配'); |
|
|
|
|
|
|
|
// // 设置页面视窗 |
|
|
|
// const meta = document.querySelector('meta[name="viewport"]'); |
|
|
|
// if (!meta) { |
|
|
|
// const newMeta = document.createElement('meta'); |
|
|
|
// newMeta.name = 'viewport'; |
|
|
|
// newMeta.content = 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover'; |
|
|
|
// document.getElementsByTagName('head')[0].appendChild(newMeta); |
|
|
|
// } else { |
|
|
|
// meta.content = 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover'; |
|
|
|
// } |
|
|
|
|
|
|
|
// // 初始化页面高度 |
|
|
|
// updateAppHeight(); |
|
|
|
|
|
|
|
// // 检测是否为iOS设备 |
|
|
|
// const isIOS = /iPhone|iPad|iPod|ios/i.test(navigator.userAgent); |
|
|
|
// console.log('是否为iOS设备:', isIOS); |
|
|
|
|
|
|
|
// if (isIOS) { |
|
|
|
// console.log('iOS设备特殊处理开始'); |
|
|
|
// // 使用 visualViewport API 监测视口变化 |
|
|
|
// if (window.visualViewport) { |
|
|
|
// window.visualViewport.addEventListener('resize', () => { |
|
|
|
// const headerHeight = document.querySelector('.el-header').offsetHeight; |
|
|
|
// const footerHeight = document.querySelector('.el-footer').offsetHeight; |
|
|
|
// const keyboardHeight = window.visualViewport.height; // 获取虚拟键盘高度 |
|
|
|
// const totalHeight = headerHeight + footerHeight; // 头部和底部的总高度 |
|
|
|
|
|
|
|
// // 计算 el-main 的新高度 |
|
|
|
// const newMainHeight = window.innerHeight - totalHeight - keyboardHeight; |
|
|
|
|
|
|
|
// // 设置 el-main 的高度 |
|
|
|
// document.querySelector('.el-main').style.height = `${newMainHeight}px`; |
|
|
|
// }); |
|
|
|
// } |
|
|
|
|
|
|
|
// } else { |
|
|
|
// // Android设备处理 |
|
|
|
// console.log('Android设备处理'); |
|
|
|
// window.addEventListener('resize', _.debounce(() => { |
|
|
|
// console.log('窗口大小改变:', window.innerHeight); |
|
|
|
// updateAppHeight(); |
|
|
|
|
|
|
|
// // 尝试在键盘弹出后滚动到输入框位置 |
|
|
|
// const msgInput = document.querySelector('.msg-input'); |
|
|
|
// if (document.activeElement === msgInput) { |
|
|
|
// setTimeout(() => { |
|
|
|
// console.log('滚动到输入框位置'); |
|
|
|
// inputElement.scrollIntoView({ block: 'end', behavior: 'smooth' }); |
|
|
|
|
|
|
|
// const tabContentElement = document.querySelector('.tab-content'); |
|
|
|
// if (tabContentElement) { |
|
|
|
// tabContentElement.scrollTop = tabContentElement.scrollHeight; |
|
|
|
// } |
|
|
|
// }, 200); |
|
|
|
// } |
|
|
|
// }, 100)); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// }; |
|
|
|
|
|
|
|
// function updateAppHeight() { |
|
|
|
// const vh = window.innerHeight; |
|
|
|
// document.documentElement.style.setProperty('--app-height', `${vh}px`); |
|
|
|
// } |
|
|
|
|
|
|
|
const adjustFooterPosition = (height) => { |
|
|
|
console.log('调整底部位置', height) |
|
|
|
const footer = document.querySelector('.el-footer'); |
|
|
@ -439,19 +339,19 @@ const adjustFooterPosition = (height) => { |
|
|
|
body.style.overflow = 'hidden'; |
|
|
|
}, 200) |
|
|
|
|
|
|
|
console.log(html.offsetHeight, 'html') |
|
|
|
console.log(html.clientHeight, 'html') |
|
|
|
console.log(html.scrollHeight, 'htmlScrollHeight') |
|
|
|
console.log(body.clientHeight, 'body') |
|
|
|
console.log(body.scrollHeight, 'bodyScrollHeight') |
|
|
|
console.log(homePage.offsetHeight, 'homePage') |
|
|
|
console.log(homePage.clientHeight, 'homePageClientHeight') |
|
|
|
console.log(homePage.scrollHeight, 'homePageScrollHeight') |
|
|
|
console.log(window.innerHeight, 'window.innerHeight') |
|
|
|
console.log(window.visualViewport.height, 'window.visualViewport.height') |
|
|
|
console.log(main.offsetHeight, 'main') |
|
|
|
console.log(main.clientHeight, 'mainClientHeight') |
|
|
|
console.log(main.scrollHeight, 'mainScrollHeight') |
|
|
|
// console.log(html.offsetHeight, 'html') |
|
|
|
// console.log(html.clientHeight, 'html') |
|
|
|
// console.log(html.scrollHeight, 'htmlScrollHeight') |
|
|
|
// console.log(body.clientHeight, 'body') |
|
|
|
// console.log(body.scrollHeight, 'bodyScrollHeight') |
|
|
|
// console.log(homePage.offsetHeight, 'homePage') |
|
|
|
// console.log(homePage.clientHeight, 'homePageClientHeight') |
|
|
|
// console.log(homePage.scrollHeight, 'homePageScrollHeight') |
|
|
|
// console.log(window.innerHeight, 'window.innerHeight') |
|
|
|
// console.log(window.visualViewport.height, 'window.visualViewport.height') |
|
|
|
// console.log(main.offsetHeight, 'main') |
|
|
|
// console.log(main.clientHeight, 'mainClientHeight') |
|
|
|
// console.log(main.scrollHeight, 'mainScrollHeight') |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|