Kaynağa Gözat

修改代码

Jing 2 ay önce
ebeveyn
işleme
800bc025f0

+ 2 - 2
src/utils/baseUrl.js

@@ -1,7 +1,7 @@
 const URL = {
   //baseUrl: 'https://admin.bjzxtw.org.cn/zxtapi',//正式环境
-  //baseUrl: 'http://183.131.25.186:9501',//测试环境
-  //baseUrl: 'http://admindev.bjzxtw.org.cn:9501',//测试域名环境
+  // baseUrl: 'http://183.131.25.186:9501',//测试环境
+  baseUrl: 'http://admindev.bjzxtw.org.cn:9501',//测试域名环境
   // baseUrl: 'http://192.168.1.201:9501',//刘佳伟本地环境
   // baseUrl:'http://192.168.1.115:9501',//冯蕊的本地环境
   //baseUrl: 'http://192.168.1.127:9501',//刘剑的本地环境

+ 47 - 6
src/views/advertise/adPlaceList.vue

@@ -33,7 +33,7 @@
         <!--表格内容 start------------------------------------------------------------>
         <div class="layerBox">
             <tableTitle :name="tableDivTitle" />
-            <!-- <button class="btn" @click="addWebsite">添加广告位</button> -->
+            <button class="btn" @click="addWebsite">添加广告位</button>
             <el-row>
                 <template>
                     <el-table class="my-table" v-loading="loading" :data="tableData" style="width: 100%">
@@ -114,6 +114,9 @@
                     <el-form-item label="广告位名称:" prop="adName">
                         <el-input v-model="ruleForm.adName" placeholder="请输入广告位名称"></el-input>
                     </el-form-item>
+                    <el-form-item label="广告位标识:" prop="adTag">
+                        <el-input v-model="ruleForm.adTag" placeholder="请输入广告位标识"></el-input>
+                    </el-form-item>
                     <el-form-item label="广告位介绍:" prop="adDesc">
                         <el-input v-model="ruleForm.adDesc" type="textarea" :rows="2" placeholder="请输入广告位介绍"
                             resize="none">
@@ -233,16 +236,19 @@ export default {
             ruleForm: {
                 webName: '', //网站名称
                 adName: '', //广告位名称
+                adTag: '', //广告位标识
                 adDesc: '',//广告位介绍
                 adPhoto: '', //广告示例图
                 adType: '',//广告类型
                 adSize: '',   //广告位大小
+                ad_size_id: 1,   //广告位大小
                 price: '',  //价格
                 status: '',   //状态
             },
             rules: {
                 webName: [{ required: true, trigger: 'blur', validator: validateEmpty }],
                 adName: [{ required: true, trigger: 'blur', validator: validateEmpty }],
+                adTag: [{ required: true, trigger: 'blur', validator: validateEmpty }],
                 adDesc: [{ required: true, trigger: 'blur', validator: validateEmpty }],
                 adPhoto: [{ required: true, trigger: 'blur', validator: validateEmpty }],
                 adType: [{ required: true, trigger: 'blur', validator: validateEmpty }],
@@ -268,6 +274,11 @@ export default {
                     this.total = data.data.count
                     for (let item of this.tableData) {
                         item.size = item.width + 'x' + item.height
+                        if (item.typeid == 2) {
+                            item.type_name = '图文'
+                        } else if (item.typeid == 1) {
+                            item.type_name = '文字'
+                        }
                     }
                 })
             } else {
@@ -281,6 +292,11 @@ export default {
                     this.total = data.data.count
                     for (let item of this.tableData) {
                         item.size = item.width + 'x' + item.height
+                        if (item.typeid == 2) {
+                            item.type_name = '图文'
+                        } else if (item.typeid == 1) {
+                            item.type_name = '文字'
+                        }
                     }
                 })
             }
@@ -299,8 +315,10 @@ export default {
             })
         },
 
