瀏覽代碼

vue代码上传

洪舒 5 年之前
父節點
當前提交
07108f06e5

+ 3 - 0
components/menu/data.js

@@ -150,6 +150,9 @@ export default [{
       {
         title: "工猫结算订单",
         path: baseUrl + "gongmall"
+      },{
+        title: "CPS",
+        path: baseUrl + "cps_manage",
       },
       // {
       //   title: "解决方案需求",

+ 20 - 0
layouts/components/Select/selectFilterable.vue

@@ -0,0 +1,20 @@
+<template>
+  <div id="selectFilterable" class="selectFilterable" style="width:100%;">
+    <el-select v-model="selectData.value" remote multiple filterable :multiple-limit=5 reserve-keyword placeholder="请选择" style="width:100%;">
+      <el-option
+        v-for="item in selectData.options"
+        :key="item.value"
+        :label="item.label"
+        :value="item.value">
+      </el-option>
+    </el-select>
+  </div>
+</template>
+
+<script>
+  export default {
+    props: {
+      selectData: Object
+    }
+  }
+</script>

+ 3 - 1
layouts/components/index.js

@@ -3,6 +3,7 @@ import Navbar from "./Navbar.vue"
 import Settings from "./Settings/index.vue"
 import Sidebar from "./Sidebar/index.vue"
 import TagsView from "./TagsView/index.vue"
+import SelectFilterable from "./select/selectFilterable.vue"
 
 export default {
 
@@ -12,5 +13,6 @@ export {
   Navbar,
   Settings,
   Sidebar,
-  TagsView
+  TagsView,
+  SelectFilterable,
 }

+ 644 - 0
pages/main/index/cps_manage.vue

@@ -0,0 +1,644 @@
+
+<template>
+  <div>
+    <el-tabs v-model="activeName" @tab-click="handleClick">
+
+      <el-tab-pane name="tag">
+        <span slot="label"><i class="el-icon-document-remove"></i> 标签</span>
+        <!--        头部操作模块 start -->
+        <div style="width:200px;margin:0 15px;float:left;">
+        <el-input v-model="tagName" placeholder="搜索标签" @keyup.enter.native="searchTag"></el-input>
+        </div>
+        <div style="width:200px;margin:0 15px;float:left;">
+          <el-select v-model="category" clearable placeholder="全部领域">
+            <el-option
+              v-for="item in categoryOptions"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id">
+            </el-option>
+          </el-select>
+        </div>
+        <div style="width:100px;margin:0 15px;float:left;">
+          <el-button type="primary" @click="searchTag">搜索</el-button>
+        </div>
+        <div style="margin:0 15px;float:right;">
+          <el-button type="primary" @click="addTag"><i class="el-icon-plus"></i>新增标签</el-button>
+        </div>
+        <div style="clear: both;"></div>
+<!--        头部操作模块 end -->
+<!--        新增标签弹出层 start -->
+        <el-dialog
+          title="新增标签"
+          :visible.sync="tagDialogVisible"
+          width="30%">
+          <el-form ref="form" :model="tagForm" label-width="100px">
+            <el-form-item>
+              <p slot="label">标签名<span style="color:red;">*</span></p>
+              <el-input v-model="tagForm.name"></el-input>
+            </el-form-item>
+            <el-form-item label="标签别名">
+              <el-select class="tag_aa"
+                v-model="tagForm.aliases"
+                multiple
+                filterable
+                allow-create
+                default-first-option
+                placeholder="请选择标签别名" style="width: 100%;">
+                <el-option
+                  v-for="item in tagRelationOptions"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value" >
+                </el-option>
+              </el-select>
+            </el-form-item>
+            <el-form-item label="权重值">
+              <el-input v-model="tagForm.weight"></el-input>
+            </el-form-item>
+            <el-form-item label="关联子标签">
+              <el-select v-model="tagForm.subtags" remote multiple filterable :multiple-limit=5 reserve-keyword placeholder="请选择" style="width: 100%;">
+                <el-option
+                  v-for="item in tagData"
+                  :key="item.id"
+                  :label="item.name"
+                  :value="item.id">
+                </el-option>
+              </el-select>
+
+            </el-form-item>
+            <el-form-item>
+              <el-button type="primary" @click="addTagSub">提交</el-button>
+            </el-form-item>
+          </el-form>
+        </el-dialog>
+        <el-dialog
+          title="修改标签"
+          :visible.sync="editTagDialogVisible"
+          width="30%">
+          <el-form ref="form" :model="tagForm" label-width="100px">
+            <el-form-item>
+              <p slot="label">标签名<span style="color:red;">*</span></p>
+              <el-input v-model="tagForm.name" v-bind:readonly="isReadOnly"></el-input>
+            </el-form-item>
+            <el-form-item label="标签别名">
+              <el-select class="tag_aa"
+                         v-model="tagForm.aliases"
+                         multiple
+                         filterable
+                         allow-create
+                         default-first-option
+                         placeholder="请选择标签别名" style="width: 100%;">
+                <el-option
+                  v-for="item in tagRelationOptions"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value" >
+                </el-option>
+              </el-select>
+            </el-form-item>
+            <el-form-item label="权重值">
+              <el-input v-model="tagForm.weight"></el-input>
+            </el-form-item>
+            <el-form-item label="关联子标签">
+              <el-select v-model="tagForm.subtags" remote multiple filterable :multiple-limit=5 reserve-keyword placeholder="请选择" style="width: 100%;">
+                <el-option
+                  v-for="item in tagData"
+                  :key="item.id"
+                  :label="item.name"
+                  :value="item.id">
+                </el-option>
+              </el-select>
+
+            </el-form-item>
+            <el-form-item>
+              <el-button type="primary" @click="editTagSub">提交</el-button>
+            </el-form-item>
+          </el-form>
+        </el-dialog>
+<!--        新增标签弹出层 end -->
+<!--        标签表格数据 start -->
+        <el-table
+          :data="tagData">
+          <el-table-column
+            prop="name"
+            label="标签名"
+            width="180">
+          </el-table-column>
+          <el-table-column
+            label="别名"
+            width="280">
+            <template slot-scope="scope">
+              <template v-if="scope.row['aliases'] != null">
+                <template v-for="item in scope.row['aliases']">
+                  <span style="margin-right: 8px">{{item}}</span>
+                </template>
+              </template>
+            </template>
+          </el-table-column>
+          <el-table-column
+            prop="weight"
+            label="权重"
+            width="180">
+          </el-table-column>
+          <el-table-column
+            label="关联子标签">
+                <template slot-scope="scope">
+                  <div v-if="scope.row['subtags'] && scope.row['subtags'].length">
+                    <el-tag v-for="(tagid, idx) in scope.row['subtags']" v-if="idx < 8">{{tag_map[tagid]}}</el-tag>
+                    <p>总共有{{scope.row['subtags'].length}}个</p>
+                  </div>
+                </template>
+          </el-table-column>
+          <el-table-column
+            label="关联领域">
+            <template slot-scope="scope">
+              {{scope.row['catIds'] && scope.row['catIds'].length ? scope.row['catIds'].map(id => cat_map[id]).join(', ') : '-'}}
+            </template>
+          </el-table-column>
+          <el-table-column
+            label="操作">
+            <template slot-scope="scope">
+            <el-button
+              type="text"
+              @click="editTag(scope.row)"
+            ><i class="el-icon-edit"></i></el-button>
+            <el-button
+              type="text"
+              @click="delTag(scope.row['id'])"
+            ><i class="el-icon-delete"></i></el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+<!--        标签表格数据 end -->
+      </el-tab-pane>
+      <el-tab-pane name="category">
+        <span slot="label"><i class="el-icon-box"></i> 领域</span>
+        <!--        头部操作模块 start -->
+        <div style="width:200px;margin:0 15px;float:left;">
+          <el-input v-model="categoryName" placeholder="搜索领域" @keyup.enter.native="searchCat"></el-input>
+        </div>
+        <div style="width:250px;margin:0 15px;float:left;line-height: 40px;">
+          <el-checkbox v-model="categoryChecked1">仅技术领域</el-checkbox>
+          <el-checkbox v-model="categoryChecked2">仅行业领域</el-checkbox>
+        </div>
+        <div style="width:100px;margin:0 15px;float:left;">
+          <el-button type="primary" @click="searchCat">搜索</el-button>
+        </div>
+        <div style="margin:0 15px;float:right;">
+          <el-button type="primary" @click="addCategoryInit"><i class="el-icon-plus"></i>新增领域</el-button>
+        </div>
+        <div style="clear: both;"></div>
+        <!--        头部操作模块 end -->
+        <!--        领域表格数据 start -->
+
+        <el-table
+          :data="categoryData">
+            <el-table-column
+              prop="name"
+              label="领域名"
+              width="180">
+            </el-table-column>
+            <el-table-column
+              prop="weight"
+              label="权重"
+              width="180">
+            </el-table-column>
+            <el-table-column
+              label="技术领域"
+              width="180">
+              <template slot-scope="scope">
+                <template v-if="scope.row['isTechnical'] == true">
+                  <p>是</p>
+                </template>
+                <template v-else>
+                  <p>否</p>
+                </template>
+              </template>
+            </el-table-column>
+            <el-table-column
+              label="行业领域">
+              <template slot-scope="scope">
+                <template v-if="scope.row['isIndustrial'] == true">
+                  <p>是</p>
+                </template>
+                <template v-else>
+                  <p>否</p>
+                </template>
+              </template>
+            </el-table-column>
+            <el-table-column
+              label="关联标签">
+              <template slot-scope="scope">
+                <div v-if="scope.row['tags'] && scope.row['tags'].length">
+                  <el-tag v-for="(tagid, idx) in scope.row['tags']" v-if="idx < 8">{{tag_map[tagid]}}</el-tag>
+                  <p>总共有{{scope.row['tags'].length}}个</p>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column
+              label="操作">
+              <template slot-scope="scope">
+                <el-button
+                  type="text"
+                  @click="editCat(scope.row)"
+                ><i class="el-icon-edit"></i></el-button>
+                <el-button
+                  type="text"
+                  @click="delCat(scope.row['id'])"
+                ><i class="el-icon-delete"></i></el-button>
+              </template>
+            </el-table-column>
+        </el-table>
+        <!--        领域表格数据 end -->
+        <!--        新增领域弹出层 start -->
+        <el-dialog
+          title="新增领域"
+          :visible.sync="categoryDialogVisible"
+          width="30%">
+          <el-form ref="form" :model="catForm" label-width="100px">
+            <el-form-item>
+              <p slot="label">领域名<span style="color:red;">*</span></p>
+              <el-input v-model="catForm.name"></el-input>
+            </el-form-item>
+            <el-form-item label="权重值">
+              <el-input v-model="catForm.weight"></el-input>
+            </el-form-item>
+            <el-form-item label="领域归属">
+              <el-checkbox v-model="catForm.isTechnical">仅技术领域</el-checkbox>
+              <el-checkbox v-model="catForm.isIndustrial">仅行业领域</el-checkbox>
+            </el-form-item>
+            <el-form-item label="关联标签">
+              <el-select v-model="catForm.tags" multiple filterable  placeholder="请选择" style="width: 100%;">
+                <el-option
+                  v-for="item in tagData"
+                  :key="item.id"
+                  :label="item.name"
+                  :value="item.id">
+                </el-option>
+              </el-select>
+
+            </el-form-item>
+            <el-form-item>
+              <el-button type="primary" @click="addCategory">提交</el-button>
+            </el-form-item>
+          </el-form>
+        </el-dialog>
+        <el-dialog
+          title="编辑领域"
+          :visible.sync="editCategoryDialogVisible"
+          width="1300px">
+          <el-form ref="form" :model="catForm" label-width="100px">
+            <el-form-item>
+              <p slot="label">领域名<span style="color:red;">*</span></p>
+              <el-input v-model="catForm.name"></el-input>
+            </el-form-item>
+            <el-form-item label="权重值">
+              <el-input v-model="catForm.weight"></el-input>
+            </el-form-item>
+            <el-form-item label="领域归属">
+              <el-checkbox v-model="catForm.isTechnical">技术领域</el-checkbox>
+              <el-checkbox v-model="catForm.isIndustrial">行业领域</el-checkbox>
+            </el-form-item>
+            <el-form-item label="关联标签">
+              <el-select v-model="catForm.tags" multiple filterable  placeholder="请选择" style="width: 100%;">
+                <el-option
+                  v-for="item in tagData"
+                  :key="item.id"
+                  :label="item.name"
+                  :value="item.id">
+                </el-option>
+              </el-select>
+
+            </el-form-item>
+            <el-form-item>
+              <el-button type="primary" @click="editCategory">提交</el-button>
+            </el-form-item>
+          </el-form>
+        </el-dialog>
+        <!--        新增领域弹出层 end -->
+      </el-tab-pane>
+    </el-tabs>
+    <div style="position: absolute;right:30px;top:20px;">
+      <el-link type="primary" @click="syncDictionary"><i class="el-icon-refresh"></i> 同步CPS词典</el-link>
+    </div>
+  </div>
+</template>
+
+<script>
+  export default {
+    data() {
+      return {
+        // activeName: 'tag',
+        activeName: 'category',
+        isReadOnly: true,
+        tagData: [],//标签数据
+        tagOption: [],//标签数据池
+        tag_map: {},
+        categoryData: [],//领域数据
+        cat_map: {},
+        tagName: '', //标签名称
+        categoryOptions: [],//领域选项
+        category:'',//领域选项值
+        categoryName: '',//领域名称
+        tagDialogVisible: false,//新增标签弹出层
+        categoryDialogVisible: false,//新增领域弹出层
+        editTagDialogVisible: false,//修改标签弹出层
+        editCategoryDialogVisible: false,//修改领域弹出层
+        tagForm: {weight:30},
+        temp_data: {},
+        catForm: {weight:50},
+        form: {},
+        categoryChecked1: false,
+        categoryChecked2: false,
+        tagRelationOptions: [],
+        categoryRelationOptions: [],
+      };
+    },
+    created: function () {
+      this.getTableData()
+        .catch(e => {
+          this.$message({
+            type: "error",
+            message: e.message
+          })
+        });
+    },
+    methods: {
+      // 获取列表数据
+      async getTableData() {
+        let tag_res = await this.$post("/api/admin/CpsManage/listTags", {});
+        if(tag_res.status == 1){
+          let map_i = {};
+          this.tagData = tag_res.data;
+          this.tagOption = tag_res.data;
+          for(let t = 0; t < this.tagData.length; t++){
+            map_i[this.tagData[t].id] = this.tagData[t].name;
+          }
+          this.tag_map = map_i;
+        }
+
+        let cat_res = await this.$post("/api/admin/CpsManage/listCategories", {});
+        if(cat_res.status == 1){
+          let map_ii = {};
+          if(cat_res.data){
+            this.categoryData = cat_res.data;
+            this.categoryOptions = cat_res.data;
+            for(let c = 0; c < this.categoryData.length; c++){
+              map_ii[this.categoryData[c].id] = this.categoryData[c].name;
+            }
+            this.cat_map = map_ii;
+          }
+        }
+      },
+      //同步
+      async syncDictionary(){
+        let res = await this.$post("/api/admin/CpsManage/syncDictionary", {});
+        if(res.status == 1){
+          this.$message({
+            type: "success",
+            message: "同步成功!"
+          });
+        }
+      },
+      //标签搜索
+      async searchTag(){
+        this.tagData = this.tagOption.filter(this.searchTagRes);
+      },
+      searchTagRes(item){
+        let q = this.tagName.toLowerCase();
+        let cat_id = this.category;
+        let res_i = true, res_ii = true;
+        if(q){
+          let name = item.name.toLowerCase();
+          res_i = (name.search(q) > -1);
+        }
+        if(cat_id){
+          res_ii = (item.catIds && item.catIds.indexOf(cat_id) > -1);
+        }
+        return (res_i && res_ii);
+      },
+      handleClick(tab, event) {
+      },
+      //领域搜索
+      async searchCat(){
+        this.categoryData = this.categoryOptions.filter(this.search);
+      },
+      search(item){
+        let q = this.categoryName.toLowerCase();
+        let res_i = true, res_ii = true, res_iii = true;
+        if(q){
+          let name = item.name.toLowerCase();
+          res_i = (name.search(q) > -1);
+        }
+        if(this.categoryChecked1){
+          res_ii = (item.isTechnical === true);
+        }
+        if(this.categoryChecked2){
+          res_iii = (item.isIndustrial === true);
+        }
+        return (res_i && res_ii && res_iii);
+      },
+      editTag(rowInfo){
+        this.editTagDialogVisible = true;
+        this.temp_data = rowInfo;
+        let info_str = JSON.stringify(rowInfo);
+        this.tagForm = JSON.parse(info_str);
+      },
+      editTagSub(){
+        let data = {
+          id: this.tagForm.id,
+          weight: this.tagForm.weight,
+          aliases: this.tagForm.aliases,
+          subtags: this.tagForm.subtags,
+        };
+        let res = this.$post("/api/admin/CpsManage/UpdateTag", data).then(res => {
+          if (res.status === 1) {
+            this.$message({
+              type: "success",
+              message: "修改成功!"
+            });
+            this.temp_data.weight = data.weight;
+            this.temp_data.aliases = data.aliases;
+            this.temp_data.subtags = data.subtags;
+          }else{
+            this.$message({
+              type: "error",
+              message: "修改失败!"
+            });
+          }
+          this.tagForm = {};
+          this.editTagDialogVisible = false;
+        });
+      },
+      addTag(){
+        this.tagDialogVisible= true;
+        this.tagForm.weight=30;
+      },
+      addTagSub(){
+        let data = {
+          name: this.tagForm.name,
+          weight: this.tagForm.weight,
+          aliases: this.tagForm.aliases,
+          subtags: this.tagForm.subtags,
+        };
+        let res = this.$post("/api/admin/CpsManage/CreateTag", data).then(res => {
+          if (res.status === 1) {
+            this.$message({
+              type: "success",
+              message: "新增成功!"
+            });
+            this.tagForm = {};
+            this.tagDialogVisible = false;
+            this.tagOption.unshift(res.data);
+            this.tagData = this.tagOption;
+          }else{
+            this.$message({
+              type: "error",
+              message: "新增失败!"
+            });
+            this.tagForm = {};
+            this.tagDialogVisible = false;
+          }
+        });
+      },
+      delTag(id){
+        this.$confirm('此操作将永久删除该标签, 是否继续?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          let data = {
+            id: id
+          };
+          let res = this.$post("/api/admin/CpsManage/DeleteTag", data).then(res => {
+            if (res.status === 1) {
+              this.$message({
+                type: "success",
+                message: "删除成功!"
+              });
+              for(let i = 0; i < this.tagData.length; i++) {
+                if (this.tagOption[i]['id'] == id) {
+                  this.tagOption.splice(i, 1);
+                  continue;
+                }
+              }
+              this.tagData = this.tagOption;
+            }else{
+              this.$message({
+                type: "error",
+                message: "删除失败!"
+              });
+            }
+          });
+        }).catch(() => {
+
+        });
+      },
+      addCategoryInit(){
+        this.categoryDialogVisible = true;
+        this.catForm.weight = 50;
+      },
+      addCategory(){
+        let data = {
+          name: this.catForm.name,
+          weight: this.catForm.weight,
+          tags: this.catForm.tags,
+          isTechnical: this.catForm.isTechnical,
+          isIndustrial: this.catForm.isIndustrial
+        };
+
+        let res = this.$post("/api/admin/CpsManage/CreateCategory", data).then(res => {
+          if (res.status === 1) {
+            this.$message({
+              type: "success",
+              message: "新增成功!"
+            });
+            this.catForm = {};
+            this.categoryDialogVisible = false;
+            this.categoryOptions.unshift(res.data);
+          }else{
+            this.$message({
+              type: "error",
+              message: "新增失败!"
+            });
+            this.catForm = {};
+            this.categoryDialogVisible = false;
+          }
+        });
+      },
+      editCat(rowInfo){
+        this.editCategoryDialogVisible = true;
+        this.temp_data = rowInfo;
+        let info_str = JSON.stringify(rowInfo);
+        this.catForm = JSON.parse(info_str);
+      },
+      editCategory(){
+
+        let data = {
+          id: this.catForm.id,
+          name: this.catForm.name,
+          weight: this.catForm.weight,
+          tags: this.catForm.tags,
+          isTechnical: this.catForm.isTechnical,
+          isIndustrial: this.catForm.isIndustrial
+        };
+        let res = this.$post("/api/admin/CpsManage/UpdateCategory", data).then(res => {
+          if (res.status === 1) {
+            this.$message({
+              type: "success",
+              message: "编辑成功!"
+            });
+            this.temp_data.name = data.name;
+            this.temp_data.weight = data.weight;
+            this.temp_data.tags = data.tags;
+            this.temp_data.isTechnical =  data.isTechnical;
+            this.temp_data.isIndustrial = data.isIndustrial;
+            this.catForm = {};
+            this.editCategoryDialogVisible = false;
+          }else{
+            this.$message({
+              type: "error",
+              message: "编辑失败!"
+            });
+            this.catForm = {};
+            this.editCategoryDialogVisible = false;
+          }
+        });
+      }
+      ,delCat(id){
+        this.$confirm('此操作将永久删除该领域, 是否继续?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          let data = {
+            id: id
+          };
+          let res = this.$post("/api/admin/CpsManage/DeleteCategory", data).then(res => {
+            if (res.status === 1) {
+              this.$message({
+                type: "success",
+                message: "删除成功!"
+              });
+              for(let i = 0; i < this.categoryData.length; i++){
+                if(this.categoryData[i]['id'] == id){
+                  this.categoryData.splice(i, 1);
+                  continue;
+                }
+              }
+            }else{
+              this.$message({
+                type: "error",
+                message: "删除失败!"
+              });
+            }
+          });
+        }).catch(() => {
+
+        });
+      }
+    }
+  };
+  </script>
+

