小说小程序前端代码仓库(小程序)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

332 lines
7.0 KiB

  1. <template>
  2. <view class="page-container">
  3. <view class="task-center">
  4. <navbar title="回复评论" leftClick @leftClick="$utils.navigateBack" />
  5. <view class="navbar-placeholder"></view>
  6. <!-- 账户剩余 -->
  7. <view class="account-balance">
  8. <view class="balance-label">账户剩余</view>
  9. <view class="balance-value"><text class="num">9</text> <text class="unit"> 推荐票</text></view>
  10. </view>
  11. <!-- 打卡得奖励 -->
  12. <view class="checkin-section">
  13. <view class="section-header">
  14. <text>打卡得奖励</text>
  15. <view class="record-btn">打卡记录</view>
  16. </view>
  17. <view class="checkin-grid">
  18. <view v-for="day in 8" :key="day" class="checkin-day" :class="{ active: day <= checkedDays }">
  19. <view class="day-label" :class="{ bold: day <= checkedDays }">{{ day }}</view>
  20. <image class="ticket-img"
  21. src="https://tse1-mm.cn.bing.net/th/id/OIP-C.pca_tFb6ZjyDNdQYgFvi0wHaE7?w=219&h=180&c=7&r=0&o=5&dpr=1.1&pid=1.7"
  22. mode="aspectFit" />
  23. <view class="ticket-num">+1</view>
  24. </view>
  25. </view>
  26. <button class="checkin-btn" :class="{ 'checked-btn': isChecked }" :disabled="isChecked"
  27. @click="handleCheckin">
  28. {{ isChecked ? '已签到' : '签到得奖励' }}
  29. </button>
  30. </view>
  31. <!-- 更多任务 -->
  32. <view class="more-tasks">
  33. <view class="more-header">更多任务</view>
  34. <view class="task-list">
  35. <view class="task-item" v-for="(task, idx) in tasks" :key="idx"
  36. :class="{ 'no-border': idx === tasks.length - 1 }">
  37. <view class="task-info">
  38. <view class="task-title">{{ task.title }}</view>
  39. <view class="task-desc">推荐票 +1</view>
  40. </view>
  41. <button class="get-btn" :class="{ 'received-btn': task.received }" :disabled="task.received"
  42. @click="handleReceive(idx)">
  43. {{ task.received ? '已领取' : '去领取' }}
  44. </button>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. import uvNavbar from '@/uni_modules/uv-navbar/components/uv-navbar/uv-navbar.vue'
  53. import uvIcon from '@/uni_modules/uv-icon/components/uv-icon/uv-icon.vue'
  54. import BackArrow from './components/BackArrow.vue'
  55. export default {
  56. components: {
  57. uvNavbar,
  58. uvIcon,
  59. BackArrow
  60. },
  61. data() {
  62. return {
  63. checkedDays: 3, // 已签到天数
  64. tasks: [{
  65. title: '观看视频广告',
  66. received: false
  67. },
  68. {
  69. title: '每日首阅三个章节',
  70. received: false
  71. },
  72. {
  73. title: '每日首条评论',
  74. received: false
  75. },
  76. ],
  77. isChecked: false, // 新增:签到按钮状态
  78. }
  79. },
  80. methods: {
  81. goBack() {
  82. uni.navigateBack();
  83. },
  84. handleCheckin() {
  85. if (this.checkedDays < 8) {
  86. this.checkedDays++;
  87. this.isChecked = true;
  88. uni.showToast({
  89. title: '签到成功',
  90. icon: 'success'
  91. });
  92. } else {
  93. this.isChecked = true;
  94. uni.showToast({
  95. title: '已全部签到',
  96. icon: 'none'
  97. });
  98. }
  99. },
  100. handleReceive(idx) {
  101. this.tasks[idx].received = true;
  102. uni.showToast({
  103. title: '领取成功',
  104. icon: 'success'
  105. });
  106. },
  107. },
  108. }
  109. </script>
  110. <style scoped lang="scss">
  111. .page-container {
  112. height: 100vh;
  113. overflow: hidden;
  114. }
  115. .task-center {
  116. background: #f8f8f8;
  117. height: 100vh;
  118. padding-bottom: 40rpx;
  119. overflow: hidden;
  120. box-sizing: border-box;
  121. }
  122. .navbar-placeholder {
  123. height: 100rpx;
  124. }
  125. .account-balance {
  126. background: linear-gradient(90deg, #ffe16b, #ffd700);
  127. border-radius: 20rpx;
  128. margin: 24rpx 24rpx 0 24rpx;
  129. padding: 24rpx 32rpx;
  130. display: flex;
  131. align-items: center;
  132. justify-content: space-between;
  133. font-size: 30rpx;
  134. color: #333;
  135. .balance-label {
  136. font-weight: 500;
  137. }
  138. .balance-value {
  139. font-weight: bold;
  140. color: #bfa100;
  141. .num {
  142. font-size: 24rpx;
  143. }
  144. .unit {
  145. font-size: 22rpx;
  146. }
  147. }
  148. }
  149. .checkin-section {
  150. background: #fff;
  151. border-radius: 20rpx;
  152. margin: 24rpx;
  153. padding: 32rpx 24rpx 24rpx 24rpx;
  154. box-shadow: 0 2rpx 8rpx rgba(255, 215, 0, 0.08);
  155. border: 4rpx solid #ffe16b;
  156. .section-header {
  157. display: flex;
  158. justify-content: space-between;
  159. align-items: center;
  160. font-size: 28rpx;
  161. font-weight: 600;
  162. margin-bottom: 24rpx;
  163. .record-btn {
  164. background: #d6ff4b;
  165. color: #383938;
  166. border-radius: 24rpx;
  167. padding: 6rpx 28rpx;
  168. font-size: 24rpx;
  169. }
  170. }
  171. .checkin-grid {
  172. display: flex;
  173. flex-wrap: wrap;
  174. gap: 18rpx;
  175. margin-bottom: 32rpx;
  176. .checkin-day {
  177. width: 22%;
  178. background: #f7f7f7;
  179. border-radius: 12rpx;
  180. display: flex;
  181. flex-direction: column;
  182. align-items: center;
  183. padding: 18rpx 0 10rpx 0;
  184. border: 2rpx solid #f0f0f0;
  185. &.active {
  186. background: #d6ff4b !important;
  187. border-color: #b6e900 !important;
  188. .day-label,
  189. .ticket-num {
  190. color: #222 !important;
  191. font-weight: bold;
  192. }
  193. }
  194. .day-label {
  195. font-size: 24rpx;
  196. font-weight: 600;
  197. height: 90rpx;
  198. margin-bottom: 8rpx;
  199. color: #333;
  200. &.bold {
  201. font-weight: bold;
  202. }
  203. }
  204. .ticket-img {
  205. width: 48rpx;
  206. height: 36rpx;
  207. margin-bottom: 6rpx;
  208. display: flex;
  209. }
  210. .ticket-num {
  211. font-size: 22rpx;
  212. color: #bfa100;
  213. }
  214. }
  215. }
  216. .checkin-btn {
  217. width: 600rpx;
  218. background: linear-gradient(90deg, #ffe16b, #ffd700);
  219. color: #333;
  220. font-size: 30rpx;
  221. border-radius: 46rpx;
  222. padding: 18rpx 0;
  223. font-weight: bold;
  224. margin-top: 8rpx;
  225. transition: background 0.2s;
  226. }
  227. }
  228. .checked-btn {
  229. background: linear-gradient(90deg, #e0e0e0, #bdbdbd) !important;
  230. color: #444 !important;
  231. cursor: not-allowed;
  232. }
  233. .more-tasks {
  234. background: #faffea;
  235. border-radius: 20rpx;
  236. margin: 0 24rpx;
  237. padding: 24rpx 24rpx 8rpx 24rpx;
  238. margin-top: 100rpx;
  239. .more-header {
  240. font-size: 28rpx;
  241. color: #bfa100;
  242. font-weight: 600;
  243. margin-bottom: 18rpx;
  244. }
  245. .task-list {
  246. .task-item {
  247. display: flex;
  248. align-items: center;
  249. justify-content: space-between;
  250. background: #fff;
  251. border-radius: 0;
  252. margin: 0;
  253. padding: 18rpx 20rpx 10rpx 20rpx;
  254. border-bottom: 1rpx solid #f2f2f2;
  255. .task-info {
  256. display: flex;
  257. flex-direction: column;
  258. align-items: flex-start;
  259. flex: 1;
  260. min-width: 0;
  261. margin-top: 30rpx;
  262. .task-title {
  263. font-size: 26rpx;
  264. color: #222;
  265. font-weight: bold;
  266. }
  267. .task-desc {
  268. font-size: 20rpx;
  269. color: #bbb;
  270. margin-top: 4rpx;
  271. }
  272. }
  273. .get-btn {
  274. background: #ffd700;
  275. color: #fff;
  276. font-size: 24rpx;
  277. border-radius: 24rpx;
  278. padding: 0 28rpx;
  279. font-weight: bold;
  280. border: none;
  281. height: 48rpx;
  282. display: flex;
  283. align-items: center;
  284. justify-content: center;
  285. box-shadow: none;
  286. white-space: nowrap;
  287. margin-left: 18rpx;
  288. transition: background 0.2s;
  289. }
  290. .received-btn {
  291. background: linear-gradient(90deg, #e0e0e0, #bdbdbd) !important;
  292. color: #444 !important;
  293. cursor: not-allowed;
  294. }
  295. &.no-border {
  296. border-bottom: none;
  297. }
  298. }
  299. }
  300. }
  301. </style>