From 93f1cf1f2eb09cd04d58416646d3dbfc009758f9 Mon Sep 17 00:00:00 2001 From: marvzhang Date: Mon, 17 Feb 2020 14:20:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=B7=BB=E5=8A=A0scrapy?= =?UTF-8?q?=E7=88=AC=E8=99=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/InfoView/SpiderInfoView.vue | 2 +- frontend/src/components/Scrapy/SpiderScrapy.vue | 13 ++++++++++--- frontend/src/views/spider/SpiderDetail.vue | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/InfoView/SpiderInfoView.vue b/frontend/src/components/InfoView/SpiderInfoView.vue index f7226bf9..b054f85d 100644 --- a/frontend/src/components/InfoView/SpiderInfoView.vue +++ b/frontend/src/components/InfoView/SpiderInfoView.vue @@ -189,7 +189,7 @@ export default { this.spiderForm.site = item._id }, onUploadSuccess () { - this.$store.dispatch('file/getFileList', this.spiderForm.src) + this.$store.dispatch('spider/getFileTree') this.uploadLoading = false diff --git a/frontend/src/components/Scrapy/SpiderScrapy.vue b/frontend/src/components/Scrapy/SpiderScrapy.vue index 823cde6c..b7d74a31 100644 --- a/frontend/src/components/Scrapy/SpiderScrapy.vue +++ b/frontend/src/components/Scrapy/SpiderScrapy.vue @@ -109,7 +109,7 @@ type="primary" size="small" icon="el-icon-plus" - @click="isAddSpiderVisible = true" + @click="onAddSpider" > {{$t('Add Spider')}} @@ -373,13 +373,20 @@ export default { id: this.$route.params.id, form: this.addSpiderForm }) - console.log(res) if (!res.data.error) { - this.$message.success('Saved successfully') + this.$message.success(this.$t('Saved successfully')) } this.isAddSpiderVisible = false this.isAddSpiderLoading = false + await this.$store.dispatch('spider/getSpiderScrapySpiders', this.$route.params.id) }) + }, + onAddSpider () { + this.addSpiderForm = { + name: '', + domain: '' + } + this.isAddSpiderVisible = true } } } diff --git a/frontend/src/views/spider/SpiderDetail.vue b/frontend/src/views/spider/SpiderDetail.vue index fc0e990c..d89e6504 100644 --- a/frontend/src/views/spider/SpiderDetail.vue +++ b/frontend/src/views/spider/SpiderDetail.vue @@ -202,6 +202,7 @@ export default { this.$store.dispatch('spider/getSpiderScrapySpiders', this.$route.params.id) this.$store.dispatch('spider/getSpiderScrapySettings', this.$route.params.id) } else if (this.activeTabName === 'files') { + this.$store.dispatch('spider/getFileTree') if (this.currentPath) { this.$store.dispatch('file/getFileContent', { path: this.currentPath }) }