sign.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <view class="h100 pos-r" :class="{dark: pattern=='dark'}">
  3. <u-navbar :title="$t('page_title.sign')" bgColor="transparent" :titleStyle="{color:'#FFFFFF'}"
  4. leftIconColor="#FFFFFF" autoBack>
  5. </u-navbar>
  6. <image class="bg" src="/static/images/6c46bb7f7c1eaa4c7ff1dd66c9b3f82.jpg" style=""></image>
  7. <view class="content-box pad-tb-32 pad-lr-48 bg-main2 flex-col-center">
  8. <!-- <view class="font36 font-bold">
  9. 已连续签到
  10. <text class="font-red font36">3</text>
  11. </view>
  12. <view class="font-999 mar-t-24">连续签到7天即可享受奖励翻倍</view> -->
  13. <!-- 进度条 -->
  14. <!-- <view class="progress">
  15. <view class="active" :style="'width:'+percentage+'%'"></view>
  16. <view class="flex-row-plus mar-t-32 flex-sp-between pad-l-32" style="color: #BABABA;">
  17. <view class="pos-r">1天</view>
  18. <view class="pos-r">2天</view>
  19. <view class="pos-r">3天
  20. <view class="brand flex-center">
  21. <text class="u-line-1">20积分</text>
  22. </view>
  23. <view class="triangle"></view>
  24. </view>
  25. <view class="pos-r">4天</view>
  26. <view class="pos-r">5天
  27. <view class="brand flex-center">
  28. <text class="u-line-1">66积分</text>
  29. </view>
  30. <view class="triangle"></view>
  31. </view>
  32. <view class="pos-r">6天</view>
  33. <view class="pos-r">7天
  34. <view class="brand flex-center">
  35. <text class="u-line-1">88积分</text>
  36. </view>
  37. <view class="triangle"></view>
  38. </view>
  39. </view>
  40. </view> -->
  41. <view class="flex-column-plus flex-items mar-t-36">
  42. <view class="btn flex-center text-align" :class="[sign?'bg-CCC-sign active':'bg-red-sign']"
  43. @click="onSign">
  44. <text class="font-bold font28">{{ text }}</text>
  45. </view>
  46. </view>
  47. <!-- <view class="integral">已经获得<text class="font-red">99</text>积分</view> -->
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. import {
  53. sign,
  54. signDetail
  55. } from "@/config/api.js"
  56. export default {
  57. data() {
  58. return {
  59. sign: false,
  60. text: this.$t('user').sign_go,
  61. signDay: 3
  62. }
  63. },
  64. computed: {
  65. percentage() {
  66. let day = this.signDay
  67. let percentage = 0
  68. if (typeof day == 'string') {
  69. day = parseInt(day)
  70. }
  71. percentage = 100 / 7 * this.signDay - (day == 7 ? 0 : 1)
  72. return percentage
  73. }
  74. },
  75. onLoad() {
  76. this.getSign()
  77. },
  78. onShow() {
  79. },
  80. methods: {
  81. getSign() {
  82. signDetail().then(res => {
  83. console.log(res)
  84. const status = res.data
  85. this.sign = status === 0 ? false : true
  86. this.text = status === 0 ? this.$t('user').sign_go : this.$t('user').sign_jintian
  87. })
  88. },
  89. onSign() {
  90. if (this.sign) return
  91. sign().then(res => {
  92. uni.showModal({
  93. content: this.$t('user').sign_success_msg,
  94. showCancel: false,
  95. confirmText: this.$t('global').know
  96. })
  97. this.sign = true,
  98. this.text = this.$t('user').sign_jintian
  99. })
  100. }
  101. }
  102. }
  103. </script>
  104. <style lang="scss">
  105. .top {
  106. height: 300rpx;
  107. }
  108. .btn {
  109. width: 203rpx;
  110. height: 63rpx;
  111. border-radius: 40rpx;
  112. color: #FFFFFF;
  113. box-shadow: 0px 8rpx 8rpx 0rpx rgba(245, 62, 15, 0.3200);
  114. &.active {
  115. color: #666666;
  116. box-shadow: none;
  117. }
  118. }
  119. .h100 {
  120. height: 100vh;
  121. }
  122. .bg {
  123. position: absolute;
  124. top: 0;
  125. left: 0;
  126. right: 0;
  127. bottom: 0;
  128. width: 100%;
  129. height: 100vh;
  130. z-index: 1;
  131. }
  132. .content-box {
  133. position: absolute;
  134. bottom: 91rpx;
  135. left: 30rpx;
  136. right: 30rpx;
  137. z-index: 100;
  138. border-radius: 37rpx;
  139. .integral {
  140. position: absolute;
  141. bottom: 30rpx;
  142. right: 24rpx;
  143. color: #BABABA;
  144. }
  145. }
  146. .progress {
  147. width: 100%;
  148. height: 18rpx;
  149. background: #FFC8C6;
  150. position: relative;
  151. border-radius: 30rpx;
  152. margin-top: 78rpx;
  153. margin-bottom: 88rpx;
  154. .active {
  155. position: absolute;
  156. left: 0;
  157. top: 0;
  158. z-index: 10;
  159. height: 100%;
  160. background: linear-gradient(90deg, #FF7373 0%, #FC451B 100%);
  161. border-radius: 18rpx;
  162. }
  163. .brand {
  164. width: 110rpx;
  165. height: 37rpx;
  166. background: linear-gradient(90deg, #FFC296 0%, #FB9E8C 100%);
  167. border-radius: 37rpx;
  168. color: #ffffff;
  169. position: absolute;
  170. top: -78rpx;
  171. left: -38rpx;
  172. z-index: 2;
  173. }
  174. .triangle {
  175. width: 0;
  176. height: 0;
  177. border-width: 12rpx;
  178. border-style: solid;
  179. border-left-color: transparent;
  180. border-top-color: #FB9E8C;
  181. border-right-color: transparent;
  182. border-bottom-color: transparent;
  183. position: absolute;
  184. top: -44rpx;
  185. left: 6rpx;
  186. z-index: 1;
  187. }
  188. }
  189. </style>