daily.vue 4.2 KB

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