index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <view :style="viewColor" class="page-container">
  3. <view class='flash-sale'>
  4. <view class='header'>
  5. <image mode="widthFix" class="presellBg" src="../static/images/topic_bg.jpg" alt="">
  6. </view>
  7. <view class="main_count">
  8. <block v-if="topicList.length>0">
  9. <navigator v-for="(item,index) in topicList" :key='index' :url="`/pages/activity/topic_detail/index?id=${item.group_data_id}`" hover-class="none">
  10. <view class='list'>
  11. <image :src="item.pic" class="picture"></image>
  12. </view>
  13. </navigator>
  14. </block>
  15. <block v-else>
  16. <view class='empty-box' v-cloak>
  17. <image src='../../store/static/images/no-topic.png'></image>
  18. <view class="txt">暂无活动专题哦~</view>
  19. </view>
  20. </block>
  21. </view>
  22. </view>
  23. <home></home>
  24. <!-- #ifndef H5 -->
  25. <passwordPopup></passwordPopup>
  26. <!-- #endif -->
  27. </view>
  28. </template>
  29. <script>
  30. // +----------------------------------------------------------------------
  31. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  32. // +----------------------------------------------------------------------
  33. // | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
  34. // +----------------------------------------------------------------------
  35. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  36. // +----------------------------------------------------------------------
  37. // | Author: CRMEB Team <admin@crmeb.com>
  38. // +----------------------------------------------------------------------
  39. import { getTopicList } from '../../../api/activity.js';
  40. import home from '@/components/home/index.vue'
  41. import emptyPage from '@/components/emptyPage.vue'
  42. import { mapGetters } from "vuex";
  43. // #ifndef H5
  44. import passwordPopup from '@/components/passwordPopup';
  45. // #endif
  46. export default {
  47. components: {
  48. // #ifndef H5
  49. passwordPopup,
  50. // #endif
  51. home,
  52. emptyPage
  53. },
  54. computed: mapGetters(['viewColor']),
  55. data() {
  56. return {
  57. topicList: [],
  58. page: 1,
  59. limit: 30,
  60. loading: false,
  61. loadend: false,
  62. pageloading: false,
  63. }
  64. },
  65. onLoad() {
  66. this.getTopicList();
  67. },
  68. methods: {
  69. getTopicList: function() {
  70. var that = this;
  71. var data = {
  72. page: that.page,
  73. limit: that.limit,
  74. };
  75. if (that.loadend) return;
  76. if (that.pageloading) return;
  77. this.pageloading = true
  78. getTopicList(0,data).then(res => {
  79. var topicList = res.data;
  80. var loadend = topicList.length < that.limit;
  81. that.page++;
  82. that.topicList = that.topicList.concat(topicList),
  83. that.page = that.page;
  84. that.pageloading = false;
  85. that.loadend = loadend;
  86. }).catch(err => {
  87. that.pageloading = false
  88. });
  89. }
  90. },
  91. /**
  92. * 页面上拉触底事件的处理函数
  93. */
  94. onReachBottom: function() {
  95. this.getTopicList();
  96. }
  97. }
  98. </script>
  99. <style lang="scss">
  100. .page-container{
  101. min-height: 100vh;
  102. background-color: #ff5348;
  103. // background-color: var(--view-theme);
  104. }
  105. .flash-sale{
  106. .header{
  107. width: 100%;
  108. position: relative;
  109. .presellBg{
  110. width: 750rpx;
  111. }
  112. }
  113. .main_count{
  114. position: relative;
  115. top: -90rpx;
  116. background-color: #fff;
  117. margin: 0 20rpx;
  118. border-radius: 16rpx;
  119. padding: 20rpx;
  120. .list{
  121. width: 100%;
  122. height: 280rpx;
  123. margin-bottom: 30rpx;
  124. position: relative;
  125. .picture{
  126. width: 100%;
  127. height: 280rpx;
  128. border-radius: 16rpx;
  129. }
  130. }
  131. }
  132. .empty-box{
  133. display: flex;
  134. flex-direction: column;
  135. justify-content: center;
  136. align-items: center;
  137. margin: 80rpx 0 120rpx 0;
  138. image{
  139. width: 414rpx;
  140. height: 240rpx;
  141. }
  142. .txt{
  143. font-size: 26rpx;
  144. color: #999;
  145. }
  146. }
  147. }
  148. </style>