inleft
2022-08-04 00e46dcc41d259b33e6c6c9771b7e2fe2ab95401
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                                 在
27                                 <router-link to="/comment" v-if="item.commentType==1" @click.native="handleCancel()">碎碎念
28                                 </router-link>
29                                 <router-link :to="{path:'/mdDetail',query:{id:item.articleId}}"
30                                     :title="item.articleTitle" @click.native="handleCancel()" v-else>
31                                     {{item.articleTitle}}
32                                 </router-link>
33                                 中留言
34                             </template>
35
36                         </a-list-item-meta>
37                         <!-- <template #extra>
38                             {{item.createDate}}
39                         </template> -->
40                     </a-list-item>
41                 </template>
42                 <template #loadMore>
43                     <div :style="{ textAlign: 'center', marginTop: '12px', height: '32px', lineHeight: '32px' }">
44                         <a-button @click="loadMore" :disabled="refresh" v-if="showButton">
45                             加载更多
46                         </a-button>
47                         <a-button disabled v-else>
48                             更多记录就不展示啦..
49                         </a-button>
50                     </div>
51                 </template>
52             </a-list>
53
54         </a-modal>
55     </div>
56
57 </template>
58
59 <script>
60     import {
61         history
62     } from '../../api/blogArticleComment.js'
63
64     export default {
65         data() {
66             return {
67                 dataList: [],
68                 visible: false,
69                 loading: false,
70                 pageNo: 1,
71                 pageSize: 5,
72                 showButton: true,
73                 refresh: false,
74             }
75         },
76         beforeMount() {},
77         mounted() {
78             this.loadData()
79         },
80         methods: {
81             loadMore() {
82                 this.$message.info("拉取信息中..")
83                 this.loadData()
84             },
85             loadData() {
86                 this.refresh = true;
87                 setTimeout(() => {
88                     this.refresh = false;
89                 }, 1000);
90
91                 history({
92                     pageNo: this.pageNo++,
93                     pageSize: this.pageSize
94                 }).then((res) => {
95                     if (res.code == 200) {
96                         this.dataList = this.dataList.concat(res.data.records);
97                         if (res.data.pages <= this.pageNo - 1) {
98                             this.showButton = false
99                         }
100
101                     } else {
102                         this.$notification.error({
103                             message: '好像哪里不对劲..',
104                             description: res.message,
105                             placement: 'bottomRight'
106                         });
107                     }
108                 })
109             },
110             showModal() {
111                 this.visible = true;
112             },
113             handleCancel(e) {
114                 this.visible = false;
115             },
116
117         },
118     }
119 </script>
120 <style scoped>
121     .loadmore-list {
122         min-height: 350px;
123     }
124
125     .ant-list-item-meta-avatar {
126         width: 65px;
127
128     }
129
130     .myhiden {
131         display: -webkit-container;
132         -webkit-line-clamp: 3;
133         text-overflow: ellipsis;
134         overflow: hidden;
135     }
136
137     a {
138         color: black;
139     }
140 </style>