index.vue 5.4 KB

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