diff --git a/package.json b/package.json index 72471b8..4edda1b 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "vue": "^3.5.13", "vue-router": "^4.5.0", "less": "^4.2.1", - "split.js": "^1.6.5", + "split.js": "^1.6.4", "localforage": "^1.10.0", "rimraf": "^3.0.2", "vue-i18n": "9.2.2", diff --git a/src/components/icons/SvgCode.js b/src/components/icons/SvgCode.js new file mode 100644 index 0000000..76740b1 --- /dev/null +++ b/src/components/icons/SvgCode.js @@ -0,0 +1,10 @@ +export default { + find: ``, + redo: ``, + undo: ``, + copy: ``, + paste: ``, + cut: ``, + open: ``, + save: `` +} \ No newline at end of file diff --git a/src/components/split/split.vue b/src/components/split/split.vue index bdf528b..45899e7 100644 --- a/src/components/split/split.vue +++ b/src/components/split/split.vue @@ -46,6 +46,11 @@ export default defineComponent({ let useFirstDefaultSize = props.firstAreaDefaultSize && props.firstAreaDefaultSize > 0 let useLastDefaultSize = props.lastAreaDefaultSize && props.lastAreaDefaultSize > 0 let splitSumCount = 0 + const refreshSize = (value) => { + if (data.value.instance) { + data.value.instance?.setSizes(value) + } + } const init = () => { if (data.value.instance !== null) { data.value.instance?.destroy() @@ -148,7 +153,7 @@ export default defineComponent({ return data.value.instance?.getSizes() || 0 } - return { data, init, parent, reset, getSizes } + return { data, init, parent, reset, getSizes, refreshSize } } }) diff --git a/src/components/viewMenus/editMenu/EditMenu.ts b/src/components/viewMenus/editMenu/EditMenu.ts index b2272b1..7637d4e 100644 --- a/src/components/viewMenus/editMenu/EditMenu.ts +++ b/src/components/viewMenus/editMenu/EditMenu.ts @@ -1,5 +1,6 @@ import { renderIcon } from '@/utils/webutils.ts' import { defineMenu } from '@/runtime/DefineMenu.ts' +import SvgCode from '@/components/icons/SvgCode' export default defineMenu((menus) => { menus.insertChildren('modelFile', @@ -11,19 +12,19 @@ export default defineMenu((menus) => { }, [ { - name: 'find', label: '查找', icon: renderIcon('ModelFile'), order: 1, tip: 'Ctrl+F', divided: true, + name: 'find', label: '查找', icon: SvgCode.find, order: 1, tip: 'Ctrl+F', divided: true, click: () => { system.msg('查找') } }, { - name: 'undo', label: '撤销', icon: renderIcon('ModelFile'), order: 2, tip: 'Ctrl+Z', disabled: true, + name: 'undo', label: '撤销', icon: SvgCode.undo, order: 2, tip: 'Ctrl+Z', disabled: true, click: () => { system.msg('撤销') } }, { - name: 'redo', label: '重做', icon: renderIcon('ModelFile'), order: 3, tip: 'Ctrl+Y', divided: true, + name: 'redo', label: '重做', icon: SvgCode.redo, order: 3, tip: 'Ctrl+Y', divided: true, disabled() { return true }, @@ -32,7 +33,7 @@ export default defineMenu((menus) => { } }, { - name: 'copy', label: '复制', icon: renderIcon('ModelFile'), order: 4, tip: 'Ctrl+C', + name: 'copy', label: '复制', icon: SvgCode.copy, order: 4, tip: 'Ctrl+C', disabled() { return true }, @@ -41,7 +42,7 @@ export default defineMenu((menus) => { } }, { - name: 'cut', label: '剪切', icon: renderIcon('ModelFile'), order: 5, tip: 'Ctrl+X', + name: 'cut', label: '剪切', icon: SvgCode.cut, order: 5, tip: 'Ctrl+X', disabled() { return true }, @@ -50,7 +51,7 @@ export default defineMenu((menus) => { } }, { - name: 'paste', label: '粘贴', icon: renderIcon('ModelFile'), order: 6, tip: 'Ctrl+V', + name: 'paste', label: '粘贴', icon: SvgCode.paste, order: 6, tip: 'Ctrl+V', disabled() { return true }, diff --git a/src/components/viewMenus/fileMenu/FileMenu.ts b/src/components/viewMenus/fileMenu/FileMenu.ts index 524a338..239ab3c 100644 --- a/src/components/viewMenus/fileMenu/FileMenu.ts +++ b/src/components/viewMenus/fileMenu/FileMenu.ts @@ -1,5 +1,7 @@ import { renderIcon } from '@/utils/webutils.ts' import { defineMenu } from '@/runtime/DefineMenu.ts' +import SvgCode from '@/components/icons/SvgCode' +import { Open } from '@element-plus/icons-vue' export default defineMenu((menus) => { menus.insertChildren('file', @@ -8,13 +10,13 @@ export default defineMenu((menus) => { }, [ { - name: 'open', label: '打开', icon: renderIcon('ModelFile'), order: 1, tip: 'Ctrl+O', + name: 'open', label: '打开', icon: SvgCode.open, order: 1, tip: 'Ctrl+O', click: () => { system.msg('打开模型文件') } }, { - name: 'save', label: '保存', icon: renderIcon('ModelFile'), order: 2, tip: 'Ctrl+S', + name: 'save', label: '保存', icon: SvgCode.save, order: 2, tip: 'Ctrl+S', click: () => { system.msg('保存模型文件') } diff --git a/src/main.less b/src/main.less index 5878f6e..aaf44f2 100644 --- a/src/main.less +++ b/src/main.less @@ -1,27 +1,30 @@ @import './base.css'; .main { - width: 100%; - height: 100vh; - background-size: 30px 30px, 30px 30px; - display: flex; - flex-direction: column; + width: 100%; + height: 100vh; + background-size: 30px 30px, 30px 30px; + display: flex; + flex-direction: column; - & > .el-container { - & > .el-main { - padding: 0; - display: flex; + & > .el-container { + & > .el-main { + padding: 0; + display: flex; - .sence { - flex-grow: 1; - overflow: hidden; - } - } + .sence { + flex-grow: 1; + overflow: hidden; + } } + } } #sence { - flex: 1; - overflow: hidden; + flex: 1; + overflow: hidden; } +.hidden-split.split + .gutter { + display: none; +} \ No newline at end of file diff --git a/src/runtime/DefineMenu.ts b/src/runtime/DefineMenu.ts index 6ef3527..bccc309 100644 --- a/src/runtime/DefineMenu.ts +++ b/src/runtime/DefineMenu.ts @@ -3,7 +3,7 @@ import type { Component } from 'vue' export interface MenuOption { name: string label?: string - icon?: Component + icon?: string order?: number tip?: string disabled?: boolean | (() => boolean) diff --git a/src/views/ModelMain.vue b/src/views/ModelMain.vue index 411d7b6..41ba0bb 100644 --- a/src/views/ModelMain.vue +++ b/src/views/ModelMain.vue @@ -64,19 +64,21 @@
任务
-
日志
-
脚本
+
日志
+
脚本
- - - - + + + +
{{ sectionLeftTitle }}
- +
@@ -122,14 +124,14 @@ 标签8 - +
{{ sectionRightTitle }}
- +
{{ sectionBottomTitle }}
@@ -169,10 +171,10 @@ export default { Logo, calcRootMenu: getRootMenu(), activeIndex: '', - defaultSize: 30, - appMenuHeight: '300px', - sectionLeft: '300px', - sectionRight: '300px', + bottomSize: 30, + hideBottom: false, + hideLeft: false, + hideRight: false, sectionLeftSize: 20, sectionRightSize: 20, sectionLeftTitle: '模型', @@ -180,9 +182,49 @@ export default { sectionBottomTitle: '任务' } }, - computed: {}, + computed: { + calcCenterSize() { + if (this.hideLeft && this.hideRight) { + return 100 + } else if (this.hideLeft) { + return 100 - this.sectionRightSize + } else if (this.hideRight) { + return 100 - this.sectionLeftSize + } + return 100 - this.sectionLeftSize - this.sectionRightSize + } + }, + watch: { + hideBottom(value) { + if (value) { + this.$refs.mainSplit.refreshSize([100, 0]) + } else { + this.$refs.mainSplit.refreshSize([100 - this.bottomSize, this.bottomSize]) + } + }, + hideLeft() { + this.recalcCenterSize() + }, + hideRight() { + this.recalcCenterSize() + } + }, methods: { renderIcon, + recalcCenterSize() { + if (this.hideLeft && this.hideRight) { + this.$refs.centerSplit.refreshSize([0, 100, 0]) + + } else if (this.hideLeft) { + this.$refs.centerSplit.refreshSize([0, 100 - this.sectionRightSize, this.sectionRightSize]) + + } else if (this.hideRight) { + this.$refs.centerSplit.refreshSize([this.sectionLeftSize, 100 - this.sectionLeftSize, 0]) + + } else { + this.$refs.centerSplit.refreshSize([this.sectionLeftSize, 100 - this.sectionLeftSize - this.sectionRightSize, this.sectionRightSize]) + } + }, clickRootMenu() { }, @@ -191,29 +233,32 @@ export default { }, btnLeftMe(name) { if (this.sectionLeftTitle === name) { - this.sectionLeft = '0' + this.hideLeft = true this.sectionLeftTitle = '' + } else { + this.hideLeft = false this.sectionLeftTitle = name - this.sectionLeft = '300px' } }, btnRightMe(name) { if (this.sectionRightTitle === name) { - this.sectionRight = '0' + this.hideRight = true this.sectionRightTitle = '' + } else { + this.hideRight = false this.sectionRightTitle = name - this.sectionRight = '300px' } }, btnBottomMe(name) { if (this.sectionBottomTitle === name) { - this.appMenuHeight = '0' + this.hideBottom = true this.sectionBottomTitle = '' + } else { + this.hideBottom = false this.sectionBottomTitle = name - this.appMenuHeight = '300px' } } } diff --git a/yarn.lock b/yarn.lock index ef156a5..d58b6db 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1999,7 +1999,7 @@ speakingurl@^14.0.1: resolved "https://registry.npmmirror.com/speakingurl/-/speakingurl-14.0.1.tgz#f37ec8ddc4ab98e9600c1c9ec324a8c48d772a53" integrity sha512-1POYv7uv2gXoyGFpBCmpDVSNV74IfsWlDW216UPjbWufNf+bSU6GdbDsxdcxtfwb4xlI3yxzOTKClUosxARYrQ== -split.js@^1.6.5: +split.js@^1.6.4: version "1.6.5" resolved "http://mirrors.cloud.tencent.com/npm/split.js/-/split.js-1.6.5.tgz#f7f61da1044c9984cb42947df4de4fadb5a3f300" integrity sha512-mPTnGCiS/RiuTNsVhCm9De9cCAUsrNFFviRbADdKiiV+Kk8HKp/0fWu7Kr8pi3/yBmsqLFHuXGT9UUZ+CNLwFw==