推拿小程序前端代码仓库
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.

239 lines
5.0 KiB

  1. <template>
  2. <view class="page">
  3. <navbar title="每日签到" leftClick @leftClick="$utils.navigateBack" color="#fff" />
  4. <view class="content">
  5. <view class="flex info">
  6. <view class="flex flex-column info-item">
  7. <view class="info-value">5</view>
  8. <view class="info-label">连续签到/</view>
  9. </view>
  10. <view class="flex flex-column info-item">
  11. <view class="info-value">20</view>
  12. <view class="info-label">累计签到/</view>
  13. </view>
  14. <view class="flex flex-column info-item">
  15. <view class="info-value">50</view>
  16. <view class="info-label">获得积分</view>
  17. </view>
  18. </view>
  19. <view class="calendars">
  20. <uv-calendars
  21. insert
  22. :showMonth="false"
  23. :selected="selected"
  24. />
  25. <view class="flex tips">
  26. <image class="tips-icon" src="../static/signIn/icon-tips.png" mode="widthFix"></image>
  27. <text>签到一次得 5 积分</text>
  28. </view>
  29. </view>
  30. <view style="text-align: right;">
  31. <button class="flex btn btn-record" @click="$utils.navigateTo('/pages_order/mine/pointsRecord')">
  32. <text>积分明细</text>
  33. <image class="btn-record-icon" src="../static/signIn/icon-arrow.png" mode="widthFix"></image>
  34. </button>
  35. </view>
  36. <view class="tools">
  37. <button plain class="flex btn btn-sign" :class="{ 'is-disabled': isSigned }" @click="onSignIn" :disabled="isSigned">我要签到</button>
  38. </view>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. export default {
  44. data() {
  45. const SELECTED_DATE_ARR = ['2025-03-04', '2025-03-05', '2025-03-06', '2025-03-07']
  46. return {
  47. // todo: fetch
  48. selected: SELECTED_DATE_ARR.map(date => {
  49. return {
  50. date,
  51. info: date[date.length - 1],
  52. infoColor: '#FFFFFF',
  53. badge: true,
  54. }
  55. }),
  56. isSigned: false
  57. }
  58. },
  59. methods: {
  60. onSignIn() {
  61. // todo
  62. setTimeout(() => {
  63. this.isSigned = true
  64. const date = this.$dayjs()
  65. this.selected.push({
  66. date: date.format("YYYY-MM-DD"),
  67. info: date.date(),
  68. infoColor: '#FFFFFF',
  69. badge: true,
  70. })
  71. uni.showToast({
  72. title: '签到成功~',
  73. });
  74. }, 2000)
  75. }
  76. },
  77. }
  78. </script>
  79. <style lang="scss" scoped>
  80. .page {
  81. background-color: $uni-bg-color;
  82. position: relative;
  83. /deep/ .nav-bar__view {
  84. padding-bottom: 409rpx;
  85. background-image: linear-gradient(#84A73F, #D8FF8F);
  86. }
  87. /deep/ .uv-calendar {
  88. width: calc(100vw - 14rpx*2);
  89. }
  90. /deep/ .uv-calendar__header {
  91. border: none;
  92. }
  93. /deep/ .uv-calendar__header-btn {
  94. border-color: $uni-color-light;
  95. }
  96. /deep/ .uv-calendar__backtoday,
  97. /deep/ .uv-calendar-item--isDay-text.uv-calendar-item__weeks-lunar-text {
  98. display: none;
  99. }
  100. /deep/ .uv-calendar__weeks-day {
  101. border-color: #E6E6E6;
  102. }
  103. /deep/ .uv-calendar-item__weeks-box-item {
  104. height: 72rpx;
  105. }
  106. /deep/ .uv-calendar-item--isDay {
  107. color: #333 !important;
  108. background-color: transparent !important;
  109. }
  110. /deep/ .uv-calendar-item__weeks-box-circle {
  111. top: 50%;
  112. left: 50%;
  113. width: 53rpx;
  114. height: 53rpx;
  115. transform: translate(-50%, -50%);
  116. border-radius: 50%;
  117. background-color: $uni-color-light;
  118. }
  119. /deep/ .uv-calendar-item__weeks-lunar-text {
  120. position: absolute;
  121. top: 50%;
  122. left: 50%;
  123. transform: translate(-50%, -50%);
  124. font-size: 28rpx;
  125. line-height: 1;
  126. }
  127. }
  128. .content {
  129. position: absolute;
  130. top: 243rpx;
  131. z-index: 999;
  132. }
  133. .info {
  134. width: 100vw;
  135. box-sizing: border-box;
  136. padding: 0 48rpx;
  137. font-size: 0;
  138. justify-content: space-between;
  139. &-item {
  140. color: $uni-text-color-inverse;
  141. }
  142. &-value {
  143. font-size: 46rpx;
  144. }
  145. &-label {
  146. font-size: 26rpx;
  147. margin-top: 19rpx;
  148. }
  149. }
  150. .calendars {
  151. background-color: $uni-fg-color;
  152. margin: 56rpx 14rpx 0 14rpx;
  153. border-radius: 45rpx;
  154. overflow: hidden;
  155. .tips {
  156. padding: 30rpx 30rpx 38rpx 30rpx;
  157. color: $uni-color-light;
  158. justify-content: flex-start;
  159. &-icon {
  160. width: 36rpx;
  161. height: auto;
  162. margin-right: 11rpx;
  163. }
  164. }
  165. }
  166. .tools {
  167. margin-top: 146rpx;
  168. width: 100%;
  169. padding: 0 82rpx;
  170. box-sizing: border-box;
  171. }
  172. .btn {
  173. border: none;
  174. &-record {
  175. margin-top: 19rpx;
  176. margin-right: 28rpx;
  177. display: inline-flex;
  178. color: #999999;
  179. &-icon {
  180. width: 21rpx;
  181. height: auto;
  182. margin-left: 18rpx;
  183. }
  184. }
  185. &-sign {
  186. width: 100%;
  187. padding: 29rpx 0;
  188. color: $uni-text-color-inverse;
  189. font-size: 28rpx;
  190. line-height: 40rpx;
  191. border-radius: 44rpx;
  192. background-image: linear-gradient(to right, #84A73F, #D8FF8F);
  193. &.is-disabled {
  194. color: $uni-text-color-inverse;
  195. background: #C7C7C7;
  196. }
  197. }
  198. }
  199. </style>