article-layout.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <!-- 文章 新动态 -->
  2. <template>
  3. <div id="article-layout">
  4. <div class="article-main">
  5. <div class="article-item">
  6. <div class="article-bg" @click="toUrl('notice',{},{class_id: datas[0].category_id})">
  7. <img :src="datas[0].img||require(`~/assets/images/index/article1.png`)" alt="">
  8. <div class="title">{{datas[0].category}}</div>
  9. </div>
  10. <div class="article-list">
  11. <div class="list-item" v-for="child in datas[0].list" :key="child.id" @click="toArticle(child, 'articleContent-id', child.id)">
  12. <div class="time">{{child.virtual_at}}</div>
  13. <div class="article-content">
  14. <div class="article-tag">【{{child.author}}】</div>
  15. <div class="article-title">{{child.title}}</div>
  16. </div>
  17. </div>
  18. </div>
  19. </div>
  20. <div class="article-item" >
  21. <div class="article-bg" @click="toUrl('notice',{},{class_id: datas[1]?datas[1].category_id:0})">
  22. <img :src="datas[1]?datas[1].img:require(`~/assets/images/index/article2.png`)" alt="">
  23. <div class="title">{{datas[1]?datas[1].category:''}}</div>
  24. </div>
  25. <div class="article-list" v-if="datas[1]">
  26. <div class="list-item" v-for="child in datas[1].list" :key="child.id" @click="toArticle(child, 'articleContent-id', child.id)">
  27. <div class="time">{{child.virtual_at}}</div>
  28. <div class="article-content">
  29. <div class="article-tag">【{{child.author}}】</div>
  30. <div class="article-title">{{child.title}}</div>
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. </div>
  36. </div>
  37. </template>
  38. <script>
  39. export default {
  40. props:{
  41. datas: {
  42. type: Array,
  43. default: () => ([])
  44. },
  45. },
  46. data () {
  47. return {
  48. };
  49. },
  50. activated() {},
  51. components: {},
  52. computed: {},
  53. mounted() {},
  54. methods: {
  55. toUrl(url, params, query) {
  56. this.$router.push(this.fun.getUrl(url, params, query));
  57. },
  58. toArticle(item, url, id) {
  59. if(item.has_one_article_pay) {
  60. if(item.has_one_record) {
  61. if(this.$baseURL) {
  62. window.open(this.fun.getSiteRoot() + "/plugins/shop_server/articleContent?i=" +this.fun.getKeyByI()+ '&id='+id, "_blank");
  63. }else {
  64. window.open(this.fun.getSiteRoot() + "/plugins/shop_server/articleContent/"+id+"?i=" +this.fun.getKeyByI(), "_blank");
  65. }
  66. // this.$router.push(this.fun.getUrl(url, { id: id }, {}));
  67. }else{
  68. this.getPay(item.id);
  69. }
  70. }else {
  71. if(this.$baseURL) {
  72. window.open(this.fun.getSiteRoot() + "/plugins/shop_server/articleContent?i=" +this.fun.getKeyByI()+ '&id='+id, "_blank");
  73. }else {
  74. window.open(this.fun.getSiteRoot() + "/plugins/shop_server/articleContent/"+id+"?i=" +this.fun.getKeyByI(), "_blank");
  75. }
  76. // this.$router.push(this.fun.getUrl(url, { id: id }, {}));
  77. }
  78. },
  79. }
  80. }
  81. </script>
  82. <style lang='scss' rel='stylesheet/scss' scoped>
  83. #article-layout{
  84. .article-main{
  85. display: grid;
  86. grid-template-columns: repeat(2, 1fr);
  87. grid-column-gap: 60px;
  88. .article-item{
  89. display: flex;
  90. flex-direction: column;
  91. overflow: hidden;
  92. .article-bg{
  93. height: 150px;
  94. padding: 30px;
  95. border-radius: 5px;
  96. overflow: hidden;
  97. box-sizing: border-box;
  98. display: flex;
  99. flex-direction: column-reverse;
  100. position: relative;
  101. img{
  102. width: 100%;
  103. height: 100%;
  104. position: absolute;
  105. top: 0;
  106. left: 0;
  107. }
  108. .title{
  109. width: 100%;
  110. font-size: 24px;
  111. color: #fff;
  112. z-index: 3;
  113. text-shadow: 0px 1px 2px #2f2f2f;
  114. overflow: hidden;/*超出部分隐藏*/
  115. text-overflow:ellipsis;/* 超出部分显示省略号 */
  116. white-space: nowrap;/*规定段落中的文本不进行换行 */
  117. }
  118. &:hover{
  119. // box-shadow: 0px 4px 14px 2px rgba(4, 0, 0, 0.15);
  120. cursor:pointer;
  121. img {
  122. transform: scale(1.04);
  123. transition: all 0.5s ease;
  124. }
  125. }
  126. }
  127. .article-list{
  128. display: flex;
  129. flex-direction: column;
  130. padding-top: 30px;
  131. .list-item{
  132. display: flex;
  133. padding: 0 20px 18px;
  134. box-sizing: border-box;
  135. font-size: 14px;
  136. cursor:pointer;
  137. .time{
  138. color: #a0a0a0;
  139. margin-right: 6px;
  140. }
  141. .article-content{
  142. display: flex;
  143. flex: 1;
  144. overflow: hidden;
  145. .article-tag{
  146. color: var(--color);
  147. margin-right: 6px;
  148. flex-shrink: 0;
  149. }
  150. .article-title{
  151. color: #262626;
  152. overflow: hidden;/*超出部分隐藏*/
  153. text-overflow:ellipsis;/* 超出部分显示省略号 */
  154. white-space: nowrap;/*规定段落中的文本不进行换行 */
  155. }
  156. }
  157. &:hover{
  158. font-weight: bold;
  159. }
  160. }
  161. }
  162. }
  163. }
  164. }
  165. </style>