-        change() {
-            console.log(this.ruleForm.adSize);
+        change(val) {
+            console.log('val1111111111', val);
+            this.ruleForm.ad_size_id = val
+            console.log('this.ruleForm.adSize', this.ruleForm.adSize);
         },
 
         //1.2 删除内容
@@ -368,6 +386,11 @@ export default {
                 this.total = data.data.count
                 for (let item of this.tableData) {
                     item.size = item.width + 'x' + item.height
+                    if (item.typeid == 2) {
+                        item.type_name = '图文'
+                    } else if (item.typeid == 1) {
+                        item.type_name = '文字'
+                    }
                 }
             })
 
@@ -398,6 +421,7 @@ export default {
             this.ruleForm.adPhoto = val.thumb //广告示例图
             this.ruleForm.price = val.price //价格
             this.ruleForm.status = val.status //状态
+            // this.ad_size_id=val.ad_size_id
 
             if (val.ad_size_id == 1) {
                 this.ruleForm.adSize = '1200x90'  //广告位大小
@@ -434,6 +458,7 @@ export default {
             //添加时清空回显回来的数据
             this.ruleForm.webName = '' //网站名称
             this.ruleForm.adName = '' //广告位名称
+            this.ruleForm.adTag = '' //广告位标识
             this.ruleForm.adDesc = '' //广告位介绍
             this.ruleForm.adPhoto = '' //广告示例图
             this.ruleForm.adSize = '' //广告尺寸
@@ -455,10 +480,18 @@ export default {
                 })
                 return
             }
+            if (this.ruleForm.adTag == '') {
+                this.$message({
+                    message: '请将数据填写完整',
+                    type: 'error'
+                })
+                return
+            }
             if (this.dialogName == "添加") {
                 createAdPlace({
                     name: this.ruleForm.adName,
                     website_id: this.website_id,
+                    ad_tag: this.ruleForm.adTag,
                     price: this.ruleForm.price,
                     thumb: this.ruleForm.adPhoto,
                     typeid: this.ruleForm.adType,
@@ -499,15 +532,23 @@ export default {
                 })
                 this.dialogVisible = true
             }
+            if (this.ruleForm.adTag == '') {
+                this.$message({
+                    message: '请将数据填写完整',
+                    type: 'error'
+                })
+                return
+            }
             if (this.dialogName == "编辑") {
                 updateAdPlace({
                     name: this.ruleForm.adName,
                     website_id: this.website_id,
+                    ad_tag: this.ruleForm.adTag,
                     price: this.ruleForm.price,
                     thumb: this.ruleForm.adPhoto,
-                    typeid: this.ruleForm.adType,
-                    ad_size_id: this.ruleForm.adSize,
-                    status: this.ruleForm.status,
+                    typeid: Number(this.ruleForm.adType),
+                    ad_size_id: Number(this.ruleForm.ad_size_id),
+                    status: Number(this.ruleForm.status),
                     introduce: this.ruleForm.adDesc,
                     id: this.activeid
                 }).then(data => {

+ 2 - 0
src/views/advertise/advertiseList.vue

@@ -48,6 +48,8 @@
                         </el-table-column>
                         <el-table-column prop="name" label="广告名称" width="160">
                         </el-table-column>
+                        <el-table-column prop="" label="广告位名称" width="160">
+                        </el-table-column>
                         <el-table-column prop="orderStatus" label="订单状态" width="100">
                         </el-table-column>
                         <el-table-column prop="sttime" label="开始时间" width="">

+ 80 - 58
src/views/crawler/webRule.vue

@@ -169,8 +169,9 @@
                             <el-input v-model="ruleForm.title" placeholder="请输入标题字符串"></el-input>
                             <el-tooltip placement="top-start">
                                 <div slot="content">
-                                    如标题代码:&lt;h1 class='news_art'>红枣滞销喂羊 电商帮忙促销&lt;/h1>,标题字符串为 .news_art 填入输入框内<br />
-                                    如标题代码:&lt;h1 id='news at'>红枣滞销喂羊 电商帮忙促销&lt;/h1>,标题字符串为 #news art 填入输入框内
+                                    如标题代码:&lt;div class='news_art'>红枣滞销喂羊 电商帮忙促销&lt;/div>,标题字符串为 .news_art 填入输入框内<br />
+                                    如标题代码:&lt;div id='news at'>红枣滞销喂羊 电商帮忙促销&lt;/div>,标题字符串为 #news art 填入输入框内<br/>
+                                    若是有多个,要保证“news_art"的唯一性,标题字符串更改为:标签名.class名 —— div.news_art 填入输入框内
                                 </div>
                                 <i class="el-icon-warning"></i>
                             </el-tooltip>
@@ -298,7 +299,7 @@
                 </div>
 
                 <div class="dialogBtn">
-                    <el-button class="cancel" @click="saveForm">保存</el-button>
+                    <el-button class="cancel" @click="saveForm">{{ dialogBoo == 'add' ? '保存' : '取消' }}</el-button>
                     <el-button type="primary" class="submit" :loading="submitDisabled"
                         @click="submitForm('ruleForm')">确定</el-button>
                 </div>
@@ -387,27 +388,27 @@ export default {
                 callback()
             }
         }
-        const validatauthor = (rule, value, callback) => {
-            if (value.length == 0) {
-                callback(new Error('请输入作者字符串'))
-            } else {
-                callback()
-            }
-        }
-        const validatauthorName = (rule, value, callback) => {
-            if (value.length == 0) {
-                callback(new Error('请输入作者替换名称'))
-            } else {
-                callback()
-            }
-        }
-        const validatparameter = (rule, value, callback) => {
-            if (value.length == 0) {
-                callback(new Error('请输入接口参数'))
-            } else {
-                callback()
-            }
-        }
+        // const validatauthor = (rule, value, callback) => {
+        //     if (value.length == 0) {
+        //         callback(new Error('请输入作者字符串'))
+        //     } else {
+        //         callback()
+        //     }
+        // }
+        // const validatauthorName = (rule, value, callback) => {
+        //     if (value.length == 0) {
+        //         callback(new Error('请输入作者替换名称'))
+        //     } else {
+        //         callback()
+        //     }
+        // }
+        // const validatparameter = (rule, value, callback) => {
+        //     if (value.length == 0) {
+        //         callback(new Error('请输入接口参数'))
+        //     } else {
+        //         callback()
+        //     }
+        // }
         const validatsecondWeb = (rule, value, callback) => {
             if (value.length == 0) {
                 callback(new Error('请输入第2页网址'))
@@ -476,9 +477,9 @@ export default {
                 ruleName: [{ required: true, trigger: 'blur', validator: validateRuleName }],
                 first_url: [{ required: true, trigger: 'blur', validator: validateFirst_url }],
                 secondWeb: [{ required: true, trigger: 'blur', validator: validatsecondWeb }],
-                // second_start:[{ required: true, trigger: 'blur', validator: validatsecondWeb }],
-                // second_num:[{ required: true, trigger: 'blur', validator: validatsecondWeb }],
-                // second_end:[{ required: true, trigger: 'blur', validator: validatsecondWeb }],
+                second_start: [{ required: true, trigger: 'blur', validator: validatsecondWeb }],
+                second_num: [{ required: true, trigger: 'blur', validator: validatsecondWeb }],
+                second_end: [{ required: true, trigger: 'blur', validator: validatsecondWeb }],
                 second_start: [{ required: true, trigger: 'blur', message: '请输入网址开头' }],
                 second_num: [{ required: true, trigger: 'blur', message: '请输入代码页数' }],
                 second_end: [{ required: true, trigger: 'blur', message: '请输入网址结束字符串' }],
@@ -490,9 +491,9 @@ export default {
                 title: [{ required: true, trigger: 'blur', validator: validatTitle }],
                 content: [{ required: true, trigger: 'blur', validator: validatcontent }],
                 source: [{ required: true, trigger: 'blur', validator: validatsource }],
-                author: [{ required: true, trigger: 'blur', validator: validatauthor }],
-                authorName: [{ required: true, trigger: 'blur', validator: validatauthorName }],
-                parameter: [{ required: true, trigger: 'blur', validator: validatparameter }]
+                author: [{ required: true, trigger: 'blur', message: "请输入作者字符串" }],
+                authorName: [{ required: true, trigger: 'blur', message: "请输入作者替换名称" }],
+                parameter: [{ required: true, trigger: 'blur', message: "请输入接口参数" }]
             }
         }
     },
@@ -505,9 +506,8 @@ export default {
                 pageSize: this.pageSize,
                 page: this.page,
             }).then(data => {
-                if (data.code == 200) {
-                    this.loading = false
-                }
+                this.loading = false
+
                 console.log(data.data.rep);
                 this.tableData = data.data.rep
                 this.total = data.data.count
@@ -595,6 +595,8 @@ export default {
 
         //1.8 设置采集规则
         addCrawlerRule() {
+            this.dialogName = '设置采集规则'
+            this.dialogBoo = "add"
             if (!this.webType) {
                 this.dialogTableVisible = false
                 this.$message({
@@ -735,6 +737,9 @@ export default {
         },
         //1.9 编辑采集规则
         goEdit(id, val) {
+            this.dialogName = '编辑采集规则'
+            this.dialogBoo = "update"
+
             console.log(id);
             this.activeId = id
             console.log(val);
@@ -746,7 +751,6 @@ export default {
                 })
                 return
             } else if (this.webType == 1) {
-                this.dialogBoo = "update"
                 this.dialogTableVisible = true
                 this.ruleForm.ruleName = val.name
                 this.ruleForm.first_url = val.first_url
@@ -768,7 +772,6 @@ export default {
                 this.ruleForm.detailPage = val.con_start
 
             } else if (this.webType == 2) {
-                this.dialogBoo = "update"
                 this.dialogTableVisible = true
                 this.ruleForm.ruleName = val.name
                 this.ruleForm.first_url = val.first_url
@@ -793,7 +796,6 @@ export default {
                     this.ruleForm.authorName = val.writer
                 }
             } else if (this.webType == 3) {
-                this.dialogBoo = "update"
                 this.dialogTableVisible = true
                 this.ruleForm.ruleName = val.name
                 this.ruleForm.diy_rule = val.diy_rule
@@ -846,7 +848,7 @@ export default {
             this.$refs[formName].validate((valid) => {
                 if (valid) {
                     console.log('submit!');
-                    this.submitDisabled = true
+                    // this.submitDisabled = true
                 } else {
                     console.log('error submit!!');
                     return false;
@@ -874,6 +876,7 @@ export default {
                             con_url: this.ruleForm.webSite_start.trim(), //详情页标签
                             con_start: this.ruleForm.detailPage, //详情页网址前缀
                         }).then(data => {
+                            this.submitDisabled = true
                             this.getData()
                             console.log(data);
                             if (data.code == 200) {
@@ -884,6 +887,13 @@ export default {
                                     type: 'success'
                                 })
                             }
+                            if (data.code == 0) {
+                                this.submitDisabled = false
+                                this.$message({
+                                    message: data.message,
+                                    type: 'error'
+                                })
+                            }
                         })
                     } else {
                         addRule({
@@ -914,6 +924,12 @@ export default {
                                     type: 'success'
                                 })
                             }
+                            if (data.code == 0) {
+                                this.$message({
+                                    message: data.message,
+                                    type: 'error'
+                                })
+                            }
                         })
                     }
 
@@ -990,6 +1006,7 @@ export default {
                         }
                     })
                 }
+                sessionStorage.clear();
             }
             //编辑
             if (this.dialogBoo == 'update') {
@@ -1015,9 +1032,9 @@ export default {
                         content: this.ruleForm.content.trim(),//规则型1:内容标签类名  接口型2:内容标签
                         source: this.ruleForm.source, //规则型1:来源标签类名  接口型2:来源标签
                         writer_class: this.ruleForm.author,//规则型1:作者标签类名  接口型2:作者标签
-                        writer: this.ruleForm.authorName.trim(),//规则型1:接口型2:作者默认名称(若未采集到则设置默认作者)
+                        writer: this.ruleForm.authorName,//规则型1:接口型2:作者默认名称(若未采集到则设置默认作者)
                         end_pagenum: this.ruleForm.endPage,//规则型1:列表页结束页码
-                        con_url: this.ruleForm.webSite_start.trim(), //详情页标签
+                        con_url: this.ruleForm.webSite_start, //详情页标签
                         con_start: this.ruleForm.detailPage, //详情页网址前缀
                     }).then(data => {
                         this.getData()
@@ -1107,25 +1124,30 @@ export default {
         },
         //保存
         saveForm() {
-            this.dialogTableVisible = false
-            sessionStorage.setItem('ruleName', this.ruleForm.ruleName); //任务规则名
-            sessionStorage.setItem('first_url', this.ruleForm.first_url); //第一页网址 
-            sessionStorage.setItem('collect', this.ruleForm.collect); //接口类 采集地址
-            sessionStorage.setItem('second_start', this.ruleForm.second_start); //第2页网址开头
-            sessionStorage.setItem('second_num', this.ruleForm.second_num); //第2页代码页数
-            sessionStorage.setItem('second_end', this.ruleForm.second_end);//第2页网址结束字符串
-            sessionStorage.setItem('startCode', this.ruleForm.startCode);  //起始代码
-            sessionStorage.setItem('startLabel', this.ruleForm.startLabel); //列表开始标签
-            sessionStorage.setItem('endPage', this.ruleForm.endPage); //结束页数
-            sessionStorage.setItem('title', this.ruleForm.title); //标题字符串
-            sessionStorage.setItem('content', this.ruleForm.content); //内容字符串
-            sessionStorage.setItem('detailPage', this.ruleForm.detailPage); //详情页标签
-            sessionStorage.setItem('webSite_start', this.ruleForm.webSite_start); //详情页网址前缀
-            sessionStorage.setItem('source', this.ruleForm.source); // 来源字符串
-            sessionStorage.setItem('author', this.ruleForm.author); // 作者字符串
-            sessionStorage.setItem('authorName', this.ruleForm.authorName); // 作者替换名称
-            sessionStorage.setItem('parameter', this.ruleForm.parameter); //接口类2 接口参数
-            sessionStorage.setItem('diy_rule', this.ruleForm.diy_rule); //自定义类
+            if (this.dialogBoo == 'add') {
+                this.dialogTableVisible = false
+                sessionStorage.setItem('ruleName', this.ruleForm.ruleName); //任务规则名
+                sessionStorage.setItem('first_url', this.ruleForm.first_url); //第一页网址 
+                sessionStorage.setItem('collect', this.ruleForm.collect); //接口类 采集地址
+                sessionStorage.setItem('second_start', this.ruleForm.second_start); //第2页网址开头
+                sessionStorage.setItem('second_num', this.ruleForm.second_num); //第2页代码页数
+                sessionStorage.setItem('second_end', this.ruleForm.second_end);//第2页网址结束字符串
+                sessionStorage.setItem('startCode', this.ruleForm.startCode);  //起始代码
+                sessionStorage.setItem('startLabel', this.ruleForm.startLabel); //列表开始标签
+                sessionStorage.setItem('endPage', this.ruleForm.endPage); //结束页数
+                sessionStorage.setItem('title', this.ruleForm.title); //标题字符串
+                sessionStorage.setItem('content', this.ruleForm.content); //内容字符串
+                sessionStorage.setItem('detailPage', this.ruleForm.detailPage); //详情页标签
+                sessionStorage.setItem('webSite_start', this.ruleForm.webSite_start); //详情页网址前缀
+                sessionStorage.setItem('source', this.ruleForm.source); // 来源字符串
+                sessionStorage.setItem('author', this.ruleForm.author); // 作者字符串
+                sessionStorage.setItem('authorName', this.ruleForm.authorName); // 作者替换名称
+                sessionStorage.setItem('parameter', this.ruleForm.parameter); //接口类2 接口参数
+                sessionStorage.setItem('diy_rule', this.ruleForm.diy_rule); //自定义类
+            }
+            if (this.dialogBoo == 'update') {
+                this.dialogTableVisible = false
+            }
         },
         // 查看
         goLook(id, val) {