list.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <gui-page :customFooter="true" iphoneXButtomStyle="background:#F8F8F8"
  3. :footerSets="{height:150, zIndex:100, bg:'none'}">
  4. <!-- 页面主体 -->
  5. <view slot="gBody" class="gui-margin">
  6. <ourLoading isFullScreen :active="pageLoading" :text="pageLoadingText" />
  7. <view class="main" v-if="state == 1">
  8. <view class="content" :style="height">
  9. <scroll-view class="menus" :scroll-into-view="view" scroll-with-animation scroll-y>
  10. <view class="wrapper">
  11. <view class="menu" :id="`menu-${v.id}`" :class="{'current': k == cate_index}" v-for="(v, k) in fetch.cate" :key="k" @tap="menu(k, v.id)">
  12. <text>{{ v.name }}</text>
  13. </view>
  14. </view>
  15. </scroll-view>
  16. <!-- goods list begin -->
  17. <scroll-view class="goods" scroll-with-animation scroll-y :scroll-top="top">
  18. <view class="wrapper">
  19. <swiper class="ads" id="ads" autoplay :interval="3000" indicator-dots v-if="fetch.focus.length > 0">
  20. <swiper-item v-for="(v, k) in fetch.focus" :key="k" @tap="go" :data-url="v.link">
  21. <image :src="v.pic"></image>
  22. </swiper-item>
  23. </swiper>
  24. <view class="list">
  25. <!-- category begin -->
  26. <view class="category" v-for="(v, k) in fetch.cate" :key="k" :id="`cate-${v.id}`" v-if="k == cate_index">
  27. <view class="items">
  28. <!-- 商品 begin -->
  29. <view class="good" v-for="(v1, k1) in fetch.info[v.id]" :key="k1">
  30. <image :src="v1.pic_cover" class="image" @tap="location(v1.id_code)"></image>
  31. <view class="right" @tap="location(v1.id_code)">
  32. <text class="name">{{ v1.name }}</text>
  33. <text class="tips">{{ v1.desc }}</text>
  34. <view class="price_and_action" v-if="v1.buy == 1" style="display: none;">
  35. <text class="price">¥{{ v1.buy_price }}</text>
  36. </view>
  37. </view>
  38. </view>
  39. <!-- 商品 end -->
  40. </view>
  41. </view>
  42. <!-- category end -->
  43. </view>
  44. </view>
  45. </scroll-view>
  46. <!-- goods list end -->
  47. </view>
  48. <!-- content end -->
  49. </view>
  50. <view v-if="state == 2" class="d-flex w-100 h-100 flex-column just-content-center align-items-center">
  51. <view class="tips d-flex flex-column align-items-center font-size-base text-color-assist">
  52. <view>您还没有任何阅览的小记</view>
  53. <view>小记可能就在你身边,快去寻找吧~</view>
  54. </view>
  55. <button type="primary" class="drink-btn" size="default" @tap="home">我的家园</button>
  56. <view class="font-size-sm text-color-primary" @tap="qun" style="display: none;">加入官方微信群</view>
  57. </view>
  58. <dever-share ref="share" :data="fetch.share" v-if="fetch.share"></dever-share>
  59. </view>
  60. <!-- 边框使用 style 实现,可以根据自己项目实际情况修改 -->
  61. <view slot="gFooter" class="gui-flex gui-rows gui-nowrap gui-space-between gui-align-items-end"
  62. style="height:150rpx;">
  63. <view class="gui-footer-icon-buttons" @tap="navChang(0)">
  64. <text class="gui-footer-icon-buttons-icon gui-block-text gui-icons"
  65. :class="[navCurrent == 0 ? 'gui-nav-bottom-active-color' : 'gui-nav-bottom-color']">&#xe63b;</text>
  66. <text class="gui-footer-icon-buttons-text gui-block-text gui-nav-bottom-color"
  67. :class="[navCurrent == 0 ? 'gui-nav-bottom-active-color' : 'gui-nav-bottom-color']">首页</text>
  68. </view>
  69. <view class="gui-footer-icon-buttons" @tap="navChang(1)">
  70. <text class="gui-footer-icon-buttons-icon gui-block-text gui-icons"
  71. :class="[navCurrent == 1 ? 'gui-nav-bottom-active-color' : 'gui-nav-bottom-color']">&#xe6b8;</text>
  72. <text class="gui-footer-icon-buttons-text gui-block-text gui-nav-bottom-color"
  73. :class="[navCurrent == 1 ? 'gui-nav-bottom-active-color' : 'gui-nav-bottom-color']">交流</text>
  74. </view>
  75. <!-- 凸出按钮占位 普通按钮 实现下面的 gui-footer-icon-buttons 即可 -->
  76. <view class="gui-footer-icon-buttons"></view>
  77. <view class="gui-footer-icon-buttons" @tap="navChang(3)">
  78. <text class="gui-footer-icon-buttons-icon gui-block-text gui-icons"
  79. :class="[navCurrent == 3 ? 'gui-nav-bottom-active-color' : 'gui-nav-bottom-color']">&#xe626;</text>
  80. <text class="gui-footer-icon-buttons-text gui-block-text"
  81. :class="[navCurrent == 3 ? 'gui-nav-bottom-active-color' : 'gui-nav-bottom-color']">客服</text>
  82. </view>
  83. <view class="gui-footer-icon-buttons" @tap="navChang(4)">
  84. <text class="gui-footer-icon-buttons-icon gui-block-text gui-icons"
  85. :class="[navCurrent == 4 ? 'gui-nav-bottom-active-color' : 'gui-nav-bottom-color']">&#xe6fe;</text>
  86. <text class="gui-footer-icon-buttons-text gui-block-text"
  87. :class="[navCurrent == 4 ? 'gui-nav-bottom-active-color' : 'gui-nav-bottom-color']">我的</text>
  88. </view>
  89. <!-- 使用定位方式实现凸出按钮 -->
  90. <view class="gui-footer-buttons-ab" @tap="navChang(2)">
  91. <text class="gui-footer-buttons-ab-icon gui-block-text gui-icons gui-bold"
  92. :class="[navCurrent == 2 ? 'gui-nav-bottom-active-color' : 'gui-nav-bottom-color']">&#xe60b;</text>
  93. <text class="gui-footer-icon-buttons-text gui-block-text"
  94. :class="[navCurrent == 2 ? 'gui-nav-bottom-active-color' : 'gui-nav-bottom-color']">合小记</text>
  95. </view>
  96. </view>
  97. </gui-page>
  98. </template>
  99. <script>
  100. import deverShare from '@/lib/dever/components/share.vue';
  101. export default {
  102. components: {
  103. },
  104. data() {
  105. return {
  106. navCurrent: 2,
  107. state : 0,
  108. fetch : {
  109. cate : [],
  110. info : [],
  111. hot : [],
  112. },
  113. height : 'height:100%',
  114. cate_index: 0,//默认分类
  115. top: 0,
  116. view: '',
  117. }
  118. },
  119. components:{
  120. deverShare
  121. },
  122. onLoad() {
  123. },
  124. onShow() {
  125. this.navCurrent = 2;
  126. //this.Dever.checkLogin();
  127. this.getData();
  128. },
  129. // 重新加载
  130. onPullDownRefresh: function() {
  131. this.getData();
  132. },
  133. //下拉加载
  134. onReachBottom() {
  135. this.getData();
  136. },
  137. methods: {
  138. navChang : function (index) {
  139. this.navCurrent = index;
  140. if (index == 0) {
  141. this.Dever.location('index/index');
  142. }
  143. },
  144. getData : function() {
  145. var self = this;
  146. this.Dever.get(this, 'app/collection/?l=api.getList', {id:-1}, function(t) {
  147. if (t.cate.length > 0) {
  148. self.state = 1;
  149. } else {
  150. self.state = 2;
  151. }
  152. uni.getSystemInfo({
  153. success: function (res) {
  154. self.height = 'height:' + res.windowHeight + 'px';
  155. }
  156. })
  157. });
  158. },
  159. home : function() {
  160. this.Dever.location('index/index');
  161. },
  162. location : function(id) {
  163. this.Dever.location('dream/index?id=' + id);
  164. },
  165. go : function(e) {
  166. var link = e.currentTarget.dataset.url;
  167. if (link) {
  168. this.Dever.location(link);
  169. }
  170. },
  171. menu : function(index, id) {
  172. this.cate_index = index
  173. },
  174. }
  175. };
  176. </script>
  177. <style>
  178. .gui-text-small{font-size:20rpx;}
  179. .gui-footer-icon-buttons{width:130rpx; height:80rpx; padding:10rpx; flex:1; position:relative; margin:0; background-color:#F8F8F8;}
  180. .gui-footer-buttons-ab{position:absolute; z-index:101; left:325rpx; top:0rpx; width:110rpx; height:150rpx;}
  181. .gui-footer-buttons-ab-icon{width:110rpx; height:110rpx; line-height:120rpx; text-align:center; font-size:68rpx; background-color:#F7F8FA; border-radius:100rpx;}
  182. </style>