瀏覽代碼

bug修复,新增回复置顶

1018653686@qq.com 1 年之前
父節點
當前提交
f90e756ae2

+ 30 - 6
src/views/XMHJC/topic/content/index.vue

@@ -44,6 +44,7 @@ import byForm from "@/components/byForm/index.vue";
 import {computed, reactive, ref} from "vue";
 import replyList from "./replyList.vue";
 const loading = ref(false);
+const submitLoading = ref(false);
 
 const sourceList = ref({
   data: [],
@@ -91,6 +92,15 @@ const config = computed(() => {
     },
     {
       attrs: {
+        label: "主题分类",
+        prop: "type",
+      },
+      render(type) {
+        return type == "1" ? "在线问答" : "精彩视频";
+      },
+    },
+    {
+      attrs: {
         label: "是否热门",
         prop: "toping",
       },
@@ -107,6 +117,7 @@ const config = computed(() => {
       // 渲染 el-button,一般用在最后一列。
       renderHTML(row) {
         return [
+          row.type == 1?
           {
             attrs: {
               label: "修改",
@@ -117,7 +128,8 @@ const config = computed(() => {
             click() {
               openEditModal(row);
             },
-          },
+          }
+          :{},
           {
             attrs: {
               label: "查看回复",
@@ -129,6 +141,7 @@ const config = computed(() => {
               openReplyModal(row);
             },
           },
+          row.type == 1 ?
           {
             attrs: {
               label: "删除",
@@ -139,7 +152,8 @@ const config = computed(() => {
             click() {
               prefixDel(row);
             },
-          },
+          }
+          :{},
         ];
       },
     },
@@ -163,6 +177,20 @@ const selectConfig = computed(() => {
         },
       ],
     },
+    {
+      label: "主题分类",
+      prop: "type",
+      data: [
+        {
+          label: "在线问答",
+          value: "1",
+        },
+        {
+          label: "精彩视频",
+          value: "2",
+        },
+      ],
+    },
   ]});
 
 let formData = reactive({
@@ -262,7 +290,6 @@ const submitForm = () => {
   byform.value.handleSubmit(() => {
     submitLoading.value = true;
     proxy.post("/topicContent/edit", formData.data).then((res) => {
-      if(res){
         ElMessage({
           message: "编辑成功",
           type: "success",
@@ -270,9 +297,6 @@ const submitForm = () => {
         dialogVisible.value = false;
         submitLoading.value = false;
         getList();
-      }else{
-        submitLoading.value = false;
-      }
     });
   });
 };

+ 44 - 0
src/views/XMHJC/topic/content/replyList.vue

@@ -74,6 +74,15 @@ const config = computed(() => {
     },
     {
       attrs: {
+        label: "是否置顶",
+        prop: "toping",
+      },
+      render(type) {
+        return type=='1' ? '是' : '否';
+      },
+    },
+    {
+      attrs: {
         label: "操作",
         align: "center",
       },
@@ -82,6 +91,17 @@ const config = computed(() => {
           return [
             {
               attrs: {
+                label: row.toping == 1 ? "取消置顶" : "置顶",
+                type: "primary",
+                text: true,
+              },
+              el: "button",
+              click() {
+                topingReplys(row);
+              },
+            },
+            {
+              attrs: {
                 label: "删除",
                 type: "danger",
                 text: true,
@@ -149,6 +169,30 @@ const prefixDel = (row) => {
   });
 };
 
+
+const topingReplys = (row) => {
+  modalType.value = "edit";
+  let toping = row.toping=='1' ? 0 : 1;
+  proxy.post("/topicReplies/detail", { id: row.id }).then((res) => {
+    res.toping = toping;
+    formData.data = res;
+    ElMessageBox.confirm("你是否确认此操作?", "提示", {
+      confirmButtonText: "确定",
+      cancelButtonText: "取消",
+      type: "warning",
+    }).then(() => {
+      // 更新状态
+      proxy.post("/topicReplies/topingReplys", formData.data).then((res) => {
+        ElMessage({
+          message: "操作成功",
+          type: "success",
+        });
+        getList();
+      });
+    });
+  });
+};
+
 const del = (id) => {
   proxy.post("/topicReplies/deleteAndChild", { id: id }).then((res) => {
     ElMessage({

+ 151 - 0
src/views/XMHJC/websiteUser/index.vue

@@ -0,0 +1,151 @@
+<template>
+  <div class="websiteUser">
+    <!-- <Banner /> -->
+    <div class="content">
+      <byTable
+        :source="sourceList.data"
+        :pagination="sourceList.pagination"
+        :config="config"
+        :loading="loading"
+        highlight-current-row
+        @get-list="getList">
+        <template #slotName="{ item }">
+          {{ item.createTime }}
+        </template>
+      </byTable>
+    </div>
+  </div>
+</template>
+
+<script setup>
+/* eslint-disable vue/no-unused-components */
+import { ElMessage, ElMessageBox } from "element-plus";
+import byTable from "@/components/byTable/index.vue";
+import byForm from "@/components/byForm/index.vue";
+import { computed, ref } from "vue";
+import {getDictOneByXmhjc} from "@/api/XMHJC/common";
+const loading = ref(false);
+const submitLoading = ref(false);
+const enableStatus = ref([]);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 3,
+    pageNum: 1,
+    pageSize: 10,
+  },
+});
+let dialogVisible = ref(false);
+let modalType = ref("add");
+let rules = ref({
+});
+const { proxy } = getCurrentInstance();
+const config = computed(() => {
+  return [
+    {
+        attrs: {
+            label: "序号",
+            prop: "id",
+        },
+    },
+    {
+      attrs: {
+        label: "用户名",
+        prop: "userName",
+      },
+    },
+    {
+      attrs: {
+        label: "密码",
+        prop: "password",
+      },
+    },
+    {
+      attrs: {
+        label: "创建时间",
+        prop: "createTime",
+      },
+    },
+    {
+      attrs: {
+        label: "操作",
+        width: "200",
+        align: "right",
+      },
+      // 渲染 el-button,一般用在最后一列。
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: "删除",
+              type: "danger",
+              text: true,
+            },
+            el: "button",
+            click() {
+              del(row);
+            },
+          },
+        ];
+      },
+    },
+  ];
+});
+
+let formData = reactive({
+  data: {},
+});
+const formOption = reactive({
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+  rules: [],
+});
+const byform = ref(null);
+const getList = async (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+    proxy.post("/websiteUsers/page", sourceList.value.pagination).then((message) => {
+    console.log(message);
+    sourceList.value.data = message.rows;
+    sourceList.value.pagination.total = message.total;
+    setTimeout(() => {
+      loading.value = false;
+    }, 200);
+  });
+};
+const openModal = () => {
+  dialogVisible.value = true;
+  modalType.value = "add";
+  formData.data = {};
+};
+
+//删除
+const del = (row) => {
+  modalType.value = "edit";
+  ElMessageBox.confirm("你是否确认此操作?", "提示", {
+    confirmButtonText: "确定",
+    cancelButtonText: "取消",
+    type: "warning",
+  }).then(() => {
+    proxy.post("/websiteUsers/delete", { id: row.id }).then((res) => {
+        ElMessage({
+          message: "操作成功",
+          type: "success",
+        });
+        getList();
+      });
+  });
+};
+getList();
+</script>
+
+<style lang="scss" scoped>
+.websiteUser {
+  padding: 20px;
+  .delete-btn{
+    margin-top: 10px;
+    margin-left: 25px;
+  }
+}
+</style>