xzrkz-web/src/pages/Exhibition/Exhibition.vue

354 lines
9.1 KiB
Vue
Raw Normal View History

2020-06-07 10:28:34 +08:00
<template>
<div>
<Header></Header>
<div class="location">
<div class="location-content">
您的位置<router-link to="/">首页</router-link> >
</div>
</div>
2020-07-15 11:22:49 +08:00
<div class="type">
<div class="type-container">
<span>类型</span>
<ul>
<li :class="{active: page.newsDirectoriesId == ''}" @click="changeType(null)">全部</li>
<li v-for="(btn,idx) in typeList" :key="idx" :class="{active: page.newsDirectoriesId == btn.newsDirectoriesId}" @click="changeType(btn.newsDirectoriesId)">{{btn.directoriesName}}</li>
</ul>
</div>
</div>
2020-06-07 10:28:34 +08:00
<div class="exhibition">
2020-07-14 16:14:54 +08:00
<div v-if="!isLoading">
<ul v-if="hasData">
2020-07-16 19:30:11 +08:00
<li v-for="(list,idx) in exhibition" :key="idx" @click="goDetail(list.newsContentLink, list.templateRecordUrl)" :title="list.newsContentTitle">
2020-07-14 16:14:54 +08:00
<div class="exhibition-img">
2022-12-14 10:24:09 +08:00
<img :src="url + 'route/file/download/false/' + list.newsContentCoverList" alt="">
2020-07-14 16:14:54 +08:00
</div>
<div class="exhibition-info">
<h1>{{list.newsContentTitle}}</h1>
<p>作者{{list.newsContentAuthor}}</p>
</div>
</li>
</ul>
<div class="no-data" v-else>
<img src="@/assets/images/no-data.png" alt="">
</div>
</div>
2020-06-07 10:28:34 +08:00
</div>
2020-06-07 16:25:03 +08:00
<div class="pager" v-if="hasData">
<span @click="paging(1)">首页</span>
<span @click="paging(page.page - 1)" v-if="page.page > 1">上一页</span>
<ul v-if="page.totalPage > 0 && page.totalPage <= 5">
<li v-for="cpage in page.totalPage" :class="{'active': page.page == cpage}" :key="cpage" @click="paging(cpage)">
{{cpage}}
</li>
2020-06-07 10:28:34 +08:00
</ul>
2020-06-07 16:25:03 +08:00
<ul v-if="page.totalPage > 5">
<li v-if="page.page < 3" v-for="cpage in 5" :class="{'active': page.page == cpage}" :key="cpage" @click="paging(cpage)">
{{cpage}}
</li>
<li v-if="page.page > page.totalPage - 2" v-for="cpage in 5" :class="{'active': page.page == (page.totalPage - 5 + cpage)}" :key="cpage" @click="paging(cpage)">
{{page.totalPage - 5 + cpage}}
</li>
<li v-if="page.page >= 3 && page.page <= page.totalPage - 2" v-for="cpage in 5" :class="{'active': page.page == (page.page - (3 - cpage))}" :key="cpage" @click="paging(cpage)">
{{page.page - (3 - cpage)}}
</li>
</ul>
<span @click="paging(page.page + 1)" v-if="page.page < page.totalPage">下一页</span>
<span @click="paging(page.totalPage)">尾页</span>
<input type="text" v-model="changePage" v-if="showJumpBtn">
<i v-if="showJumpBtn">/{{page.totalPage}}</i>
<button v-if="showJumpBtn" @click="doJumpPage">跳转</button>
2020-06-07 10:28:34 +08:00
</div>
2020-07-14 16:14:54 +08:00
<div class="loading" v-if="isLoading">
<img src="@/assets/images/loading.gif" alt="">
</div>
2020-06-07 10:28:34 +08:00
<Footer></Footer>
</div>
</template>
<script>
import Header from '@/common/components/Header'
import Footer from '@/common/components/Footer'
2020-07-11 14:45:34 +08:00
import common from '@/common/components/common.js'
2020-06-07 10:28:34 +08:00
import axios from 'axios'
export default {
name: 'Exhibition',
components: {
Header,
Footer
},
data () {
return {
2020-07-15 11:22:49 +08:00
typeList: [],
2020-06-07 16:25:03 +08:00
changePage: 1,
exhibition: [],
page: {
page: 1,
rows: 8,
totalPage: 1,
2020-07-15 11:22:49 +08:00
newsDirectoriesId: '',
newsDirectoriesParentId: 'f1d5d313-f728-4dda-9843-1116d97e17b0'
2020-07-11 14:45:34 +08:00
},
2020-07-14 16:14:54 +08:00
url: common.url,
isLoading: false
2020-06-07 16:25:03 +08:00
}
},
computed: {
showJumpBtn () {
return this.page.totalPage > 1
},
hasData () {
return this.exhibition.length > 0
2020-06-07 10:28:34 +08:00
}
},
methods: {
2020-07-15 11:22:49 +08:00
changeType: function (type) {
2020-07-18 12:25:06 +08:00
this.page.page = 1
this.changePage = 1
2020-07-15 11:22:49 +08:00
if (type) {
this.page.newsDirectoriesId = type
} else {
this.page.newsDirectoriesId = ''
}
this.getList()
},
getTypeList: function () {
var self = this
2022-11-23 23:32:15 +08:00
axios.get(self.url + 'app/newsdirectories/listnewsdirectoriesrelease', {
2020-07-15 11:22:49 +08:00
params: {
directoriesParentId: 'f1d5d313-f728-4dda-9843-1116d97e17b0'
}
}).then(function (res) {
self.typeList = res.data
})
},
2020-07-16 19:30:11 +08:00
goDetail: function (link, url) {
if (link) {
2020-07-18 12:25:06 +08:00
window.open(link)
2020-07-16 19:30:11 +08:00
} else {
window.location.href = this.url + url
}
2020-06-07 16:25:03 +08:00
},
doJumpPage: function () {
this.page.page = this.changePage
this.getList()
},
paging: function (page) {
this.page.page = page
this.getList()
},
getList: function () {
2020-06-07 10:28:34 +08:00
var self = this
2020-07-14 16:14:54 +08:00
self.isLoading = true
2022-12-14 18:05:12 +08:00
axios.get(self.url + 'app/newscontent/listpagenewscontentrelease/' + common.area.areaCode, {
2020-06-07 16:25:03 +08:00
params: self.page
}).then(function (res) {
for (var i = 0; i < res.data.rows.length; i++) {
res.data.rows[i].newsContentCoverList = res.data.rows[i].newsContentCoverList[0].contentCoverId
}
2020-07-14 16:14:54 +08:00
self.isLoading = false
2020-06-07 16:25:03 +08:00
self.exhibition = res.data.rows
self.page.page = res.data.page
self.page.totalPage = Math.ceil(res.data.total / self.page.rows)
2020-06-07 10:28:34 +08:00
})
}
},
2020-06-07 16:25:03 +08:00
mounted: function () {
2020-07-15 11:22:49 +08:00
this.getTypeList()
2020-06-07 16:25:03 +08:00
this.getList()
2020-06-07 10:28:34 +08:00
}
}
</script>
<style lang="stylus" rel="stylesheet/stylus" scoped>
2020-06-10 11:19:26 +08:00
@import "~styles/public.styl"
2020-07-15 11:22:49 +08:00
.type
padding 15px 0
background #f0f0f0
.type-container
width 1200px
margin 0 auto
overflow hidden
font-size 14px
color #565656
span
float left
line-height 30px
ul
overflow hidden
float left
margin-left 20px
li
float left
width 80px
height: 30px
text-align center
line-height 30px
cursor pointer
&.active
background $main-color
border-radius 4px
color #fff
2020-07-14 16:14:54 +08:00
.no-data
padding 80px 0
text-align center
img
width 200px
.loading
position fixed
top 50%
left 50%
transform translate(-50%, -50%)
background rgba(255,255,255,0.6)
padding 30px
border-radius 10px
box-shadow 0 0 17px #DEDEDE
2020-06-07 10:28:34 +08:00
.location
background #e5e5e5
line-height 30px
.location-content
width 1200px
margin 0 auto
font-size 14px
color #565656
.select
padding 10px 0 0
background #f0f0f0
overflow hidden
.select-container
width 1200px
margin 0 auto
.select-line
margin-bottom 10px
font-size 14px
span
color #565656
button
width 80px
height 30px
padding 0 5px
box-sizing border-box
border none
background none
outline none
color #565656
border-radius 4px
cursor pointer
white-space nowrap
overflow hidden
text-overflow: ellipsis
&.active
color #fff
2020-06-10 11:19:26 +08:00
background $main-color
2020-06-07 10:28:34 +08:00
.exhibition
width 1200px
min-height 400px
margin 20px auto
ul
2020-07-15 11:22:49 +08:00
&:after
content ''
display block
clear both
2020-06-07 10:28:34 +08:00
li
width 280px
2020-06-17 15:19:42 +08:00
box-shadow 0px 0px 10px 0px rgba(176,176,176,0.3)
2020-06-07 10:28:34 +08:00
box-sizing border-box
float left
margin-right 25px
margin-bottom 25px
cursor pointer
&:nth-child(4n)
margin-right 0
2020-06-17 15:19:42 +08:00
&:hover
box-shadow 0px 0px 20px 0px rgba(176,176,176,0.9)
2020-06-07 10:28:34 +08:00
.exhibition-img
width 100%
height 185px
img
width 100%
height 100%
.exhibition-info
padding 10px 20px
h1
text-align center
font-size 18px
color #565656
white-space nowrap
overflow hidden
text-overflow: ellipsis
margin-bottom 5px
2020-07-16 19:30:11 +08:00
font-family '宋体'
2020-06-07 16:25:03 +08:00
p
font-size 14px
color #565656
text-align center
white-space nowrap
overflow hidden
text-overflow ellipsis
2020-07-16 19:30:11 +08:00
font-family '宋体'
2020-06-07 10:28:34 +08:00
.exhibition-info-bottom
span
font-size 14px
color #a8a8a8
&.view
float right
.pager
width 1200px
2020-06-07 16:25:03 +08:00
margin 20px auto
2020-06-07 10:28:34 +08:00
text-align center
font-size 0
span
display inline-block
padding 0 15px
line-height 25px
color #676767
border 1px solid #d2d2d2
font-size 14px
margin 0 5px
vertical-align middle
2020-06-07 16:25:03 +08:00
cursor pointer
2020-06-07 10:28:34 +08:00
ul
display inline-block
overflow hidden
vertical-align middle
li
width 45px
line-height 25px
float left
margin-right 10px
border 1px solid #d2d2d2
cursor pointer
text-align center
font-size 14px
color #676767
2020-06-07 16:25:03 +08:00
&.active
2020-06-10 11:19:26 +08:00
background $main-color
2020-06-07 16:25:03 +08:00
color #fff
2020-06-10 11:19:26 +08:00
border 1px solid $main-color
2020-06-07 16:25:03 +08:00
&:last-child
margin 0
2020-06-07 10:28:34 +08:00
input
width 50px
height 25px
border 1px solid #d2d2d2
text-align center
vertical-align middle
i
font-style normal
color #676767
font-size 14px
line-height 25px
display inline-block
vertical-align middle
margin 0 5px
button
border none
outline none
2020-07-16 19:30:11 +08:00
background $main-color
2020-06-07 10:28:34 +08:00
width 50px
height 25px
vertical-align middle
color #fff
2020-07-16 19:30:11 +08:00
cursor pointer
2020-06-07 10:28:34 +08:00
font-size 14px
</style>