From 63ad2c3598400370dd7da5534659fd7e768a0a4a Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Mon, 16 May 2022 17:29:46 +0800
Subject: [PATCH] 地址替换

---
 src/views/article/article.vue |  119 +++++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 107 insertions(+), 12 deletions(-)

diff --git a/src/views/article/article.vue b/src/views/article/article.vue
index 7a8798a..9b8b1a9 100644
--- a/src/views/article/article.vue
+++ b/src/views/article/article.vue
@@ -22,7 +22,7 @@
     >
       <template slot="menuLeft">
         <el-button
-          type="danger"
+
           size="small"
           icon="el-icon-delete"
           plain
@@ -30,6 +30,24 @@
           @click="handleDelete"
         >删 除
         </el-button>
+        <el-button
+
+          size="small"
+          icon="el-icon-s-order"
+          plain
+          @click="kqcomment"
+        >开启评论
+        </el-button>
+        <el-button
+
+          size="small"
+          icon="el-icon-s-release"
+          plain
+          @click="gbcomment"
+        >关闭评论
+        </el-button>
+
+
       </template>
 
       <template slot-scope="{type,size,row }" slot="menu">
@@ -49,13 +67,22 @@
         </el-tag>
       </template>
 
+      <template slot-scope="{ row }" slot="iscomment">
+        <el-tag
+        >{{
+          row.iscomment == "1" ? "开启" : row.iscomment == "0" ? "关闭" : "关闭"
+          }}
+        </el-tag>
+      </template>
+
     </avue-crud>
   </basic-container>
 </template>
 
 <script>
-  import {getList, remove, update, add, getNotice} from "@/api/article/article";
+  import {getList, remove, update, add, getNotice, upcomment} from "@/api/article/article";
   import {mapGetters} from "vuex";
+  import userinfo from "@/views/system/userinfo";
 
   export default {
     data() {
@@ -177,11 +204,8 @@
             {
               label: "发布时间",
               prop: "createTime",
-              addDisplay: false,
-              editDisplay: false,
-              viewDisplay: false,
               type: "date",
-              format: "yyyy-MM-dd HH:mm:ss",
+              format: "yyyy-MM-dd",
               valueFormat: "yyyy-MM-dd HH:mm:ss",
             },
             {
@@ -193,6 +217,13 @@
               slot: true,
               search: true,
               type: "select",
+              rules: [
+                {
+                  required: true,
+                  message: "请选择发布状态",
+                  trigger: "blur",
+                },
+              ],
               dicData: [
                 {
                   label: "未发布",
@@ -205,11 +236,28 @@
               ],
             },
             {
+              label: "评论区",
+              prop: "iscomment",
+              width: 80,
+              slot: true,
+              type: "select",
+              dicData: [
+                {
+                  label: "关闭",
+                  value: "0",
+                },
+                {
+                  label: "开启",
+                  value: "1",
+                }
+              ],
+            },
+            {
               label: "视频",
               prop: "videoUrl",
               type: "upload",
               accept: "video/mp4",
-              display: true,
+              display: false,
               hide: true,
               span: 24,
               listType: "picture-img",
@@ -228,7 +276,8 @@
                 //   lineHeights: ['1', '1.15', '1.6', '2', '2.5', '3']
                 // },//wangEditor编辑的配置
                 props: {
-                  res: "data"
+                  res: "data",
+                  url: "link",
                 },
               },
               hide: true,
@@ -251,7 +300,7 @@
               content.display = false;
               videoUrl.rules = [
                 {
-                  required: true,
+                  required: false,
                   message: "请选择视频",
                   trigger: "blur",
                 },
@@ -259,7 +308,7 @@
             } else {
               videoUrl.display = false;
               content.display = true;
-              videoUrl.rules = [];
+              videoUrl.rules = "";
             }
           }
         },
@@ -267,7 +316,7 @@
       }
     },
     computed: {
-      ...mapGetters(["permission"]),
+      ...mapGetters(["permission","userInfo"]),
       permissionList() {
         return {
           addBtn: this.vaildData(this.permission.article_add, true),
@@ -286,6 +335,10 @@
     },
     methods: {
       rowSave(row, done, loading) {
+        if (row.videoUrl.length == 0) {
+          row.videoUrl = "";
+        }
+        row.userid=this.userInfo.user_id;
         add(row).then(
           () => {
             this.onLoad(this.page);
@@ -403,7 +456,7 @@
             endTime: dateTime[1],
             ...this.query,
           };
-          values.datetime = null;
+          values.dateTime = null;
         }
         this.loading = true;
         getList(page.currentPage, page.pageSize, values).then((res) => {
@@ -434,6 +487,48 @@
             loading();
           }
         );
+      },
+      kqcomment() {
+        if (this.selectionList.length === 0) {
+          this.$message.warning("请选择至少一条数据");
+          return;
+        }
+        this.$confirm("确定将选择数据开启评论?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        }).then(() => {
+          return upcomment(this.ids, "1");
+        })
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!",
+            });
+            this.$refs.crud.toggleSelection();
+          });
+      },
+      gbcomment() {
+        if (this.selectionList.length === 0) {
+          this.$message.warning("请选择至少一条数据");
+          return;
+        }
+        this.$confirm("确定将选择数据开启评论?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        }).then(() => {
+          return upcomment(this.ids, "0");
+        })
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!",
+            });
+            this.$refs.crud.toggleSelection();
+          });
       }
     },
   };

--
Gitblit v1.9.3