+ 440 - 35
pages/main/index/jishuquan.vue

@@ -1,9 +1,9 @@
 <template>
   <div>
     <el-radio-group v-model="tab" size="small" @change="getList">
-      <el-radio-button label="ad">活动直播管理</el-radio-button>
       <el-radio-button label="topic">文章管理</el-radio-button>
       <el-radio-button label="video">视频管理</el-radio-button>
+      <el-radio-button label="ad">活动直播管理</el-radio-button>
       <el-radio-button label="kol">KOL管理</el-radio-button>
     </el-radio-group>
     <br/>
@@ -46,15 +46,37 @@
       />
     </template>
     <template v-if="tab==='topic'">
-      <el-radio-group v-model="labelTab" size="small" @change="getList" style="margin-top: 20px;">
-        <el-radio-button label>全部</el-radio-button>
-        <el-radio-button label="is_top">置顶</el-radio-button>
-        <el-radio-button label="is_must_see">进站必看</el-radio-button>
-        <el-radio-button label="is_hot">热门</el-radio-button>
-        <el-radio-button label="is_good">优质</el-radio-button>
-        <el-radio-button label="is_new">最新</el-radio-button>
-        <el-radio-button label="is_ad">广告</el-radio-button>
-      </el-radio-group>
+      <div  style="margin-top: 15px;">
+        <div style="float: left;width: 200px;margin-right: 15px;">
+          <el-input v-model="title" placeholder="请输入文章标题" @keyup.enter.native="getList"></el-input>
+        </div>
+        <div style="float: left;width: 200px;margin-right: 15px;">
+          <el-select v-model="labelTab" clearable placeholder="筛选运营标签">
+            <el-option
+              v-for="item in labelOptions"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value">
+            </el-option>
+          </el-select>
+        </div>
+        <div style="float: left;width: 200px;margin-right: 15px;">
+          <el-select v-model="is_show" clearable placeholder="筛选状态">
+            <el-option
+              v-for="item in showOptions"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value">
+            </el-option>
+          </el-select>
+        </div>
+        <div style="float: left;width: 200px;margin-right: 15px;">
+          <el-button type="primary" @click="getList">搜索</el-button>
+        </div>
+
+        <div style="clear: both;"></div>
+      </div>
+
       <div class="content" v-if="topics">
         <el-table :data="topics" height="100%" border style="width: 100%">
           <el-table-column :className="`clickable`" prop="title" label="文章标题">
