diff --git a/frontend/src/components/InfoView/SpiderInfoView.vue b/frontend/src/components/InfoView/SpiderInfoView.vue
index e72673b2..fe384f14 100644
--- a/frontend/src/components/InfoView/SpiderInfoView.vue
+++ b/frontend/src/components/InfoView/SpiderInfoView.vue
@@ -23,6 +23,14 @@
+
+
+
+
@@ -152,6 +160,22 @@ export default {
})
}
})
+ },
+ fetchSiteSuggestions (keyword, callback) {
+ this.$request.get('/sites', {
+ keyword: keyword,
+ page_num: 1,
+ page_size: 100
+ }).then(response => {
+ const data = response.data.items.map(d => {
+ d.value = `${d.name} | ${d.domain}`
+ return d
+ })
+ callback(data)
+ })
+ },
+ onSiteSelect (item) {
+ this.spiderForm.site = item._id
}
}
}
@@ -167,4 +191,8 @@ export default {
width: 100%;
text-align: right;
}
+
+ .el-autocomplete {
+ width: 100%;
+ }
diff --git a/frontend/src/store/modules/site.js b/frontend/src/store/modules/site.js
index 2ffc392d..d05b8de4 100644
--- a/frontend/src/store/modules/site.js
+++ b/frontend/src/store/modules/site.js
@@ -1,7 +1,7 @@
import request from '../../api/request'
const state = {
- tableData: [],
+ siteList: [],
// filter
filter: {
@@ -21,8 +21,8 @@ const mutations = {
SET_KEYWORD (state, value) {
state.keyword = value
},
- SET_TABLE_DATA (state, value) {
- state.tableData = value
+ SET_SITE_LIST (state, value) {
+ state.siteList = value
},
SET_PAGE_NUM (state, value) {
state.pageNum = value
@@ -52,7 +52,7 @@ const actions = {
}
})
.then(response => {
- commit('SET_TABLE_DATA', response.data.items)
+ commit('SET_SITE_LIST', response.data.items)
commit('SET_TOTAL_COUNT', response.data.total_count)
})
}
diff --git a/frontend/src/store/modules/spider.js b/frontend/src/store/modules/spider.js
index 6247c865..b7e702fd 100644
--- a/frontend/src/store/modules/spider.js
+++ b/frontend/src/store/modules/spider.js
@@ -74,7 +74,8 @@ const actions = {
lang: state.spiderForm.lang,
col: state.spiderForm.col,
cron: state.spiderForm.cron,
- cron_enabled: state.spiderForm.cron_enabled ? 1 : 0
+ cron_enabled: state.spiderForm.cron_enabled ? 1 : 0,
+ site: state.spiderForm.site
})
.then(() => {
dispatch('getSpiderList')
@@ -89,7 +90,8 @@ const actions = {
lang: state.spiderForm.lang,
col: state.spiderForm.col,
cron: state.spiderForm.cron,
- cron_enabled: state.spiderForm.cron_enabled ? 1 : 0
+ cron_enabled: state.spiderForm.cron_enabled ? 1 : 0,
+ site: state.spiderForm.site
})
.then(() => {
dispatch('getSpiderList')
diff --git a/frontend/src/views/site/SiteList.vue b/frontend/src/views/site/SiteList.vue
index 5358539f..d4393a42 100644
--- a/frontend/src/views/site/SiteList.vue
+++ b/frontend/src/views/site/SiteList.vue
@@ -19,7 +19,7 @@
-
@@ -109,7 +109,7 @@ export default {
computed: {
...mapState('site', [
'filter',
- 'tableData',
+ 'siteList',
'totalCount'
]),
keyword: {