community.vue 5.1 KB

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