@@ -76,7 +98,16 @@
               <el-tag type="danger">评论{{topic.row.reply_count}}</el-tag>
             </template>
           </el-table-column>
-          <el-table-column label="当前标签" width="280px">
+          <el-table-column label="内容标签" width="180px">
+            <template slot-scope="topic">
+              <span  v-for="item in topic.row.tags">
+                <el-tag type="info">{{item.name}}</el-tag>
+              </span>
+
+              <el-link icon="el-icon-edit" style="float: right;" @click="editContentTag(topic.row)"></el-link>
+            </template>
+          </el-table-column>
+          <el-table-column label="运营标签" width="240px">
             <template slot-scope="label" v-if="tab==='topic'">
               <el-tag type="info" v-if="label.row.is_top==1" class="custom-label">置顶</el-tag>
               <el-tag type="info" v-if="label.row.is_must_see==1" class="custom-label">进站必看</el-tag>
@@ -84,24 +115,47 @@
               <el-tag type="info" v-if="label.row.is_good==1" class="custom-label">优质</el-tag>
               <el-tag type="info" v-if="label.row.is_new==1" class="custom-label">最新</el-tag>
               <el-tag type="info" v-if="label.row.is_ad==1" class="custom-label">广告</el-tag>
+
+              <el-link icon="el-icon-edit" style="float: right;" @click="editOperateTag(label.row)"></el-link>
+            </template>
+          </el-table-column>
+          <el-table-column label="状态" width="100px">
+            <template slot-scope="label" v-if="tab==='topic'">
+              <span v-if="label.row.is_show==1" >显示中</span>
+              <span v-else-if="label.row.is_show==0 && label.row.risk_type=='ad'">[命中风控]<br/>&nbsp;&nbsp;&nbsp;&nbsp;广告</span>
+              <span v-else >已下架</span>
             </template>
           </el-table-column>
 
