| <template> | 
|   <div class="my-collect-task"> | 
|     <div class="my-collect-task-title">收藏任务列表</div> | 
|     <div class="my-collect-task-btn" @click="clearExpiredTask">清空已失效任务</div> | 
|   </div> | 
|   <InfiniteLoading | 
|     scrollViewClassName="common-infinite-scroll-list home-list" | 
|     v-bind="infiniteLoadingProps" | 
|   > | 
|     <template #renderItem="{ item }"> | 
|       <TaskCard | 
|         :id="item.id" | 
|         :name="item.name" | 
|         :address-name="item.addressName" | 
|         :begin-time="item.beginTime" | 
|         :end-time="item.endTime" | 
|         :gender-limit="item.genderLimit" | 
|         :service-fee="item.serviceFee" | 
|         :billing-method="item.billingMethod" | 
|         :settlement-cycle="item.settlementCycle" | 
|         :benefits="item.benefits" | 
|         :show-actions="true" | 
|         :release-status="item.releaseStatus" | 
|         :hireStatus="item.hireStatus" | 
|         @apply="goTaskDetail" | 
|       > | 
|       </TaskCard> | 
|     </template> | 
|   </InfiniteLoading> | 
| </template> | 
|   | 
| <script setup lang="ts"> | 
| import { TaskCard } from '@12333/components'; | 
| import * as taskServices from '@12333/services/apiV2/task'; | 
| import * as taskUserServices from '@12333/services/apiV2/taskUser'; | 
| import { useInfiniteLoading, useTaskList } from '@12333/hooks'; | 
| import Taro from '@tarojs/taro'; | 
| import { Message } from '@12333/utils'; | 
|   | 
| defineOptions({ | 
|   name: 'InnerPage', | 
| }); | 
|   | 
| const { infiniteLoadingProps, invalidateQueries } = useInfiniteLoading( | 
|   ({ pageParam }) => { | 
|     let params: API.GetTaskInfosQuery = { | 
|       pageModel: { | 
|         rows: 20, | 
|         page: pageParam, | 
|       }, | 
|       isCollected: true, | 
|     }; | 
|   | 
|     return taskServices.getTaskInfos(params, { | 
|       showLoading: false, | 
|     }); | 
|   }, | 
|   { | 
|     queryKey: ['taskServices/getTaskInfos'], | 
|   } | 
| ); | 
|   | 
| function goTaskDetail(id: string) { | 
|   Taro.navigateTo({ | 
|     url: `${RouterPath.taskDetail}?id=${id}&from=apply`, | 
|   }); | 
| } | 
|   | 
| async function clearExpiredTask() { | 
|   try { | 
|     await Message.confirm({ | 
|       message: '确定要清空已失效任务吗?', | 
|     }); | 
|     let res = await taskUserServices.clearTaskCollect({}); | 
|     if (res) { | 
|       Message.success('清空成功'); | 
|       invalidateQueries(); | 
|     } | 
|   } catch (error) {} | 
| } | 
| </script> | 
|   | 
| <style lang="scss"> | 
| @import '@/styles/common.scss'; | 
|   | 
| .mineCollectTask-page-wrapper { | 
|   .my-collect-task { | 
|     display: flex; | 
|     align-items: center; | 
|     justify-content: space-between; | 
|     padding: 30px 40px; | 
|   | 
|     .my-collect-task-title { | 
|       font-size: 28px; | 
|       line-height: 40px; | 
|       color: boleGetCssVar('text-color', 'primary'); | 
|     } | 
|   | 
|     .my-collect-task-btn { | 
|       font-size: 24px; | 
|       line-height: 34px; | 
|       color: boleGetCssVar('text-color', 'regular'); | 
|     } | 
|   } | 
| } | 
| </style> |