Demo:结构侧边栏样式调整

This commit is contained in:
wanglin2 2025-04-03 23:34:22 +08:00
parent bb4a07b151
commit 978c088d95
30 changed files with 216 additions and 75 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

@ -1,14 +1,19 @@
// 布局结构图片映射 // 布局结构图片映射
export const layoutImgMap = { export const layoutImgMap = {
logicalStructure: require('../assets/img/structures/logicalStructure.png'), logicalStructure: require('../assets/img/structures/logicalStructure.jpg'),
logicalStructureLeft: require('../assets/img/structures/logicalStructureLeft.jpg'), logicalStructureLeft: require('../assets/img/structures/logicalStructureLeft.jpg'),
mindMap: require('../assets/img/structures/mindMap.png'), mindMap: require('../assets/img/structures/mindMap.jpg'),
organizationStructure: require('../assets/img/structures/organizationStructure.png'), organizationStructure: require('../assets/img/structures/organizationStructure.jpg'),
catalogOrganization: require('../assets/img/structures/catalogOrganization.png'), catalogOrganization: require('../assets/img/structures/catalogOrganization.jpg'),
timeline: require('../assets/img/structures/timeline.png'), timeline: require('../assets/img/structures/timeline.jpg'),
timeline2: require('../assets/img/structures/timeline2.png'), timeline2: require('../assets/img/structures/timeline2.jpg'),
fishbone: require('../assets/img/structures/fishbone.png'), fishbone: require('../assets/img/structures/fishbone.jpg'),
verticalTimeline: require('../assets/img/structures/verticalTimeline.png') fishbone2: require('../assets/img/structures/fishbone2.jpg'),
rightFishbone: require('../assets/img/structures/rightFishbone.jpg'),
rightFishbone2: require('../assets/img/structures/rightFishbone2.jpg'),
verticalTimeline: require('../assets/img/structures/verticalTimeline.jpg'),
verticalTimeline2: require('../assets/img/structures/verticalTimeline2.jpg'),
verticalTimeline3: require('../assets/img/structures/verticalTimeline3.jpg')
} }
// 公式列表 // 公式列表

View File

@ -648,3 +648,37 @@ export const alignList = [
value: 'right' value: 'right'
} }
] ]
// 结构列表
export const layoutGroupList = [
{
name: 'Logical structure',
list: ['logicalStructure', 'logicalStructureLeft']
},
{
name: 'Mind map',
list: ['mindMap']
},
{
name: 'Organization structure',
list: ['organizationStructure']
},
{
name: 'Catalog organization',
list: ['catalogOrganization']
},
{
name: 'Timeline',
list: [
'timeline',
'timeline2',
'verticalTimeline2',
'verticalTimeline3',
'verticalTimeline'
]
},
{
name: 'Fishbone',
list: ['fishbone', 'fishbone2', 'rightFishbone', 'rightFishbone2']
}
]

View File

@ -23,7 +23,8 @@ import {
numberTypeList as numberTypeListZh, numberTypeList as numberTypeListZh,
numberLevelList as numberLevelListZh, numberLevelList as numberLevelListZh,
linearGradientDirList as linearGradientDirListZh, linearGradientDirList as linearGradientDirListZh,
alignList as alignListZh alignList as alignListZh,
layoutGroupList as layoutGroupListZh
} from './zh' } from './zh'
import { import {
fontFamilyList as fontFamilyListEn, fontFamilyList as fontFamilyListEn,
@ -40,7 +41,8 @@ import {
numberTypeList as numberTypeListEn, numberTypeList as numberTypeListEn,
numberLevelList as numberLevelListEn, numberLevelList as numberLevelListEn,
linearGradientDirList as linearGradientDirListEn, linearGradientDirList as linearGradientDirListEn,
alignList as alignListEn alignList as alignListEn,
layoutGroupList as layoutGroupListEn
} from './en' } from './en'
import { import {
fontFamilyList as fontFamilyListZhtw, fontFamilyList as fontFamilyListZhtw,
@ -57,7 +59,8 @@ import {
numberTypeList as numberTypeListZhtw, numberTypeList as numberTypeListZhtw,
numberLevelList as numberLevelListZhtw, numberLevelList as numberLevelListZhtw,
linearGradientDirList as linearGradientDirListZhtw, linearGradientDirList as linearGradientDirListZhtw,
alignList as alignListZhtw alignList as alignListZhtw,
layoutGroupList as layoutGroupListZhtw
} from './zhtw' } from './zhtw'
const fontFamilyList = { const fontFamilyList = {
@ -162,6 +165,12 @@ const alignList = {
zhtw: alignListZhtw zhtw: alignListZhtw
} }
const layoutGroupList = {
zh: layoutGroupListZh,
en: layoutGroupListEn,
zhtw: layoutGroupListZhtw
}
export { export {
fontSizeList, fontSizeList,
borderWidthList, borderWidthList,
@ -187,5 +196,6 @@ export {
numberTypeList, numberTypeList,
numberLevelList, numberLevelList,
linearGradientDirList, linearGradientDirList,
alignList alignList,
layoutGroupList
} }

View File

@ -745,3 +745,37 @@ export const alignList = [
value: 'right' value: 'right'
} }
] ]
// 结构列表
export const layoutGroupList = [
{
name: '逻辑结构图',
list: ['logicalStructure', 'logicalStructureLeft']
},
{
name: '思维导图',
list: ['mindMap']
},
{
name: '组织结构图',
list: ['organizationStructure']
},
{
name: '目录组织图',
list: ['catalogOrganization']
},
{
name: '时间轴',
list: [
'timeline',
'timeline2',
'verticalTimeline2',
'verticalTimeline3',
'verticalTimeline'
]
},
{
name: '鱼骨图',
list: ['fishbone', 'fishbone2', 'rightFishbone', 'rightFishbone2']
}
]

View File

@ -647,3 +647,37 @@ export const alignList = [
value: 'right' value: 'right'
} }
] ]
// 结构列表
export const layoutGroupList = [
{
name: '邏輯結構圖',
list: ['logicalStructure', 'logicalStructureLeft']
},
{
name: '思維導圖',
list: ['mindMap']
},
{
name: '組織結構圖',
list: ['organizationStructure']
},
{
name: '目錄組織圖',
list: ['catalogOrganization']
},
{
name: '時間軸',
list: [
'timeline',
'timeline2',
'verticalTimeline2',
'verticalTimeline3',
'verticalTimeline'
]
},
{
name: '魚骨圖',
list: ['fishbone', 'fishbone2', 'rightFishbone', 'rightFishbone2']
}
]

