loveitem.vue 4.1 KB

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