task-list.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <template>
  2. <view class="task-list-container">
  3. <view class="task-list-header">
  4. <text class="task-list-title">做任务赚积分</text>
  5. </view>
  6. <view class="task-list">
  7. <view
  8. v-for="(task, index) in tasks"
  9. :key="index"
  10. class="task-item"
  11. @click="handleTask(task, index)"
  12. >
  13. <view class="task-item-left">
  14. <view class="task-icon" :class="task.iconClass">
  15. <ImageItem src="/static/points/task_order.png"/>
  16. <!-- <ImageItem src="/static/points/task_shop.png"/>-->
  17. <!-- <ImageItem src="/static/points/task_trend.png"/>-->
  18. <!-- <ImageItem src="/static/points/task_wx.png"/>-->
  19. <!-- <ImageItem src="/static/points/task_account.png"/>-->
  20. </view>
  21. <view class="task-info">
  22. <view class="task-name">{{ task.name }}</view>
  23. <view class="task-reward">
  24. <ImageItem src="/static/points/point.png"/>
  25. <text>+{{ task.reward }}</text>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="task-item-right">
  30. <button class="task-btn" @click.stop="handleTask(task, index)">
  31. {{ task.status === 'completed' ? '已完成' : '去完成' }}
  32. </button>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="more-tasks" @click="handleMoreTasks">
  37. 赚更多积分 >
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. import ImageItem from "@/components/swiper/components/image.vue";
  43. export default {
  44. components: {ImageItem},
  45. data() {
  46. return {
  47. tasks: [
  48. {
  49. id: 1,
  50. name: '完成一次订单',
  51. reward: 20,
  52. status: 'pending',
  53. icon: 'order',
  54. iconClass: 'order-icon'
  55. },
  56. {
  57. id: 2,
  58. name: '浏览动态',
  59. reward: 20,
  60. status: 'pending',
  61. icon: 'browse',
  62. iconClass: 'browse-icon'
  63. }
  64. ]
  65. }
  66. },
  67. methods: {
  68. handleTask(task, index) {
  69. if (task.status !== 'completed') {
  70. this.$emit('task', task)
  71. }
  72. },
  73. handleMoreTasks() {
  74. this.$emit('moreTasks')
  75. }
  76. }
  77. }
  78. </script>
  79. <style lang="scss" scoped>
  80. .task-list-container {
  81. background-color: #fff;
  82. border-radius: 20rpx;
  83. padding: 24rpx;
  84. box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
  85. .task-list-header {
  86. margin-bottom: 26rpx;
  87. .task-list-title {
  88. font-size: 32rpx;
  89. font-weight: 600;
  90. color: #333;
  91. }
  92. }
  93. .task-list {
  94. .task-item {
  95. display: flex;
  96. justify-content: space-between;
  97. align-items: center;
  98. margin-bottom: 32rpx;
  99. .task-item-left {
  100. display: flex;
  101. align-items: center;
  102. .task-icon {
  103. width: 72rpx;
  104. height: 72rpx;
  105. margin-right: 18rpx;
  106. image{
  107. width: 72rpx;
  108. height: 72rpx;
  109. }
  110. }
  111. .task-info {
  112. .task-name {
  113. font-family: PingFang SC, PingFang SC;
  114. font-weight: 400;
  115. font-size: 28rpx;
  116. color: #333333;
  117. margin-bottom: 12rpx;
  118. }
  119. .task-reward {
  120. display: inline-flex;
  121. height: 32rpx;
  122. background: #FBF2E1;
  123. border-radius: 22rpx;
  124. padding-right: 12rpx;
  125. image{
  126. width: 32rpx;
  127. height: 32rpx;
  128. margin-right: 4rpx;
  129. }
  130. text{
  131. font-family: PingFang SC, PingFang SC;
  132. font-weight: 500;
  133. font-size: 24rpx;
  134. color: #FF9F00;
  135. line-height: 32rpx;
  136. }
  137. }
  138. }
  139. }
  140. .task-item-right {
  141. .task-btn {
  142. height: 48rpx;
  143. background: #03C1B8;
  144. border-radius: 98rpx;
  145. font-family: PingFang SC, PingFang SC;
  146. font-weight: 500;
  147. font-size: 26rpx;
  148. color: #FFFFFF;
  149. line-height: 48rpx;
  150. }
  151. }
  152. }
  153. }
  154. .more-tasks {
  155. text-align: center;
  156. font-weight: 500;
  157. font-size: 28rpx;
  158. color: #999999;
  159. }
  160. }
  161. </style>