diff --git a/src/common/utils.js b/src/common/utils.js index 68890ff..b074ded 100644 --- a/src/common/utils.js +++ b/src/common/utils.js @@ -42,16 +42,21 @@ export const handleScreenAuto = id => { // 还需要将缩放后的content 相对于flex_center容器进行充满 export const handleScreenToFlexCenter = (contentId, flexId) => { - // const originEle = document.querySelector(contentId) - // const targetEle = document.querySelector(flexId) - // // 需要判断缩放后的高度是否超过了容器高度 - // const scale = - // originEle.clientWidth / originEle.clientHeight < - // targetEle.clientWidth / targetEle.clientHeight - // ? originEle.clientWidth / targetEle.clientWidth - // : originEle.clientHeight / targetEle.clientHeight - // document.querySelector(contentId).style['transform-origin'] = 'center center' - // document.querySelector(contentId).style.transform = `scale(${scale})` + const clientWidth = document.documentElement.clientWidth + const clientHeight = document.documentElement.clientHeight + if (clientWidth <= 1600 && clientHeight < 1080) { + const originEle = document.querySelector(contentId) + const targetEle = document.querySelector(flexId) + // 需要判断缩放后的高度是否超过了容器高度 + const scale = + originEle.clientWidth / originEle.clientHeight < + targetEle.clientWidth / targetEle.clientHeight + ? originEle.clientWidth / targetEle.clientWidth + : originEle.clientHeight / targetEle.clientHeight + document.querySelector(contentId).style['transform-origin'] = + 'center center' + document.querySelector(contentId).style.transform = `scale(${scale})` + } } const handleBottomFont = (id, scale) => { diff --git a/src/views/Index/components/CasePictureList/index.vue b/src/views/Index/components/CasePictureList/index.vue index 58d0cb6..dfe1117 100644 --- a/src/views/Index/components/CasePictureList/index.vue +++ b/src/views/Index/components/CasePictureList/index.vue @@ -176,7 +176,7 @@ const showEmpty = ref(true) flex-direction: column; font-family: 'SourceHanSans'; background-size: 100% 100%; - padding: 40px 0 0 0; + padding: 50px 0 0 0; box-sizing: border-box; position: relative; white-space: nowrap; diff --git a/src/views/Index/components/Recruit/index.vue b/src/views/Index/components/Recruit/index.vue index 69e6170..e17a226 100644 --- a/src/views/Index/components/Recruit/index.vue +++ b/src/views/Index/components/Recruit/index.vue @@ -1,7 +1,7 @@