top.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <!-- 推荐的动态路由 -->
  2. <template>
  3. <view class="recommend">
  4. <view class="multiple">
  5. <view
  6. class="item-food"
  7. v-for="(item, index) in itemFood"
  8. :key="item.id"
  9. @click="footStyle(index, item)"
  10. :class="{ itemstyle: footIndex == index }"
  11. >
  12. <text class="alarm">#</text> {{ item.title }}
  13. </view>
  14. </view>
  15. <view class="waterfall"> </view>
  16. <waterfall
  17. v-if="flowList.length > 0"
  18. ref="wfp"
  19. :colunmNumber="colunmNumber"
  20. :flowList="flowList"
  21. :columnGap="10"
  22. :status="status"
  23. ></waterfall>
  24. <loadMore v-if="flowList.length > 0" :status="status"></loadMore>
  25. <nodata v-else :config="{ top: 15, content: '暂无数据~' }"></nodata>
  26. <view class="release" @click="gotorelease()">
  27. <image src="../../../static/pen.png" mode=""></image>
  28. <view class="item"> 发布 </view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import waterfall from "../../../components/waterfall/waterfall";
  34. import nodata from "../../noData/nodata";
  35. import loadMore from "../../uni-load-more/uni-load-more";
  36. export default {
  37. data() {
  38. return {
  39. footIndex: 0, //点击切换food的样式,默认是第一个
  40. recommendIndex: 0, //点击切换头部样式,默认是第一个
  41. itemFood: [],
  42. colunmNumber: 2,
  43. index: 19,
  44. flowList: [],
  45. page: 1,
  46. limit: 10,
  47. themeId: null, //主题id
  48. status: "more",
  49. };
  50. },
  51. props: {},
  52. comments: {
  53. waterfall,
  54. nodata,
  55. loadMore,
  56. },
  57. watch: {},
  58. mounted() {
  59. this.getTheme();
  60. },
  61. methods: {
  62. isload() {
  63. this.page = 1;
  64. (this.flowList = []), this.getList(this.themeId);
  65. },
  66. loaderMore() {
  67. if (this.status == "more") {
  68. this.page++;
  69. this.getList(this.themeId);
  70. }
  71. },
  72. getTheme() {
  73. this.$http.get("/opus/theme/list", this.params).then((res) => {
  74. if (res && res.code == 200) {
  75. this.itemFood = res.list;
  76. if (res.list.length > 0) {
  77. this.themeId = this.itemFood[0].id;
  78. this.getList(this.itemFood[0].id);
  79. }
  80. }
  81. });
  82. },
  83. gotorelease() {
  84. //跳转到发布页面
  85. uni.navigateTo({
  86. url: "./release",
  87. });
  88. },
  89. getList(id) {
  90. this.$http
  91. .get("/opus/all-list", {
  92. themeId: id,
  93. page: this.page,
  94. limit: this.limit,
  95. })
  96. .then((res) => {
  97. if (res && res.code == 200) {
  98. this.flowList = this.flowList.concat(res.page.list);
  99. if (res.page.totalPage <= res.page.currPage) {
  100. this.status = "noMore";
  101. } else {
  102. this.status = "more";
  103. }
  104. console.log(this.status);
  105. }
  106. });
  107. },
  108. footStyle(index, item) {
  109. this.flowList=[]
  110. this.footIndex = index;
  111. this.themeId = item.id;
  112. this.page = 1;
  113. this.getList(this.themeId);
  114. },
  115. },
  116. };
  117. </script>
  118. <style lang="scss" scoped>
  119. .release {
  120. background-color: #00321e;
  121. width: 101rpx;
  122. height: 101rpx;
  123. border-radius: 999rpx;
  124. position: fixed;
  125. bottom: 259rpx;
  126. right: 30rpx;
  127. display: flex;
  128. align-items: center;
  129. flex-direction: column;
  130. image {
  131. width: 37rpx;
  132. height: 30rpx;
  133. margin-top: 15rpx;
  134. margin-bottom: 6rpx;
  135. }
  136. .item {
  137. color: #ffffff;
  138. font-weight: 400;
  139. font-size: 25rpx;
  140. }
  141. }
  142. .water-flow-box {
  143. background-color: #f5f5f5;
  144. border-radius: 40rpx;
  145. }
  146. .waterfall {
  147. background-color: #f5f5f5;
  148. border-radius: 40px;
  149. }
  150. .multiple {
  151. margin-top: 88rpx;
  152. font-size: 32rpx;
  153. font-weight: 700;
  154. color: #999999;
  155. background: #ffffff;
  156. display: flex;
  157. align-items: center;
  158. white-space: nowrap;
  159. overflow-x: auto;
  160. -webkit-overflow-scrolling: touch;
  161. .item-food {
  162. padding-bottom: 30rpx;
  163. padding-top: 32rpx;
  164. margin-left: 30rpx;
  165. box-sizing: border-box;
  166. height: 105rpx;
  167. display: flex;
  168. .alarm {
  169. margin-right: 5rpx;
  170. display: block;
  171. }
  172. }
  173. .itemstyle {
  174. border-bottom: 1rpx solid #00321e;
  175. color: #00321e;
  176. border-radius: 1rpx;
  177. }
  178. }
  179. .top {
  180. z-index: 1;
  181. width: 100%;
  182. height: 88rpx;
  183. position: fixed;
  184. background-color: #00321e;
  185. display: flex;
  186. justify-content: center;
  187. align-items: center;
  188. color: rgba(255, 255, 255, 1);
  189. .recommend {
  190. padding-bottom: 24rpx;
  191. padding-top: 14rpx;
  192. font-size: 36rpx;
  193. font-weight: 500;
  194. margin-right: 104rpx;
  195. box-sizing: border-box;
  196. height: 86rpx;
  197. }
  198. .recommendtwo {
  199. border-bottom: 4rpx #ffffff solid;
  200. border-radius: 1rpx;
  201. }
  202. }
  203. .recommend {
  204. overflow: hidden;
  205. }
  206. </style>