book.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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">
  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. lunbolist: [{
  41. image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
  42. title: '昨夜星辰昨夜风,画楼西畔桂堂东'
  43. },
  44. {
  45. image: 'https://cdn.uviewui.com/uview/swiper/2.jpg',
  46. title: '身无彩凤双飞翼,心有灵犀一点通'
  47. },
  48. {
  49. image: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
  50. title: '谁念西风独自凉,萧萧黄叶闭疏窗,沉思往事立残阳'
  51. }
  52. ],
  53. configInfo: {}
  54. }
  55. },
  56. methods: {
  57. getbook: async function() {
  58. let res = await this.$request.post("/api/v1/article/articleList")
  59. let status = user.islogin(res)
  60. if (status) {
  61. this.list = res.data.data
  62. }
  63. },
  64. bookinfo(id, title) {
  65. uni.navigateTo({
  66. url: "../common_tools/collection/collection_details?id=" + id + "&title=" + title
  67. })
  68. },
  69. getconfigLsit: async function() {
  70. let res = await this.$request.post("/api/v1/common/configList")
  71. console.log(res)
  72. if (res.status == 0) {
  73. this.configInfo = res.data
  74. }
  75. }
  76. }
  77. };
  78. </script>
  79. <style scoped lang="scss">
  80. .main {
  81. padding-top: 10rpx;
  82. padding-left: 20rpx;
  83. padding-right: 20rpx;
  84. }
  85. .tltleStyle {
  86. padding: 30rpx 30rpx 15rpx 15rpx;
  87. font-weight: bold;
  88. font-size: 40rpx;
  89. background-color: #fff;
  90. }
  91. .u-card-wrap {
  92. background-color: $u-bg-color;
  93. padding: 1px;
  94. }
  95. .u-body-item {
  96. font-size: 32rpx;
  97. color: #333;
  98. padding: 20rpx 10rpx;
  99. }
  100. .u-body-item image {
  101. width: 120rpx;
  102. flex: 0 0 120rpx;
  103. height: 120rpx;
  104. border-radius: 8rpx;
  105. margin-left: 12rpx;
  106. }
  107. </style>