首页列表展示完成80%
This commit is contained in:
@@ -1,8 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-container style="display: flex;flex-direction: row;">
|
<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>
|
<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">
|
<div slot="header" class="clearfix">
|
||||||
<span><i class="el-icon-menu"></i> 热门标签</span>
|
<span><i class="el-icon-menu"></i> 热门标签</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -23,19 +25,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-tabs v-model="activeName" type="border-card" style="width: 45vw;" @tab-click="tabChange">
|
<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
|
<ul
|
||||||
class="list"
|
class="list"
|
||||||
v-infinite-scroll="load"
|
v-infinite-scroll="load"
|
||||||
infinite-scroll-disabled="disabled">
|
infinite-scroll-disabled="disabled">
|
||||||
<ol v-for="i in count" :key="i" class="list-item" style="display: flex;flex-direction: row;margin-left: -80px">
|
<ol v-for="(project,index) in projectLists" :key="index" class="list-item"
|
||||||
<ProjectList></ProjectList>
|
style="display: flex;flex-direction: row;margin-left: -80px">
|
||||||
|
<ProjectList :project-lists="project"></ProjectList>
|
||||||
</ol>
|
</ol>
|
||||||
</ul>
|
</ul>
|
||||||
<p v-if="loading">加载中...</p>
|
<p v-if="loading">加载中...</p>
|
||||||
<p v-if="noMore">没有更多了</p>
|
<p v-if="noMore">没有更多了</p>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="最新" name="second">
|
<el-tab-pane label="最热" name="second">
|
||||||
<div class="lsm-container">
|
<div class="lsm-container">
|
||||||
<el-scrollbar class="scrollbar-wrapper" style="position: relative;">
|
<el-scrollbar class="scrollbar-wrapper" style="position: relative;">
|
||||||
<div class="infinite-list-wrapper">
|
<div class="infinite-list-wrapper">
|
||||||
@@ -43,8 +46,9 @@
|
|||||||
class="list"
|
class="list"
|
||||||
v-infinite-scroll="load"
|
v-infinite-scroll="load"
|
||||||
infinite-scroll-disabled="disabled">
|
infinite-scroll-disabled="disabled">
|
||||||
<ol v-for="i in count" :key="i" class="list-item" style="display: flex;flex-direction: row;margin-left: -80px">
|
<ol v-for="(project,index) in projectLists" :key="index" class="list-item"
|
||||||
<ProjectList></ProjectList>
|
style="display: flex;flex-direction: row;margin-left: -80px">
|
||||||
|
<ProjectList :project-lists="project"></ProjectList>
|
||||||
</ol>
|
</ol>
|
||||||
</ul>
|
</ul>
|
||||||
<p v-if="loading">加载中...</p>
|
<p v-if="loading">加载中...</p>
|
||||||
@@ -198,12 +202,14 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import Vue from "vue";
|
import Vue from "vue";
|
||||||
import ProjectList from "@/components/ProjectList.vue";
|
import ProjectList from "@/components/ProjectList.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "HomeComponent",
|
name: "HomeComponent",
|
||||||
components: {ProjectList},
|
components: {ProjectList},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
activeName: 'first',
|
activeName: 'first',
|
||||||
|
projectLists:[],
|
||||||
count: 10,
|
count: 10,
|
||||||
loading: false,
|
loading: false,
|
||||||
loginDialogVisible: false,
|
loginDialogVisible: false,
|
||||||
@@ -236,6 +242,7 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.account(); //获取cookie的方法
|
this.account(); //获取cookie的方法
|
||||||
|
this.ProjectLists();
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
noMore() {
|
noMore() {
|
||||||
@@ -439,22 +446,29 @@ export default {
|
|||||||
this.loading = false
|
this.loading = false
|
||||||
}, 2000)
|
}, 2000)
|
||||||
},
|
},
|
||||||
tabChange(tab, event){
|
|
||||||
console.log(tab, event);
|
//-------首页列表-------
|
||||||
if (tab.name == "first") {
|
ProjectLists() {
|
||||||
|
var that=this;
|
||||||
axios({
|
axios({
|
||||||
method: 'get',
|
method: 'post',
|
||||||
// 请求的地址
|
// 请求的地址
|
||||||
url: 'http://localhost:8082/helloGithub_war_exploded/selectLastByCate',
|
url: 'http://localhost:8082/helloGithub_war_exploded/selectLastByCate',
|
||||||
// URL 中的查询参数
|
// URL 中的查询参数
|
||||||
params: {
|
params: {
|
||||||
num: 0,
|
num: "0",
|
||||||
}
|
}
|
||||||
}).then(function (res){
|
}).then((res)=>{
|
||||||
console.log(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") {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,30 +1,30 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="ProjectList">
|
<div class="ProjectList">
|
||||||
<div class="projectIco">
|
<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>
|
||||||
<div style="height: 12vh;margin-left: 5px;width: auto;display: flex;flex-direction: column;justify-content: space-between">
|
<div style="height: 12vh;margin-left: 5px;width: auto;display: flex;flex-direction: column;justify-content: space-between">
|
||||||
<div class="ProjectTitle">
|
<div class="ProjectTitle">
|
||||||
<span>由密码学专家团队打造的开源隐私计算平台</span>
|
<span>{{projectLists.projectTitle}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="summary">
|
<div class="summary">
|
||||||
<span style="font-size: 1rem">随着《数据安全法》和《个人信息保护法》的相继颁布,隐私计算技术在近两..</span>
|
<span style="font-size: 1rem">{{brief}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="other">
|
<div class="other">
|
||||||
<div class="otherInfo">
|
<div class="otherInfo">
|
||||||
<div class="projectName">
|
<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>
|
<div>
|
||||||
<div style="margin-left: 10px;width: 10px;height: 10px;border-radius: 50%;background-color: #ffba00"></div>
|
<div style="margin-left: 10px;width: 10px;height: 10px;border-radius: 50%;background-color: #ffba00"></div>
|
||||||
</div>
|
</div>
|
||||||
<el-tag size="mini" style="margin-left: 5px">C++</el-tag><span style="color: rgb(156 163 175);margin-left: 5px"> • </span>
|
<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">
|
<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>
|
</div>
|
||||||
<div class="lookCount">
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -43,17 +43,18 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
// 对时间进行格式化
|
// 对时间进行格式化
|
||||||
formatTime: function() {
|
formatTime: function() {
|
||||||
if (this.article) {
|
if (this.projectLists) {
|
||||||
const dt = new Date(this.article.time)
|
const dt = new Date(this.projectLists.submitTime)
|
||||||
|
const year=dt.getFullYear()
|
||||||
const month = dt.getMonth()
|
const month = dt.getMonth()
|
||||||
const date = dt.getDate()
|
const date = dt.getDate()
|
||||||
return `${month}月${date}日`
|
return `${year}-${month}-${date}`
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
},
|
},
|
||||||
// 截取文章内容的前 35 个字,并加上省略号
|
// 截取文章内容的前 35 个字,并加上省略号
|
||||||
brief: function() {
|
brief: function() {
|
||||||
return this.projectLists.content.substr(0, 35) + '...';
|
return this.projectLists.projectDescription.substr(0, 35) + '...';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user