首页列表展示完成80%

This commit is contained in:
2023-06-30 23:22:40 +08:00
parent 626991b2cc
commit 226632509a
2 changed files with 106 additions and 91 deletions

View File

@@ -1,8 +1,10 @@
<template>
<el-container style="display: flex;flex-direction: row;">
<el-aside width="22vw" style=" height: calc(80vh - 60px); display: flex;flex-direction: row;justify-content: flex-end;margin-top: 5vh;">
<el-aside width="22vw"
style=" height: calc(80vh - 60px); display: flex;flex-direction: row;justify-content: flex-end;margin-top: 5vh;">
<template>
<el-card class="box-card" style="position: fixed;width: 10vw;height: 50vh;box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1)">
<el-card class="box-card"
style="position: fixed;width: 10vw;height: 50vh;box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1)">
<div slot="header" class="clearfix">
<span><i class="el-icon-menu"></i> 热门标签</span>
</div>
@@ -23,19 +25,20 @@
<template>
<div>
<el-tabs v-model="activeName" type="border-card" style="width: 45vw;" @tab-click="tabChange">
<el-tab-pane label="最" name="first" style="display: flex;justify-content: flex-start">
<el-tab-pane label="最" name="first">
<ul
class="list"
v-infinite-scroll="load"
infinite-scroll-disabled="disabled">
<ol v-for="i in count" :key="i" class="list-item" style="display: flex;flex-direction: row;margin-left: -80px">
<ProjectList></ProjectList>
<ol v-for="(project,index) in projectLists" :key="index" class="list-item"
style="display: flex;flex-direction: row;margin-left: -80px">
<ProjectList :project-lists="project"></ProjectList>
</ol>
</ul>
<p v-if="loading">加载中...</p>
<p v-if="noMore">没有更多了</p>
</el-tab-pane>
<el-tab-pane label="最" name="second">
<el-tab-pane label="最" name="second">
<div class="lsm-container">
<el-scrollbar class="scrollbar-wrapper" style="position: relative;">
<div class="infinite-list-wrapper">
@@ -43,8 +46,9 @@
class="list"
v-infinite-scroll="load"
infinite-scroll-disabled="disabled">
<ol v-for="i in count" :key="i" class="list-item" style="display: flex;flex-direction: row;margin-left: -80px">
<ProjectList></ProjectList>
<ol v-for="(project,index) in projectLists" :key="index" class="list-item"
style="display: flex;flex-direction: row;margin-left: -80px">
<ProjectList :project-lists="project"></ProjectList>
</ol>
</ul>
<p v-if="loading">加载中...</p>
@@ -198,12 +202,14 @@
import axios from 'axios'
import Vue from "vue";
import ProjectList from "@/components/ProjectList.vue";
export default {
name: "HomeComponent",
components: {ProjectList},
data() {
return {
activeName: 'first',
projectLists:[],
count: 10,
loading: false,
loginDialogVisible: false,
@@ -236,6 +242,7 @@ export default {
},
mounted() {
this.account(); //获取cookie的方法
this.ProjectLists();
},
computed: {
noMore() {
@@ -439,22 +446,29 @@ export default {
this.loading = false
}, 2000)
},
tabChange(tab, event){
console.log(tab, event);
if (tab.name == "first") {
//-------首页列表-------
ProjectLists() {
var that=this;
axios({
method: 'get',
method: 'post',
// 请求的地址
url: 'http://localhost:8082/helloGithub_war_exploded/selectLastByCate',
// URL 中的查询参数
params: {
num: 0,
num: "0",
}
}).then(function (res){
console.log(res);
}).then((res)=>{
console.log(res.data);
that.projectLists=res.data;
});
} else if (tab.name == "second") {
//网络请求2
},
tabChange(tab, event) {
console.log(tab, event);
// eslint-disable-next-line no-empty
if (tab.name == "second") {
}
}

View File

@@ -1,30 +1,30 @@
<template>
<div class="ProjectList">
<div class="projectIco">
<img src="../assets/images/touxiang.png" style="width: 5vw;height: 5vw;margin-left: 10px;border-radius: 10px">
<img :src="projectLists.projectIco" style="width: 5vw;height: 5vw;margin-left: 10px;border-radius: 10px">
</div>
<div style="height: 12vh;margin-left: 5px;width: auto;display: flex;flex-direction: column;justify-content: space-between">
<div class="ProjectTitle">
<span>由密码学专家团队打造的开源隐私计算平台</span>
<span>{{projectLists.projectTitle}}</span>
</div>
<div class="summary">
<span style="font-size: 1rem">随着数据安全法个人信息保护法的相继颁布隐私计算技术在近两..</span>
<span style="font-size: 1rem">{{brief}}</span>
</div>
<div class="other">
<div class="otherInfo">
<div class="projectName">
<span style="color: #59A3A4">primihub</span><span style="color: rgb(156 163 175);"> </span>
<span style="color: #59A3A4">{{ projectLists.projectName }}</span><span style="color: rgb(156 163 175);"> </span>
</div>
<div>
<div style="margin-left: 10px;width: 10px;height: 10px;border-radius: 50%;background-color: #ffba00"></div>
</div>
<el-tag size="mini" style="margin-left: 5px">C++</el-tag><span style="color: rgb(156 163 175);margin-left: 5px"> </span>
<div style="margin-left: 10px">
<span style="color: rgb(156 163 175); ">2023-6-30</span>
<span style="color: rgb(156 163 175); ">{{ formatTime }}</span>
</div>
</div>
<div class="lookCount">
<i class="el-icon-view" style="color: rgb(156 163 175);"></i><span style="margin-left: 5px;color: rgb(156 163 175); ">1.3k</span>
<i class="el-icon-view" style="color: rgb(156 163 175);"></i><span style="margin-left: 5px;color: rgb(156 163 175); ">{{ projectLists.lookCount }}</span>
</div>
</div>
</div>
@@ -43,17 +43,18 @@ export default {
computed: {
// 对时间进行格式化
formatTime: function() {
if (this.article) {
const dt = new Date(this.article.time)
if (this.projectLists) {
const dt = new Date(this.projectLists.submitTime)
const year=dt.getFullYear()
const month = dt.getMonth()
const date = dt.getDate()
return `${month}${date}`
return `${year}-${month}-${date}`
}
return '';
},
// 截取文章内容的前 35 个字,并加上省略号
brief: function() {
return this.projectLists.content.substr(0, 35) + '...';
return this.projectLists.projectDescription.substr(0, 35) + '...';
}
}
}