loveitem.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <template>
  2. <view class="content">
  3. <view class="js" style="height: 20rpx;">
  4. </view>
  5. <view class="list-box" v-for="(item,index) in science" :key='index' @click="Jump(item)">
  6. <view class="box-left">
  7. <image :src="item.image_input[0]" mode="" class="left-img"></image>
  8. </view>
  9. <view class="box-right">
  10. <view class="right-top word1_ellipsis clamp">
  11. {{item.title}}
  12. </view>
  13. <view class="right-center clamp2">
  14. {{item.synopsis}}
  15. </view>
  16. <!-- <view class="right-foot">
  17. 已阅读人数:{{item.visit || 0}}
  18. </view> -->
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import {
  25. crtItemList
  26. } from '@/api/index.js';
  27. export default {
  28. data() {
  29. return {
  30. keyword: '',
  31. science: [],
  32. cartId: '',
  33. }
  34. },
  35. onLoad(opt) {
  36. this.cartId = opt.id
  37. if (this.cartId == 17) {
  38. uni.setNavigationBarTitle({
  39. title: '公益项目'
  40. })
  41. } else if (this.cartId == 18) {
  42. uni.setNavigationBarTitle({
  43. title: '造血干细胞捐献'
  44. })
  45. } else if (this.cartId == 19) {
  46. uni.setNavigationBarTitle({
  47. title: '器官遗体捐献'
  48. })
  49. }
  50. this.loadData();
  51. },
  52. filters: {
  53. time(val) {
  54. let arr = val.split(' ')
  55. return arr[0]
  56. }
  57. },
  58. methods: {
  59. loadData() {
  60. let obj = this;
  61. crtItemList({
  62. pages: 1,
  63. limit: 20
  64. }, obj.cartId).then(({
  65. data
  66. }) => {
  67. console.log(data);
  68. obj.science = data.list;
  69. console.log(obj.science, '999999999999999999')
  70. });
  71. },
  72. Jump(item) {
  73. if (item.url) {
  74. console.log(item.url)
  75. window.location.href = item.url
  76. } else {
  77. uni.navigateTo({
  78. url: "/pages/applic/info?id=" + item.id
  79. })
  80. }
  81. },
  82. }
  83. }
  84. </script>
  85. <style lang="scss">
  86. //搜索框
  87. .Search-box {
  88. padding-left: 20rpx;
  89. padding-right: 20rpx;
  90. height: 100rpx;
  91. background: #ffffff;
  92. display: flex;
  93. justify-content: space-between;
  94. align-items: center;
  95. .Search-box-sort {
  96. font-size: 30rpx;
  97. font-weight: 500;
  98. color: rgba(102, 102, 102, 1);
  99. .sort-text {
  100. width: 57rpx;
  101. height: 29rpx;
  102. font-size: 30rpx;
  103. font-weight: 500;
  104. color: rgba(51, 51, 51, 1);
  105. line-height: 58rpx;
  106. margin-right: 19rpx;
  107. }
  108. .sort-img {
  109. width: 21rpx;
  110. height: 11rpx;
  111. margin-bottom: 4rpx;
  112. }
  113. }
  114. .Search-box-size {
  115. width: 630rpx;
  116. height: 65rpx;
  117. border-radius: 32rpx;
  118. background-color: #f1f1f1;
  119. padding-left: 36rpx;
  120. display: flex;
  121. align-items: center;
  122. .box-img {
  123. height: 32rpx;
  124. width: 32rpx;
  125. margin-right: 16rpx;
  126. }
  127. .box-word {
  128. width: 100%;
  129. font-size: 22rpx;
  130. font-weight: 500;
  131. color: rgba(205, 203, 203, 1);
  132. line-height: 55rpx;
  133. }
  134. }
  135. }
  136. .content {
  137. line-height: 1.5;
  138. .list-box {
  139. width: 725rpx;
  140. height: 200rpx;
  141. margin: 0 auto 20rpx;
  142. background: #FFFFFF;
  143. box-shadow: 0px 5rpx 5rpx 0px rgba(35, 24, 21, 0.06);
  144. border-radius: 7rpx;
  145. padding: 0 20rpx;
  146. display: flex;
  147. align-items: center;
  148. .box-left {
  149. width: 230rpx;
  150. height: 145rpx;
  151. margin-right: 20rpx;
  152. .left-img {
  153. width: 230rpx;
  154. height: 145rpx;
  155. }
  156. }
  157. .box-right {
  158. width: 430rpx;
  159. height: 145rpx;
  160. position: relative;
  161. .right-top {
  162. line-height: 1.5;
  163. font-size: 25rpx;
  164. font-weight: bold;
  165. color: #333333;
  166. margin-bottom: 24rpx;
  167. }
  168. .right-center {
  169. width: 362rpx;
  170. // height: 53rpx;
  171. font-size: 21rpx;
  172. font-weight: bold;
  173. color: #999999;
  174. line-height: 33rpx;
  175. overflow: hidden;
  176. text-overflow: ellipsis;
  177. display: -webkit-box;
  178. -webkit-line-clamp: 2; //在第几行显示...
  179. -webkit-box-orient: vertical;
  180. }
  181. .right-foot {
  182. font-size: 21rpx;
  183. font-weight: bold;
  184. color: #999999;
  185. line-height: 31rpx;
  186. text-align: right;
  187. // margin-top: 13rpx;
  188. position: absolute;
  189. right: 0;
  190. bottom: 0;
  191. }
  192. }
  193. }
  194. }
  195. </style>