Commit bceef011 authored by 刘怀志's avatar 刘怀志

banner暂存-6

parent 841345c0
...@@ -231,34 +231,29 @@ ...@@ -231,34 +231,29 @@
width="30%" width="30%"
title="小程序" title="小程序"
:visible.sync="innerVisible" :visible.sync="innerVisible"
append-to-body> append-to-body
<img id="crawlerImage" v-show="src" :src="src" alt="Crawler Image"> >
<img v-show="src" id="crawlerImage" :src="src" alt="Crawler Image">
<el-checkbox-group v-model="souceList">
<el-checkbox label="慧保天下" />
<el-checkbox label="中国银行保险报" />
<el-checkbox label="今日保条" />
<el-checkbox label="陈果 George" />
</el-checkbox-group>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="innerVisible = false">取 消</el-button> <el-button @click="innerVisible = false">取 消</el-button>
<el-button type="primary" @click="startImage">抓取</el-button> <el-button type="primary" :loading="imgLoading" @click="startImage">抓取</el-button>
</div> </div>
</el-dialog> </el-dialog>
<el-row> <el-row>
<el-col :span="12" style="margin-bottom: 15px"> <el-col :span="12" style="margin-bottom: 15px">
<el-button @click="innerVisible = true,loadImage2()">小程序</el-button> <el-button :loading="webLoading" @click="crawlerData">中国保险行业协会 行业要闻</el-button>
</el-col>
<el-col :span="12" style="margin-bottom: 15px">
<el-button @click="crawlerData">中国保险行业协会 行业要闻</el-button>
</el-col> </el-col>
</el-row> </el-row>
<el-divider></el-divider> <el-divider />
<el-row> <el-row>
<el-col :span="12" style="margin-bottom: 15px"> <el-col :span="12" style="margin-bottom: 15px">
<el-button>慧保天下</el-button> <el-button @click="innerVisible = true,loadImage2()">小程序</el-button>
</el-col>
<el-col :span="12" style="margin-bottom: 15px">
<el-button>中国银行保险报</el-button>
</el-col>
<el-col :span="12" style="margin-bottom: 15px">
<el-button>今日保条</el-button>
</el-col>
<el-col :span="12" style="margin-bottom: 15px">
<el-button>陈果 George</el-button>
</el-col> </el-col>
</el-row> </el-row>
</el-dialog> </el-dialog>
...@@ -282,6 +277,10 @@ export default { ...@@ -282,6 +277,10 @@ export default {
// }, // },
data() { data() {
return { return {
imgLoading: false,
webLoading: false,
intervalId: null,
souceList: [],
innerVisible: false, innerVisible: false,
src: '', src: '',
rules: { rules: {
...@@ -422,16 +421,39 @@ export default { ...@@ -422,16 +421,39 @@ export default {
}) })
}, },
startImage() { startImage() {
scanCrawlerPicture('CodeSheep') this.imgLoading = true
console.log(this.souceList.join(','))
scanCrawlerPicture(this.souceList.join(',')).then(res => {
this.checkId = '1'
this.checkStatus()
}).catch(err => {
this.$message.warning(err.message)
this.imgLoading = false
})
},
checkStatus() {
this.webLoading = false
this.intervalId = setInterval(() => {
crawler({ id: this.checkId }).then(res => {
if (res.status === '1') {
this.$message.success('抓取成功')
this.webLoading = false
this.imgLoading = false
this.loadData()
clearInterval(this.intervalId)
}
})
}, 1000)
}, },
// 测试定时爬虫 // 测试定时爬虫
crawlerData() { crawlerData() {
this.webLoading = true
crawler().then(res => { crawler().then(res => {
this.$message({ this.checkId = '1'
message: '爬取成功', this.checkStatus()
type: 'success' }).catch(err => {
}) this.$message.warning(err.message)
this.resetQuery() this.webLoading = false
}) })
}, },
/** 修改密码确定操作*/ /** 修改密码确定操作*/
......
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