cashTask.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  1. <template>
  2. <view class="cash-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">
  10. <u-icon name="search" size="20" color="#333" v-if="false"></u-icon>
  11. </view>
  12. </view>
  13. <!-- 搜索栏 -->
  14. <view class="search-bar-wrap">
  15. <u-search
  16. placeholder="查找任务"
  17. v-model="keyword"
  18. :showAction="false"
  19. bgColor="#f9f9f9"
  20. height="32"
  21. searchIcon="search"
  22. searchIconSize="20"
  23. searchIconColor="#999"
  24. placeholderColor="#999"
  25. :inputStyle="{ fontSize: '28rpx' }"
  26. ></u-search>
  27. </view>
  28. <!-- 分类 Tabs 区域 -->
  29. <view class="tabs-wrap">
  30. <view class="tabs-scroll">
  31. <u-tabs
  32. :list="tabList"
  33. :current="currentTab"
  34. @change="tabChange"
  35. lineWidth="40rpx"
  36. lineHeight="12rpx"
  37. :lineColor="`url(${lineBg}) 40rpx 12rpx`"
  38. :inactiveStyle="{
  39. fontSize: '28rpx',
  40. color: '#666',
  41. lineHeight: '80rpx',
  42. flexShrink: 0,
  43. }"
  44. :activeStyle="{
  45. fontWeight: 600,
  46. fontSize: '32rpx',
  47. color: '#000',
  48. lineHeight: '80rpx',
  49. flexShrink: 0,
  50. }"
  51. itemStyle="margin: 6rpx 0"
  52. >
  53. <view slot="right" class="tabs-more" style="padding: 0 20rpx;" @click="toggleListLayout">
  54. <u-icon :name="isGridLayout ? 'list' : 'grid'" size="24" color="#999"></u-icon>
  55. </view>
  56. </u-tabs>
  57. </view>
  58. </view>
  59. <!-- 任务列表区域 -->
  60. <scroll-view scroll-y class="task-list-scroll" @scrolltolower="loadMore">
  61. <view :class="['task-list', isGridLayout ? 'task-list-grid' : '']">
  62. <!-- 任务项 1 -->
  63. <view class="task-item">
  64. <image class="task-img" src="@/static/image/points/icon_cash_task.png" mode="aspectFit"></image>
  65. <view class="task-info">
  66. <view class="task-title">新人必做任务易上手</view>
  67. <view class="task-tags">
  68. <text class="tag">无需经验</text>
  69. <text class="tag">时间自由</text>
  70. </view>
  71. <view class="task-bottom">
  72. <text class="task-stat">128人已赚<text class="divider">|</text>剩余10单</text>
  73. <view class="task-reward-wrap">
  74. <text class="task-reward">+2.35</text>
  75. <text class="task-reward-unit">元</text>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. <!-- 任务项 2 -->
  81. <view class="task-item">
  82. <image class="task-img" src="@/static/image/points/icon_cash_task.png" mode="aspectFit"></image>
  83. <view class="task-info">
  84. <view class="task-title">下载指定软件</view>
  85. <view class="task-tags">
  86. <text class="tag">无需经验</text>
  87. <text class="tag">时间自由</text>
  88. </view>
  89. <view class="task-bottom">
  90. <text class="task-stat">128人已赚<text class="divider">|</text>剩余10单</text>
  91. <view class="task-reward-wrap">
  92. <text class="task-reward">+2.35</text>
  93. <text class="task-reward-unit">元</text>
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. <!-- 任务项 3 -->
  99. <view class="task-item">
  100. <image class="task-img" src="@/static/image/points/icon_cash_task.png" mode="aspectFit"></image>
  101. <view class="task-info">
  102. <view class="task-title">加微信群</view>
  103. <view class="task-tags">
  104. <text class="tag">无需经验</text>
  105. <text class="tag">时间自由</text>
  106. </view>
  107. <view class="task-bottom">
  108. <text class="task-stat">128人已赚<text class="divider">|</text>剩余10单</text>
  109. <view class="task-reward-wrap">
  110. <text class="task-reward">+2.35</text>
  111. <text class="task-reward-unit">元</text>
  112. </view>
  113. </view>
  114. </view>
  115. </view>
  116. <!-- 任务项 4 -->
  117. <view class="task-item">
  118. <image class="task-img" src="@/static/image/points/icon_cash_task.png" mode="aspectFit"></image>
  119. <view class="task-info">
  120. <view class="task-title">下载指定软件</view>
  121. <view class="task-tags">
  122. <text class="tag">无需经验</text>
  123. <text class="tag">时间自由</text>
  124. </view>
  125. <view class="task-bottom">
  126. <text class="task-stat">128人已赚<text class="divider">|</text>剩余10单</text>
  127. <view class="task-reward-wrap">
  128. <text class="task-reward">+2.35</text>
  129. <text class="task-reward-unit">元</text>
  130. </view>
  131. </view>
  132. </view>
  133. </view>
  134. <!-- 任务项 5 -->
  135. <view class="task-item">
  136. <image class="task-img" src="@/static/image/points/icon_cash_task.png" mode="aspectFit"></image>
  137. <view class="task-info">
  138. <view class="task-title">淘宝写好评</view>
  139. <view class="task-tags">
  140. <text class="tag">无需经验</text>
  141. <text class="tag">时间自由</text>
  142. </view>
  143. <view class="task-bottom">
  144. <text class="task-stat">128人已赚<text class="divider">|</text>剩余10单</text>
  145. <view class="task-reward-wrap">
  146. <text class="task-reward">+2.35</text>
  147. <text class="task-reward-unit">元</text>
  148. </view>
  149. </view>
  150. </view>
  151. </view>
  152. </view>
  153. </scroll-view>
  154. </view>
  155. </template>
  156. <script>
  157. const lineBg = "/static/image/hall/hall_on_icon.png";
  158. export default {
  159. data() {
  160. return {
  161. lineBg,
  162. currentTab: 0,
  163. keyword: '',
  164. isGridLayout: false,
  165. tabList: [
  166. { name: '推荐' },
  167. { name: '简单好做' },
  168. { name: '高额赏金' },
  169. { name: '注册下载' },
  170. { name: '加群其他' }
  171. ]
  172. };
  173. },
  174. methods: {
  175. goBack() {
  176. uni.navigateBack();
  177. },
  178. tabChange(item) {
  179. this.currentTab = item.index;
  180. },
  181. toggleListLayout() {
  182. this.isGridLayout = !this.isGridLayout;
  183. },
  184. loadMore() {
  185. console.log('加载更多数据');
  186. }
  187. }
  188. };
  189. </script>
  190. <style lang="scss" scoped>
  191. .cash-task-container {
  192. height: 100vh;
  193. background-color: #F5F7FA;
  194. display: flex;
  195. flex-direction: column;
  196. }
  197. .search-bar-wrap {
  198. position: relative;
  199. z-index: 1;
  200. padding: 20rpx 30rpx;
  201. background-color: #fff;
  202. }
  203. .nav-header {
  204. display: flex;
  205. justify-content: space-between;
  206. align-items: center;
  207. padding: 60rpx 30rpx 20rpx; /* 适配状态栏高度 */
  208. background-color: #fff;
  209. }
  210. .nav-left, .nav-right {
  211. width: 60rpx;
  212. display: flex;
  213. align-items: center;
  214. }
  215. .nav-right {
  216. justify-content: flex-end;
  217. }
  218. .nav-title {
  219. font-size: 36rpx;
  220. font-weight: bold;
  221. color: #333;
  222. flex: 1;
  223. text-align: center;
  224. }
  225. .tabs-wrap {
  226. display: flex;
  227. align-items: center;
  228. background-color: #fff;
  229. border-bottom: 1px solid #eee;
  230. position: relative;
  231. }
  232. .tabs-scroll {
  233. width: 100%;
  234. }
  235. .tab-item {
  236. position: relative;
  237. display: flex;
  238. flex-direction: column;
  239. align-items: center;
  240. justify-content: center;
  241. height: 88rpx;
  242. padding: 0 10rpx;
  243. }
  244. .tab-text {
  245. font-size: 30rpx;
  246. color: #666;
  247. }
  248. .active-text {
  249. font-size: 32rpx;
  250. color: #333;
  251. font-weight: bold;
  252. }
  253. .custom-indicator {
  254. position: absolute;
  255. bottom: 10rpx;
  256. width: 50rpx;
  257. height: 12rpx;
  258. }
  259. .indicator-img {
  260. width: 100%;
  261. height: 100%;
  262. }
  263. .tabs-more {
  264. display: flex;
  265. justify-content: center;
  266. align-items: center;
  267. height: 88rpx;
  268. background-color: #fff;
  269. position: relative;
  270. }
  271. .tabs-more::before {
  272. content: '';
  273. position: absolute;
  274. left: 0;
  275. top: 50%;
  276. transform: translateY(-50%);
  277. width: 20rpx;
  278. height: 60rpx;
  279. background: linear-gradient(to right, rgba(242, 245, 255, 0), #fff);
  280. margin-left: -20rpx;
  281. }
  282. .task-list-scroll {
  283. flex: 1;
  284. height: 0; /* 配合 flex:1 实现滚动 */
  285. background-color: #F5F7FA;
  286. }
  287. .task-list {
  288. padding: 20rpx 30rpx;
  289. }
  290. /* 列表模式样式 */
  291. .task-item {
  292. display: flex;
  293. padding: 30rpx 20rpx;
  294. background-color: #fff;
  295. border-radius: 20rpx;
  296. margin-bottom: 20rpx;
  297. }
  298. .task-img {
  299. width: 140rpx;
  300. height: 140rpx;
  301. border-radius: 20rpx;
  302. flex-shrink: 0;
  303. background-color: #f5f5f5;
  304. }
  305. .task-info {
  306. flex: 1;
  307. margin-left: 20rpx;
  308. display: flex;
  309. flex-direction: column;
  310. justify-content: space-between;
  311. }
  312. .task-title {
  313. font-size: 30rpx;
  314. color: #333;
  315. font-weight: bold;
  316. line-height: 1.4;
  317. display: -webkit-box;
  318. -webkit-box-orient: vertical;
  319. -webkit-line-clamp: 2;
  320. overflow: hidden;
  321. }
  322. /* 网格模式样式 */
  323. .task-list-grid {
  324. display: flex;
  325. flex-wrap: wrap;
  326. justify-content: space-between;
  327. }
  328. .task-list-grid .task-item {
  329. width: 48%;
  330. flex-direction: column;
  331. padding: 0;
  332. margin-bottom: 30rpx;
  333. overflow: hidden;
  334. background-color: #fff;
  335. border-radius: 20rpx;
  336. }
  337. .task-list-grid .task-img {
  338. width: 100%;
  339. height: 330rpx;
  340. border-radius: 20rpx 20rpx 0 0;
  341. }
  342. .task-list-grid .task-info {
  343. margin-left: 0;
  344. padding: 20rpx;
  345. }
  346. .task-list-grid .task-title {
  347. margin-bottom: 16rpx;
  348. }
  349. .task-list-grid .task-tags {
  350. display: none; /* 网格模式下隐藏标签,或者根据需要调整 */
  351. }
  352. .task-list-grid .task-bottom {
  353. flex-direction: row;
  354. justify-content: space-between;
  355. align-items: center;
  356. margin-top: 10rpx;
  357. }
  358. .task-list-grid .task-stat {
  359. font-size: 20rpx;
  360. }
  361. .task-list-grid .task-stat .divider,
  362. .task-list-grid .task-stat text:last-child {
  363. display: none; /* 简化统计信息展示 */
  364. }
  365. .task-list-grid .task-stat::after {
  366. content: '价值:9.90元'; /* 这里可以绑定实际数据 */
  367. color: #999;
  368. font-size: 20rpx;
  369. margin-left: 10rpx;
  370. }
  371. .task-list-grid .task-reward-wrap{
  372. background-color: #FF5A1F;
  373. padding: 4rpx 16rpx;
  374. border-radius: 20rpx;
  375. }
  376. .task-list-grid .task-reward,
  377. .task-list-grid .task-reward-unit {
  378. font-size: 24rpx;
  379. color: #fff;
  380. }
  381. .task-tags {
  382. display: flex;
  383. flex-wrap: wrap;
  384. margin-top: 12rpx;
  385. }
  386. .tag {
  387. font-size: 20rpx;
  388. color: #647294;
  389. background-color: #F5F7FA;
  390. padding: 4rpx 12rpx;
  391. border-radius: 6rpx;
  392. margin-right: 12rpx;
  393. margin-bottom: 8rpx;
  394. }
  395. .task-bottom {
  396. display: flex;
  397. justify-content: space-between;
  398. align-items: center;
  399. margin-top: auto;
  400. }
  401. .task-stat {
  402. font-size: 22rpx;
  403. color: #999;
  404. }
  405. .divider {
  406. margin: 0 16rpx;
  407. color: #E5E6EB;
  408. }
  409. .task-reward-wrap {
  410. display: flex;
  411. align-items: baseline;
  412. }
  413. .task-reward {
  414. font-size: 32rpx;
  415. color: #FF5A1F;
  416. font-weight: bold;
  417. }
  418. .task-reward-unit {
  419. font-size: 24rpx;
  420. color: #FF5A1F;
  421. font-weight: normal;
  422. }
  423. </style>