style-two.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <view class="style-two dir-left-nowrap">
  3. <app-category-list
  4. @click="active"
  5. :list="list"
  6. v-if="list.length !== 0"
  7. :noSetHeight="setHeight+'rpx'"
  8. :theme="theme"
  9. ></app-category-list>
  10. <scroll-view scroll-y
  11. class="right"
  12. :style="{height: `${setHeight}rpx`}"
  13. v-if="list.length > 0">
  14. <view>
  15. <app-jump-button :open_type="list[activeIndex].advert_open_type"
  16. :params="list[activeIndex].advert_params"
  17. :url="list[activeIndex].advert_url">
  18. <image class="advert_pic"
  19. @click="advert(list[activeIndex])"
  20. :src="list[activeIndex].advert_pic"
  21. v-if="list[activeIndex].advert_pic">
  22. </image>
  23. </app-jump-button>
  24. </view>
  25. <!-- 分类页面跳转 -->
  26. <view class="item"
  27. v-for="(it, k) in list[activeIndex].child"
  28. :key="k"
  29. @click="route_go(it)">
  30. <!-- <image :src="it.big_pic_url"
  31. class="big_pic_url">
  32. </image> -->
  33. <view class="img_box">
  34. <image :src="it.pic_url"
  35. class="pic_url">
  36. </image>
  37. </view>
  38. <text>
  39. {{it.name}}
  40. </text>
  41. </view>
  42. <view class="no-empty main-center"
  43. v-if="list[activeIndex].child.length === 0">
  44. <app-no-goods title="该分类下无相关内容哦~"></app-no-goods>
  45. </view>
  46. </scroll-view>
  47. <view class="no-empty main-center" v-else>
  48. <app-no-goods background="#f7f7f7" title="该分类下无相关内容哦~"></app-no-goods>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. import appCategoryList from '../../components/page-component/app-category-list/app-category-list.vue';
  54. import appNoGoods from '../../components/page-component/app-no-goods/app-no-goods.vue';
  55. export default {
  56. name: 'style-two',
  57. props: [`list`, `activeIndex`, `setHeight`, `theme`],
  58. components: {
  59. 'app-category-list': appCategoryList,
  60. 'app-no-goods': appNoGoods
  61. },
  62. methods: {
  63. active({item}) {
  64. this.$emit('active', item);
  65. },
  66. route_go(e) {
  67. console.log(e.name)
  68. uni.navigateTo({
  69. url: `${e.page_url}&titleName=${e.name}`
  70. });
  71. },
  72. advert(e) {
  73. this.$emit('route_advert', e);
  74. }
  75. }
  76. }
  77. </script>
  78. <style scoped lang="scss">
  79. .right {
  80. width: #{524rpx};
  81. margin-left: #{22rpx};
  82. background-color: #ffffff;
  83. }
  84. .advert_pic {
  85. width: #{500rpx};
  86. height: #{184rpx};
  87. margin: #{20upx 24upx 20upx 0};
  88. }
  89. .item {
  90. margin-left: #{2rpx};
  91. height: #{158rpx};
  92. width: #{524rpx};
  93. margin-bottom: #{20rpx};
  94. display: flex;
  95. justify-content: flex-start;
  96. align-items: center;
  97. .img_box{
  98. height: #{128rpx};
  99. width: #{150rpx};
  100. display: flex;
  101. align-items: center;
  102. margin:0rpx 20rpx;
  103. .pic_url {
  104. display: inline-block;
  105. max-width: 100%;
  106. max-height: 80%;
  107. }
  108. }
  109. }
  110. .big_pic_url {
  111. height: #{158rpx};
  112. width: #{524rpx};
  113. }
  114. .no-empty {
  115. width: 100%;
  116. margin-top: #{150upx};
  117. }
  118. </style>