-          <el-table-column label="操作" width="260px" v-if="tab==='topic'">
+          <el-table-column label="操作" width="130px" v-if="tab==='topic'">
             <template slot-scope="topic" v-if="tab==='topic'">
-              <template>
-                <el-button type="primary" @click="editLabel(topic.row)">
-                  标签管理
-                  <i class="el-icon-setting el-icon--right"></i>
-                </el-button>
-              </template>
-              <el-button type="danger" @click="delTopic(topic.row.id)">
-                删除
-                <i class="el-icon-delete el-icon--right"></i>
-              </el-button>
+              <el-link type="warning" icon="el-icon-download" v-if="topic.row.is_show == 1" @click="stopShow(topic.row.id, topic.row.is_show)">下架</el-link>
+              <el-link type="success" icon="el-icon-upload2" v-else @click="stopShow(topic.row.id, topic.row.is_show)">上架</el-link>
+
+              <el-link type="danger" icon="el-icon-delete" @click="delTopic(topic.row.id)">删除</el-link>
             </template>
           </el-table-column>
         </el-table>
+        <el-dialog title="内容标签管理" :visible.sync="contentTagManege">
+          <el-form ref="form" :model="form" label-width="100px">
+            <SelectFilterable :selectData="contentTagData"/>
+            <div style="float: right;margin-top: 15px;">
+              <el-button type="primary" @click="addContentTag">提交</el-button>
+            </div>
+            <div style="clear: both;"></div>
+          </el-form>
+        </el-dialog>
+
+        <el-dialog title="运营标签管理" :visible.sync="operateTagManege">
+          <el-form ref="form" :model="form" label-width="100px">
+            <SelectFilterable :selectData="operateTagOptions"/>
+            <div style="float: right;margin-top: 15px;">
+              <el-button type="primary" @click="addOperateTag">提交</el-button>
+            </div>
+            <div style="clear: both;"></div>
+          </el-form>
+        </el-dialog>
+
       </div>
       <el-pagination
         class="order-footer"
