glhcp/pc/pages/demand_list/index.vue

208 lines
6.4 KiB
Vue
Raw Normal View History

2023-08-22 10:14:17 +00:00
<template>
<div class="help-center-container">
<div class="help-center-box">
<div class="article-lists-container m-l-16 bg-white" style="width: 100%;">
<div v-show="!dataNull">
<div>
<nuxt-link :to="'/demand_list/demand_detail?id=' + item.id"
class="article-item flex-col bg-white" v-for="(item) in articleList" :key="item.id">
<div class="lg article-name line2" style="font-weight: bold;">{{item.name}}</div>
<div class="lighter article-content" v-html="item.content"></div>
<div class="flex row-between" style="margin-top:16px;">
<div class="sm muted">发布时间{{item.create_time}}</div>
<div class="flex m-l-16">
<i class="el-icon-s-promotion muted"></i>
<div class="muted" style="margin-left: 3px;">已报名<span style="margin:0 5px;color: #f00;">{{item.reports_count}}</span></div>
</div>
</div>
<div class="sign"><el-button type="primary" icon="el-icon-s-promotion">查看报名</el-button></div>
</nuxt-link>
</div>
<div class="help-center-pagination row-center">
<el-pagination background hide-on-single-page layout="prev, pager, next" :total="count"
prev-text="上一页" next-text="下一页" :page-size="10" @current-change="changePage" />
</div>
</div>
<div class="data-null column-center" v-show="dataNull">
<img style="width: 150px;height: 150px;" src="~/static/images/news_null.png" />
<div class="xs muted">
暂无消息记录
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
head() {
return {
title: this.$store.getters.headTitle,
link: [{
rel: "icon",
type: "image/x-icon",
href: this.$store.getters.favicon
}],
};
},
async asyncData({
$get,
$post
}) {
let currentId = 0;
let articleList = [];
let count = 0;
let dataNull = true;
let listsRes = await $get("demand/lists", {
params: {
page_size: 1,
}
});
if (listsRes.code == 1) {
articleList = listsRes.data.list;
count = listsRes.data.count
if (count <= 0) {
dataNull = true;
} else {
dataNull = false
}
}
return {
articleList,
count,
dataNull,
}
},
data() {
return {
articleList: [],
count: 0,
swiperOptions: {
width: 1180,
}
}
},
mounted() {
console.log(this.articleList, 'articleList')
},
methods: {
async changePage(current) {
let res = await this.$get("demand/lists", {
params: {
cid: this.currentId,
page_no: current,
page_size: 10
}
});
if (res.code == 1) {
this.articleList = res.data.list;
if (this.articleList.length <= 0) {
dataNull = true;
} else {
dataNull = false
}
}
},
changeList(id) {
this.currentId = id;
this.changePage(1)
}
}
}
</script>
<style lang="scss" scoped>
.help-center-container {
.help-center-banner {
margin-top: 16px;
}
.help-center-box {
margin-top: 16px;
display: flex;
flex-direction: row;
.help-center-aside {
width: 160px;
// min-height: 635px;
padding-top: 20px;
padding-bottom: 20px;
padding: 20px 30px;
.nav {
li {
margin: 10px 0px;
padding: 0px 30px;
cursor: pointer;
}
.active-item {
padding-left: 27px;
color: $--color-primary;
border-left: 3px solid $--color-primary;
}
}
}
.article-lists-container {
width: 1004px;
display: flex;
flex-direction: column;
justify-content: space-between;
.article-item {
margin: 0px 20px;
padding: 15px 0px;
border-bottom: 1px solid #E5E5E5;
cursor: pointer;
position: relative;
.article-name {
margin-bottom: 11px;
margin-top: 13px;
max-width: 720px;
}
}
.help-center-pagination {
padding-top: 38px;
margin-bottom: 30px;
}
.data-null {
padding-top: 150px;
}
}
}
}
::v-deep .el-pagination.is-background .btn-prev {
background: #fff;
padding: 0 10px;
}
::v-deep .el-pagination.is-background .btn-next {
background: #fff;
padding: 0 10px;
}
::v-deep .el-pagination.is-background .el-pager li {
background: #fff;
padding: 0 10px;
}
.article-content {
min-height: 50px;
max-height: 140px;
overflow: hidden;
}
.sign {
position: absolute;
right: 0;
top: 30px;
}
</style>