View File

@ -528,10 +528,6 @@ export default {
padding: 20px; padding: 20px;
&.isDark { &.isDark {
.panel {
background-color: #262a2e;
border-left-color: hsla(0, 0%, 100%, 0.1);
.panelHeader { .panelHeader {
.name { .name {
color: #fff; color: #fff;
@ -545,6 +541,11 @@ export default {
color: hsla(0, 0%, 100%, 0.6); color: hsla(0, 0%, 100%, 0.6);
} }
} }
.styleBtn {
background-color: #363b3f;
color: hsla(0, 0%, 100%, 0.6);
border-color: hsla(0, 0%, 100%, 0.1);
} }
} }
} }

View File

@ -1,17 +1,23 @@
<template> <template>
<Sidebar ref="sidebar" :title="$t('strusture.title')"> <Sidebar ref="sidebar" :title="$t('strusture.title')">
<div class="layoutList" :class="{ isDark: isDark }"> <div class="layoutGroupList" :class="{ isDark: isDark }">
<div
class="laytouGroup"
v-for="group in layoutGroupList"
:key="group.name"
>
<div class="groupName">{{ group.name }}</div>
<div class="layoutList">
<div <div
class="layoutItem" class="layoutItem"
v-for="item in layoutList" v-for="item in group.list"
:key="item.value" :key="item"
@click="useLayout(item)" @click="useLayout(item)"
:class="{ active: item.value === layout }" :class="{ active: item === layout }"
> >
<div class="imgBox"> <img :src="layoutImgMap[item]" alt="" />
<img :src="layoutImgMap[item.value]" alt="" /> </div>
</div> </div>
<div class="name">{{ item.name }}</div>
</div> </div>
</div> </div>
</Sidebar> </Sidebar>
@ -19,10 +25,10 @@
<script> <script>
import Sidebar from './Sidebar.vue' import Sidebar from './Sidebar.vue'
import { layoutList } from 'simple-mind-map/src/constants/constant'
import { storeData } from '@/api' import { storeData } from '@/api'
import { mapState } from 'vuex' import { mapState } from 'vuex'
import { layoutImgMap } from '@/config/constant.js' import { layoutImgMap } from '@/config/constant.js'
import { layoutGroupList } from '@/config'
// //
export default { export default {
@ -36,7 +42,6 @@ export default {
}, },
data() { data() {
return { return {
layoutList,
layoutImgMap, layoutImgMap,
layout: '' layout: ''
} }
@ -45,7 +50,11 @@ export default {
...mapState({ ...mapState({
isDark: state => state.localConfig.isDark, isDark: state => state.localConfig.isDark,
activeSidebar: state => state.activeSidebar activeSidebar: state => state.activeSidebar
}) }),
layoutGroupList() {
return layoutGroupList[this.$i18n.locale] || layoutGroupList.zh
}
}, },
watch: { watch: {
activeSidebar(val) { activeSidebar(val) {
@ -59,10 +68,10 @@ export default {
}, },
methods: { methods: {
useLayout(layout) { useLayout(layout) {
this.layout = layout.value this.layout = layout
this.mindMap.setLayout(layout.value) this.mindMap.setLayout(layout)
storeData({ storeData({
layout: layout.value layout: layout
}) })
} }
} }
@ -70,27 +79,45 @@ export default {
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.layoutList { .layoutGroupList {
width: 100%;
padding: 20px; padding: 20px;
&.isDark { &.isDark {
.name { .laytouGroup {
.groupName {
color: #fff; color: #fff;
} }
} }
}
.laytouGroup {
width: 100%;
margin-bottom: 12px;
.groupName {
font-weight: 500;
color: #303133;
margin-bottom: 8px;
font-size: 14px;
}
.layoutList {
width: 100%;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
.layoutItem { .layoutItem {
width: 100%; width: 120px;
height: 70px;
cursor: pointer; cursor: pointer;
border-bottom: 1px solid #e9e9e9; border: 1px solid #e9e9e9;
margin-bottom: 20px;
padding-bottom: 20px;
transition: all 0.2s; transition: all 0.2s;
border: 1px solid transparent; overflow: hidden;
margin-bottom: 12px;
&:last-of-type { padding: 5px;
border: none; border-radius: 5px;
}
&:hover { &:hover {
box-shadow: 0 1px 2px -2px rgba(0, 0, 0, 0.16), box-shadow: 0 1px 2px -2px rgba(0, 0, 0, 0.16),
@ -98,19 +125,15 @@ export default {
} }
&.active { &.active {
border: 1px solid #67c23a; border: 1px solid #409eff;
} }
.imgBox {
width: 100%;
img { img {
width: 100%; width: 100%;
height: 100%;
object-fit: cover;
} }
} }
.name {
text-align: center;
font-size: 14px;
} }
} }
} }