From 423895b5d4f3c33755bbdd62e2bf70e438ca972c Mon Sep 17 00:00:00 2001 From: sc Date: Thu, 13 May 2021 14:56:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A8=E5=B1=80=E9=85=8D=E7=BD=AE=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E9=A6=96=E9=A1=B5=E9=BB=98=E8=AE=A4=E5=B8=83=E5=B1=80?= =?UTF-8?q?=EF=BC=8CTAGS=E5=BC=80=E5=90=AF=EF=BC=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/config.js | 4 ++++ src/config/index.js | 21 +++++++++++++++++++-- src/layout/index.vue | 2 +- src/utils/tool.js | 4 ++++ src/views/home/gridLayout.vue | 20 +++----------------- 5 files changed, 31 insertions(+), 20 deletions(-) diff --git a/public/config.js b/public/config.js index a3a4d7f3..4b9e1824 100644 --- a/public/config.js +++ b/public/config.js @@ -1,3 +1,7 @@ + +// 此文件非必要,在生产环境下此文件配置可覆盖运行配置,开发环境下不起效 +// 详情见 src/config/index.js + const APP_CONFIG = { //标题 APP_NAME: "SCUI", diff --git a/src/config/index.js b/src/config/index.js index 07f0520e..be07d8be 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -1,11 +1,28 @@ - const DEFAULT_CONFIG = { //标题 APP_NAME: "SCUI", + //版本号 APP_VER: "1.0.4", + //接口地址 - API_URL: "" + API_URL: "", + + //是否开启多标签 + LAYOUT_TAGS: true, + + //控制台首页默认布局 + DEFAULT_GRID: { + //默认分栏数量和宽度 例如 [24] [18,6] [8,8,8] [6,12,6] + layout: [18, 6], + //小组件分布,com取值:views/home/components 文件名 + copmsList: [ + [{ title: "模块1", com: 'C1' },{ title: "模块3", com: 'C3' }], + [{ title: "模块2", com: 'C2' }], + [] + ] + } + } // 如果生产模式,就合并动态的APP_CONFIG diff --git a/src/layout/index.vue b/src/layout/index.vue index 8c0ace37..19be62d2 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -3,7 +3,7 @@
- +
diff --git a/src/utils/tool.js b/src/utils/tool.js index a5402320..03526678 100644 --- a/src/utils/tool.js +++ b/src/utils/tool.js @@ -46,6 +46,10 @@ const tool = { } } }, + /* 复制对象 */ + objCopy(obj){ + return JSON.parse(JSON.stringify(obj)); + }, /* 日期格式化 */ dateFormat(date, fmt='yyyy-MM-dd'){ date = new Date(date) diff --git a/src/views/home/gridLayout.vue b/src/views/home/gridLayout.vue index a5bd8d6f..52637e2b 100644 --- a/src/views/home/gridLayout.vue +++ b/src/views/home/gridLayout.vue @@ -115,27 +115,13 @@ }, showSet: false, selectLayout: [], - defaultGrid: { - layout: [18, 6], //数组总数不能大于24, [16,8]:分两列左16右8 还可以设置 [24] [18,6] [8,8,8] [6,12,6] - copmsList: [ - [ - { title: "模块1", com: 'C1' }, - { title: "模块3", com: 'C3' } - ], - [ - { title: "模块2", com: 'C2' } - ], - [ - - ] - ] - }, + defaultGrid: this.$CONFIG.DEFAULT_GRID, grid: [], } }, created(){ var grid = this.$TOOL.data.get("grid"); - this.grid = grid || this.defaultGrid; + this.grid = grid || JSON.parse(JSON.stringify(this.defaultGrid)); }, mounted(){ @@ -223,7 +209,7 @@ }, //恢复默认 backDefaul(){ - this.grid = this.$options.data().defaultGrid; + this.grid = JSON.parse(JSON.stringify(this.defaultGrid)); this.$TOOL.data.remove("grid"); } }