@@ -171,21 +225,58 @@
       />
     </template>
     <template v-if="tab==='kol'">
-      <div>
-        <el-button type="success" style="margin-top: 20px;" @click="onAddAu(null)">添加KOL</el-button>
+      <div style="margin:15px 0;">
+        <div style="width:200px;margin:0 15px;float:left;">
+          <el-input v-model="authorName" placeholder="输入作者名" @keyup.enter.native="search"></el-input>
+        </div>
+        <div style="width:200px;margin:0 15px;float:left;">
+          <template>
+            <el-select v-model="createScene" clearable placeholder="选择创建场景">
+              <el-option
+                v-for="item in createSceneList"
+                :label="item.label"
+                :value="item.value">
+              </el-option>
+            </el-select>
+          </template>
+        </div>
+        <div style="width:200px;margin:0 15px;float:left;">
+          <template>
+            <el-select v-model="signing" clearable placeholder="选择签约状态">
+              <el-option
+                v-for="item in signingList"
+                :label="item.label"
+                :value="item.value">
+              </el-option>
+            </el-select>
+          </template>
+        </div>
+        <div style="width:100px;margin:0 15px;float:left;">
+          <el-button type="primary"  @click="search">搜索</el-button>
+        </div>
+        <div style="margin:0 15px;float:right;">
+          <el-button type="success" @click="onAddAu(null)">添加KOL</el-button>
+        </div>
+        <div style="clear: both;"></div>
       </div>
