Browse Source

article spider

begmoon 1 year ago
parent
commit
f64f20b940
2 changed files with 18 additions and 1 deletions
  1. 4 0
      src/api.js
  2. 14 1
      src/views/match/addChampionSay.vue

+ 4 - 0
src/api.js

@@ -461,5 +461,9 @@ export default {
     baikeDetailTop: params => {
         return axios.put(`${baseURL}/api/admin/baike/detail/top`, params)
     },
+    //文章抓取
+    getSpiderArticle: params => {
+        return axios.get(`${baseURL}/api/admin/article/spider`, { params: params })
+    },
 
 }

+ 14 - 1
src/views/match/addChampionSay.vue

@@ -66,6 +66,10 @@
           <i v-else class="el-icon-plus avatar-uploader-icon"></i>
         </el-upload>
       </el-form-item>
+      <el-form-item label="文章抓取">
+         <el-input placeholder="URL地址" v-model="articleurl" style="width:500px"></el-input>
+        <el-button type="primary" @click="spiderArticle" style="margin-left:20px">抓取</el-button>
+      </el-form-item>
       <el-form-item label="详情">
         <!-- <fuEditor
           v-model="form.content"
@@ -135,7 +139,8 @@ export default {
       bannerList:[
         {label:"否",value:0},
         {label:"是",value:1}
-      ]
+      ],
+      articleurl:"",
     };
   },
   methods: {
@@ -201,6 +206,14 @@ export default {
         });
       }
     },
+
+    spiderArticle() {
+      this.$api.getSpiderArticle({ url: this.articleurl }).then((res) => {
+        console.log('data',res.data)
+        this.form.content = res.data.data;
+      });
+    },
+
     handleAvatarSuccess(res, file) {
       this.form.img = res.data.url;
     },