|
@@ -813,12 +813,16 @@ export default {
|
|
|
}
|
|
|
this.initData();
|
|
|
// 计算默认marginTop
|
|
|
- const defaultMarginTop =
|
|
|
- (Math.round(this.$refs.topTd[0].getBoundingClientRect().height) - 18) *
|
|
|
- 10 +
|
|
|
- 28;
|
|
|
+ const topTdHeight = this.$refs.topTd[0].getBoundingClientRect().height;
|
|
|
+ const defaultMarginTop = (Math.round(topTdHeight) - 18) * 10 + 28;
|
|
|
this.marginTop = defaultMarginTop;
|
|
|
|
|
|
+ console.log('=== mounted调试信息 ===');
|
|
|
+ console.log('topTd元素高度:', topTdHeight);
|
|
|
+ console.log('计算过程:', `(${Math.round(topTdHeight)} - 18) * 10 + 28 = ${defaultMarginTop}`);
|
|
|
+ console.log('最终marginTop:', this.marginTop);
|
|
|
+ console.log('========================');
|
|
|
+
|
|
|
// 根据分辨率设置样式
|
|
|
this.setStyleByResolution();
|
|
|
|
|
@@ -1460,7 +1464,26 @@ export default {
|
|
|
const screenWidth = window.screen.width;
|
|
|
const screenHeight = window.screen.height;
|
|
|
|
|
|
- console.log('当前分辨率:', screenWidth + 'x' + screenHeight);
|
|
|
+ console.log('=== 调试信息 ===');
|
|
|
+ console.log('屏幕分辨率:', screenWidth + 'x' + screenHeight);
|
|
|
+ console.log('浏览器缩放比例:', window.devicePixelRatio);
|
|
|
+ console.log('实际窗口尺寸:', window.innerWidth + 'x' + window.innerHeight);
|
|
|
+ console.log('计算的marginTop:', this.marginTop);
|
|
|
+ console.log('topTd元素高度:', this.$refs.topTd ? this.$refs.topTd[0].getBoundingClientRect().height : '未获取到');
|
|
|
+
|
|
|
+ // DPI相关调试信息
|
|
|
+ console.log('=== DPI调试信息 ===');
|
|
|
+ console.log('devicePixelRatio (设备像素比):', window.devicePixelRatio);
|
|
|
+ console.log('CSS像素与物理像素比例:', 1 / window.devicePixelRatio);
|
|
|
+ console.log('屏幕物理尺寸 (英寸):', {
|
|
|
+ width: screenWidth / (96 * window.devicePixelRatio),
|
|
|
+ height: screenHeight / (96 * window.devicePixelRatio)
|
|
|
+ });
|
|
|
+ console.log('估算DPI:', {
|
|
|
+ horizontal: Math.round(screenWidth / (screenWidth / (96 * window.devicePixelRatio))),
|
|
|
+ vertical: Math.round(screenHeight / (screenHeight / (96 * window.devicePixelRatio)))
|
|
|
+ });
|
|
|
+ console.log('================');
|
|
|
|
|
|
// 默认样式(当前分辨率)
|
|
|
let style = {
|
|
@@ -1580,24 +1603,45 @@ export default {
|
|
|
// 可以根据不同分辨率设置不同样式
|
|
|
// 例如:1920x1080
|
|
|
if (screenWidth === 1920 && screenHeight === 1080) {
|
|
|
- pulseStyle = {
|
|
|
- titleMarginTop: '0px',
|
|
|
- firstRowMarginTop: '44px',
|
|
|
- normalRowMarginTop: '61px',
|
|
|
- lastRowMarginTop: '61px'
|
|
|
- };
|
|
|
- temperatureStyle = {
|
|
|
- titleMarginTop: '0px',
|
|
|
- firstRowMarginTop: '44px',
|
|
|
- normalRowMarginTop: '61px',
|
|
|
- lastRowMarginTop: '61px'
|
|
|
- };
|
|
|
- legendStyle = {
|
|
|
- marginTop: '476px'
|
|
|
- };
|
|
|
- containerStyle = {
|
|
|
- marginTop: '22px'
|
|
|
- };
|
|
|
+ if(this.marginTop > 0) {//marginTop:48
|
|
|
+ pulseStyle = {
|
|
|
+ titleMarginTop: '0px',
|
|
|
+ firstRowMarginTop: '32px',
|
|
|
+ normalRowMarginTop: '55px',
|
|
|
+ lastRowMarginTop: '56px'
|
|
|
+ };
|
|
|
+ temperatureStyle = {
|
|
|
+ titleMarginTop: '0px',
|
|
|
+ firstRowMarginTop: '32px',
|
|
|
+ normalRowMarginTop: '55px',
|
|
|
+ lastRowMarginTop: '56px'
|
|
|
+ };
|
|
|
+ legendStyle = {
|
|
|
+ marginTop: '476px'
|
|
|
+ };
|
|
|
+ containerStyle = {
|
|
|
+ marginTop: this.marginTop + 'px',
|
|
|
+ };
|
|
|
+ }else {//marginTop:-2
|
|
|
+ pulseStyle = {
|
|
|
+ titleMarginTop: '0px',
|
|
|
+ firstRowMarginTop: '44px',
|
|
|
+ normalRowMarginTop: '61px',
|
|
|
+ lastRowMarginTop: '61px'
|
|
|
+ };
|
|
|
+ temperatureStyle = {
|
|
|
+ titleMarginTop: '0px',
|
|
|
+ firstRowMarginTop: '44px',
|
|
|
+ normalRowMarginTop: '61px',
|
|
|
+ lastRowMarginTop: '61px'
|
|
|
+ };
|
|
|
+ legendStyle = {
|
|
|
+ marginTop: '476px'
|
|
|
+ };
|
|
|
+ containerStyle = {
|
|
|
+ marginTop: '22px'
|
|
|
+ };
|
|
|
+ }
|
|
|
}
|
|
|
// 例如:1366x768
|
|
|
else if (screenWidth === 1366 && screenHeight === 768) {
|