index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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="`${domain}/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~2024 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. import { HTTP_REQUEST_URL } from '@/config/app';
  44. // #ifndef H5
  45. import passwordPopup from '@/components/passwordPopup';
  46. // #endif
  47. export default {
  48. components: {
  49. // #ifndef H5
  50. passwordPopup,
  51. // #endif
  52. home,
  53. emptyPage
  54. },
  55. computed: mapGetters(['viewColor']),
  56. data() {
  57. return {
  58. domain: HTTP_REQUEST_URL,
  59. topicList: [],
  60. page: 1,
  61. limit: 30,
  62. loading: false,
  63. loadend: false,
  64. pageloading: false,
  65. }
  66. },
  67. onLoad() {
  68. this.getTopicList();
  69. },
  70. methods: {
  71. getTopicList: function() {
  72. var that = this;
  73. var data = {
  74. page: that.page,
  75. limit: that.limit,
  76. };
  77. if (that.loadend) return;
  78. if (that.pageloading) return;
  79. this.pageloading = true
  80. getTopicList(0,data).then(res => {
  81. var topicList = res.data;
  82. var loadend = topicList.length < that.limit;
  83. that.page++;
  84. that.topicList = that.topicList.concat(topicList),
  85. that.page = that.page;
  86. that.pageloading = false;
  87. that.loadend = loadend;
  88. }).catch(err => {
  89. that.pageloading = false
  90. });
  91. }
  92. },
  93. /**
  94. * 页面上拉触底事件的处理函数
  95. */
  96. onReachBottom: function() {
  97. this.getTopicList();
  98. }
  99. }
  100. </script>
  101. <style lang="scss" scoped>
  102. .page-container{
  103. min-height: 100vh;
  104. background-color: #ff5348;
  105. }
  106. .flash-sale{
  107. .header{
  108. width: 100%;
  109. position: relative;
  110. .presellBg{
  111. width: 750rpx;
  112. box-sizing: border-box;
  113. }
  114. }
  115. .main_count{
  116. position: relative;
  117. top: -90rpx;
  118. background-color: #fff;
  119. margin: 0 20rpx;
  120. border-radius: 16rpx;
  121. padding: 20rpx;
  122. .list{
  123. width: 100%;
  124. height: 280rpx;
  125. margin-bottom: 30rpx;
  126. position: relative;
  127. .picture{
  128. width: 100%;
  129. height: 280rpx;
  130. border-radius: 16rpx;
  131. }
  132. }
  133. }
  134. .empty-box{
  135. display: flex;
  136. flex-direction: column;
  137. justify-content: center;
  138. align-items: center;
  139. margin: 80rpx 0 120rpx 0;
  140. image{
  141. width: 414rpx;
  142. height: 240rpx;
  143. }
  144. .txt{
  145. font-size: 26rpx;
  146. color: #999;
  147. }
  148. }
  149. }
  150. </style>