list.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <div class="garden">
  3. <div class="container">
  4. <div class="top">
  5. <ul class="list-inline">
  6. <li :class="{active: step === ''}" @click="selectEvent()">全部</li>
  7. <li v-for="item in typeList" v-text="item.at_name" @click="selectEvent(item.at_name)" :class="{active: item.active === true}">旅行</li>
  8. </ul>
  9. </div>
  10. <div class="content">
  11. <div class="empty" v-if="listCount.list.length === 0">无相关活动信息!</div>
  12. <div class="info-list" v-for="item in listCount.list">
  13. <div class="img">
  14. <img :src="item.ac_icon">
  15. </div>
  16. <div class="list-right">
  17. <p v-text="item.ac_title">企业为员工打造全新潼湖小镇,舒服办公环境</p>
  18. <span v-text="item.ac_desc">2017年,优软科技携手碧桂园创办全新智慧生态园,发扬优软新势力,适应互联网潮流 发展.</span>
  19. </div>
  20. <div class="detail">
  21. <h4 v-text="item.ac_title">12</h4>
  22. <span v-text="item.ac_desc">3213ffds</span>
  23. <p v-text="formatDate(item.ac_startdate)">32342</p>
  24. <p v-text="item.ac_addr">32342</p>
  25. <p>{{item.ac_enternum}}&nbsp;参加活动</p>
  26. <a :href="'/townInfo/' + item.ac_id">查看详情</a>
  27. </div>
  28. </div>
  29. </div>
  30. <div class="page" v-if="listCount.total > count">
  31. <el-pagination
  32. @current-change="handleCurrentChange"
  33. :current-page.sync="page"
  34. :page-size="count"
  35. layout="total, prev, pager, next, jumper"
  36. :total="listCount.total"/>
  37. </div>
  38. </div>
  39. </div>
  40. </template>
  41. <script>
  42. import {formatDate} from '@/utils/date.js'
  43. export default {
  44. name: 'GardenList',
  45. data () {
  46. return {
  47. step: '',
  48. count: 16,
  49. page: 1,
  50. typeList: {}
  51. }
  52. },
  53. mounted () {
  54. let list = this.$store.state.gardens.gardenType.data.list
  55. for(let i = 0; i < list.length; i++) {
  56. list[i].active = false
  57. }
  58. this.typeList = JSON.parse(JSON.stringify(list))
  59. },
  60. computed: {
  61. listCount () {
  62. return this.$store.state.gardens.list.data
  63. }
  64. },
  65. methods: {
  66. // 格式化时间
  67. formatDate (row) {
  68. let date = new Date(row)
  69. return formatDate(date, 'yyyy-MM-dd hh:mm')
  70. },
  71. selectEvent (type) {
  72. for(let i = 0; i < this.typeList.length; i++) {
  73. if(type) {
  74. this.step = type
  75. this.typeList[i].at_name === type ? this.typeList[i].active = true : this.typeList[i].active = false
  76. } else {
  77. this.typeList[i].active = false
  78. this.step = ''
  79. }
  80. }
  81. this.$store.dispatch('loadGardenList', {limit: 16, page: this.page, type: type})
  82. },
  83. handleCurrentChange(val) {
  84. this.$store.dispatch('loadGardenList', {limit: 16, page: val, type: this.step})
  85. }
  86. }
  87. }
  88. </script>
  89. <style scoped type="text/scss" lang="scss">
  90. .garden{
  91. background: #f4f4f4;
  92. padding-bottom:80px;
  93. .top{
  94. margin: 0 auto;
  95. overflow: hidden;
  96. padding:55px 0;
  97. text-align: center;
  98. ul{
  99. li{
  100. padding:0 24px;
  101. font-size: 14px;
  102. color:#333;
  103. font-weight: bold;
  104. border-right:1px solid #bfbfbf;
  105. &:last-child{
  106. border:none;
  107. }
  108. &:hover,&.active{
  109. cursor:pointer;
  110. color:#149ccf;
  111. }
  112. }
  113. }
  114. }
  115. .content{
  116. .empty{
  117. padding:50px 0;
  118. font-size: 28px;
  119. text-align: center;
  120. color:#333;
  121. }
  122. .info-list{
  123. position:relative;
  124. display:inline-block;
  125. width:24%;
  126. height:430px;
  127. vertical-align: top;
  128. margin-right:10px;
  129. margin-bottom:30px;
  130. background: #fff;
  131. overflow: hidden;
  132. &:last-child{
  133. margin:0;
  134. }
  135. &:hover{
  136. cursor:pointer;
  137. .detail{
  138. opacity:1;
  139. top:0;
  140. }
  141. }
  142. .img{
  143. width:280px;
  144. height:250px;
  145. img{
  146. width:100%;
  147. height:100%;
  148. border:none;
  149. padding:0;
  150. }
  151. }
  152. .list-right{
  153. padding:24px 16px 0 16px;
  154. overflow: hidden;
  155. p{
  156. font-size: 20px;
  157. color:#333;
  158. margin-bottom:25px;
  159. width:98%;
  160. overflow: hidden;
  161. text-overflow: ellipsis;
  162. white-space: nowrap;
  163. }
  164. span{
  165. font-size: 14px;
  166. line-height: 20px;
  167. color:#969696;
  168. }
  169. }
  170. .detail{
  171. position:absolute;
  172. top:100%;
  173. opacity:0;
  174. transition: all .5s ease;
  175. background: rgba(0,0,0,.8);
  176. width:100%;
  177. height:430px;
  178. padding:30px 16px;
  179. h4{
  180. font-size: 20px;
  181. color:#fff;
  182. margin-bottom:25px;
  183. }
  184. span{
  185. display:block;
  186. font-size: 14px;
  187. color:#fff;
  188. line-height: 20px;
  189. margin-bottom:10px;
  190. }
  191. p{
  192. font-size: 14px;
  193. color:#b4b4b4;
  194. margin-bottom:10px;
  195. }
  196. a{
  197. display: block;
  198. width:200px;
  199. height:40px;
  200. line-height: 38px;
  201. text-align: center;
  202. margin:0 auto;
  203. margin-top:30px;
  204. font-size: 16px;
  205. color:#fff;
  206. border:1px solid #fff;
  207. &:hover{
  208. cursor:pointer;
  209. color:#149ccf;
  210. border: 1px solid #149ccf;
  211. }
  212. }
  213. }
  214. }
  215. }
  216. .page{
  217. text-align: center;
  218. padding: 55px 0;
  219. }
  220. }
  221. </style>