index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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. <view v-if="todoList.length === 0" class="schedule_empty">
  41. <image src="@/static/image/bg/no_data.png" class="empty_image" mode="aspectFit"></image>
  42. <text class="empty_text">暂无待办事项</text>
  43. </view>
  44. </view>
  45. <common-tabbar></common-tabbar>
  46. </view>
  47. </template>
  48. <script setup>
  49. import { ref, onMounted } from 'vue';
  50. import { onShow } from '@dcloudio/uni-app';
  51. import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue';
  52. import PageHeader from '@/components/page-header.vue';
  53. import workspace from '@/reqApi/workspace.js';
  54. const todoList = ref([]);
  55. const getTagStyle = (status) => {
  56. if (status === '已驳回') {
  57. return 'meta_tag_red'
  58. }
  59. if (status === '进行中' || status === "已通过") {
  60. return 'meta_tag_green'
  61. }
  62. return ''
  63. }
  64. const fetchTodoList = async () => {
  65. try {
  66. const res = await workspace.getTodoList();
  67. todoList.value = []
  68. if (res && res.data) {
  69. todoList.value = res.data
  70. }
  71. } catch (error) {
  72. console.error('获取待办事项列表失败:', error);
  73. }
  74. };
  75. onShow(() => {
  76. fetchTodoList();
  77. });
  78. </script>
  79. <style lang="scss">
  80. .page_todo {
  81. height: 100vh;
  82. display: flex;
  83. flex-direction: column;
  84. background-color: #FFFFFF;
  85. }
  86. .todo_content {
  87. flex: 1;
  88. display: flex;
  89. flex-direction: column;
  90. overflow: hidden;
  91. padding: 140rpx 0rpx 160rpx 0rpx;
  92. }
  93. // 待办事项标题
  94. .todo_header {
  95. display: flex;
  96. align-items: baseline;
  97. margin-bottom: 24rpx;
  98. padding:0 24rpx;
  99. .todo_title {
  100. font-weight: 500;
  101. font-size: 32rpx;
  102. color: #333333;
  103. }
  104. .todo_count {
  105. font-size: 26rpx;
  106. color: #999999;
  107. margin-left: 8rpx;
  108. }
  109. }
  110. .todo_list {
  111. flex: 1;
  112. overflow-y: auto;
  113. padding:0 24rpx;
  114. .todo_item {
  115. display: flex;
  116. align-items: center;
  117. justify-content: space-between;
  118. padding: 20rpx 16rpx;
  119. background: #F9FAFF;
  120. border-radius: 20rpx;
  121. margin-bottom: 24rpx;
  122. border: 2rpx solid #E4E7ED;
  123. &:last-child {
  124. margin-bottom: 0;
  125. }
  126. .todo_left {
  127. display: flex;
  128. flex: 1;
  129. align-items: flex-start;
  130. gap: 16rpx;
  131. }
  132. .todo_icon {
  133. flex-shrink: 0;
  134. margin-top: 4rpx;
  135. width: 32rpx;
  136. height: 32rpx;
  137. }
  138. .todo_info {
  139. flex: 1;
  140. overflow: hidden;
  141. }
  142. .todo_title_row {
  143. display: flex;
  144. align-items: center;
  145. gap: 16rpx;
  146. margin-bottom: 16rpx;
  147. .todo_name {
  148. font-size: 28rpx;
  149. color: #333333;
  150. font-weight: 500;
  151. flex: 1;
  152. width: 0;
  153. overflow: hidden;
  154. text-overflow: ellipsis;
  155. white-space: nowrap;
  156. }
  157. .todo_tag {
  158. font-size: 24rpx;
  159. padding: 6rpx 12rpx;
  160. border-radius: 4rpx;
  161. flex-shrink: 0;
  162. &.tag-red {
  163. background-color: rgba(245, 108, 108, 0.1);
  164. color: #F56C6C;
  165. }
  166. }
  167. }
  168. .todo_meta {
  169. display: flex;
  170. align-items: center;
  171. flex-wrap: wrap;
  172. gap: 16rpx;
  173. .meta_tag {
  174. font-size: 22rpx;
  175. padding: 8rpx 12rpx;
  176. background-color: rgba(74, 108, 247, 0.1);
  177. color: #4A6CF7;
  178. border-radius: 4rpx;
  179. }
  180. .meta_tag_red {
  181. background-color: rgba(245, 108, 108, 0.1);
  182. color: #F56C6C;
  183. }
  184. .meta_tag_green {
  185. background-color: rgba(43, 198, 68, 0.1);
  186. color: #2BC644;
  187. }
  188. .meta_type {
  189. font-size: 24rpx;
  190. color: #999999;
  191. }
  192. .meta_time {
  193. font-size: 24rpx;
  194. color: #999999;
  195. }
  196. }
  197. }
  198. }
  199. .schedule_empty {
  200. display: flex;
  201. flex-direction: column;
  202. align-items: center;
  203. font-size: 28rpx;
  204. color: #999999;
  205. position: relative;
  206. .empty_image {
  207. width: 400rpx;
  208. height: 400rpx;
  209. }
  210. .empty_text {
  211. position: absolute;
  212. bottom: 15%;
  213. left: 50%;
  214. transform: translate(-50%, -50%);
  215. }
  216. }
  217. </style>