TaskDialog.vue 4.4 KB

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