提交 64b655b9 authored 作者: wangjiahao's avatar wangjiahao

refactor: 优化仪表板辅助设计

上级 b9847a2c
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
stroke-width="1" stroke-width="1"
/> />
</pattern> </pattern>
<pattern id="grid" :width="matrixStyle.width" :height="matrixStyle.height" patternUnits="userSpaceOnUse"> <pattern id="grid" :width="gridW" :height="gridH" patternUnits="userSpaceOnUse">
<rect :width="matrixStyle.width" :height="matrixStyle.height" fill="url(#smallGrid)" /> <rect :width="gridW" :height="gridH" fill="url(#smallGrid)" />
<path <path
:d="pathD" :d="pathD"
fill="none" fill="none"
stroke="rgba(64,158,255,0.8)" stroke="rgba(64,158,255,0.6)"
stroke-width="1" stroke-width="1"
/> />
</pattern> </pattern>
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
<script> <script>
import { mapState } from 'vuex'
export default { export default {
props: { props: {
// eslint-disable-next-line vue/require-default-prop // eslint-disable-next-line vue/require-default-prop
...@@ -40,17 +42,30 @@ export default { ...@@ -40,17 +42,30 @@ export default {
computed: { computed: {
pathD: function() { pathD: function() {
return 'M ' + this.matrixStyle.width + ' 0 L 0 0 0 ' + this.matrixStyle.height return 'M ' + this.gridW + ' 0 L 0 0 0 ' + this.gridH
}, },
smallGridPathD: function() { smallGridPathD: function() {
return 'M ' + this.smallGridW + ' 0 L 0 0 0 ' + this.smallGridH return 'M ' + this.smallGridW + ' 0 L 0 0 0 ' + this.smallGridH
}, },
gridW: function() {
return this.matrixStyle.width * 2 * this.matrixBase
},
gridH: function() {
return this.matrixStyle.height * 2 * this.matrixBase
},
smallGridW: function() { smallGridW: function() {
return this.matrixStyle.width / 3 return this.matrixStyle.width
}, },
smallGridH: function() { smallGridH: function() {
return this.matrixStyle.height / 3 return this.matrixStyle.height
} },
matrixBase: function() {
// return this.canvasStyleData.aidedDesign ? this.canvasStyleData.aidedDesign.matrixBase : 1
return this.canvasStyleData.aidedDesign.matrixBase
},
...mapState([
'canvasStyleData'
])
} }
} }
</script> </script>
......
...@@ -866,14 +866,8 @@ export default { ...@@ -866,14 +866,8 @@ export default {
} }
}, },
matrixCount: { matrixCount: {
required: false, required: true,
type: Object, type: Object
default: () => {
return {
x: 36,
y: 18
}
}
}, },
scrollTop: { scrollTop: {
type: Number, type: Number,
...@@ -1017,13 +1011,11 @@ export default { ...@@ -1017,13 +1011,11 @@ export default {
} }
}, },
watch: { watch: {
matrixCount: { 'canvasStyleData.aidedDesign.matrixBase': {
handler(newVal, oldVal) { handler(newVal, oldVal) {
if (newVal && oldVal) { this.changeComponentSizePoint(newVal / oldVal)
this.changeComponentSizePoint(newVal.x / oldVal.x) },
} deep: true
this.changeScale()
}
}, },
customStyle: { customStyle: {
handler(newVal) { handler(newVal) {
...@@ -1065,10 +1057,7 @@ export default { ...@@ -1065,10 +1057,7 @@ export default {
}, },
mounted() { mounted() {
setTimeout(() => { this.canvasInit()
this.changeScale()
this.editShow = true
}, 500)
// 获取编辑器元素 // 获取编辑器元素
this.$store.commit('getEditor') this.$store.commit('getEditor')
const _this = this const _this = this
...@@ -1089,6 +1078,13 @@ export default { ...@@ -1089,6 +1078,13 @@ export default {
created() { created() {
}, },
methods: { methods: {
canvasInit() {
this.editShow = false
setTimeout(() => {
this.changeScale()
this.editShow = true
}, 500)
},
backgroundSetClose() { backgroundSetClose() {
this.boardSetVisible = false this.boardSetVisible = false
}, },
...@@ -1255,6 +1251,7 @@ export default { ...@@ -1255,6 +1251,7 @@ export default {
item.sizex = item.sizex * pointScale item.sizex = item.sizex * pointScale
item.sizey = item.sizey * pointScale item.sizey = item.sizey * pointScale
}) })
this.changeScale()
} }
}, },
......
...@@ -95,7 +95,6 @@ export function panelInit(componentData, componentStyle) { ...@@ -95,7 +95,6 @@ export function panelInit(componentData, componentStyle) {
item.hyperlinks = (item.hyperlinks || HYPERLINKS) item.hyperlinks = (item.hyperlinks || HYPERLINKS)
} }
item.commonBackground = item.commonBackground || deepCopy(COMMON_BACKGROUND_NONE) item.commonBackground = item.commonBackground || deepCopy(COMMON_BACKGROUND_NONE)
componentData[index] = item
}) })
// style初始化 // style初始化
componentStyle.refreshTime = (componentStyle.refreshTime || 5) componentStyle.refreshTime = (componentStyle.refreshTime || 5)
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<el-radio-group v-model="aidedDesign.matrixBase" size="mini"> <el-radio-group v-model="aidedDesign.matrixBase" size="mini">
<el-radio-button :label="1">普通</el-radio-button> <el-radio-button :label="1">普通</el-radio-button>
<el-radio-button :label="2">适中</el-radio-button> <el-radio-button :label="2">适中</el-radio-button>
<el-radio-button :label="3">密集</el-radio-button> <el-radio-button :label="4">密集</el-radio-button>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-form> </el-form>
......
...@@ -40,7 +40,7 @@ module.exports = { ...@@ -40,7 +40,7 @@ module.exports = {
}, },
configureWebpack: { configureWebpack: {
name: name, name: name,
devtool: 'cheap-module-source-map', devtool: 'source-map',
resolve: { resolve: {
alias: { alias: {
'@': resolve('src') '@': resolve('src')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论