加入树形结构文件目录

This commit is contained in:
marvzhang
2020-01-15 17:44:11 +08:00
parent 30608af099
commit ae2ff69b45
8 changed files with 362 additions and 120 deletions

View File

@@ -38,8 +38,7 @@ const actions = {
},
getFileContent ({ commit, rootState }, payload) {
const { path } = payload
const spiderId = rootState.spider.spiderForm._id
return request.get(`/spiders/${spiderId}/file`, { path })
return request.get(`/file`, { path })
.then(response => {
commit('SET_FILE_CONTENT', response.data.data)
})

View File

@@ -38,7 +38,10 @@ const state = {
previewCrawlData: [],
// template list
templateList: []
templateList: [],
// spider file tree
fileTree: {}
}
const getters = {}
@@ -86,6 +89,9 @@ const mutations = {
},
SET_TEMPLATE_LIST (state, value) {
state.templateList = value
},
SET_FILE_TREE (state, value) {
state.fileTree = value
}
}
@@ -185,6 +191,11 @@ const actions = {
const { id } = payload
const res = await request.get(`/spiders/${id}/schedules`)
commit('schedule/SET_SCHEDULE_LIST', res.data.data, { root: true })
},
async getFileTree ({ state, commit }, payload) {
const { id } = payload
const res = await request.get(`/spiders/${id}/file/tree`)
commit('SET_FILE_TREE', res.data.data)
}
}