From 8d1e9fa8e9199def7c39e8320fa32b7e931a3c08 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Thu, 17 Aug 2023 10:00:33 +0800 Subject: [PATCH] =?UTF-8?q?Demo=EF=BC=9A=E4=BE=A7=E8=BE=B9=E6=A0=8F?= =?UTF-8?q?=E6=B6=89=E5=8F=8A=E5=9B=BE=E5=BD=A2=E7=9A=84=E9=80=89=E9=A1=B9?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=AF=E8=A7=86=E5=8C=96=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/config/index.js | 16 ++++- web/src/config/zh.js | 24 ++++++- web/src/pages/Edit/components/BaseStyle.vue | 79 ++++++++++++++++++++- web/src/pages/Edit/components/Style.vue | 77 ++++++++++++++++++-- 4 files changed, 187 insertions(+), 9 deletions(-) diff --git a/web/src/config/index.js b/web/src/config/index.js index 385fc236..9b8e115d 100644 --- a/web/src/config/index.js +++ b/web/src/config/index.js @@ -17,7 +17,9 @@ import { shapeList as shapeListZh, sidebarTriggerList as sidebarTriggerListZh, backgroundSizeList as backgroundSizeListZh, - downTypeList as downTypeListZh + downTypeList as downTypeListZh, + shapeListMap as shapeListMapZh, + lineStyleMap as lineStyleMapZh } from './zh' import { fontFamilyList as fontFamilyListEn, @@ -48,6 +50,11 @@ const lineStyleList = { en: lineStyleListEn } +const lineStyleMap = { + zh: lineStyleMapZh, + en: lineStyleMapZh +} + const rootLineKeepSameInCurveList = { zh: rootLineKeepSameInCurveListZh, en: rootLineKeepSameInCurveListEn @@ -78,6 +85,11 @@ const shapeList = { en: shapeListEn } +const shapeListMap = { + zh: shapeListMapZh, + en: shapeListMapZh +} + const sidebarTriggerList = { zh: sidebarTriggerListZh, en: sidebarTriggerListEn @@ -100,12 +112,14 @@ export { fontFamilyList, borderDasharrayList, lineStyleList, + lineStyleMap, rootLineKeepSameInCurveList, backgroundRepeatList, backgroundPositionList, backgroundSizeList, shortcutKeyList, shapeList, + shapeListMap, sidebarTriggerList, downTypeList } diff --git a/web/src/config/zh.js b/web/src/config/zh.js index c33c1cdf..08798137 100644 --- a/web/src/config/zh.js +++ b/web/src/config/zh.js @@ -142,6 +142,12 @@ export const borderRadiusList = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] // 线宽 export const lineWidthList = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +export const lineStyleMap = { + straight: ``, + curve: ``, + direct: `` +} + // 连线风格 export const lineStyleList = [ { @@ -379,6 +385,22 @@ export const shortcutKeyList = [ } ] +export const shapeListMap = { + rectangle: 'M 4 12 L 4 3 L 56 3 L 56 21 L 4 21 L 4 12 Z', + diamond: 'M 4 12 L 30 3 L 56 12 L 30 21 L 4 12 Z', + parallelogram: 'M 10 3 L 56 3 L 50 21 L 4 21 L 10 3 Z', + roundedRectangle: + 'M 13 3 L 47 3 A 9 9 0, 0 1 47 21 L 13 21 A 9 9 0, 0 1 13 3 Z', + octagonalRectangle: + 'M 4 12 L 4 9 L 10 3 L 50 3 L 56 9 L 56 15 L 50 21 L 10 21 L 4 15 L 4 12 Z', + outerTriangularRectangle: + 'M 4 12 L 10 3 L 50 3 L 56 12 L 50 21 L 10 21 L 4 12 Z', + innerTriangularRectangle: + 'M 10 12 L 4 3 L 56 3 L 50 12 L 56 21 L 4 21 L 10 12 Z', + ellipse: 'M 4 12 A 26 9 0, 1, 0 30 3 A 26 9 0, 0, 0 4 12 Z', + circle: 'M 21 12 A 9 9 0, 1, 0 30 3 A 9 9 0, 0, 0 21 12 Z' +} + // 形状列表 export const shapeList = [ { @@ -509,4 +531,4 @@ export const downTypeList = [ icon: 'iconxmind', desc: 'XMind格式' } -] \ No newline at end of file +] diff --git a/web/src/pages/Edit/components/BaseStyle.vue b/web/src/pages/Edit/components/BaseStyle.vue index ef1e89dc..d9705bf6 100644 --- a/web/src/pages/Edit/components/BaseStyle.vue +++ b/web/src/pages/Edit/components/BaseStyle.vue @@ -137,6 +137,12 @@ :label="item" :value="item" > + @@ -160,6 +166,12 @@ :key="item.value" :label="item.name" :value="item.value" + class="lineStyleOption" + :class="{ + isDark: isDark, + isSelected: style.lineStyle === item.value + }" + v-html="lineStyleMap[item.value]" > @@ -227,6 +239,12 @@ :label="item" :value="item" > + @@ -271,6 +289,12 @@ :label="item" :value="item" > + @@ -317,6 +341,12 @@ :label="item" :value="item" > + @@ -738,7 +768,8 @@ import { backgroundSizeList, fontFamilyList, fontSizeList, - rootLineKeepSameInCurveList + rootLineKeepSameInCurveList, + lineStyleMap } from '@/config' import ImgUpload from '@/components/ImgUpload' import { storeConfig } from '@/api' @@ -845,6 +876,9 @@ export default { }, fontFamilyList() { return fontFamilyList[this.$i18n.locale] || fontFamilyList.zh + }, + lineStyleMap() { + return lineStyleMap[this.$i18n.locale] || lineStyleMap.zh } }, watch: { @@ -1158,4 +1192,47 @@ export default { } } } + +.borderLine { + display: inline-block; + width: 100%; + background-color: #000; + + &.isDark { + background-color: #fff; + } +} + + diff --git a/web/src/pages/Edit/components/Style.vue b/web/src/pages/Edit/components/Style.vue index 8aba9892..6bce2364 100644 --- a/web/src/pages/Edit/components/Style.vue +++ b/web/src/pages/Edit/components/Style.vue @@ -1,6 +1,10 @@ - + @@ -196,6 +200,17 @@ :label="item.name" :value="item.value" > + + + @@ -217,6 +232,12 @@ :label="item" :value="item" > + @@ -280,6 +301,14 @@ :label="item.name" :value="item.value" > + + + @@ -320,6 +349,17 @@ :label="item.name" :value="item.value" > + + + @@ -341,6 +381,12 @@ :label="item" :value="item" > + @@ -388,7 +434,8 @@ import { borderDasharrayList, borderRadiusList, lineHeightList, - shapeList + shapeList, + shapeListMap } from '@/config' import { supportActiveStyle } from 'simple-mind-map/src/themes/default' import { mapState } from 'vuex' @@ -407,10 +454,8 @@ export default { data() { return { supportActiveStyle, - fontSizeList, borderWidthList, - borderRadiusList, lineHeightList, activeNodes: [], @@ -448,7 +493,10 @@ export default { }, shapeList() { return shapeList[this.$i18n.locale] || shapeList.zh - } + }, + shapeListMap() { + return shapeListMap[this.$i18n.locale] || shapeListMap.zh + }, }, watch: { activeSidebar(val) { @@ -635,7 +683,7 @@ export default { .row { .rowItem { .name { - color: hsla(0,0%,100%,.6); + color: hsla(0, 0%, 100%, 0.6); } } @@ -764,4 +812,21 @@ export default { } } } + +.borderLine { + display: inline-block; + width: 100%; + background-color: #000; + + &.isDark { + background-color: #fff; + } +} + \ No newline at end of file