From eb7d8b8fa34486faff6e70b6d56f73a4713f4f04 Mon Sep 17 00:00:00 2001 From: marvzhang Date: Mon, 2 Dec 2019 13:29:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=8F=AF=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=88=AC=E8=99=AB=E8=AE=BE=E7=BD=AE=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/Config/ConfigList.vue | 68 +++++++++++++--- .../components/TableView/FieldsTableView.vue | 24 +++++- .../TableView/SettingFieldsTableView.vue | 81 +++++++++++-------- frontend/src/store/modules/spider.js | 10 +++ frontend/src/views/spider/SpiderDetail.vue | 3 + 5 files changed, 136 insertions(+), 50 deletions(-) diff --git a/frontend/src/components/Config/ConfigList.vue b/frontend/src/components/Config/ConfigList.vue index 2c730b3b..160de988 100644 --- a/frontend/src/components/Config/ConfigList.vue +++ b/frontend/src/components/Config/ConfigList.vue @@ -177,7 +177,7 @@ :value="isList(stage)" @change="onCheckIsList($event, stage)" /> - +
CSS @@ -190,11 +190,24 @@
- CSS + + + + CSS - + + + XPath
@@ -208,8 +221,9 @@ style="text-align: left; flex-basis: 20px; margin-right: 5px" :value="isPage(stage)" @change="onCheckIsPage($event, stage)" + :disabled="!isList(stage)" /> - +
CSS @@ -222,11 +236,24 @@
- CSS + + + + CSS - + + + XPath
@@ -255,7 +282,7 @@
- + {{$t('Save')}}
@@ -522,6 +549,25 @@ export default { }, onClickSelectorType (selectorType) { Object.values(this.spiderForm.config.stages).forEach(stage => { + // 列表 + if (selectorType === 'css') { + if (stage.list_xpath) stage.list_xpath = '' + if (!stage.list_css) stage.list_css = 'body' + } else { + if (stage.list_css) stage.list_css = '' + if (!stage.list_xpath) stage.list_xpath = '//body' + } + + // 分页 + if (selectorType === 'css') { + if (stage.page_xpath) stage.page_xpath = '' + if (!stage.page_css) stage.page_css = 'body' + } else { + if (stage.page_css) stage.page_css = '' + if (!stage.page_xpath) stage.page_xpath = '//body' + } + + // 字段 stage.fields.forEach(field => { if (selectorType === 'css') { if (field.xpath) field.xpath = '' diff --git a/frontend/src/components/TableView/FieldsTableView.vue b/frontend/src/components/TableView/FieldsTableView.vue index 40c276de..2dbcfd81 100644 --- a/frontend/src/components/TableView/FieldsTableView.vue +++ b/frontend/src/components/TableView/FieldsTableView.vue @@ -23,6 +23,7 @@ @@ -50,10 +51,20 @@ @@ -80,7 +91,12 @@