daily.vue 4.2 KB

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