find.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. <template>
  2. <view class="zaiui-find-box" :class="show?'show':''">
  3. <!--分类标题栏-->
  4. <view class="bg-white zaiui-title-tab-box">
  5. <!--小程序端的标题-->
  6. <!-- #ifdef MP -->
  7. <view class="text-center text-black zaiui-small-routine-title">发现</view>
  8. <!-- #endif -->
  9. <view class="flex flex-wrap">
  10. <view class="basis-l">
  11. <scroll-view scroll-x class="nav z">
  12. <block v-for="(item,index) in TabData" :key="index">
  13. <view class="cu-item text-black" :class="index==TabCur?'select':''" @tap="tabSelect" :data-id="index">
  14. <view>{{item}}</view>
  15. <view class="tab-dot bg-red"/>
  16. </view>
  17. </block>
  18. </scroll-view>
  19. </view>
  20. <view class="basis-s text-right">
  21. <button class="cu-btn sm bg-red margin-top-xs">
  22. <text class="cuIcon-write"/>
  23. <text class="margin-left-xs">发布</text>
  24. </button>
  25. </view>
  26. </view>
  27. </view>
  28. <!--占位的-->
  29. <view class="zaiui-seat-height"/>
  30. <!--中间内容区域-->
  31. <view class="zaiui-view-content" v-if="TabCur == 0">
  32. <!--动态列表-->
  33. <trends-list :list_data="followTrendsData" :viewBtn="true"
  34. @userTap="trends_userTap" @followTap="trends_followTap" @contentTap="trends_contentTap"
  35. @imgTap="trends_imgTap" @talkTap="trends_talkTap" @viewBtnTap="trends_viewBtnTap"
  36. @commentTap="trends_commentTap" @appreciateTap="trends_appreciateTap"/>
  37. <!--占位底部距离-->
  38. <view class="cu-tabbar-height"/>
  39. </view>
  40. <!--中间内容区域-->
  41. <view class="zaiui-view-content" v-if="TabCur == 1">
  42. <!--动态列表1-->
  43. <trends-list :list_data="trendsData" :isMax="2"
  44. @userTap="trends_userTap" @followTap="trends_followTap" @contentTap="trends_contentTap"
  45. @imgTap="trends_imgTap" @talkTap="trends_talkTap" @forwardTap="trends_forwardTap"
  46. @commentTap="trends_commentTap" @appreciateTap="trends_appreciateTap"/>
  47. <!--热门话题,小程序上无效,待查原因-->
  48. <!-- #ifndef MP -->
  49. <hot-topic-list :list_data="hotTopicData" @listTap="hotTopicTap" @viewAllTap="viewAllTap"/>
  50. <!-- #endif -->
  51. <!--为你推荐-->
  52. <recommend-scroll-list :list_data="recommendScrollData" @userTap="r_userTap"
  53. @followTap="r_followTap" @viewAllTap="r_viewAllTap"/>
  54. <!--动态列表2-->
  55. <trends-list :list_data="trendsData" :isMin="2"
  56. @userTap="trends_userTap" @followTap="trends_followTap" @contentTap="trends_contentTap"
  57. @imgTap="trends_imgTap" @talkTap="trends_talkTap" @forwardTap="trends_forwardTap"
  58. @commentTap="trends_commentTap" @appreciateTap="trends_appreciateTap"/>
  59. <!--占位底部距离-->
  60. <view class="cu-tabbar-height"/>
  61. </view>
  62. <!--中间内容区域-->
  63. <view class="margin-top" v-show="TabCur == 2?true:false">
  64. <!--话题类型-->
  65. <topic-grid-list :list_data="topicGridData" @listTap="topicGridTap"/>
  66. <view class="zaiui-view-content">
  67. <!--热门话题,小程序上无效,待查原因-->
  68. <!-- #ifndef MP -->
  69. <hot-topic-list isSort="topic" :list_data="hotTopicData" @listTap="hotTopicTap" @viewAllTap="viewAllTap"/>
  70. <!-- #endif -->
  71. <!--话题列表-->
  72. <topic-card-list :list_data="topicCardData" @listTap="topicCardTap" @viewTap="topicCardViewTap"/>
  73. <!--占位底部距离-->
  74. <view class="cu-tabbar-height"/>
  75. </view>
  76. </view>
  77. </view>
  78. </template>
  79. <script>
  80. import trendsList from '@/components/zaiui-common/list/trends-list';
  81. import hotTopicList from '@/components/zaiui-common/list/hot-topic-list';
  82. import recommendScrollList from '@/components/zaiui-common/list/recommend-scroll-list';
  83. import topicGridList from '@/components/zaiui-common/list/topic-grid-list';
  84. import topicCardList from '@/components/zaiui-common/list/topic-card-list';
  85. //======================================================================
  86. import _find_data from '@/static/zaiui/data/find.js'; //虚拟数据
  87. import _tool from '@/static/zaiui/util/tools.js';
  88. export default {
  89. name: 'find',
  90. components: {
  91. trendsList, hotTopicList, recommendScrollList, topicGridList, topicCardList
  92. },
  93. data() {
  94. return {
  95. TabCur: 1, TabData: ['关注','推荐','广场'], followTrendsData: [], trendsData: [], hotTopicData: [], recommendScrollData: [],
  96. topicGridData: [], topicCardData: [],
  97. }
  98. },
  99. props: {
  100. show: {
  101. type: Boolean,
  102. default: true
  103. },
  104. scrollY: {
  105. type: Number,
  106. default: 0
  107. },
  108. scrollBottom: {
  109. type: Number,
  110. default: 0
  111. }
  112. },
  113. watch: {
  114. scrollY() {
  115. //通知他妈的滚动了。
  116. this.setPageScroll(this.scrollY);
  117. },
  118. scrollBottom() {
  119. if(this.scrollBottom != 0) {
  120. //通知他妈的触底了
  121. this.setReachBottom();
  122. }
  123. },
  124. },
  125. created() {
  126. //加载虚拟数据
  127. this.trendsData = _find_data.trendsData();
  128. this.hotTopicData = _find_data.hotTopicData();
  129. this.recommendScrollData = _find_data.recommendScrollData();
  130. this.followTrendsData = _find_data.followTrendsData();
  131. this.topicGridData = _find_data.topicGridData();
  132. this.topicCardData = _find_data.topicCardData();
  133. },
  134. mounted() {
  135. _tool.setBarColor(true);
  136. uni.pageScrollTo({
  137. scrollTop: 0,
  138. duration: 0
  139. });
  140. },
  141. methods: {
  142. //页面被滚动
  143. setPageScroll(scrollTop) {
  144. //console.log(scrollTop);
  145. },
  146. //触底了
  147. setReachBottom() {
  148. console.log('触底了');
  149. },
  150. tabSelect(e) {
  151. this.TabCur = e.currentTarget.dataset.id;
  152. uni.pageScrollTo({
  153. scrollTop: 0,
  154. duration: 0
  155. });
  156. },
  157. trends_userTap(e) {
  158. console.log('用户区域被点击:' + JSON.stringify(e));
  159. },
  160. trends_followTap(e) {
  161. console.log('关注按钮被点击:' + JSON.stringify(e));
  162. },
  163. trends_contentTap(e) {
  164. console.log('文字内容被点击:' + JSON.stringify(e));
  165. },
  166. trends_imgTap(e) {
  167. console.log('图片被点击:' + JSON.stringify(e));
  168. },
  169. trends_talkTap(e) {
  170. console.log('话题被点击:' + JSON.stringify(e));
  171. },
  172. trends_forwardTap(e) {
  173. console.log('分享被点击:' + JSON.stringify(e));
  174. },
  175. trends_commentTap(e) {
  176. console.log('评论被点击:' + JSON.stringify(e));
  177. },
  178. trends_appreciateTap(e) {
  179. console.log('点赞被点击:' + JSON.stringify(e));
  180. },
  181. trends_viewBtnTap(e) {
  182. console.log('查看TA被点击:' + JSON.stringify(e));
  183. },
  184. hotTopicTap(e) {
  185. console.log(e);
  186. },
  187. viewAllTap() {
  188. console.log('点击了查看全部');
  189. },
  190. r_userTap(e) {
  191. console.log('用户信息被点击:' + JSON.stringify(e));
  192. },
  193. r_followTap(e) {
  194. console.log('关注按钮被点击:' + JSON.stringify(e));
  195. },
  196. r_viewAllTap() {
  197. console.log('点击了查看全部');
  198. },
  199. topicGridTap(e) {
  200. console.log(e);
  201. },
  202. topicCardTap(e) {
  203. console.log(e);
  204. },
  205. topicCardViewTap(e) {
  206. console.log(e);
  207. }
  208. }
  209. }
  210. </script>
  211. <style lang="scss" scoped>
  212. .zaiui-find-box {
  213. display: none;
  214. }
  215. .zaiui-find-box.show {
  216. display: block;
  217. }
  218. .zaiui-title-tab-box {
  219. position: fixed;
  220. width: 100%;
  221. top: 0;
  222. z-index: 999;
  223. padding: calc(var(--status-bar-height) + 9.09upx) 27.27upx 9.09upx 9.09upx;
  224. .flex {
  225. .basis-l {
  226. flex-basis: 70%;
  227. }
  228. .basis-s {
  229. flex-basis: 30%;
  230. }
  231. }
  232. }
  233. .zaiui-seat-height {
  234. width: 100%;
  235. /* #ifndef MP */
  236. height: calc(var(--status-bar-height) + 81.81upx);
  237. /* #endif */
  238. /* #ifdef MP */
  239. margin-top: calc(var(--status-bar-height) + 185upx);
  240. /* #endif */
  241. }
  242. .zaiui-view-content {
  243. padding: 0 27.27upx 54.54upx;
  244. }
  245. </style>