TaskDetailSummary.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <view class="task-detail-summary">
  3. <text class="task-detail-summary__score">+{{ scoreText }} 积分</text>
  4. <view class="task-detail-summary__title">{{ taskTitle }}</view>
  5. <view class="task-detail-summary__number">任务编号:{{ taskNumber }}</view>
  6. <view class="task-detail-summary__time">提交时间:{{ submitTime }}</view>
  7. </view>
  8. </template>
  9. <script setup lang="ts">
  10. import { computed } from 'vue'
  11. import type { TaskDetailResponse } from '@/services/modules/task/taskDetail/type'
  12. import { normalizeText } from '../utils'
  13. const props = defineProps<{
  14. taskDetail: TaskDetailResponse
  15. }>()
  16. const taskTitle = computed(() => {
  17. return normalizeText(
  18. props.taskDetail.taskInfo.taskTypeId ??
  19. props.taskDetail.taskInfo.taskTypeName ??
  20. props.taskDetail.taskType,
  21. '任务详情'
  22. )
  23. })
  24. const taskNumber = computed(() => {
  25. return normalizeText(props.taskDetail.taskInfo.taskNumber ?? props.taskDetail.taskInfo.id)
  26. })
  27. const submitTime = computed(() => normalizeText(props.taskDetail.taskInfo.createTime))
  28. const scoreText = computed(() => {
  29. const score =
  30. 'score' in props.taskDetail ? props.taskDetail.score : props.taskDetail.taskInfo.score
  31. return normalizeText(score, '0')
  32. })
  33. </script>
  34. <style lang="scss" scoped>
  35. .task-detail-summary {
  36. position: relative;
  37. padding: 32rpx;
  38. color: #fff;
  39. background: linear-gradient(135deg, #42b6f5 0%, #267ae8 100%);
  40. border-radius: 24rpx;
  41. box-shadow: 0 14rpx 34rpx rgba(47, 140, 247, 0.22);
  42. }
  43. .task-detail-summary__score {
  44. position: absolute;
  45. top: 32rpx;
  46. right: 32rpx;
  47. color: #fff4bd;
  48. font-size: 26rpx;
  49. font-weight: 650;
  50. line-height: 42rpx;
  51. }
  52. .task-detail-summary__title {
  53. min-height: 42rpx;
  54. padding-right: 190rpx;
  55. font-size: 38rpx;
  56. font-weight: 700;
  57. line-height: 52rpx;
  58. word-break: break-all;
  59. }
  60. .task-detail-summary__number,
  61. .task-detail-summary__time {
  62. margin-top: 10rpx;
  63. font-size: 23rpx;
  64. line-height: 34rpx;
  65. opacity: 0.78;
  66. word-break: break-all;
  67. }
  68. .task-detail-summary__time {
  69. margin-top: 4rpx;
  70. }
  71. </style>