community.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template name="community">
  2. <view class="home" @touchstart="Dever.slide" @touchend="end">
  3. <view class="card-bottom">
  4. <!-- 顶部分页栏 -->
  5. <view class="top-tab">
  6. <view :class="['tab-item flex-center', activeTab == index ? 'active' : '']" @tap="handleTab(index)" v-for="(item, index) in tabList" :key="index">{{ item.title }}</view>
  7. </view>
  8. <view class="scroll-wrapper">
  9. <!-- 漂流瓶 -->
  10. <view v-if="activeTab == 0">
  11. <view class="margin-bottom" v-for="(item, index) in cardList" :key="index">
  12. <y-DiaryItem :obj="item" />
  13. </view>
  14. </view>
  15. <!-- 聚集岛 -->
  16. <view v-else>
  17. <view class="margin-bottom" v-for="(item, index) in rightList" :key="item.id">
  18. <y-DiaryItem :obj="item" />
  19. </view>
  20. </view>
  21. <y-LoadMore :status="loadMoreStatus" />
  22. </view>
  23. <!-- 右下角按钮 -->
  24. <y-Fab :bottom="140" :right="40" :btnList="fabList" @click="handleFab" />
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. name: "community",
  31. props: {
  32. info_id : {
  33. type : String,
  34. value : null
  35. },
  36. page_id : {
  37. type : String,
  38. value : null
  39. },
  40. parent_page_id : {
  41. type : String,
  42. value : null
  43. },
  44. index : 0
  45. },
  46. data() {
  47. return {
  48. startNum: 0,
  49. activeTab: 0,
  50. // tab的名称
  51. tabList: [
  52. {
  53. title: '漂流瓶'
  54. },
  55. {
  56. title: '聚集岛'
  57. }
  58. ],
  59. cardList: [{
  60. id: 2,
  61. time: '06-17',
  62. avatarUrl: 'https://6d61-matchbox-79a395-1302390714.tcb.qcloud.la/matchbox/cat.jpg',
  63. nickName: '小黄鸭',
  64. title: '洛稚喜欢盛淮南谁也不知道',
  65. follow: false,
  66. isLike: false,
  67. likeNum: '24',
  68. commentNum: '0',
  69. imgList: [
  70. 'https://6d61-matchbox-79a395-1302390714.tcb.qcloud.la/matchbox/tree.jpg'
  71. ]
  72. },
  73. {
  74. id: 2,
  75. time: '06-17',
  76. avatarUrl: 'https://6d61-matchbox-79a395-1302390714.tcb.qcloud.la/matchbox/cat.jpg',
  77. nickName: '小黄鸭',
  78. title: '洛稚喜欢盛淮南谁也不知道',
  79. follow: false,
  80. isLike: false,
  81. likeNum: '24',
  82. commentNum: '0',
  83. imgList: [
  84. 'https://6d61-matchbox-79a395-1302390714.tcb.qcloud.la/matchbox/tree.jpg'
  85. ]
  86. }],
  87. rightList: [{
  88. id: 2,
  89. time: '06-17',
  90. avatarUrl: 'https://6d61-matchbox-79a395-1302390714.tcb.qcloud.la/matchbox/cat.jpg',
  91. nickName: '小黄鸭1',
  92. title: '洛稚喜欢盛淮南谁也不知道2222',
  93. follow: false,
  94. isLike: false,
  95. likeNum: '24',
  96. commentNum: '0',
  97. imgList: [
  98. 'https://6d61-matchbox-79a395-1302390714.tcb.qcloud.la/matchbox/tree.jpg'
  99. ]
  100. }],
  101. loadMoreStatus: 1, //0加载前,1加载中,2没有更多了
  102. //fab的设置
  103. fabList: [
  104. {
  105. bgColor: '#16C2C2',
  106. text: '发布',
  107. fontSize: 28,
  108. color: '#fff'
  109. },
  110. {
  111. bgColor: '#37b59d',
  112. text: '分享',
  113. fontSize: 28,
  114. color: '#fff'
  115. }
  116. ]
  117. };
  118. },
  119. created() {
  120. this.getData('add');
  121. //this.rightList = this.$store.state.diary.rightList;
  122. },
  123. onReachBottom() {
  124. this.startNum++;
  125. //上滑加载
  126. this.getData('add');
  127. },
  128. methods:{
  129. toDetails : function(id){
  130. uni.navigateTo({
  131. url: '../diary/details/details?id=' + id
  132. })
  133. },
  134. toOther : function(id){
  135. uni.navigateTo({
  136. url: '../mine/other/other?id=' + id
  137. })
  138. },
  139. getData : function(type) {
  140. },
  141. //下拉刷新
  142. onPulldownReresh : function() {
  143. console.info(222)
  144. this.getData('refresh');
  145. },
  146. handleTab : function(index) {
  147. this.activeTab = index;
  148. },
  149. //点击右下角tab按钮
  150. handleFab : function(e) {
  151. let index = e.index;
  152. switch (index) {
  153. case 0:
  154. uni.navigateTo({
  155. url: '../push/push'
  156. });
  157. break;
  158. case 1:
  159. console.log(1);
  160. break;
  161. }
  162. },
  163. end : function(e) {
  164. var type = this.Dever.slideEnd(e);
  165. if (type == 3 || type == 4) {
  166. this.$emit('goIndex', this.index);
  167. }
  168. }
  169. },
  170. }
  171. </script>
  172. <style lang="less" scoped>
  173. page {
  174. --mainColor: #435257;
  175. --activeColor: #36b39b;
  176. }
  177. view {
  178. box-sizing: border-box;
  179. }
  180. .flex-center {
  181. display: flex;
  182. align-items: center;
  183. justify-content: center;
  184. }
  185. .mainColor {
  186. color: var(--mainColor);
  187. }
  188. .aColor {
  189. color: var(--activeColor);
  190. }
  191. .color-nine{
  192. color: #999999;
  193. }
  194. .main-btn {
  195. border-radius: 40upx;
  196. display: flex;
  197. align-items: center;
  198. justify-content: center;
  199. color: var(--mainColor);
  200. border: 1upx solid var(--mainColor);
  201. padding: 10rpx 40rpx;
  202. }
  203. .active-btn {
  204. color: #FFFFFF !important;
  205. background-color: var(--activeColor) !important;
  206. border: 1upx solid var(--activeColor) !important;
  207. }
  208. /* 点赞和评论 */
  209. .margin-bottom {
  210. margin-bottom: 14px;
  211. }
  212. .home {
  213. padding-top: 120rpx;
  214. .top-barrage {
  215. width: 100%;
  216. height: 320rpx;
  217. overflow: hidden;
  218. }
  219. .card-bottom {
  220. width: 100%;
  221. .top-tab {
  222. display: flex;
  223. height: 120rpx;
  224. position: fixed;
  225. top: 0;
  226. width: 100%;
  227. z-index: 100;
  228. background-color: #ffffff;
  229. .tab-item {
  230. flex: 1;
  231. color: #999;
  232. border-bottom: 4rpx solid #ececec;
  233. }
  234. .active {
  235. color: var(--mainColor);
  236. border-bottom: 4rpx solid var(--mainColor);
  237. }
  238. }
  239. }
  240. }
  241. </style>