-      <div class="content" v-if="kols">
+      <div class="content" height="30%"  v-if="kols">
         <el-table :data="kols" height="100%" border style="width: 100%">
+          <el-table-column prop="portrait" label="头像">
+            <template slot-scope="scope">
+              <img :src="scope.row.portrait" min-width="70" height="70">
+            </template>
+          </el-table-column>
           <el-table-column prop="name" :className="`clickable`" label="作者名">
             <template slot-scope="scope">
-              <span>{{scope.row.name}}</span>
+              <span style="color:black;">{{scope.row.name}}</span>
             </template>
           </el-table-column>
-          <el-table-column prop="introduction" :className="`clickable`" label="简介">
+          <el-table-column prop="introduction" show-overflow-tooltip :className="`clickable`" label="简介">
             <template slot-scope="scope">
-              <span>{{scope.row.introduction}}</span>
+              <span style="color:black;">{{scope.row.introduction}}</span>
             </template>
           </el-table-column>
+
           <el-table-column prop="is_signing" label="是否签约">
             <template slot-scope="scope">
               <div v-if="scope.row.is_signing ==1">
@@ -195,6 +286,20 @@
 
             </template>
           </el-table-column>
+          <el-table-column prop="show_repost" label="开启转载说明">
+            <template slot-scope="scope">
+              <div v-if="scope.row.show_repost ==1">
+                开启
+              </div>
+              <div v-else>不开启</div>
+            </template>
+          </el-table-column>
+          <el-table-column prop="create_scene" label="创建场景">
+            <template slot-scope="scope">
+              <span v-if="scope.row.create_scene == 'self'">用户绑定</span>
+              <span v-else>后台新增</span>
+            </template>
+          </el-table-column>
           <el-table-column prop="uid" label="客栈UID"></el-table-column>
           <el-table-column label="关联渠道">
             <template slot-scope="scope">
@@ -272,6 +377,9 @@
 
     <el-dialog title="KOL管理" :visible.sync="kolFormVisible" :closeOnClickModal="false" :closeOnPressEscape="false">
       <el-form :model="kolform">
+        <el-form-item label="头像" v-if="kolform.portrait != './'" :label-width="formLabelWidth">
+          <img :src="kolform.portrait" style="width:100px;height:100px;" alt="头像">
+        </el-form-item>
         <el-form-item label="作者名" :label-width="formLabelWidth">
           <el-input v-model="kolform.name" autocomplete="off"></el-input>
         </el-form-item>
