allFile.wpy 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <style lang="less">
  2. .all-file {
  3. width: 100%;
  4. }
  5. .bg {
  6. color: #ccc;
  7. }
  8. .file-item {
  9. width: 100%;
  10. height: 140rpx;
  11. border-bottom: 2rpx solid #F0F0F0;
  12. display: flex;
  13. justify-content: space-between;
  14. align-items: center;
  15. padding: 0 18rpx;
  16. box-sizing:border-box;
  17. .dian {
  18. width:100rpx;
  19. height: 60rpx;
  20. image {
  21. width: 44rpx;
  22. height: 10rpx;
  23. }
  24. }
  25. .file {
  26. display: flex;
  27. image {
  28. width:80rpx;
  29. height: 76rpx;
  30. margin-right: 26rpx;
  31. }
  32. .file-explain {
  33. display: flex;
  34. flex-direction: column;
  35. justify-content: center;
  36. .title {
  37. font-size:28rpx;
  38. font-weight: bolder;
  39. }
  40. .time {
  41. font-size: 24rpx;
  42. color: #909090;
  43. }
  44. }
  45. }
  46. }
  47. </style>
  48. <template>
  49. <view class="all-file">
  50. <repeat for="{{fileList}}" key="index" index="index" item="item">
  51. <view class="file-item {{item.taskJoinUser.fileStatus === 'CLOSE' ? 'bg' : ''}}" wx:if="{{item.task}}" @tap="detail({{item.task}}, {{item.taskJoinUser.fileStatus}})">
  52. <view class="file">
  53. <image src="../static/img/file{{item.taskJoinUser.fileStatus === 'CLOSE' ? '_b' : ''}}.png"></image>
  54. <view class="file-explain">
  55. <text class="title">{{item.task.title}}</text>
  56. <text class="time">{{timeList[index]}}</text>
  57. </view>
  58. </view>
  59. <view class="dian" @tap.stop="operation({{index}}, {{item.taskJoinUser.fileStatus}})">
  60. <image src="../static/img/dian{{item.taskJoinUser.fileStatus === 'CLOSE' ? '_b' : ''}}.png"></image>
  61. </view>
  62. </view>
  63. </repeat>
  64. </view>
  65. <del :syncFlag.sync="flag" :index.sync="index" :fileList.sync="fileList"/>
  66. </template>
  67. <script>
  68. import wepy from 'wepy'
  69. import Del from './del'
  70. import { httpRequestApi } from '../util/httpRequestApi'
  71. import { formDate } from '../util/utils'
  72. export default class AllFile extends wepy.component {
  73. data = {
  74. fileList: [],
  75. flag: 'false',
  76. timeList: [],
  77. index: 0,
  78. totalNo: 0
  79. }
  80. components = {
  81. del: Del
  82. }
  83. methods = {
  84. detail (task, fileStatus) {
  85. if (fileStatus === 'CLOSE') {
  86. return false
  87. }
  88. const id = task.id ? task.id : ''
  89. const title = task.title ? task.title : ''
  90. this.$root.$navigate(`/pages/detail?id=${id}&title=${title}`)
  91. },
  92. operation (ind, fileStatus) {
  93. if (fileStatus === 'CLOSE') {
  94. return false
  95. }
  96. this.flag = 'true'
  97. this.index = ind
  98. },
  99. getTaskList: (pageNo, pageSize, type) => {
  100. httpRequestApi.getTaskList(pageNo, pageSize).success(res => {
  101. this.totalNo = res.data.data.totalNo
  102. if (type) {
  103. this.fileList = res.data.data.list
  104. }
  105. res.data.data.list.forEach(item => {
  106. if (!type) {
  107. this.fileList.push(item)
  108. }
  109. if (item.task) {
  110. this.timeList.push(formDate(item.task.gmtCreated))
  111. }
  112. })
  113. this.$apply()
  114. })
  115. }
  116. }
  117. }
  118. </script>