点击爬虫跳转相应文件 pipelines.py

This commit is contained in:
marvzhang
2020-02-21 19:05:32 +08:00
parent 21323f0d28
commit e2014b10a8
3 changed files with 41 additions and 3 deletions

View File

@@ -26,13 +26,18 @@
<git-settings/>
</el-tab-pane>
<el-tab-pane v-if="isScrapy" :label="$t('Scrapy Settings')" name="scrapy-settings">
<spider-scrapy/>
<spider-scrapy
@click-spider="onClickScrapySpider"
@click-pipeline="onClickScrapyPipeline"
/>
</el-tab-pane>
<el-tab-pane v-if="isConfigurable" :label="$t('Config')" name="config">
<config-list ref="config"/>
</el-tab-pane>
<el-tab-pane :label="$t('Files')" name="files">
<file-list/>
<file-list
ref="file-list"
/>
</el-tab-pane>
<el-tab-pane :label="$t('Environment')" name="environment">
<environment-list/>
@@ -162,7 +167,8 @@ export default {
}
this.$utils.tour.nextStep('spider-detail', currentStep)
}
}
},
redirectType: ''
}
},
computed: {
@@ -227,6 +233,20 @@ export default {
this.$store.dispatch('spider/getSpiderScrapySettings', this.$route.params.id),
this.$store.dispatch('spider/getSpiderScrapyPipelines', this.$route.params.id)
])
},
async onClickScrapySpider () {
this.redirectType = 'spider'
this.activeTabName = 'files'
await this.$store.dispatch('spider/getFileTree')
if (this.currentPath) {
await this.$store.dispatch('file/getFileContent', { path: this.currentPath })
}
},
async onClickScrapyPipeline () {
this.redirectType = 'pipeline'
this.activeTabName = 'files'
await this.$store.dispatch('spider/getFileTree')
this.$refs['file-list'].clickPipeline()
}
},
async created () {