index.vue 5.3 KB

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