@@ -288,6 +396,15 @@
         <el-form-item label="是否签约" :label-width="formLabelWidth">
           <el-switch v-model="kolform.is_signing"></el-switch>
         </el-form-item>
+        <el-form-item label="是否开启转载" :label-width="formLabelWidth">
+          <el-switch v-model="kolform.show_repost"></el-switch>
+        </el-form-item>
+        <el-form-item label="创建场景" v-if="kolform.create_scene == 'self'" :label-width="formLabelWidth">
+          <span>用户绑定</span>
+        </el-form-item>
+        <el-form-item label="创建场景" v-else :label-width="formLabelWidth">
+          <span>后台新增</span>
+        </el-form-item>
         <el-form-item :label-width="formLabelWidth">
           <template>
             <el-row :gutter="20">
@@ -434,13 +551,102 @@
 </template>
 
 <script>
+  import {
+    AppMain,
+    Navbar,
+    Settings,
+    Sidebar,
+    TagsView,
+    SelectFilterable,
+    SelectLongRangeSearch,
+  } from "../../../layouts/components/index";
   export default {
+    components: {
+      AppMain,
+      Navbar,
+      Settings,
+      Sidebar,
+      TagsView,
+      SelectFilterable,
+      SelectLongRangeSearch,
+    },
     data() {
       return {
+        edit_id: '',
+        contentTagManege: false,
+        operateTagManege: false,
+        contentTagData: {
+          value: '',
+          options: []
+        },
+        operateTagOptions: {
+          value: '',
+          options: [{
+            'label':'置顶',
+            'value':'is_top'
+          },{
+            'label':'进站必看',
+            'value':'is_must_see'
+          },{
+            'label':'热门',
+            'value':'is_hot'
+          },{
+            'label':'优质',
+            'value':'is_good'
+          },{
+            'label':'最新',
+            'value':'is_new'
+          },{
+            'label':'广告',
+            'value':'is_ad'
+          },]
+        },
+        operateTags: [],
         labelTab: "",
+        title: "",
+        labelOptions: [
+          {
+            label: '全部',
+            value: ''
+          },
+          {
+            'label':'置顶',
+            'value':'is_top'
+          },{
+            'label':'进站必看',
+            'value':'is_must_see'
+          },{
+            'label':'热门',
+            'value':'is_hot'
+          },{
+            'label':'优质',
+            'value':'is_good'
+          },{
+            'label':'最新',
+            'value':'is_new'
+          },{
+            'label':'广告',
+            'value':'is_ad'
+          },
+        ],
+        is_show:"",
+        showOptions: [
+          {
+            label: '全部',
+            value: ''
+          },
+          {
+            label: '显示中',
+            value: 1
+          },
+          {
+            label:'已下架',
+            value: 0
+          }
+        ],
         page: 1,
         size: 20,
-        tab: "ad",
+        tab: "topic",
         total: 1,
         ads: [],
         topics: [],
@@ -456,11 +662,12 @@
           position: "1"
         },
         kolform: {
-          portrait: './',
+          portrait: '',
           name: "",
           introduction: "",
           uid: "",
           is_signing: true,
+          show_repost: true
         },
         options: [{
           value: 'wechat',
@@ -496,7 +703,34 @@
             url: '',
             code: 'wechat'
           }
-        ]      //
+        ],
+        authorName: '',
+        createScene: '',
+        createSceneList: [
+          {
+            'label':'全部',
+            'value':''
+          },{
+            'label':'后台新增',
+            'value':'admin'
+          },{
+            'label':'自行绑定',
+            'value':'self'
+          }
+        ],
+        signing:'',
+        signingList:[{
+          'label':'全部',
+          'value':''
+        },{
+          'label':'已签约',
+          'value':'1'
+        },{
+          'label':'未签约',
+          'value':'0'
+        }
+        ],
+
       }
     },
     mounted() {
@@ -504,13 +738,11 @@
     },
     methods: {
       goTopic(topic) {
-        console.log(topic);
         window.open(
           this.$store.state.domainConfig.jishuinUrl + "/p/" + topic.id + ".html"
         );
       },
       goVideo(topic) {
-        console.log(topic);
         window.open(
           this.$store.state.domainConfig.jishuinUrl + "/video/" + topic.video_id
         );
@@ -607,6 +839,37 @@
             });
           });
       },
