shuishen
2024-01-08 3fa3ea08a189ee1c9fb44bb267c7a5bddde21337
文章评论
1 files modified
94 ■■■■ changed files
src/views/article/articleComment.vue 94 ●●●● patch | view | raw | blame | history
src/views/article/articleComment.vue
@@ -2,8 +2,8 @@
  <basicContainer>
    <avue-crud :data="dataList" ref="crud" :table-loading="loading" @current-change="currentChange"
      @search-change="searchChange" @search-reset="searchReset" @size-change="sizeChange" :option="option"
      v-model="data" :page="page" @selection-change="selectionChange" @row-del="rowDel" @refresh-change="refreshChange"
      @on-load="onLoad">
            v-model="data" :page="page" @selection-change="selectionChange" @row-del="rowDel"
            @refresh-change="refreshChange" @on-load="onLoad">
      <template slot="menuLeft">
        <!-- <el-button size="small" icon="el-icon-delete" plain v-if="permission.article_delete" @click="handleDelete">删 除
        </el-button> -->
@@ -22,10 +22,10 @@
    add,
    getNotice,
    upcomment
  } from "@/api/article/articleComment";
} from "@/api/article/articleComment"
  import {
    mapGetters
  } from "vuex";
} from "vuex"
  import website from '@/config/website'
@@ -42,6 +42,12 @@
        loading: true,
        selectionList: [],
        option: {
                labelWidth: 96,
                searchLabelWidth: 66,
                searchShow: true,
                searchMenuSpan: 3,
                menuWidth: 80,
          selection: true,
          height: "auto",
          calcHeight: 54,
@@ -49,21 +55,24 @@
          menuAlign: 'center',
          addBtn: false,
          editBtn: false,
          searchMenuSpan: 3,
          searchBtn: true,
          column: [{
                column: [
                    {
                        width: 110,
              label: '头像',
              prop: 'avatar',
              dataType: 'string',
              type: 'img',
            },
            {
                        width: 120,
              label: '电话',
              prop: 'phone',
              searchSpan: 4,
              search: true,
            },
            {
                        width: 110,
              label: '昵称',
              prop: 'name',
              searchSpan: 4,
@@ -91,19 +100,19 @@
          viewBtn: this.vaildData(this.permission.article_view, true),
          delBtn: this.vaildData(this.permission.article_delete, true),
          editBtn: this.vaildData(this.permission.article_edit, true),
        };
            }
      },
      ids() {
        let ids = [];
            let ids = []
        this.selectionList.forEach((ele) => {
          ids.push(ele.id);
        });
        return ids.join(",");
                ids.push(ele.id)
            })
            return ids.join(",")
      },
    },
    methods: {
      selectionChange(list) {
        this.selectionList = list;
            this.selectionList = list
      },
      rowDel(row) {
        this.$confirm("确定将选择数据删除?", {
@@ -112,23 +121,23 @@
            type: "warning",
          })
          .then(() => {
            return remove(row.id);
                    return remove(row.id)
          })
          .then(() => {
            this.onLoad(this.page);
                    this.onLoad(this.page)
            this.$message({
              type: "success",
              message: "操作成功!",
            });
          });
                    })
                })
      },
      refreshChange() {
        this.onLoad(this.page, this.query);
            this.onLoad(this.page, this.query)
      },
      handleDelete() {
        if (this.selectionList.length === 0) {
          this.$message.warning("请选择至少一条数据");
          return;
                this.$message.warning("请选择至少一条数据")
                return
        }
        this.$confirm("确定将选择数据删除?", {
            confirmButtonText: "确定",
@@ -136,44 +145,44 @@
            type: "warning",
          })
          .then(() => {
            return remove(this.ids);
                    return remove(this.ids)
          })
          .then(() => {
            this.onLoad(this.page);
                    this.onLoad(this.page)
            this.$message({
              type: "success",
              message: "操作成功!",
            });
            this.$refs.crud.toggleSelection();
          });
                    })
                    this.$refs.crud.toggleSelection()
                })
      },
      searchReset() {
        this.query = {};
        this.onLoad(this.page);
            this.query = {}
            this.onLoad(this.page)
      },
      searchChange(params, done) {
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
            this.query = params
            this.page.currentPage = 1
            this.onLoad(this.page, params)
            done()
      },
      currentChange(currentPage) {
        console.log(currentPage)
        this.page.currentPage = currentPage;
            this.page.currentPage = currentPage
      },
      sizeChange(pageSize) {
        console.log(pageSize)
        this.page.pageSize = pageSize;
            this.page.pageSize = pageSize
      },
      onLoad(page, params = {}) {
        let values = {
          ...params,
        };
        this.loading = true;
            }
            this.loading = true
        getPageList(page.currentPage, page.pageSize, values).then((res) => {
          const data = res.data.data;
          this.page.total = data.total;
          this.dataList = data.records;
                const data = res.data.data
                this.page.total = data.total
                this.dataList = data.records
          this.dataList.forEach(item => {
            if (item.avatar) {
              // var urls = []
@@ -184,16 +193,15 @@
              item.avatar = website.minioUrl + item.avatar
            }
          })
          this.loading = false;
        });
                this.loading = false
            })
      },
      selectionClear() {
        this.selectionList = [];
        this.$refs.crud.toggleSelection();
            this.selectionList = []
            this.$refs.crud.toggleSelection()
      },
    }
  }
</script>
<style>
</style>
<style></style>