Merge pull request #4030 from dataease/pr@dev@fix_mobile-tab

fix(移动端): 修复移动端Tab组件激活字体大小显示较小,视图可能存在空白区域问题
This commit is contained in:
王嘉豪 2022-12-06 18:05:04 +08:00 committed by GitHub
commit 19b3214e44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 87 additions and 60 deletions

View File

@ -13,6 +13,7 @@
<script> <script>
import { mapState } from 'vuex' import { mapState } from 'vuex'
export default { export default {
props: { props: {
element: { element: {
@ -55,7 +56,7 @@ export default {
}, },
deleteComponent() { deleteComponent() {
this.$emit('amRemoveItem') this.$emit('amRemoveItem')
this.$store.commit('deleteComponent') this.$store.commit('deleteComponentWithId', this.element.id)
this.$store.commit('setCurComponent', { component: null, index: null }) this.$store.commit('setCurComponent', { component: null, index: null })
}, },
updateMobileSelected(id, mobileSelected) { updateMobileSelected(id, mobileSelected) {
@ -70,29 +71,30 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.bar-main{ .bar-main {
position: absolute; position: absolute;
float:right; float: right;
z-index: 10000; z-index: 10000;
border-radius:2px; border-radius: 2px;
padding-left: 1px; padding-left: 1px;
padding-right: 1px; padding-right: 1px;
cursor:pointer!important; cursor: pointer !important;
text-align: center; text-align: center;
background-color: var(--primary,#3370ff); background-color: var(--primary, #3370ff);
} }
.bar-main i{
color: white;
float: right;
margin-right: 3px;
}
.bar-main ::v-deep .el-checkbox__inner{ .bar-main i {
width: 16px; color: white;
height: 16px; float: right;
} margin-right: 3px;
}
.bar-main ::v-deep .el-checkbox__inner::after{ .bar-main ::v-deep .el-checkbox__inner {
width: 4.5px; width: 16px;
} height: 16px;
}
.bar-main ::v-deep .el-checkbox__inner::after {
width: 4.5px;
}
</style> </style>

View File

@ -635,7 +635,7 @@ export default {
component.style[key] = this.format(component.style[key], this.scaleHeight) component.style[key] = this.format(component.style[key], this.scaleHeight)
} }
if (this.needToChangeWidth.includes(key)) { if (this.needToChangeWidth.includes(key)) {
if (key === 'fontSize' && (this.terminal === 'mobile' || component.type === 'custom')) { if ((key === 'fontSize' || key === 'activeFontSize') && (this.terminal === 'mobile' || component.type === 'custom')) {
// do nothing ( v-text ) // do nothing ( v-text )
} else { } else {
component.style[key] = this.format(component.style[key], this.scaleWidth) component.style[key] = this.format(component.style[key], this.scaleWidth)

View File

@ -85,6 +85,7 @@
:ref="element.propValue.id" :ref="element.propValue.id"
class="chart-class" class="chart-class"
:chart="chart" :chart="chart"
:terminal-type="scaleCoefficientType"
:track-menu="trackMenu" :track-menu="trackMenu"
:search-count="searchCount" :search-count="searchCount"
@onChartClick="chartClick" @onChartClick="chartClick"

View File

@ -5,40 +5,49 @@ export default {
mutations: { mutations: {
upComponent({ componentData, curComponent }) { upComponent({ componentData, curComponent }) {
const curComponentIndex = findCurComponentIndex(componentData, curComponent) if (curComponent) {
// 上移图层 index表示元素在数组中越往后 const curComponentIndex = findCurComponentIndex(componentData, curComponent)
if (curComponentIndex < componentData.length - 1) { // 上移图层 index表示元素在数组中越往后
moveUp(componentData, curComponentIndex) if (curComponentIndex < componentData.length - 1) {
} else { moveUp(componentData, curComponentIndex)
toast('已经到顶了') } else {
toast('已经到顶了')
}
} }
}, },
downComponent({ componentData, curComponent }) { downComponent({ componentData, curComponent }) {
const curComponentIndex = findCurComponentIndex(componentData, curComponent) if (curComponent) {
// 下移图层 index表示元素在数组中越往前 const curComponentIndex = findCurComponentIndex(componentData, curComponent)
if (curComponentIndex > 0) { // 下移图层 index表示元素在数组中越往前
moveDown(componentData, curComponentIndex) if (curComponentIndex > 0) {
} else { moveDown(componentData, curComponentIndex)
toast('已经到底了') } else {
toast('已经到底了')
}
} }
}, },
topComponent({ componentData, curComponent }) { topComponent({ componentData, curComponent }) {
const curComponentIndex = findCurComponentIndex(componentData, curComponent) if (curComponent) {
// 置顶 const curComponentIndex = findCurComponentIndex(componentData, curComponent)
if (curComponentIndex < componentData.length - 1) { // 置顶
toTop(componentData, curComponentIndex) if (curComponentIndex < componentData.length - 1) {
toTop(componentData, curComponentIndex)
}
} }
}, },
bottomComponent({ componentData, curComponent }) { bottomComponent({ componentData, curComponent }) {
const curComponentIndex = findCurComponentIndex(componentData, curComponent) if (curComponent) {
// 置底 const curComponentIndex = findCurComponentIndex(componentData, curComponent)
if (curComponentIndex > 0) { // 置底
toBottom(componentData, curComponentIndex) if (curComponentIndex > 0) {
} else { toBottom(componentData, curComponentIndex)
toast('已经到底了') } else {
toast('已经到底了')
}
} }
} }
} }

View File

@ -17,7 +17,7 @@
:active-color="activeColor" :active-color="activeColor"
:border-color="borderColor" :border-color="borderColor"
:border-active-color="borderActiveColor" :border-active-color="borderActiveColor"
:addable="isEdit" :addable="isEdit && !mobileLayoutStatus"
@tab-add="addTab" @tab-add="addTab"
@tab-click="handleClick" @tab-click="handleClick"
> >
@ -710,6 +710,7 @@ export default {
::v-deep .el-tabs__nav-prev { ::v-deep .el-tabs__nav-prev {
line-height: 25px; line-height: 25px;
} }
::v-deep .el-tabs__nav-next { ::v-deep .el-tabs__nav-next {
line-height: 25px; line-height: 25px;
} }

View File

@ -232,8 +232,8 @@ const data = {
} }
}, },
setShapeStyle({ curComponent, canvasStyleData, curCanvasScaleMap }, { top, left, width, height, rotate }) { setShapeStyle({ curComponent, canvasStyleData, curCanvasScaleMap }, { top, left, width, height, rotate }) {
const curCanvasScaleSelf = curCanvasScaleMap[curComponent.canvasId]
if (curComponent) { if (curComponent) {
const curCanvasScaleSelf = curCanvasScaleMap[curComponent.canvasId]
if (top || top === 0) curComponent.style.top = Math.round((top / curCanvasScaleSelf.scalePointHeight)) if (top || top === 0) curComponent.style.top = Math.round((top / curCanvasScaleSelf.scalePointHeight))
if (left || left === 0) curComponent.style.left = Math.round((left / curCanvasScaleSelf.scalePointWidth)) if (left || left === 0) curComponent.style.left = Math.round((left / curCanvasScaleSelf.scalePointWidth))
if (width || width === 0) curComponent.style.width = Math.round((width / curCanvasScaleSelf.scalePointWidth)) if (width || width === 0) curComponent.style.width = Math.round((width / curCanvasScaleSelf.scalePointWidth))
@ -569,7 +569,7 @@ const data = {
// 移动端布局转换 // 移动端布局转换
state.componentData.forEach(item => { state.componentData.forEach(item => {
item.mobileStyle = (item.mobileStyle || BASE_MOBILE_STYLE) item.mobileStyle = (item.mobileStyle || BASE_MOBILE_STYLE)
if (item.mobileSelected || item.canvasId !== 'canvas-main') { if (item.mobileSelected && item.canvasId === 'canvas-main') {
item.style.width = item.mobileStyle.style.width item.style.width = item.mobileStyle.style.width
item.style.height = item.mobileStyle.style.height item.style.height = item.mobileStyle.style.height
item.style.top = item.mobileStyle.style.top item.style.top = item.mobileStyle.style.top
@ -581,6 +581,8 @@ const data = {
item.sizey = item.mobileStyle.sizey item.sizey = item.mobileStyle.sizey
item.auxiliaryMatrix = item.mobileStyle.auxiliaryMatrix item.auxiliaryMatrix = item.mobileStyle.auxiliaryMatrix
mainComponentData.push(item) mainComponentData.push(item)
} else if (item.canvasId !== 'canvas-main') {
mainComponentData.push(item)
} }
}) })
state.componentData = mainComponentData state.componentData = mainComponentData

View File

@ -67,8 +67,8 @@
> >
{{ $t('chart.total') }} {{ $t('chart.total') }}
<span>{{ <span>{{
(chart.datasetMode === 0 && !not_support_page_dataset.includes(chart.datasourceType)) ? chart.totalItems : ((chart.data && chart.data.tableRow) ? chart.data.tableRow.length : 0) (chart.datasetMode === 0 && !not_support_page_dataset.includes(chart.datasourceType)) ? chart.totalItems : ((chart.data && chart.data.tableRow) ? chart.data.tableRow.length : 0)
}}</span> }}</span>
{{ $t('chart.items') }} {{ $t('chart.items') }}
</span> </span>
<de-pagination <de-pagination
@ -101,10 +101,15 @@ import { DEFAULT_TITLE_STYLE, NOT_SUPPORT_PAGE_DATASET } from '@/views/chart/cha
import ChartTitleUpdate from './ChartTitleUpdate.vue' import ChartTitleUpdate from './ChartTitleUpdate.vue'
import { mapState } from 'vuex' import { mapState } from 'vuex'
import DePagination from '@/components/deCustomCm/pagination.js' import DePagination from '@/components/deCustomCm/pagination.js'
export default { export default {
name: 'ChartComponentS2', name: 'ChartComponentS2',
components: { TitleRemark, ViewTrackBar, ChartTitleUpdate, DePagination }, components: { TitleRemark, ViewTrackBar, ChartTitleUpdate, DePagination },
props: { props: {
terminalType: {
type: String,
default: 'pc'
},
chart: { chart: {
type: Object, type: Object,
required: true required: true
@ -183,13 +188,18 @@ export default {
return this.previewCanvasScale.scalePointWidth return this.previewCanvasScale.scalePointWidth
}, },
autoStyle() { autoStyle() {
return { if (this.terminalType === 'pc') {
height: (100 / this.scale) + '%!important', return {
width: (100 / this.scale) + '%!important', height: (100 / this.scale) + '%!important',
left: 50 * (1 - 1 / this.scale) + '%', // 2 width: (100 / this.scale) + '%!important',
top: 50 * (1 - 1 / this.scale) + '%', // 2 left: 50 * (1 - 1 / this.scale) + '%', // 2
transform: 'scale(' + this.scale + ')' top: 50 * (1 - 1 / this.scale) + '%', // 2
transform: 'scale(' + this.scale + ')'
}
} else {
return {}
} }
}, },
trackBarStyleTime() { trackBarStyleTime() {
return this.trackBarStyle return this.trackBarStyle

View File

@ -1,6 +1,7 @@
<template> <template>
<el-row class="component-wait"> <el-row class="component-wait">
<el-tabs <el-tabs
class="wait-tab"
v-model="activeName" v-model="activeName"
style="padding-left: 10px" style="padding-left: 10px"
> >
@ -36,7 +37,7 @@
class="component-wait-main" class="component-wait-main"
style="padding:10px" style="padding:10px"
> >
<mobile-background-selector /> <mobile-background-selector/>
</el-row> </el-row>
</el-row> </el-row>
</template> </template>
@ -141,7 +142,8 @@ export default {
height: 100%; height: 100%;
} }
::v-deep .el-tabs--top {
.wait-tab {
height: 40px !important; height: 40px !important;
background-color: #9ea6b2; background-color: #9ea6b2;
} }