+      stopShow(id, is_show) {
+        let tip = '下架';
+        if(is_show == 0){
+          tip = '上架';
+        }
+        this.$confirm("此操作将"+ tip +"该文章, 是否继续?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        })
+          .then(() => {
+            let res = this.$post("/api/admin/jishuquan/stop_show", {
+              id: id,
+              is_show: is_show
+            }).then(res => {
+              if (res.status == 1) {
+                this.$message({
+                  type: "success",
+                  message: tip +"成功!"
+                });
+                this.getList();
+              }
+            });
+          })
+          .catch(() => {
+            this.$message({
+              type: "info",
+              message: "已取消" + tip
+            });
+          });
+      },
       approveVideo(id) {
         this.$confirm("更改视频状态", "提示", {
           confirmButtonText: "确定",
@@ -660,7 +923,6 @@
           });
       },
       showAdEdit(item) {
-        console.log(item);
         if (item != null) {
           this.form.id = item.id;
           this.form.title = item.title;
@@ -703,7 +965,6 @@
         let form = this.form;
         if (form.id) {
           let res = await this.$post("/api/admin/jishuquan/update_ad", form);
-          console.log(res);
           if (res.status == 1) {
             this.$message({
               type: "success",
@@ -753,9 +1014,22 @@
             break;
           case "topic":
             if (this.labelTab) data.type = this.labelTab;
+            data.is_show = this.is_show;
+            if (this.title) data.title = this.title;
             res = await this.$post("/api/admin/jishuquan/get_topics", data);
             this.topics = res.data.topics;
             this.total = res.data.total;
+            if(this.contentTagData.options.length == 0){
+              res = await this.$post("/api/admin/jishuquan/listTags", {});
+              this.contentTagData.options = [];
+              if(res.status == 1){
+                let op_arr = new Array();
+                for(var i in res.data) {
+                  op_arr.push({value:res.data[i].id, label:res.data[i].name});
+                }
+                this.contentTagData.options = op_arr;
+              }
+            }
             break;
           case "kol":
             res = await this.$post("/api/admin/author/get_aus", data);
@@ -787,6 +1061,7 @@
             if (res.status == 1) {
               this.kolform = res.data;
               this.kolform.is_signing = res.data.is_signing == 1 ? true : false;
+              this.kolform.show_repost = res.data.show_repost == 1 ? true : false;
               this.channelData = res.data.channel.length >= 1 ? res.data.channel : [
                 {
                   channel_id: '',
@@ -812,6 +1087,7 @@
         let form = this.kolform;
         form.is_signing = form.is_signing ? 1 : 0;
         form.channelData = JSON.stringify(this.channelData);
+        form.show_repost = form.show_repost ? 1 : 0;
         if (form.id) {
           let res = this.$post("/api/admin/author/update_au", form)
             .then(res => {
@@ -833,6 +1109,7 @@
           if (this.radio == '1') {
             form.uid = '';
           }
+          form.create_scene = 'admin';
           let res = await this.$post("/api/admin/author/create_au", form)
             .then(res => {
               if (res.status == 1) {
@@ -863,7 +1140,135 @@
         };
         this.channelData = [{channel_id: '', url: '', code: 'wechat'}];
         this.getList();
+      },
+      async search(){
+        let form = {
+          'authorName': this.authorName,
+          'createScene': this.createScene,
+          'signing': this.signing,
+          'page': this.page,
+          'size': this.size,
+        }
+        let res = await this.$post("/api/admin/author/search_aus", form)
+          .then(res => {
+            if (res.status == 1) {
+              this.kols = res.data.aus;
+              this.total = res.data.total;
+              this.$message({
+                type: "success",
+                message: "查询成功!"
+              });
+            }
+          }).catch((re) => {
+            this.$message({
+              type: "error",
+              message: "查询失败"
+            });
+          });
+      },
+      editContentTag(row){
+        this.edit_id = row.id;
+        this.contentTagManege = true;
+        this.contentTagData.value = row.tags && row.tags.map(item => item.tag_id) || [];
+      },
+      editOperateTag(row){
+        this.edit_id = row.id;
+        let tags = new Array();
+        if(row.is_top == 1){
+          tags.push('is_top');
+        }
+        if(row.is_must_see == 1){
+          tags.push('is_must_see');
+        }
+        if(row.is_hot == 1){
+          tags.push('is_hot');
+        }
+        if(row.is_good == 1){
+          tags.push('is_good');
+        }
+        if(row.is_new == 1){
+          tags.push('is_new');
+        }
+        if(row.is_ad == 1){
+          tags.push('is_ad');
+        }
+
+        this.operateTagOptions.value = tags;
+        this.operateTagManege = true;
+      },
+      async addContentTag(){
+        let id = this.edit_id;
+        let tags = this.contentTagData.value;
+        let data = {
+          id: id,
+          tags: tags
+        };
+        let res = await this.$post("/api/admin/jishuquan/updateTopicTags", data)
+          .then(res => {
+            if (res.status == 1) {
+              this.$message({
+                type: "success",
+                message: "编辑成功!"
+              });
+              this.contentTagData.value = [];
+              this.getList();
+              this.contentTagManege = false;
+            }
+          }).catch((re) => {
+            this.$message({
+              type: "error",
+              message: "编辑失败"
+            });
+          });
+      },
+      async addOperateTag(){
+        let id = this.edit_id;
+        let tags = this.operateTagOptions.value;
+        let data = {
+          id: id,
+          is_top: 0,
+          is_must_see: 0,
+          is_hot: 0,
+          is_good: 0,
+          is_new: 0,
+          is_ad: 0,
+
+        };
+        for(var j = 0; j < tags.length; j++) {
+          if(tags[j] === 'is_top'){
+            data.is_top = 1;
+          }else if(tags[j] === 'is_must_see'){
+            data.is_must_see = 1;
+          }else if(tags[j] === 'is_hot'){
+            data.is_hot = 1;
+          }else if(tags[j] === 'is_good'){
+            data.is_good = 1;
+          }else if(tags[j] ==='is_new'){
+            data.is_new = 1;
+          }else if(tags[j] === 'is_ad'){
+            data.is_ad = 1;
+          }
+        }
+        let res = await this.$post("/api/admin/jishuquan/update_operate_tag", data)
+          .then(res => {
+            if (res.status == 1) {
+              this.kols = res.data.aus;
+              this.total = res.data.total;
+              this.$message({
+                type: "success",
+                message: "编辑成功!"
+              });
+              this.getList();
+              this.operateTagManege = false;
+            }
+          }).catch((re) => {
+            this.$message({
+              type: "error",
+              message: "编辑失败"
+            });
+          });
       }
+
     }
   };
 </script>