myTask.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <view class="my-task-container">
  3. <!-- 顶部导航栏 -->
  4. <view class="nav-header">
  5. <view class="nav-left" @click="goBack">
  6. <u-icon name="arrow-left" size="20" color="#333"></u-icon>
  7. </view>
  8. <text class="nav-title">我的任务</text>
  9. <view class="nav-right"></view>
  10. </view>
  11. <!-- 选项卡区域 -->
  12. <view class="tabs-wrap">
  13. <u-tabs
  14. :list="tabList"
  15. :current="currentTab"
  16. @change="tabChange"
  17. lineWidth="40rpx"
  18. lineHeight="6rpx"
  19. lineColor="#FF5A1F"
  20. :inactiveStyle="{
  21. fontSize: '30rpx',
  22. color: '#999',
  23. lineHeight: '80rpx',
  24. }"
  25. :activeStyle="{
  26. fontWeight: 600,
  27. fontSize: '32rpx',
  28. color: '#333',
  29. lineHeight: '80rpx',
  30. }"
  31. itemStyle="flex: 1; height: 88rpx;"
  32. :scrollable="false"
  33. ></u-tabs>
  34. </view>
  35. <!-- 任务列表区域 -->
  36. <scroll-view scroll-y class="task-list-scroll" @scrolltolower="loadMore">
  37. <view class="task-list">
  38. <!-- 任务项 1 -->
  39. <view class="task-item">
  40. <image class="task-img" src="@/static/image/points/icon_cash_task.png" mode="aspectFill"></image>
  41. <view class="task-info">
  42. <view class="task-title">新人必做任务易上手</view>
  43. <view class="task-time">03-12 15:38前提交</view>
  44. <view class="task-bottom">
  45. <view class="status-badge passed">已通过</view>
  46. <view class="task-reward-wrap">
  47. <text class="task-reward">+2.35</text>
  48. <text class="task-reward-unit">元</text>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <!-- 任务项 2 -->
  54. <view class="task-item">
  55. <image class="task-img" src="@/static/image/points/icon_cash_task.png" mode="aspectFill"></image>
  56. <view class="task-info">
  57. <view class="task-title">新人必做任务易上手</view>
  58. <view class="task-time">03-12 15:38前提交</view>
  59. <view class="task-bottom">
  60. <view class="status-badge passed">已通过</view>
  61. <view class="task-reward-wrap">
  62. <text class="task-reward">+2.35</text>
  63. <text class="task-reward-unit">元</text>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. <!-- 任务项 3 -->
  69. <view class="task-item">
  70. <image class="task-img" src="@/static/image/points/icon_cash_task.png" mode="aspectFill"></image>
  71. <view class="task-info">
  72. <view class="task-title">新人必做任务易上手</view>
  73. <view class="task-time">03-12 15:38前提交</view>
  74. <view class="task-bottom">
  75. <view class="status-badge passed">已通过</view>
  76. <view class="task-reward-wrap">
  77. <text class="task-reward">+2.35</text>
  78. <text class="task-reward-unit">元</text>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. <!-- 底部提示 -->
  84. <view class="loading-more">没有更多了</view>
  85. </view>
  86. </scroll-view>
  87. </view>
  88. </template>
  89. <script>
  90. export default {
  91. data() {
  92. return {
  93. currentTab: 1, // 默认选中"已通过"
  94. tabList: [
  95. { name: '进行中' },
  96. { name: '已通过' },
  97. { name: '未通过' }
  98. ]
  99. };
  100. },
  101. methods: {
  102. goBack() {
  103. uni.navigateBack();
  104. },
  105. tabChange(item) {
  106. this.currentTab = item.index;
  107. // TODO: 切换标签时重新加载对应状态的数据
  108. },
  109. loadMore() {
  110. console.log('触底加载更多数据...');
  111. // TODO: 实现上拉加载逻辑
  112. }
  113. }
  114. };
  115. </script>
  116. <style lang="scss" scoped>
  117. .my-task-container {
  118. height: 100vh;
  119. background-color: #F7F8FA; /* 背景色偏淡蓝 */
  120. display: flex;
  121. flex-direction: column;
  122. }
  123. /* 顶部导航栏固定 */
  124. .nav-header {
  125. display: flex;
  126. justify-content: space-between;
  127. align-items: center;
  128. padding: 80rpx 30rpx 20rpx; /* 适配状态栏高度 */
  129. background-color: transparent; /* 背景透明融入全局 */
  130. flex-shrink: 0;
  131. background-color: #fff;
  132. }
  133. .nav-left, .nav-right {
  134. width: 60rpx;
  135. display: flex;
  136. align-items: center;
  137. }
  138. .nav-title {
  139. font-size: 36rpx;
  140. font-weight: bold;
  141. color: #333;
  142. flex: 1;
  143. text-align: center;
  144. }
  145. /* Tabs 区域固定 */
  146. .tabs-wrap {
  147. background-color: transparent;
  148. flex-shrink: 0;
  149. padding: 0 40rpx;
  150. margin-bottom: 20rpx;
  151. background-color: #fff;
  152. }
  153. /* 列表滚动区域占满剩余空间 */
  154. .task-list-scroll {
  155. flex: 1;
  156. height: 0; /* 配合 flex:1 实现滚动 */
  157. }
  158. .task-list {
  159. padding: 0 30rpx 40rpx;
  160. }
  161. .task-item {
  162. display: flex;
  163. padding: 30rpx;
  164. background-color: #fff;
  165. border-radius: 20rpx;
  166. margin-bottom: 24rpx;
  167. box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.02);
  168. }
  169. .task-img {
  170. width: 160rpx;
  171. height: 160rpx;
  172. border-radius: 20rpx;
  173. flex-shrink: 0;
  174. background-color: #f5f5f5; /* 占位色 */
  175. }
  176. .task-info {
  177. flex: 1;
  178. margin-left: 24rpx;
  179. display: flex;
  180. flex-direction: column;
  181. justify-content: space-between;
  182. }
  183. .task-title {
  184. font-size: 32rpx;
  185. color: #333;
  186. font-weight: bold;
  187. line-height: 1.4;
  188. margin-bottom: 8rpx;
  189. }
  190. .task-time {
  191. font-size: 24rpx;
  192. color: #999;
  193. margin-bottom: auto;
  194. }
  195. .task-bottom {
  196. display: flex;
  197. justify-content: space-between;
  198. align-items: center;
  199. margin-top: 16rpx;
  200. }
  201. .status-badge {
  202. font-size: 22rpx;
  203. padding: 4rpx 16rpx;
  204. border-radius: 6rpx;
  205. }
  206. .status-badge.passed {
  207. color: #27C282;
  208. background-color: #E2F6EC;
  209. }
  210. .task-reward-wrap {
  211. display: flex;
  212. align-items: baseline;
  213. }
  214. .task-reward {
  215. font-size: 32rpx;
  216. color: #FF5A1F;
  217. font-weight: bold;
  218. }
  219. .task-reward-unit {
  220. font-size: 24rpx;
  221. color: #FF5A1F;
  222. margin-left: 4rpx;
  223. }
  224. .loading-more {
  225. text-align: center;
  226. color: #999;
  227. font-size: 24rpx;
  228. padding: 20rpx 0;
  229. }
  230. </style>