tasks-card.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <script setup lang="ts">
  2. import { Task } from '../../../core/models/moment'
  3. import { taskCenterBg } from '../../../core/libs/pngs'
  4. defineProps({
  5. customClass: {
  6. type: String,
  7. default: '',
  8. },
  9. items: {
  10. type: Array as PropType<Task[]>,
  11. default: () => [],
  12. },
  13. })
  14. const styles = ref({
  15. header: {
  16. width: '100%',
  17. height: '60px',
  18. background: `url(${taskCenterBg}) -9px -9px`,
  19. },
  20. content: {
  21. background: `url(${taskCenterBg}) -9px -69px no-repeat`,
  22. },
  23. main: {
  24. background: `url(${taskCenterBg}) -9px -9px`,
  25. },
  26. })
  27. </script>
  28. <template>
  29. <view class="relative w-full box-border">
  30. <view class="relative h-full mx--2.5 mb--6 mt--1 box-border">
  31. <wd-img :width="'100%'" :height="'100%'" :src="taskCenterBg" mode="widthFix"></wd-img>
  32. </view>
  33. <view class="absolute left-0 right-0 top-1 bottom-6 z-1 p-3.5">
  34. <view class="w-full h-full flex flex-col justify-between">
  35. <div class="text-start text-black text-lg font-normal font-['PingFang_SC'] leading-normal">
  36. 任务中心
  37. </div>
  38. <div class="flex-grow mt-4 overflow-auto">
  39. <template v-for="({ taskKey, taskValue, status }, i) in items" :key="i">
  40. <div class="flex items-center my-6">
  41. <div class="text-black/90 text-sm font-normal font-['PingFang_SC'] leading-normal">
  42. {{ taskKey }}
  43. </div>
  44. <div
  45. class="ml-1 text-[#dc753a] text-xs font-normal font-['PingFang_SC'] leading-normal"
  46. >
  47. +{{ taskValue }}积分
  48. </div>
  49. <div class="flex-1"></div>
  50. <wd-button type="info" plain size="small" :disabled="status">去完成</wd-button>
  51. </div>
  52. </template>
  53. </div>
  54. </view>
  55. </view>
  56. </view>
  57. <!-- <div>
  58. <div :style="styles.header">1</div>
  59. <div :style="styles.content" class="p-3.5">
  60. <template v-for="({ title, score }, i) in items" :key="i">
  61. <div class="flex items-center my-6">
  62. <div class="text-black/90 text-sm font-normal font-['PingFang_SC'] leading-normal">
  63. {{ title }}
  64. </div>
  65. <div class="ml-1 text-[#dc753a] text-xs font-normal font-['PingFang_SC'] leading-normal">
  66. +{{ score }}积分
  67. </div>
  68. <div class="flex-1"></div>
  69. <wd-button type="info" plain size="small">去完成</wd-button>
  70. </div>
  71. </template>
  72. </div>
  73. <div></div>
  74. </div> -->
  75. <!-- <div class="card" :style="styles.main">
  76. <div class="card-content">
  77. <h2>任务中心</h2>
  78. <ul>
  79. <li>每日发布圈子获取积分</li>
  80. <li>到店打卡获取积分</li>
  81. <li>到店打卡获取积分</li>
  82. <li>到店打卡获取积分</li>
  83. <li>到店打卡获取积分</li>
  84. <li>到店打卡获取积分</li>
  85. <li>到店打卡获取积分</li>
  86. <li>到店打卡获取积分</li>
  87. <li>到店打卡获取积分</li>
  88. <li>到店打卡获取积分</li>
  89. <li>到店打卡获取积分</li>
  90. <li>到店打卡获取积分</li>
  91. <li>到店打卡获取积分</li>
  92. <li>到店打卡获取积分</li>
  93. <li>到店打卡获取积分</li>
  94. </ul>
  95. </div>
  96. </div> -->
  97. </template>
  98. <style scoped>
  99. .card {
  100. box-sizing: border-box;
  101. display: flex;
  102. flex-direction: column;
  103. justify-content: flex-start;
  104. width: 100%;
  105. min-height: 200px;
  106. padding: 20px;
  107. /* background-image: url('your-image-path'); */
  108. /* 背景图片路径 */
  109. background-repeat: no-repeat;
  110. background-position: top center; /* 背景图片头部固定 */
  111. background-size: auto; /* 固定背景图片的宽度,不拉伸 */
  112. border-radius: 10px;
  113. }
  114. .card-content {
  115. flex-grow: 1;
  116. padding: 20px;
  117. background-color: rgba(255, 255, 255, 0.8); /* 半透明背景 */
  118. border-radius: 10px;
  119. }
  120. </style>