zxl
2025-05-23 5d5b0f7ab0f34019e11901ddcd59cd8b51ea9ff9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<template>
  <div class="wrapper">
    <div class="content">
      <div>
        <div class="tables">
          <Table
           border
            height="350"
            tooltip
            :loading="loading"
            :columns="columns"
            :data="data"
          >
          </Table>
 
          <Page
 
            @on-change="changePageNum"
            @on-page-size-change="changePageSize"
            :current="params.pageNumber"
            :page-size="params.pageSize"
            class="mt_10"
            :total="Number(total)"
            size="small"
            show-elevator
          />
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { getHomeList }  from "@/api/other.js";
export default {
  data() {
    return {
      loading: true, //表格请求数据为true
      promotionList: "", // 活动列表
      selectedIndex: 0, //左侧菜单选择
      promotions: "", //选中的活动key
      index: 999, // 已选下标
      data:[],
      params: {
        sort: "createTime",
        order: "desc",
        pageClientType: "H5",
        pageNumber: 1,
        pageSize: 10,
        pageType: "SPECIAL",
      },
      total: 0, // 表单数据总数
      columns: [
        {
          title: "专题名称",
          key: "name",
          tooltip: true,
          // slot: 'name'
        //   width: 200,
        },
        {
          title: "操作",
          key: "action",
          fixed: "right",
          width: 100,
          render: (h, params) => {
            return h("div", [
              h(
                "Button",
                {
                  props: {
                    type: this.index == params.index ? "primary" : "default",
                    size: "small",
                  },
                  on: {
                    click: () => {
                      this.index = params.index;
                      params.row = {...params.row,pageType:'special',___type:'special'}
                      this.$emit("selected", [params.row]);
                    },
                  },
                },
                this.index == params.index ? "已选" : "选择"
              ),
            ]);
          },
        },
      ],
    };
  },
  mounted() {
    this.init();
  },
 
  methods: {
    changePageNum (val) { // 修改评论页码
      this.params.pageNumber = val;
      this.init();
    },
    changePageSize (val) { // 修改评论页数
      this.params.pageNumber = 1;
      this.params.pageSize = val;
      this.init();
    },
    // 获取话题的标题
    async init() {
      // 根据当前路径判断当前是H5还是PC
      this.params.pageClientType = this.$route.name === 'renovation' ? 'PC' : 'H5'
      let res = await getHomeList(this.params);
      if (res.success) {
        this.loading = false;
        this.data= res.result.records
        this.total = res.result.total
      } else {
        this.loading = false;
      }
    },
  },
};
</script>
<style lang="scss" scoped>
img {
  max-width: 100% !important;
}
.search {
  width: 300px;
}
.page {
  margin-top: 2vh;
  text-align: right;
}
.time {
  font-size: 12px;
}
.tables {
  height: 400px;
  margin-top: 20px;
  overflow: auto;
  width: 100%;
}
/deep/ .ivu-table-wrapper {
  width: 100%;
}
.list {
  margin: 0 1.5%;
  height: 400px;
  overflow: auto;
  > .list-item {
    padding: 10px;
    transition: 0.35s;
    cursor: pointer;
  }
  .list-item:hover {
    background: #ededed;
  }
}
.list {
  flex: 1;
  width: auto;
}
.content {
  overflow: hidden;
  flex: 4;
}
.active {
  background: #ededed;
}
.wrapper {
  overflow: hidden;
}
.search-views {
  display: flex;
  > * {
    margin: 0 4px;
  }
}
</style>