TaskDialog.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <custom-dialog :visible="visible" title="" content-width="720rpx" @close="onClose">
  3. <view class="task-board">
  4. <view class="board-title">
  5. <view class="title-dot"></view>
  6. <text>任务看板</text>
  7. <view class="title-dot"></view>
  8. </view>
  9. <view v-for="(task, index) in tasks" :key="index" class="task-card">
  10. <view class="task-header">
  11. <text class="task-label">任务目标:</text>
  12. <text class="task-content">{{task.title}}</text>
  13. </view>
  14. <view class="task-desc">
  15. <text class="task-label">任务描述:</text>
  16. <text class="task-content">{{task.description}}</text>
  17. </view>
  18. <view class="task-rewards">
  19. <text class="task-label">任务奖励:</text>
  20. <view class="reward-list">
  21. <view v-for="(reward, rIndex) in task.rewards" :key="rIndex" class="reward-item">
  22. <view class="reward-box">
  23. <image :src="reward.icon" class="reward-icon"></image>
  24. </view>
  25. <text class="reward-text">{{reward.text}}</text>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="task-footer">
  30. <text class="task-date">{{task.date}}</text>
  31. <button
  32. :class="['task-button', task.status === 'completed' ? 'completed' : 'available']"
  33. @click="handleTaskAction(task)"
  34. >
  35. {{task.status === 'completed' ? '完成任务' : '领取任务'}}
  36. </button>
  37. </view>
  38. <view class="card-divider"></view>
  39. </view>
  40. </view>
  41. </custom-dialog>
  42. </template>
  43. <script>
  44. import CustomDialog from '@/components/CustomDialog/CustomDialog.vue'
  45. export default {
  46. name: 'TaskDialog',
  47. components: {
  48. CustomDialog
  49. },
  50. props: {
  51. visible: {
  52. type: Boolean,
  53. default: false
  54. }
  55. },
  56. data() {
  57. return {
  58. tasks: [
  59. {
  60. title: '负债累累的冒险家',
  61. description: '终极目标就是偿还移民的债务,做一个无债一身轻的玩家',
  62. rewards: [
  63. {
  64. icon: '/static/icons/coin.png',
  65. text: '金币×3000'
  66. },
  67. {
  68. icon: '/static/icons/exp.png',
  69. text: '经验×3000'
  70. },
  71. {
  72. icon: '/static/icons/blueprint.png',
  73. text: '升级房屋图纸×1'
  74. }
  75. ],
  76. date: '2024/04/08',
  77. status: 'completed'
  78. },
  79. {
  80. title: '负债累累的冒险家',
  81. description: '终极目标就是偿还移民的债务,做一个无债一身轻的玩家',
  82. rewards: [
  83. {
  84. icon: '/static/icons/coin.png',
  85. text: '金币×3000'
  86. },
  87. {
  88. icon: '/static/icons/exp.png',
  89. text: '经验×3000'
  90. },
  91. {
  92. icon: '/static/icons/blueprint.png',
  93. text: '升级房屋图纸×1'
  94. }
  95. ],
  96. date: '2024/04/08',
  97. status: 'available'
  98. }
  99. ]
  100. }
  101. },
  102. methods: {
  103. onClose() {
  104. this.$emit('close')
  105. },
  106. handleTaskAction(task) {
  107. if (task.status === 'completed') {
  108. // 处理完成任务的逻辑
  109. uni.showToast({
  110. title: '任务已完成!',
  111. icon: 'success'
  112. })
  113. } else {
  114. // 处理领取任务的逻辑
  115. uni.showToast({
  116. title: '已领取任务',
  117. icon: 'success'
  118. })
  119. }
  120. }
  121. }
  122. }
  123. </script>
  124. <style lang="scss">
  125. @import './TaskDialog.scss';
  126. </style>