CateOne.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <div :class="['qn-page-' + theme]">
  3. <scroll-view scroll-y class="cate-ul" :style="{ height: 'calc(100vh - 112rpx - ' + (isBang ? '84px' : '50px') + ')' }">
  4. <view class="cate-li" v-for="(item, index) in cate_list" :key="index" @click="goPage('/pagesT/productDetail/productDetail?id=' + item.id + '&name=' + item.title)">
  5. <view class="cate-name">
  6. <view class="cate-name-in">{{ item.title }}</view>
  7. </view>
  8. <image class="cate-img" :src="item.adImage || item.images" mode="aspectFill"></image>
  9. </view>
  10. </scroll-view>
  11. </div>
  12. </template>
  13. <script>
  14. export default {
  15. data() {
  16. return {
  17. cate_list: []
  18. };
  19. },
  20. computed:{
  21. userId() {
  22. return this.$store.state.userStatus.id;
  23. }
  24. },
  25. created() {
  26. this.getAllCategory();
  27. },
  28. methods: {
  29. // 分类列表 getAllCategory
  30. getAllCategory() {
  31. this.$u.api.getAllCategory({
  32. userCenterId: this.userId || 0
  33. }).then(data=>{
  34. this.cate_list = data.data;
  35. });
  36. }
  37. }
  38. };
  39. </script>
  40. <style lang="scss">
  41. .cate-ul {
  42. width: 750upx;
  43. height: calc(100vh - 112upx);
  44. .cate-li {
  45. background-color: #f5f5f5;
  46. margin: 30upx auto 0;
  47. width: 680upx;
  48. position: relative;
  49. .cate-img {
  50. display: block;
  51. width: 100%;
  52. height: 300upx;
  53. }
  54. .cate-name {
  55. position: absolute;
  56. bottom: 24upx;
  57. width: 400upx;
  58. left: 50%;
  59. transform: translateX(-200upx);
  60. text-align: center;
  61. z-index: 1;
  62. font-size: 28upx;
  63. font-weight: 600;
  64. height: 88upx;
  65. border: 2upx solid #fff;
  66. .cate-name-in {
  67. width: calc(100% - 8upx);
  68. height: calc(100% - 8upx);
  69. line-height: 80upx;
  70. margin: 4upx auto;
  71. background-color: rgba(255, 255, 255, 0.8);
  72. }
  73. }
  74. }
  75. }
  76. </style>