daily.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <template>
  2. <view class="page">
  3. <view class="content">
  4. <view class="head">
  5. <span class="title">项目日志</span>
  6. <navigator
  7. url="/pages/daily/form"
  8. class="self"
  9. open-type="navigate"
  10. hover-class="navigator-hover"
  11. >
  12. 写日志
  13. </navigator>
  14. </view>
  15. <uni-search-bar
  16. bgColor="#FFFFFF"
  17. :radius="20"
  18. placeholder="请输入日志标题"
  19. v-model="searchKeyword"
  20. @confirm="handelSearchConfirm"
  21. />
  22. <scroll-view
  23. class="list"
  24. :scroll-top="scrollTop"
  25. scroll-y="true"
  26. @scrolltolower="scrollToLower()"
  27. >
  28. <view class="item" v-for="item in list" :key="item.log_id">
  29. <view class="time">{{ item.c_time | getTime }}</view>
  30. <view class="box" @click="() => handlerDetailClick(item.log_id)">
  31. <view class="title">{{ item.author_name }}的金科环境项目日志</view>
  32. <view class="desc">
  33. <view class="desc-title">日志概述:</view>
  34. <view class="desc-content"> 列表接口没有概述 </view>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="loadmore">{{ loadMoreText }}</view>
  39. </scroll-view>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. import { queryDaily } from "@/services/daily";
  45. import mixin from "@/utils/listMixin";
  46. import moment from "moment";
  47. export default {
  48. mixins: [mixin],
  49. data() {
  50. return {
  51. searchKeyword: "",
  52. scrollTop: 0,
  53. loadMoreText: "",
  54. list: [],
  55. };
  56. },
  57. onShow() {
  58. this.pagination.currentPage = 1;
  59. this.initData();
  60. },
  61. filters: {
  62. getTime: (time) => {
  63. return moment(time).format("YYYY-MM-DD HH:mm");
  64. },
  65. },
  66. methods: {
  67. handelSearchConfirm() {},
  68. scrollToLower() {
  69. if (this.list.length >= this.pagination.total) {
  70. this.loadMoreText = "没有更多数据了";
  71. return;
  72. }
  73. this.pagination.currentPage++;
  74. this.initData();
  75. },
  76. async getList(params) {
  77. let res = await queryDaily(params);
  78. this.list = res.data.list;
  79. return res.data;
  80. },
  81. handlerDetailClick(id) {
  82. uni.navigateTo({
  83. url: `/pages/daily/form?id=${id}`,
  84. });
  85. },
  86. },
  87. };
  88. </script>
  89. <style lang="less" scoped>
  90. .content {
  91. display: flex;
  92. justify-content: center;
  93. flex-wrap: wrap;
  94. padding-top: 150rpx;
  95. ::v-deep {
  96. .uni-searchbar {
  97. width: 100%;
  98. .uni-searchbar__box {
  99. border: 1px solid #ccc;
  100. }
  101. }
  102. }
  103. }
  104. .head {
  105. width: calc(100% - 60rpx);
  106. padding: 40rpx;
  107. position: fixed;
  108. background: url("~@/static/app-plus/menu-title-bg.png") no-repeat center;
  109. background-size: 100% 100%;
  110. background-color: #fff;
  111. display: flex;
  112. justify-content: space-between;
  113. align-items: center;
  114. z-index: 1;
  115. top: 0;
  116. .title {
  117. font: 18px bold;
  118. color: #fff;
  119. }
  120. .self {
  121. font: 14px;
  122. padding-left: 20rpx;
  123. color: #fff;
  124. }
  125. }
  126. .list {
  127. width: 90%;
  128. height: calc(90vh - 130rpx);
  129. ::v-deep {
  130. .uni-list--border-top {
  131. background-color: transparent;
  132. }
  133. .uni-list-item__container {
  134. padding: 12rpx 30rpx;
  135. }
  136. }
  137. }
  138. .loadmore {
  139. padding: 30rpx 0px;
  140. font-size: 16px;
  141. color: gray;
  142. text-align: center;
  143. }
  144. .item {
  145. margin-top: 20rpx;
  146. .time {
  147. padding-left: 25rpx;
  148. font-size: 24rpx;
  149. color: #7a7a7a;
  150. line-height: 32rpx;
  151. margin-bottom: 10rpx;
  152. }
  153. .box {
  154. padding: 40rpx;
  155. border-radius: 5rpx;
  156. border: 1px solid #ccc;
  157. box-shadow: 0 1rpx 4rpx rgba(255, 255, 255, 0.2);
  158. .title {
  159. font-size: 28rpx;
  160. font-weight: 400;
  161. color: #4a90e2;
  162. line-height: 40rpx;
  163. margin-bottom: 18rpx;
  164. }
  165. .desc {
  166. display: flex;
  167. font-size: 28rpx;
  168. font-weight: 400;
  169. color: #4a4a4a;
  170. line-height: 40rpx;
  171. .desc-title {
  172. flex-shrink: 1;
  173. }
  174. .desc-content {
  175. flex: 1;
  176. display: -webkit-box;
  177. -webkit-line-clamp: 2; /* 显示的行数 */
  178. -webkit-box-orient: vertical;
  179. overflow: hidden;
  180. text-overflow: ellipsis;
  181. white-space: normal;
  182. }
  183. }
  184. }
  185. }
  186. </style>