index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <view class="page_todo">
  3. <page-header></page-header>
  4. <view class="todo_content">
  5. <!-- 待办事项 -->
  6. <view class="todo_header">
  7. <text class="todo_title">待办事项({{ todoList.length }}项)</text>
  8. </view>
  9. <!-- 待办事项列表 -->
  10. <view class="todo_list">
  11. <view v-for="item in todoList" :key="item.id" class="todo_item">
  12. <view class="todo_left">
  13. <view class="todo_info">
  14. <view class="todo_title_row">
  15. <image :src="item.source === 1 ? '/static/image/todo/xiaoxi.png' : (item.source === 2 ? '/static/image/todo/daiban.png' : '/static/image/todo/shipin.png')" class="todo_icon" mode="aspectFit"></image>
  16. <text class="todo_name">{{ item.title }}</text>
  17. <uni-icons type="right" size="18" color="#999999"></uni-icons>
  18. </view>
  19. <view class="todo_meta" v-if="item.source === 1">
  20. <text class="meta_tag" >未读</text>
  21. <text class="meta_type" >{{ item.noticeType }}</text>
  22. <text class="meta_type" >{{ item.createdBy }}</text>
  23. <text class="meta_type" >{{ item.releaseTime }}</text>
  24. </view>
  25. <view class="todo_meta" v-if="item.source === 2">
  26. <text class="meta_tag" :class="getTagStyle('进行中')" >{{ '进行中' }}</text>
  27. <text class="meta_type" >{{ item.departmentName }}</text>
  28. <text class="meta_type" >{{ item.materialCategoryName }}</text>
  29. <text class="meta_type" >{{"剩余" + item.daysRemaining + "天"}}</text>
  30. </view>
  31. <view class="todo_meta" v-if="item.source === 3">
  32. <text class="meta_tag" >{{ item.taskTyp }}</text>
  33. <text class="meta_type" >{{ item.workspaceTheme }}</text>
  34. <text class="meta_type" >{{ item.contentDomain }}</text>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <no-data v-if="todoList.length === 0" centered text="暂无待办事项" />
  41. </view>
  42. <common-tabbar></common-tabbar>
  43. </view>
  44. </template>
  45. <script setup>
  46. import { ref, onMounted } from 'vue';
  47. import { onShow } from '@dcloudio/uni-app';
  48. import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue';
  49. import PageHeader from '@/components/page-header.vue';
  50. import NoData from '@/components/no-data.vue';
  51. import workspace from '@/reqApi/workspace.js';
  52. const todoList = ref([]);
  53. const getTagStyle = (status) => {
  54. if (status === '已驳回') {
  55. return 'meta_tag_red'
  56. }
  57. if (status === '进行中' || status === "已通过") {
  58. return 'meta_tag_green'
  59. }
  60. return ''
  61. }
  62. const fetchTodoList = async () => {
  63. try {
  64. const res = await workspace.getTodoList();
  65. todoList.value = []
  66. if (res && res.data) {
  67. todoList.value = res.data
  68. }
  69. } catch (error) {
  70. console.error('获取待办事项列表失败:', error);
  71. }
  72. };
  73. onShow(() => {
  74. fetchTodoList();
  75. });
  76. </script>
  77. <style lang="scss">
  78. .page_todo {
  79. height: 100vh;
  80. display: flex;
  81. flex-direction: column;
  82. background-color: #FFFFFF;
  83. padding-bottom: env(safe-area-inset-bottom);
  84. box-sizing: border-box;
  85. }
  86. .todo_content {
  87. flex: 1;
  88. display: flex;
  89. flex-direction: column;
  90. overflow: hidden;
  91. padding-top: calc(140rpx + env(safe-area-inset-top));
  92. padding-bottom: calc(160rpx + env(safe-area-inset-bottom));
  93. padding-left: 0rpx;
  94. padding-right: 0rpx;
  95. }
  96. // 待办事项标题
  97. .todo_header {
  98. display: flex;
  99. align-items: baseline;
  100. margin-bottom: 24rpx;
  101. padding:0 24rpx;
  102. .todo_title {
  103. font-weight: 500;
  104. font-size: 32rpx;
  105. color: #333333;
  106. }
  107. .todo_count {
  108. font-size: 26rpx;
  109. color: #999999;
  110. margin-left: 8rpx;
  111. }
  112. }
  113. .todo_list {
  114. flex: 1;
  115. overflow-y: auto;
  116. padding:0 24rpx;
  117. .todo_item {
  118. display: flex;
  119. align-items: center;
  120. justify-content: space-between;
  121. padding: 20rpx 16rpx;
  122. background: #F9FAFF;
  123. border-radius: 20rpx;
  124. margin-bottom: 24rpx;
  125. border: 2rpx solid #E4E7ED;
  126. &:last-child {
  127. margin-bottom: 0;
  128. }
  129. .todo_left {
  130. display: flex;
  131. flex: 1;
  132. align-items: flex-start;
  133. gap: 16rpx;
  134. }
  135. .todo_icon {
  136. flex-shrink: 0;
  137. margin-top: 4rpx;
  138. width: 32rpx;
  139. height: 32rpx;
  140. }
  141. .todo_info {
  142. flex: 1;
  143. overflow: hidden;
  144. }
  145. .todo_title_row {
  146. display: flex;
  147. align-items: center;
  148. gap: 16rpx;
  149. margin-bottom: 16rpx;
  150. .todo_name {
  151. font-size: 28rpx;
  152. color: #333333;
  153. font-weight: 500;
  154. flex: 1;
  155. width: 0;
  156. overflow: hidden;
  157. text-overflow: ellipsis;
  158. white-space: nowrap;
  159. }
  160. .todo_tag {
  161. font-size: 24rpx;
  162. padding: 6rpx 12rpx;
  163. border-radius: 4rpx;
  164. flex-shrink: 0;
  165. &.tag-red {
  166. background-color: rgba(245, 108, 108, 0.1);
  167. color: #F56C6C;
  168. }
  169. }
  170. }
  171. .todo_meta {
  172. display: flex;
  173. align-items: center;
  174. flex-wrap: wrap;
  175. gap: 16rpx;
  176. .meta_tag {
  177. font-size: 22rpx;
  178. padding: 8rpx 12rpx;
  179. background-color: rgba(74, 108, 247, 0.1);
  180. color: #4A6CF7;
  181. border-radius: 4rpx;
  182. }
  183. .meta_tag_red {
  184. background-color: rgba(245, 108, 108, 0.1);
  185. color: #F56C6C;
  186. }
  187. .meta_tag_green {
  188. background-color: rgba(43, 198, 68, 0.1);
  189. color: #2BC644;
  190. }
  191. .meta_type {
  192. font-size: 24rpx;
  193. color: #999999;
  194. }
  195. .meta_time {
  196. font-size: 24rpx;
  197. color: #999999;
  198. }
  199. }
  200. }
  201. }
  202. </style>