book.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <template>
  2. <view class="main">
  3. <view class="indexswiper" style="margin-top: 10rpx;">
  4. <u-swiper :list="configInfo.banners" mode="none"></u-swiper>
  5. </view>
  6. <view class="tltleStyle">
  7. 推荐文章
  8. </view>
  9. <u-card :show-head="false" :show-foot="false" :border="false">
  10. <view class="" slot="body" v-for="(item,index) in list" :key="index" @click="bookinfo(item.id,item.title)">
  11. <view class="u-border-bottom padding-bottom-sm">
  12. <view class="u-body-item u-flex u-col-between u-p-t-0 justify-between">
  13. <view class="u-body-item-title u-line-2">{{item.title}}</view>
  14. <image :src="item.banner_url"></image>
  15. </view>
  16. <!-- <u-tag text="情感咨询" size="mini" shape="circle" mode="dark" type="info" /> -->
  17. </view>
  18. </view>
  19. </u-card>
  20. <view class="margin-tb padding-tb-xs">
  21. <u-loadmore :status="nomore" :icon-type="flower" />
  22. </view>
  23. <u-no-network></u-no-network>
  24. </view>
  25. </template>
  26. <script>
  27. var user = require('../../common/user.js');
  28. export default {
  29. onLoad(options) {
  30. },
  31. onShow() {
  32. this.getbook()
  33. this.getconfigLsit()
  34. },
  35. mounted() {
  36. },
  37. data() {
  38. return {
  39. list: [],
  40. configInfo: {},
  41. pageindex: 1
  42. }
  43. },
  44. onReachBottom() {
  45. this.getbook()
  46. },
  47. methods: {
  48. getbook: async function() {
  49. let res = await this.$request.post("/api/v1/article/articleList", {
  50. page: this.pageindex
  51. }, false)
  52. console.log(res)
  53. let status = user.islogin(res)
  54. if (status) {
  55. if (this.pageindex > res.data.last_page) {
  56. uni.showToast({
  57. title: "没有更多了",
  58. icon: "none"
  59. })
  60. } else {
  61. this.list = this.list.concat(res.data.data)
  62. this.pageindex++
  63. }
  64. }
  65. },
  66. bookinfo(id, title) {
  67. uni.navigateTo({
  68. url: "../common_tools/collection/collection_details?id=" + id + "&title=" + title
  69. })
  70. },
  71. getconfigLsit: async function() {
  72. let res = await this.$request.post("/api/v1/common/configList", {}, false)
  73. console.log(res)
  74. if (res.status == 0) {
  75. this.configInfo = res.data
  76. }
  77. }
  78. }
  79. };
  80. </script>
  81. <style scoped lang="scss">
  82. .main {
  83. padding-top: 10rpx;
  84. padding-left: 20rpx;
  85. padding-right: 20rpx;
  86. }
  87. .tltleStyle {
  88. padding: 30rpx 30rpx 15rpx 15rpx;
  89. font-weight: bold;
  90. font-size: 40rpx;
  91. background-color: #fff;
  92. }
  93. .u-card-wrap {
  94. background-color: $u-bg-color;
  95. padding: 1px;
  96. }
  97. .u-body-item {
  98. font-size: 32rpx;
  99. color: #333;
  100. padding: 20rpx 10rpx;
  101. }
  102. .u-body-item image {
  103. width: 120rpx;
  104. flex: 0 0 120rpx;
  105. height: 120rpx;
  106. border-radius: 8rpx;
  107. margin-left: 12rpx;
  108. }
  109. </style>