style-five.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <view class="style-five">
  3. <view class="head" v-if="list.length !== 0">
  4. <app-head-navigation @click="active" :list="list" :theme="theme"></app-head-navigation>
  5. </view>
  6. <view class="nav" v-if="list[activeIndex].child.length > 0">
  7. <text class="name" @click="setNav({it: it, key:k})"
  8. :style="{'color': k === activeIndexTwo ? theme.color : ''}"
  9. :class="k === activeIndexTwo ? 'active' : 'default'"
  10. v-for="(it, k) in list[activeIndex].child" :key="k">
  11. {{it.name}}
  12. </text>
  13. </view>
  14. <view :class="list[activeIndex].child.length === 0 ? 'margin-fixed' : ''">
  15. <app-product-list :isShowAttr="false" :theme="theme" v-if="goods_list.length > 0" @routeGo="route_go" :goods_list="goods_list"></app-product-list>
  16. <view class="u-loading-list" v-if="goodsLoading">加载中...</view>
  17. <view class="no-empty main-center" v-else-if="goods_list.length === 0 && is_over_goods">
  18. <app-no-goods background="#f7f7f7" title="该分类下无相关内容哦~"></app-no-goods>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import appHeadNavigation from '../../components/page-component/app-head-navigation/app-head-navigation.vue';
  25. import appProductList from '../../components/page-component/app-product-list/app-product-list.vue';
  26. import appNoGoods from '../../components/page-component/app-no-goods/app-no-goods.vue';
  27. import {mapState} from "vuex";
  28. export default {
  29. name: "style-five",
  30. components: {
  31. 'app-head-navigation': appHeadNavigation,
  32. 'app-product-list': appProductList,
  33. 'app-no-goods': appNoGoods
  34. },
  35. props: [`list`, `activeIndex`, `goods_list`, `activeIndexTwo`, `theme`, `is_over_goods`, `goodsLoading`],
  36. methods: {
  37. active(data) {
  38. this.$emit('active', data);
  39. },
  40. setNav({it, key}) {
  41. this.$emit('setNav', {
  42. item: it,
  43. index: key
  44. });
  45. },
  46. route_go(e) {
  47. // #ifndef MP-BAIDU
  48. if (e.video_url && this.getVideo == 1) {
  49. // #ifdef MP
  50. uni.navigateTo({
  51. url: `/pages/goods/video?goods_id=${e.id}&sign=${e.sign}`
  52. });
  53. // #endif
  54. // #ifdef H5
  55. uni.navigateTo({
  56. url: e.page_url
  57. });
  58. // #endif
  59. } else {
  60. uni.navigateTo({
  61. url: e.page_url
  62. });
  63. }
  64. // #endif
  65. // #ifdef MP-BAIDU
  66. uni.navigateTo({
  67. url: e.page_url
  68. });
  69. // #endif
  70. }
  71. },
  72. computed: {
  73. ...mapState({
  74. platform: function(state) {
  75. return state.gConfig.systemInfo.platform;
  76. }
  77. }),
  78. }
  79. }
  80. </script>
  81. <style scoped lang="scss">
  82. .margin-fixed {
  83. margin-top: #{188upx};
  84. }
  85. .nav {
  86. width: 100%;
  87. padding-top: #{24rpx};
  88. padding-left: #{24rpx};
  89. background-color: #ffffff;
  90. margin-top: #{188upx};
  91. }
  92. .head {
  93. position: fixed;
  94. top: 88upx;
  95. left: 0;
  96. z-index: 1000;
  97. }
  98. .name {
  99. border: #{1rpx} solid #cccccc;
  100. font-size: #{28rpx};
  101. padding: 0 #{28rpx};
  102. display: inline-block;
  103. height: #{54rpx};
  104. line-height: #{54rpx};
  105. margin-right: #{24rpx};
  106. border-radius: #{28rpx};
  107. margin-bottom: #{20rpx};
  108. }
  109. .default {
  110. color: #666666;
  111. }
  112. .active {
  113. border: #{1rpx} solid ;
  114. }
  115. .u-loading-list {
  116. height: 64upx;
  117. line-height: 64upx;
  118. text-align: center;
  119. color: #b0b0b0;
  120. font-size: 24upx;
  121. }
  122. </style>