community.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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 == k ? 'active' : '']" @tap="handleTab(k)" v-for="(v, k) in fetch.cate" :key="k">{{ v.name }}</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. content_id : {
  37. type : String,
  38. value : null
  39. },
  40. page_id : {
  41. type : String,
  42. value : null
  43. },
  44. parent_page_id : {
  45. type : String,
  46. value : null
  47. },
  48. index : 0
  49. },
  50. data() {
  51. return {
  52. fetch : {
  53. cate : [],
  54. info : [],
  55. },
  56. startNum: 0,
  57. activeTab: 0,
  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.getData('add');
  120. //this.rightList = this.$store.state.diary.rightList;
  121. },
  122. onReachBottom() {
  123. this.startNum++;
  124. //上滑加载
  125. this.getData('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. getData : function(type) {
  139. this.Dever.get(this, 'app/community/?l=api.category', {info_id:this.info_id, page_id:this.page_id, content_id:this.content_id});
  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>