i-block-list.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <view>
  3. <view class="line"></view>
  4. <view class="block_box" v-for="(box,index) in blocksList" :key="index">
  5. <view class="block_title">
  6. <view class="icon"></view>
  7. <view class="name">{{box.title}}</view>
  8. </view>
  9. <view class="block_inner">
  10. <view class="inner_list">
  11. <view class="item" v-for="item in box.children">
  12. <view class="item_border" @click="go_block_detail(item.link)">
  13. <view class="name">
  14. <text>{{item.title}}</text>
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. props:[
  26. "blocksList"
  27. ],
  28. data() {
  29. return {
  30. };
  31. },
  32. methods:{
  33. go_block_detail(href){
  34. console.log(href)
  35. uni.navigateTo({
  36. url:"../../i-block-detail/i-block-detail",
  37. success: function(res) {
  38. // 通过eventChannel向被打开页面传送数据
  39. res.eventChannel.emit('acceptDataFromOpenerPage', { href: href })
  40. }
  41. })
  42. }
  43. }
  44. }
  45. </script>
  46. <style lang="scss">
  47. .line{
  48. width: 100%;
  49. height: 6rpx;
  50. background-color: #F0F0F0;
  51. }
  52. .block_box{
  53. box-sizing: border-box;
  54. padding-top: 34rpx;
  55. padding-left: 42rpx;
  56. padding-right: 68rpx;
  57. padding-bottom: 20rpx;
  58. border-bottom: 1rpx solid #eee;
  59. .block_title{
  60. display: flex;
  61. .icon{
  62. margin-right: 16rpx;
  63. width: 52rpx;
  64. height: 52rpx;
  65. background-image: url(icon/icon_title.png);
  66. background-size: cover;
  67. background-repeat: no-repeat;
  68. }
  69. .name{
  70. height: 52rpx;
  71. font-size: 37rpx;
  72. font-family: PingFangSC-Regular, PingFang SC;
  73. font-weight: 400;
  74. color: #121212;
  75. line-height: 52rpx;
  76. text-shadow: 0px 2rpx 6rpx rgba(0, 0, 0, 0.5);
  77. }
  78. }
  79. .block_inner{
  80. margin-top: 25rpx;
  81. .inner_list{
  82. display: flex;
  83. flex-wrap: wrap;
  84. // justify-content: space-between;
  85. .item{
  86. margin-bottom: 16rpx;
  87. margin-right: 17rpx;
  88. width: 144rpx;
  89. height: 82rpx;
  90. border-radius: 26rpx;
  91. border: 2rpx solid #4AA0D5;
  92. .item_border{
  93. width: 138rpx;
  94. height: 78rpx;
  95. background: #FFFFFF;
  96. border-radius: 20rpx;
  97. // border: 2rpx solid #D5D5DB;
  98. .name{
  99. text-align: center;
  100. height: 82rpx;
  101. font-size: 20rpx;
  102. font-family: PingFangSC-Regular, PingFang SC;
  103. font-weight: 400;
  104. color: #009FE8;
  105. line-height: 82rpx;
  106. }
  107. }
  108. }
  109. .item:nth-child(4n){
  110. margin-right: 0;
  111. }
  112. }
  113. }
  114. }
  115. </style>