taskDetail.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. <template>
  2. <view class="page_body">
  3. <!-- 头部 -->
  4. <nav-bar height="96" title="任务详情" :onlyTitle="true" :showHeaderborder="true" @GoBack="GoBack"></nav-bar>
  5. <view class="page_content padding_btm">
  6. <view class="task_title">{{state?.details?.taskName}}</view>
  7. <view class="task_class_collect">
  8. <text class="class_item">{{state?.details?.departmentName}}</text>
  9. <text class="class_item">{{state?.details?.materialCategoryName}}</text>
  10. <text class="class_item">{{state?.details?.createdBy}}</text>
  11. </view>
  12. <view class="task_time">
  13. <view class="time_day">
  14. <text class="time_item">{{state?.details?.startTime}}</text>
  15. <text class="time_item">至</text>
  16. <text class="time_item">{{state?.details?.endTime}}</text>
  17. <text class="time_item" v-if="state?.details?.taskStatus === 1 && remainingDays(state?.details?.endTime) > 0">剩余{{remainingDays(state?.details?.endTime)}}天</text>
  18. </view>
  19. <view :class="['task_status', statusClassMap[state?.details?.taskStatus]]">
  20. {{taskStatusMap[state?.details?.taskStatus]}}
  21. </view>
  22. </view>
  23. <view :class="['task_desc',{'over':!state.isExpand}]">
  24. 采集要求:{{state?.details?.collectionRequire}}
  25. </view>
  26. <view class="task_desc_all">
  27. 采集要求:{{state?.details?.collectionRequire}}
  28. </view>
  29. <view class="expand_btn" v-if="state.showExpandBtn" @click="toggleExpand"><text
  30. class="expand_text">{{!state.isExpand?'展开':'收起'}}</text><uni-icons class="expand_icon"
  31. :type="!state.isExpand?'down':'up'"></uni-icons></view>
  32. </view>
  33. <!-- 间隔 -->
  34. <view class="row_gap"></view>
  35. <view class="page_content">
  36. <view class="total">
  37. <view class="status_tag" :class="state.auditStatus">
  38. <text>{{ tabStatusClassMap[state.auditStatus] }}:{{ state?.details?.taskTargetVos?.length || 0 }}</text>
  39. </view>
  40. </view>
  41. <view class="list_item" v-for="item in (state?.details?.taskTargetVos || [])" :Key="item.id">
  42. <view class="item_name_file">
  43. <view class="name_file">
  44. <text class="name">{{item.targetName}}</text>
  45. <text class="file_num">文件数量:{{item?.fileNum || 0}}</text>
  46. </view>
  47. <view class="btn" @click="HandleDetail(item.id)">{{state.auditStatus == 'notSubmitList'?'立即提交':'查看'}}</view>
  48. </view>
  49. <view class="item_info">
  50. <template v-for="text in ['departmentName','departmentGroupName','subjectName','gradeName','classTypeName','className','updateTime']">
  51. <text class="info_text" v-if="item?.[text]" :key="text">{{item?.[text]}}</text>
  52. </template>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </template>
  58. <script setup>
  59. import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue';
  60. import navBar from '@/components/navBar.vue';
  61. import { remainingDays } from '@/common/common.js';
  62. import {onLoad} from '@dcloudio/uni-app';
  63. import {
  64. reactive,
  65. ref,
  66. nextTick,
  67. getCurrentInstance,
  68. onMounted,
  69. onUnmounted
  70. } from 'vue';
  71. const state = reactive({
  72. taskId: '', //任务id
  73. auditStatus:'',//审核状态
  74. showExpandBtn: false, //是否显示展开按钮
  75. isExpand: false, //是否展开
  76. details: {}, //详情信息
  77. });
  78. const statusClassMap = {
  79. 1: 'status_published',
  80. 2: 'status_closed'
  81. };
  82. const taskStatusMap = {
  83. 1: '进行中',
  84. 2: '已结束'
  85. };
  86. const tabStatusClassMap = {
  87. 'notSubmitList':'待提交',// 待提交
  88. 'notReviewList':'审核中',// 审核中
  89. 'reviewReasonList':'已驳回',// 已驳回
  90. 'reviewList':'已提交'// 已提交
  91. };
  92. onLoad((option) => {
  93. state.taskId = option.taskId;
  94. state.auditStatus = option.auditStatus;
  95. })
  96. onMounted(() => {
  97. state.details = uni.getStorageSync('submitMaterialDetailInfo') || {};
  98. checkTextOverflow();
  99. });
  100. const checkTextOverflow = () => {
  101. nextTick(() => {
  102. const instance = getCurrentInstance();
  103. // 安全保护
  104. if (!instance || !instance.proxy) {
  105. // 备用方案:全局查询(要求元素 class 唯一)
  106. let taskDescAllHeight = 0,
  107. taskDescHeight = 0;
  108. const query = uni.createSelectorQuery();
  109. query.select('.task_desc_all').boundingClientRect((rect) => {
  110. taskDescAllHeight = rect?.height || 0;
  111. });
  112. query.select('.task_desc').boundingClientRect((rect) => {
  113. taskDescHeight = rect?.height || 0;
  114. });
  115. query.select('.page_content_data').boundingClientRect((rect) => {
  116. state.searchBoxTop = rect?.top || 0;
  117. });
  118. query.exec(() => {
  119. // 所有回调执行完毕后触发
  120. state.showExpandBtn = taskDescAllHeight > taskDescHeight + 1;
  121. });
  122. return;
  123. }
  124. let taskDescAllHeight = 0,
  125. taskDescHeight = 0;
  126. const query = uni.createSelectorQuery().in(instance.proxy);
  127. query.select('.task_desc_all').boundingClientRect((rect) => {
  128. taskDescAllHeight = rect?.height || 0;
  129. });
  130. query.select('.task_desc').boundingClientRect((rect) => {
  131. taskDescHeight = rect?.height || 0;
  132. });
  133. query.select('.page_content_data').boundingClientRect((rect) => {
  134. state.searchBoxTop = rect?.top || 0;
  135. });
  136. query.exec(() => {
  137. // 所有回调执行完毕后触发
  138. state.showExpandBtn = taskDescAllHeight > taskDescHeight + 1;
  139. });
  140. });
  141. }
  142. // 展开收起切换
  143. const toggleExpand = () => {
  144. state.isExpand = !state.isExpand;
  145. }
  146. //提交材料
  147. const HandleDetail = (targetId) => {
  148. uni.navigateTo({
  149. url: `/pages/materialCollection/submitMaterial/submitDetail?taskId=${state.taskId}&targetId=${targetId}`
  150. });
  151. }
  152. //返回
  153. const GoBack = () => {
  154. uni.navigateBack({
  155. delta: 1
  156. });
  157. }
  158. </script>
  159. <style scoped lang="scss">
  160. .page_content {
  161. &.padding_btm {
  162. padding-bottom: 24rpx;
  163. .task_title {
  164. font-weight: 500;
  165. font-size: 32rpx;
  166. color: #333333;
  167. margin-top: 24rpx;
  168. }
  169. .task_class_collect {
  170. display: inline-flex;
  171. align-items: center;
  172. flex-wrap: wrap;
  173. width: 100%;
  174. margin-top: 16rpx;
  175. gap: 16rpx;
  176. .class_item {
  177. font-weight: 400;
  178. font-size: 24rpx;
  179. color: #999999;
  180. }
  181. }
  182. .task_time {
  183. display: flex;
  184. align-items: flex-start;
  185. width: 100%;
  186. margin-top: 16rpx;
  187. .time_day {
  188. display: inline-flex;
  189. align-items: center;
  190. flex-wrap: wrap;
  191. flex: 1;
  192. .time_item {
  193. font-weight: 400;
  194. font-size: 24rpx;
  195. line-height: 48rpx;
  196. color: #999999;
  197. &:nth-child(2) {
  198. margin: 0 8rpx;
  199. }
  200. &:nth-child(4) {
  201. color: #2E64FA;
  202. margin-left: 16rpx;
  203. }
  204. }
  205. }
  206. .task_status {
  207. display: inline-flex;
  208. align-items: center;
  209. height: 48rpx;
  210. padding: 0 12rpx;
  211. border-radius: 8rpx;
  212. font-weight: 400;
  213. font-size: 24rpx;
  214. &.status_pending {
  215. background: rgba(46, 100, 250, 0.1);
  216. color: #2E64FA;
  217. }
  218. &.status_published {
  219. background: rgba(82, 196, 26, 0.1);
  220. color: #2BC644;
  221. }
  222. &.status_closed {
  223. background: #6666661a;
  224. color: #666666;
  225. }
  226. }
  227. }
  228. .task_desc {
  229. margin-top: 24rpx;
  230. display: flex;
  231. width: 100%;
  232. padding-top: 24rpx;
  233. border-top: 2rpx solid #F3F3F3;
  234. font-weight: 400;
  235. font-size: 28rpx;
  236. color: #999999;
  237. line-height: 44rpx;
  238. box-sizing: border-box;
  239. position: relative;
  240. &.over {
  241. max-height: 168rpx;
  242. overflow: hidden;
  243. transition: all 0.25s;
  244. display: -webkit-box;
  245. -webkit-line-clamp: 3;
  246. -webkit-box-orient: vertical;
  247. }
  248. }
  249. .task_desc_all {
  250. display: flex;
  251. width: 100%;
  252. padding-top: 24rpx;
  253. border-top: 2rpx solid #F3F3F3;
  254. font-weight: 400;
  255. font-size: 28rpx;
  256. color: #999999;
  257. line-height: 44rpx;
  258. box-sizing: border-box;
  259. position: absolute;
  260. left: -9999px;
  261. top: 0;
  262. visibility: hidden; // 不可见但占据空间(不影响布局,因为absolute)
  263. pointer-events: none;
  264. }
  265. .expand_btn {
  266. width: 100%;
  267. height: 40rpx;
  268. background-color: #FFFFFF;
  269. display: flex;
  270. justify-content: flex-end;
  271. align-items: center;
  272. .expand_text {
  273. font-weight: 400;
  274. font-size: 28rpx;
  275. color: #2E64FA;
  276. margin-right: 8rpx;
  277. }
  278. .expand_icon {
  279. font-size: 32rpx !important;
  280. color: #2E64FA !important;
  281. }
  282. }
  283. }
  284. }
  285. .row_gap {
  286. background-color: #F8F9FD;
  287. width: 100%;
  288. height: 24rpx;
  289. }
  290. .total {
  291. width: 100%;
  292. display: flex;
  293. padding: 24rpx 0;
  294. border-bottom: 2rpx solid #F3F3F3;
  295. .status_tag{
  296. font-size: 24rpx;
  297. text-align: center;
  298. padding: 8rpx 12rpx;
  299. font-weight: 400;
  300. border-radius: 8rpx;
  301. flex-shrink: 0;
  302. &.notSubmitList {
  303. background: rgba(46,100,250,0.1);
  304. color: #2E64FA;
  305. }
  306. &.notReviewList {
  307. background: rgba(251,159,52,0.1);
  308. color: #FB9F34;
  309. }
  310. &.reviewReasonList {
  311. background: rgba(245,108,108,0.1);
  312. color: #F56C6C;
  313. }
  314. &.reviewList {
  315. background: rgba(43,198,68,0.1);
  316. color: #2BC644;
  317. }
  318. }
  319. }
  320. .list_item {
  321. display: flex;
  322. flex-direction: column;
  323. width: 100%;
  324. padding: 24rpx 0;
  325. border-bottom: 2rpx solid #F3F3F3;
  326. .item_name_file{
  327. display: flex;
  328. width: 100%;
  329. align-items: center;
  330. gap: 20rpx;
  331. .name_file{
  332. flex:1;
  333. gap: 20rpx;
  334. display: flex;
  335. align-items: center;
  336. .name{
  337. font-weight: 500;
  338. font-size: 32rpx;
  339. color: #333333;
  340. }
  341. .file_num{
  342. font-weight: 400;
  343. font-size: 24rpx;
  344. color: #2E64FA;
  345. }
  346. }
  347. .btn{
  348. padding: 12rpx 24rpx;
  349. border-radius: 8rpx;
  350. border: 2rpx solid #2E64FA;
  351. font-weight: 400;
  352. font-size: 28rpx;
  353. color: #2E64FA;
  354. display: inline-flex;
  355. align-items: center;
  356. justify-content: center;
  357. }
  358. }
  359. .item_info{
  360. margin-top: 16rpx;
  361. display: flex;
  362. gap: 16rpx;
  363. align-items: center;
  364. flex-wrap: wrap;
  365. .info_text{
  366. font-weight: 400;
  367. font-size: 24rpx;
  368. color: #999999;
  369. flex-shrink: 0;
  370. }
  371. }
  372. }
  373. </style>