inleft
2022-08-12 0dd41bd8cee430d3a948b89c664cb511c400993c
commit | author | age
00e46d 1 <template>
I 2     <div class="myModal">
3         <a-modal v-model="visible" title="天涯共此时.." :footer="null"
4             :bodyStyle="{'overflow':'overlay','maxHeight': '550px'}">
5             <!-- <template #actions>
6                 <a-button>
7                     未读
8                     <a-icon type="bell" />
9                 </a-button>
10             </template> -->
11             <a-list item-layout="horizontal" :data-source="dataList">
12                 <template slot="renderItem" slot-scope="item">
13                     <a-list-item>
14                         <a-list-item-meta :description="item.commentContent">
15                             <template #avatar>
16                                 <a :href="item.visitorHomePage" target="_blank" v-if="item.visitorHomePage!=''">
17                                     <a-tooltip placement="bottomLeft" :title="item.visitorNickName">
18                                         <span class="myTip">{{item.visitorNickName}} :</span>
19                                     </a-tooltip>
20                                 </a>
21                                 <a-tooltip placement="bottomLeft" :title="item.visitorNickName" v-else>
22                                     <span class="myTip">{{item.visitorNickName}} :</span>
23                                 </a-tooltip>
24                             </template>
25                             <template #title>
26                                 在
2795be 27                                 <router-link to="/comment" @click.native="handleCancel()" v-if="item.commentType==1">
I 28                                     {{item.articleTitle}}
00e46d 29                                 </router-link>
I 30                                 <router-link :to="{path:'/mdDetail',query:{id:item.articleId}}"
31                                     :title="item.articleTitle" @click.native="handleCancel()" v-else>
32                                     {{item.articleTitle}}
33                                 </router-link>
34                                 中留言
35                             </template>
36
37                         </a-list-item-meta>
38                         <!-- <template #extra>
39                             {{item.createDate}}
40                         </template> -->
41                     </a-list-item>
42                 </template>
43                 <template #loadMore>
44                     <div :style="{ textAlign: 'center', marginTop: '12px', height: '32px', lineHeight: '32px' }">
45                         <a-button @click="loadMore" :disabled="refresh" v-if="showButton">
46                             加载更多
47                         </a-button>
48                         <a-button disabled v-else>
49                             更多记录就不展示啦..
50                         </a-button>
2795be 51                         <span style="margin: 20px;">
I 52                             <a-button @click="reload" :disabled="refresh">
53                                 <a-icon type="redo" />
54                             </a-button>
55                         </span>
00e46d 56                     </div>
I 57                 </template>
58             </a-list>
59
60         </a-modal>
61     </div>
62
63 </template>
64
65 <script>
66     import {
67         history
68     } from '../../api/blogArticleComment.js'
69
70     export default {
71         data() {
72             return {
73                 dataList: [],
74                 visible: false,
75                 loading: false,
76                 pageNo: 1,
146176 77                 pageSize: 4,
00e46d 78                 showButton: true,
I 79                 refresh: false,
80             }
81         },
82         beforeMount() {},
83         mounted() {
0dd41b 84             this.loadMore()
00e46d 85         },
I 86         methods: {
87             loadMore() {
88                 this.$message.info("拉取信息中..")
89                 this.loadData()
90             },
2795be 91             reload() {
I 92                 this.$message.info("重新拉取信息..")
93                 this.pageNo = 1;
146176 94                 this.pageSize = 4;
2795be 95                 this.showButton = true;
I 96                 this.dataList = [];
97                 setTimeout(() => {
98                     this.loadData()
99                 }, 100);
100             },
00e46d 101             loadData() {
I 102                 this.refresh = true;
103                 setTimeout(() => {
104                     this.refresh = false;
105                 }, 1000);
106
107                 history({
108                     pageNo: this.pageNo++,
109                     pageSize: this.pageSize
110                 }).then((res) => {
111                     if (res.code == 200) {
112                         this.dataList = this.dataList.concat(res.data.records);
113                         if (res.data.pages <= this.pageNo - 1) {
114                             this.showButton = false
115                         }
116
117                     } else {
118                         this.$notification.error({
119                             message: '好像哪里不对劲..',
120                             description: res.message,
121                             placement: 'bottomRight'
122                         });
123                     }
124                 })
125             },
126             showModal() {
127                 this.visible = true;
128             },
129             handleCancel(e) {
130                 this.visible = false;
131             },
132
133         },
134     }
135 </script>
136 <style scoped>
137     .loadmore-list {
138         min-height: 350px;
139     }
140
141     .ant-list-item-meta-avatar {
142         width: 65px;
143
144     }
145
146
147     a {
148         color: black;
149     }
150 </style>