index.vue 5.3 KB

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