Commit 086c36c8 authored by 刘怀志's avatar 刘怀志

暂存

parent bceef011
...@@ -92,6 +92,12 @@ export function crawler() { ...@@ -92,6 +92,12 @@ export function crawler() {
method: 'get' method: 'get'
}) })
} }
export function queryCrawlerStatus(params) {
return request({
url: '/cmstask/detail/'+ params.id,
method: 'get'
})
}
// 公众号爬虫 // 公众号爬虫
export function getCrawlerPicture() { export function getCrawlerPicture() {
......
...@@ -264,7 +264,13 @@ ...@@ -264,7 +264,13 @@
import commonField from '@/utils/commonField' import commonField from '@/utils/commonField'
import { import {
delSysContentNewsInformation, delSysContentNewsInformation,
listSysContentNewsInformation, updateStatus, shareShop, crawler, getCrawlerPicture, scanCrawlerPicture listSysContentNewsInformation,
updateStatus,
shareShop,
crawler,
getCrawlerPicture,
scanCrawlerPicture,
queryCrawlerStatus
} from '@/api/contentManagement/sysContentNewsInformation' } from '@/api/contentManagement/sysContentNewsInformation'
import { error } from 'autoprefixer/lib/utils' import { error } from 'autoprefixer/lib/utils'
import { parseTime } from '@/utils' import { parseTime } from '@/utils'
...@@ -424,7 +430,7 @@ export default { ...@@ -424,7 +430,7 @@ export default {
this.imgLoading = true this.imgLoading = true
console.log(this.souceList.join(',')) console.log(this.souceList.join(','))
scanCrawlerPicture(this.souceList.join(',')).then(res => { scanCrawlerPicture(this.souceList.join(',')).then(res => {
this.checkId = '1' this.checkId = res.data
this.checkStatus() this.checkStatus()
}).catch(err => { }).catch(err => {
this.$message.warning(err.message) this.$message.warning(err.message)
...@@ -432,24 +438,29 @@ export default { ...@@ -432,24 +438,29 @@ export default {
}) })
}, },
checkStatus() { checkStatus() {
this.webLoading = false
this.intervalId = setInterval(() => { this.intervalId = setInterval(() => {
crawler({ id: this.checkId }).then(res => { queryCrawlerStatus({ id: this.checkId }).then(res => {
if (res.status === '1') { if (res.data.status === '1') {
this.$message.success('抓取成功') this.$message.success('抓取成功')
this.webLoading = false this.webLoading = false
this.imgLoading = false this.imgLoading = false
this.loadData() this.loadData()
clearInterval(this.intervalId) clearInterval(this.intervalId)
} else if (res.data.status === '2') {
this.$message.success('失败')
this.webLoading = false
this.imgLoading = false
this.loadData()
clearInterval(this.intervalId)
} }
}) })
}, 1000) }, 5000)
}, },
// 测试定时爬虫 // 测试定时爬虫
crawlerData() { crawlerData() {
this.webLoading = true this.webLoading = true
crawler().then(res => { crawler().then(res => {
this.checkId = '1' this.checkId = res.data
this.checkStatus() this.checkStatus()
}).catch(err => { }).catch(err => {
this.$message.warning(err.message) this.$message.warning(err.message)
...@@ -498,7 +509,7 @@ export default { ...@@ -498,7 +509,7 @@ export default {
this.queryParams.unitId = this.deptId this.queryParams.unitId = this.deptId
} }
}, },
// 获取所有部门信息 // 获取所有 部门信息
getDeptList() { getDeptList() {
listAllShop().then(res => { listAllShop().then(res => {
if (res.code === 200) { if (res.code === 200) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment