-

api->createLib;?>

+

api->editLib;?>

From 02f2bd22c6fca90b444e01fb4aee3927a231e96e Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Wed, 20 Oct 2021 11:07:24 +0800 Subject: [PATCH 3/7] * Fix bug #15669. --- module/doc/model.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/module/doc/model.php b/module/doc/model.php index fabfa09110..897e091ad4 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -69,7 +69,9 @@ class docModel extends model if($type == 'all' or $type == 'includeDeleted') { $stmt = $this->dao->select('*')->from(TABLE_DOCLIB) - ->beginIF($type == 'all')->where('deleted')->eq(0)->fi() + ->where(1) + ->beginIF($type == 'all')->andWhere('deleted')->eq(0)->fi() + ->andWhere('type')->ne('api') ->orderBy('id_desc') ->query(); } @@ -77,7 +79,8 @@ class docModel extends model { $stmt = $this->dao->select('*')->from(TABLE_DOCLIB) ->where('deleted')->eq(0) - ->beginIF($type)->andWhere('type')->eq($type)->fi() + ->beginIF($type and $type != 'api')->andWhere('type')->eq($type)->fi() + ->andWhere('type')->ne('api') ->orderBy('`order`, id desc')->query(); } From 2fb6e092189d57a9a9bc8f7bce34df9b9aef97f2 Mon Sep 17 00:00:00 2001 From: liyuchun Date: Wed, 20 Oct 2021 11:18:10 +0800 Subject: [PATCH 4/7] * Fix bug #15663. --- module/api/control.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/module/api/control.php b/module/api/control.php index 19fe374ee0..24154d0e95 100755 --- a/module/api/control.php +++ b/module/api/control.php @@ -33,6 +33,15 @@ class api extends control */ public function index($libID = 0, $moduleID = 0, $apiID = 0, $version = 0, $release = 0) { + /* Get all api doc libraries. */ + $libs = $this->doc->getApiLibs(); + + /* Generate bread crumbs dropMenu. */ + if($libs) + { + if($libID == 0) $libID = key($libs); + $this->lang->modulePageNav = $this->generateLibsDropMenu($libs, $libID, $release); + } /* Get an api doc. */ if($apiID > 0) @@ -58,15 +67,6 @@ class api extends control $this->view->apiList = $apiList; } - /* Get all api doc libraries. */ - $libs = $this->doc->getApiLibs(); - - /* Generate bread crumbs dropMenu. */ - if($libs) - { - if($libID == 0) $libID = key($libs); - $this->lang->modulePageNav = $this->generateLibsDropMenu($libs, $libID, $release); - } $this->setMenu($libID); $this->view->isRelease = $release > 0; From e5cac550f511fe0c3bce1dac889323e6374a5ec6 Mon Sep 17 00:00:00 2001 From: xiawenlong Date: Wed, 20 Oct 2021 13:39:46 +0800 Subject: [PATCH 5/7] fix many subfield bug. --- module/api/js/common.js | 56 ++++++++++++++++++++++++++--------------- module/api/js/create.js | 1 + module/api/js/edit.js | 1 + 3 files changed, 38 insertions(+), 20 deletions(-) diff --git a/module/api/js/common.js b/module/api/js/common.js index a0fd10e85a..336de76f00 100644 --- a/module/api/js/common.js +++ b/module/api/js/common.js @@ -302,11 +302,17 @@ try { }, current: { handler(val) { + // console.log(val) /* handle level field data. */ const attr = []; val.forEach((item) => { if (item.sub == 1) { - attr.push(this.handleParams(item)) + const newItem = { + ...item, + children: [] + } + this.handleParams(val, newItem); + attr.push(newItem) } }) this.$emit('change', attr) @@ -319,17 +325,25 @@ try { if (this.attr && this.attr.length > 0) { const attr = []; this.decodeParams(this.attr, attr) - this.current = attr - this.params[this.structType] = this.current; + const current = []; + attr.forEach(item => { + current.push({ + ...item, + children: [], + }) + }) + this.current = current.splice(0); + this.params[this.structType] = [...this.current]; } }, methods: { genKey() { - this.fieldKey++; - if (this.current.findIndex(item => item.key == this.fieldKey) != -1) { - this.genKey(); + let key = Date.now().toString(36) + key += Math.random().toString(36).substr(2) + if (this.current.findIndex(item => item.key == key) != -1) { + return this.genKey(); } - return this.fieldKey + return key }, getInitField() { const data = { @@ -345,25 +359,27 @@ try { data.key = this.genKey() return data }, - handleParams(field) { - this.current.forEach(item => { + handleParams(current, field) { + current.forEach(item => { if (!field.children) field.children = [] if (item.parentKey == field.key && field.children.findIndex(i => i.key == item.key) == -1) { - this.handleParams(item) - field.children.push(item) + const newField = { + ...item, + children: [], + } + this.handleParams(current, newField) + field.children.push({...newField}) } }) - return field }, decodeParams(data, attr) { if (!data) return; data.forEach(item => { - const tmp = { - ...item - } - delete tmp.children - attr.push(tmp) - if (item.children) { + attr.push({ + ...item, + children: [], + }) + if (item.children && item.children.length> 0) { this.decodeParams(item.children, attr) } }) @@ -375,6 +391,7 @@ try { sub = s.sub + 1 } fieldKey = s.key + // console.log('添加子字段', JSON.stringify(s), fieldKey) const field = { ...this.getInitField(), parentKey: fieldKey, @@ -385,7 +402,7 @@ try { add(data, sub) { const field = this.getInitField(); field.sub = sub; - data.push(field); + data.push({...field}); }, del(data, index) { if(data.length <= 1) return; @@ -398,7 +415,6 @@ try { ]; } this.current = this.params[this.structType]; - console.log(this.current) }, getPadding(sub) { var padding = 0; diff --git a/module/api/js/create.js b/module/api/js/create.js index 8d0e441826..e073d9d82e 100644 --- a/module/api/js/create.js +++ b/module/api/js/create.js @@ -41,6 +41,7 @@ var app = new Vue({ }, methods: { changeAttr(val) { + // console.log('更新之前', JSON.stringify(val)) this.body = val; }, changeType(val) { diff --git a/module/api/js/edit.js b/module/api/js/edit.js index 50ca3eb7f8..1dc4d3074b 100644 --- a/module/api/js/edit.js +++ b/module/api/js/edit.js @@ -58,6 +58,7 @@ var app = new Vue({ }, methods: { changeAttr(val) { + // console.log('新的值', JSON.stringify(val)) this.body = val }, changeType(val) { From 902d24ff14ed57805489c4fc7feb095711410429 Mon Sep 17 00:00:00 2001 From: xiawenlong Date: Wed, 20 Oct 2021 13:48:18 +0800 Subject: [PATCH 6/7] fix code style --- module/doc/model.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/module/doc/model.php b/module/doc/model.php index 897e091ad4..59a14f0f27 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -69,9 +69,8 @@ class docModel extends model if($type == 'all' or $type == 'includeDeleted') { $stmt = $this->dao->select('*')->from(TABLE_DOCLIB) - ->where(1) + ->where('type')->ne('api') ->beginIF($type == 'all')->andWhere('deleted')->eq(0)->fi() - ->andWhere('type')->ne('api') ->orderBy('id_desc') ->query(); } From e912a03df7f4895e158193f450c9ffb74554a828 Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Wed, 20 Oct 2021 13:50:51 +0800 Subject: [PATCH 7/7] * Fix bug #15673. --- module/doc/view/editlib.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/doc/view/editlib.html.php b/module/doc/view/editlib.html.php index 31952aea21..e6b1c90397 100644 --- a/module/doc/view/editlib.html.php +++ b/module/doc/view/editlib.html.php @@ -25,7 +25,7 @@ type != 'book' ? $lang->doc->editLib : $lang->doc->editBook;?> - +
product)):?>