团队作业-冲刺二(10)
收藏个人信息界面
1 <template> 2 <div> 3 <div class="showlist"> 4 <el-row class="art-item" v-model="bookList" v-for="userblog in bookList"> 5 <el-card shadow="hover" style="height: 180px"> 6 <el-row class="art-info d-flex align-items-center justify-content-start"> 7 <div class="d-flex align-items-center"> 8 <div class="art-title"> 9 <a :href="'view?url='+userblog.url+'&name=userblog.document.title&type=inline'">{{userblog.title}}</a> 10 <!-- {{userblog.title}} --> 11 </div> 12 </div> 13 </el-row> 14 <el-row class="art-body"> 15 <div class="side-abstract"> 16 <div class="art-abstract"> 17 {{userblog.Abstract}} 18 </div> 19 </div> 20 </el-row> 21 <el-row class="art-floor"> 22 <div class="art-more"> 23 <el-button style="border-radius: 200px;" @click="delHistory()">删除记录</el-button> 24 </div> 25 <div class="art-time"> 26 <i class="el-icon-apple">作者:</i>{{ userblog.author }}   27 <i class="el-icon-time"></i>发布时间: {{ userblog.date }}   28 <i class="el-icon-apple">数据库:</i>{{ userblog.author }}   29 </div> 30 <div class="art-resouse"> 31 <i class="el-icon-apple">来源:</i>{{ userblog.resouse }} 32 </div> 33 </el-row> 34 </el-card> 35 </el-row> 36 </div> 37 38 <div > 39 <el-pagination 40 background 41 @size-change="handleSizeChange" 42 @current-change="handleCurrentChange" 43 :current-page="currentPage" 44 :page-sizes="[1, 2, 50, 100]" 45 :page-size="pageSize" 46 layout="total,sizes, prev, pager, next, jumper" 47 :total="total"> 48 </el-pagination> 49 </div> 50 </div> 51 </template> 52 53 <script> 54 //辅助函数获取仓库的数据 55 import { mapState } from "vuex"; 56 export default { 57 58 data(){ 59 return{ 60 currentPage: 1, // 初始页码 61 pageSize: 1, // 每页的数据 searchList.size 62 total: 0, // 总记录数 searchList.totatotalElementslPages 63 bookList: [], // content:[] 64 userId: this.$store.state.user.userinfo.id, 65 } 66 }, 67 mounted() { 68 this.search(); 69 }, 70 methods: { 71 //添加历史记录 72 delHistory() { 73 let userId = this.userId; 74 let data = this.histroy.id; 75 this.$store.dispatch("delHistory", {userId, data} ); 76 }, 77 gohighSearch() { 78 this.$router.push("/highSearch"); 79 }, 80 // 每页大小变更处理函数 81 handleSizeChange: function (size) { 82 this.pageSize = size; 83 console.log("每页大小:" + this.pageSize); //每页下拉显示数据 84 this.search(); 85 }, 86 // 页码变更处理函数 87 handleCurrentChange: function (currentPage) { 88 this.currentPage = currentPage; 89 console.log("当前页码:" + this.currentPage); //点击第几页 90 this.search(); 91 }, 92 search () { 93 // let userId = this.userId; 94 // let data = { 95 // currentPage: this.currentPage, 96 // pageSize: this.pageSize, 97 // }; 98 // this.$store.dispatch("getHistory", { userId,data} ); 99 // let data=JSON.parse(JSON.stringify(this.$store.state.bro.histroy.content)) 100 this.$store.dispatch("getBookList"); 101 let datas=JSON.parse(JSON.stringify(this.$store.state.book.bookList)) 102 this.bookList = datas.splice( 103 (this.currentPage - 1) * this.pageSize, 104 this.pageSize 105 ), 106 this.total=this.$store.state.book.bookList.length 107 }, 108 computed: { 109 ...mapState({ 110 histroy: (state) => state.bro.histroy, 111 }), 112 }, 113 }, 114 }; 115 </script> 116 117 <style scoped> 118 .showlist { 119 margin-left: 10%; 120 width: 80%; 121 } 122 123 #side .item { 124 margin-bottom: 30px; 125 } 126 127 .art-item { 128 margin-bottom: 1px; 129 position: relative; 130 } 131 132 .art-item .star { 133 width: 60px; 134 height: 60px; 135 position: absolute; 136 top: 0; 137 right: 0; 138 } 139 140 img.tag { 141 width: 16px; 142 height: 16px; 143 } 144 145 .art-title:hover { 146 padding-left: 10px; 147 color: #409eff; 148 } 149 150 .art-time { 151 margin-left: 30px; 152 font-size: 10px; 153 display: inline-block; 154 } 155 .art-more { 156 display: inline-block; 157 margin-top: 0px; 158 margin-right: 100px; 159 width: 15px; 160 } 161 162 .art-resouse{ 163 font-size: 10px; 164 display: inline-block; 165 width: 200px; 166 height: 13px; 167 white-space: nowrap; 168 overflow: hidden; 169 text-overflow: ellipsis; 170 } 171 .art-floor{ 172 padding: 10px 0; 173 } 174 .art-body { 175 display: flex; 176 padding: 10px 0; 177 } 178 179 .side-img { 180 height: 150px; 181 width: 270px; 182 overflow: hidden; 183 margin-right: 10px; 184 } 185 186 img.art-banner { 187 width: 100%; 188 height: 100%; 189 transition: all 0.6s; 190 } 191 192 img.art-banner:hover { 193 transform: scale(1.4); 194 } 195 196 .side-abstract { 197 flex: 1; 198 display: flex; 199 flex-direction: column; 200 } 201 202 .art-abstract { 203 flex: 1; 204 color: #aaa; 205 white-space: nowrap; 206 width: 800px; 207 height: 1200px; 208 margin-top: 10px; 209 overflow: hidden; 210 text-overflow: ellipsis; 211 font-size: 20px; 212 } 213 214 .art-more .view { 215 color: #aaa; 216 } 217 h5 { 218 font-size: 18px; 219 } 220 .pagination { 221 background-color: #f9f9f9; 222 } 223 .art-title { 224 font-size: 30px; 225 color: #2267c7; 226 border-left: 3px solid #f56c6c; 227 padding-left: 5px; 228 cursor: pointer; 229 width: 600px; 230 height: 40px; 231 overflow: hidden; 232 text-overflow: ellipsis; 233 white-space: nowrap; 234 } 235 </style>