list.vue 4.2 KB

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