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

252 lines
5.2 KiB

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