list.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <gui-page :customFooter="true" :customHeader="true" iphoneXButtomStyle="background:#F8F8F8"
  3. :footerSets="{height:150, zIndex:100, bg:'none'}" :isLoading="pageLoading" :headerStyle="headerStyle">
  4. <view slot="gHeader">
  5. <view class="gui-flex gui-nowrap gui-rows gui-align-items-center gui-padding">
  6. <view class="gui-flex1 gui-text-center">
  7. <text class="gui-h4 gui-ellipsis gui-primary-color">合小记</text>
  8. </view>
  9. </view>
  10. </view>
  11. <!-- 页面主体 -->
  12. <view slot="gBody">
  13. <view class="gui-margin-top">
  14. <gui-swiper :swiperItems="fetch.focus" :width="750" :height="330" @taped="taped"></gui-swiper>
  15. </view>
  16. <view class="gui-flex gui-rows gui-justify-content-center gui-margin-top">
  17. <view style="width:500rpx;">
  18. <gui-segmented-control :items="cate" :current="0" borderRadius="50rpx" @change="menu">
  19. </gui-segmented-control>
  20. </view>
  21. </view>
  22. <block v-if="state == 1">
  23. <view class="gui-grids gui-flex gui-rows gui-wrap gui-margin-top gui-bg-gray menu">
  24. <gui-switch-navigation :items="fetch.cate" :currentIndex="nav_index" @change="nav"
  25. activeDirection="center" textAlign="center"
  26. activeLineBg="linear-gradient(to right, #008AFF,#008AFF)"></gui-switch-navigation>
  27. </view>
  28. <view class="gui-margin gui-card-list gui-flex gui-rows gui-wrap gui-space-between gui-margin-top">
  29. <view class="gui-card-item" hover-class="gui-tap" v-for="(v, k) in fetch.info" :key="k"
  30. @click="view(v.id_code)">
  31. <view class="gui-card-img" style="height:100%">
  32. <gui-image :width="330" :height="191" :src="v.pic_cover"></gui-image>
  33. <text
  34. class="gui-card-mask-title gui-absolute-lb gui-bg-black-opacity5 gui-block-text gui-color-white gui-h6 gui-border-box gui-text-center">{{v.name}}</text>
  35. </view>
  36. </view>
  37. </view>
  38. </block>
  39. <gui-empty v-if="state == 2">
  40. <view slot="img" class="gui-flex gui-rows gui-justify-content-center">
  41. <image class="gui-empty-img" src="@/static/dreamland/img/kong.png"></image>
  42. </view>
  43. <text slot="text" class="gui-text-small gui-block-text gui-text-center gui-margin-top"
  44. style="color:#9DABFF;">您还没有可以阅览的合小记</text>
  45. </gui-empty>
  46. </view>
  47. <view slot="gPendant" style="display: none;">
  48. <text class="gui-block-text pendant gui-color-white gui-bg-primary gui-icons">社区</text>
  49. </view>
  50. <!--<foot ref="foot" slot="gFooter" :value="foot_value"></foot>-->
  51. <dever-share ref="share" :data="fetch.share" v-if="fetch.share"></dever-share>
  52. </gui-page>
  53. </template>
  54. <script>
  55. import deverShare from '@/lib/dever/components/share.vue';
  56. import foot from '@/pages/index/foot.vue';
  57. export default {
  58. data() {
  59. return {
  60. homePage : 'pages/index/my',
  61. foot_value: 2,
  62. state: 0,
  63. fetch: {
  64. cate: [],
  65. info: [],
  66. focus: [],
  67. },
  68. cate: ["推荐", "私藏"],
  69. cate_index: 0, //默认分类
  70. nav_index: 0,
  71. headerStyle: 'background-color:#F8F8F8',
  72. }
  73. },
  74. components: {
  75. deverShare,
  76. foot
  77. },
  78. onLoad() {
  79. this.getInfo();
  80. },
  81. onShow() {
  82. this.$nextTick(function() {
  83. //this.$refs.foot.cur = this.foot_value;
  84. });
  85. },
  86. // 重新加载
  87. onPullDownRefresh: function() {
  88. this.getInfo();
  89. },
  90. //下拉加载
  91. onReachBottom() {
  92. this.getData(2, false);
  93. },
  94. methods: {
  95. getInfo: function() {
  96. var self = this;
  97. var data = {};
  98. data.id = -1;
  99. data.type = this.cate_index + 1;
  100. this.nav_index = 0;
  101. this.Dever.get(this, 'app/collection/?l=api.getList', data, function(t) {
  102. if (t.cate.length > 0) {
  103. self.state = 1;
  104. } else {
  105. self.state = 2;
  106. }
  107. });
  108. },
  109. getData: function(page, index) {
  110. var self = this;
  111. if (!index) {
  112. index = this.nav_index;
  113. }
  114. var data = {};
  115. data.id = -1;
  116. data.type = this.cate_index + 1;
  117. data.cate = this.fetch.cate[index].id;
  118. this.Dever.page([page, 'info'], this, 'app/collection/?l=api.getListData', data);
  119. },
  120. view: function(id) {
  121. this.Dever.location('dream/index?id=' + id);
  122. },
  123. menu: function(e) {
  124. this.cate_index = e
  125. this.getInfo();
  126. },
  127. nav: function(e) {
  128. this.nav_index = e;
  129. this.getData(1, e);
  130. },
  131. taped: function(e) {
  132. this.Dever.location(this.fetch.focus[e].link, 'webview', this.fetch.focus[e].name);
  133. }
  134. }
  135. };
  136. </script>
  137. <style>
  138. .pendant {
  139. width: 88rpx;
  140. height: 88rpx;
  141. border-radius: 88rpx;
  142. text-align: center;
  143. line-height: 88rpx;
  144. font-size: 24rpx;
  145. margin-top: 10rpx;
  146. }
  147. .menu {
  148. width: 750rpx;
  149. padding: 15rpx 30rpx;
  150. box-sizing: border-box;
  151. padding-bottom: 0;
  152. }
  153. .gui-text-small {
  154. font-size: 20rpx;
  155. }
  156. </style>