北斗天云官网前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

225 lines
5.9KB

  1. <template>
  2. <div class="products-yemian">
  3. <div class="container">
  4. <div class="row">
  5. <!-- <div class="col-md-3 col-sm-3 products-leul">
  6. <h4>
  7. <span class="glyphicon glyphicon-globe" style="margin-right: 3px; vertical-align: middle;"></span>
  8. 热门动态
  9. </h4>
  10. <ul class="news-left" @click="handleNews">
  11. <li v-for="item in hotNewsList" :key="item.ptsid">
  12. <router-link :to="`/news/detail/${item.ptsid}`" :data-title="item.title">{{ item.title }}</router-link>
  13. </li>
  14. </ul>
  15. </div> -->
  16. <div class="col-md-12">
  17. <div class="bread-container">
  18. <b>您当前的位置:</b>
  19. <el-breadcrumb separator-class="el-icon-arrow-right">
  20. <el-breadcrumb-item v-for="item in breadList" :key="item.path">
  21. <router-link :to="item.path" @click.native="handleClick" :data-title="item.meta.title">{{ item.meta.title }}</router-link>
  22. </el-breadcrumb-item>
  23. <el-breadcrumb-item v-if="planTitle && !$route.meta.isDetail">
  24. <span class="nav-title">{{planTitle}}</span>
  25. </el-breadcrumb-item>
  26. </el-breadcrumb>
  27. </div>
  28. <div class="row" v-if="!$route.meta.isDetail" style="margin-top: 10px;">
  29. <div v-if="caseList.total==0"><el-empty :image-size="200"></el-empty></div>
  30. <div v-else>
  31. <div class="col-md-4 col-sm-6 col-xs-12" v-for="item in caseList.list" :key="item.ptsid" style="margin-bottom: 20px;">
  32. <el-card :body-style="{ padding: '0px' }" shadow="never">
  33. <router-link :to="`/applications/detail/${item.ptsid}`" class="products-border">
  34. <img :src="item.thumbnail" loading="lazy" :data-src="item.thumbnail" alt="" @click="handleToDetail" :data-title="item.title">
  35. </router-link>
  36. <div style="padding: 14px;">
  37. <strong class="public-title">{{item.title}}</strong>
  38. <div class="bottom clearfix">
  39. <p class="public-time"></p>
  40. <p>
  41. <router-link :to="`/applications/detail/${item.ptsid}`">
  42. <span @click="handleToDetail" :data-title="item.title" class="products-aniu">查看详情 <i class="fa fa-angle-right"></i></span>
  43. </router-link>
  44. </p>
  45. </div>
  46. </div>
  47. </el-card>
  48. </div>
  49. </div>
  50. </div>
  51. <div class="row" v-else style="margin-top: 10px;">
  52. <router-view :key="$route.fullPath"></router-view>
  53. </div>
  54. <div class="footer-pagination" v-if="!$route.meta.isDetail">
  55. <el-pagination
  56. background
  57. hide-on-single-page
  58. layout="total, prev, pager, next"
  59. :page-size="9"
  60. :total="caseList.total"
  61. :current-page="curPage"
  62. @current-change="handleChangePage"
  63. >
  64. </el-pagination>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. </template>
  71. <script>
  72. import { mapGetters, mapActions } from 'vuex'
  73. export default {
  74. data() {
  75. return {
  76. planTitle: '',
  77. curPage: 1
  78. }
  79. },
  80. computed: {
  81. ...mapGetters([
  82. 'caseList',
  83. ]),
  84. breadList() {
  85. const matche = this.$route.matched
  86. matche[0].path = '/'
  87. const length = matche.length
  88. if (length > 2) {
  89. matche[length-1].path = ''
  90. matche[length-1].meta.title = this.planTitle
  91. }
  92. return matche
  93. }
  94. },
  95. created() {
  96. const planTitle = localStorage.getItem('planTitle')
  97. if (planTitle) this.planTitle = planTitle
  98. },
  99. mounted() {
  100. // this.getNewsList({
  101. // limit: 15
  102. // }).then(res => {
  103. // this.hotNewsList = res.list
  104. // })
  105. this.getCaseList({
  106. limit: 9,
  107. type: 'case'
  108. // orderField: 'sort'
  109. })
  110. },
  111. methods: {
  112. ...mapActions({
  113. getCaseList: 'cases/getCaseLists',
  114. }),
  115. handleNews(e) {
  116. this.planTitle = e.target.dataset.title
  117. // console.log('newsId', newsId)
  118. // this.planTitle = this.productsType.filter(item => item.id == productTypeId).map(item => item.name)[0]
  119. localStorage.setItem('planTitle', this.planTitle)
  120. },
  121. handleClick(e) {
  122. const title = e.target.dataset.title
  123. if (title == '应用方案') {
  124. this.planTitle = ''
  125. localStorage.removeItem('planTitle')
  126. }
  127. },
  128. handleToDetail(e) {
  129. this.planTitle = e.target.dataset.title
  130. localStorage.setItem('planTitle', this.planTitle)
  131. },
  132. handleChangePage(curPage) {
  133. this.curPage = curPage
  134. this.getCaseList({
  135. type: 'case',
  136. limit: 9,
  137. page: curPage,
  138. // orderField: 'sort'
  139. })
  140. }
  141. },
  142. beforeDestroy() {
  143. localStorage.removeItem('planTitle')
  144. },
  145. beforeRouteUpdate(to, from, next) {
  146. if (to.meta.isDetail) {
  147. to.meta.title = this.planTitle
  148. }
  149. next()
  150. }
  151. }
  152. </script>
  153. <style scoped>
  154. .news-left li {
  155. display: flex;
  156. }
  157. .news-left li a {
  158. overflow: hidden;
  159. white-space: nowrap;
  160. text-overflow: ellipsis;
  161. display: inline-block;
  162. width: 100%;
  163. padding-left: 5px !important;
  164. }
  165. .bread-container {
  166. display: flex;
  167. align-items: center;
  168. line-height: 32px;
  169. border-bottom: 1px solid #dadada;
  170. }
  171. .bread-container .nav-title {
  172. font-weight: 600;
  173. color: #3884c0;
  174. }
  175. .bread-container .nav-title:hover {
  176. color: #333;
  177. /* border-bottom: 1px solid #084587; */
  178. }
  179. .el-breadcrumb__item {
  180. display: flex;
  181. }
  182. .el-breadcrumb__item:last-child a {
  183. font-weight: 600;
  184. color: #3884c0;
  185. }
  186. a {
  187. outline: none;
  188. }
  189. .footer-pagination {
  190. text-align: right;
  191. margin-bottom: 20px;
  192. }
  193. :deep(.el-pagination.is-background .el-pager li:not(.disabled).active) {
  194. background-color: #3884c0;
  195. }
  196. .bottom .public-time {
  197. color: #666;
  198. margin-bottom: 5px;
  199. /* font-size: 12px; */
  200. }
  201. </style>