signIn.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <view :style="[signWrapStyle]">
  3. <view class="signIn" :style="[signStyle]">
  4. <view v-if="dataConfig.styleConfig.tabVal" class="text-wrap acea-row row-middle">
  5. <image src="../../../static/images/sign-icon-04.png" mode="widthFix" class="image"></image>
  6. <view class="text">
  7. <view class="name-wrap acea-row row-middle">
  8. <view class="name">签到立即获取</view>
  9. <view class="num acea-row row-middle" :style="[numStyle]">
  10. <view class="inner" :class="{ opacity: !dataConfig.toneConfig.tabVal }">
  11. <image src="../../../static/images/sign-icon-01.png" mode="widthFix" class="icon"></image>
  12. +{{ sign_give_point }}
  13. </view>
  14. </view>
  15. </view>
  16. <view>连续签到{{nextContinuousSignRewardList.days||0}}天,额外活动{{nextContinuousSignRewardList.point}}积分</view>
  17. </view>
  18. <view class="button" :style="[buttonStyle]" @click="goUserSgin">立即签到</view>
  19. </view>
  20. <view v-else class="week-wrap acea-row row-middle">
  21. <view class="week acea-row">
  22. <view v-for="(item, index) in signList" :key="index" class="item acea-row row-column row-center-wrapper">
  23. <image v-if="item.is_sign" src="../../../static/images/sign-icon-03.png" mode="widthFix" class="image"></image>
  24. <image v-else-if="item.type == 1" src="../../../static/images/sign-icon-01.png" mode="widthFix" class="image"></image>
  25. <image v-else-if="item.type == 2" src="../../../static/images/sign-icon-02.png" mode="widthFix" class="image"></image>
  26. <view>周{{ index | weekFormat }}</view>
  27. </view>
  28. </view>
  29. <view class="button" :style="[buttonStyle]" @click="goUserSgin">签到</view>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. import {
  36. getSign
  37. } from '@/api/api.js';
  38. export default {
  39. props: {
  40. dataConfig: {
  41. type: Object,
  42. default: () => {}
  43. },
  44. isSortType: {
  45. type: String | Number,
  46. default: 0
  47. }
  48. },
  49. filters: {
  50. weekFormat: function(value) {
  51. return ['一', '二', '三', '四', '五', '六', '日'][value];
  52. }
  53. },
  54. data() {
  55. return {
  56. today: 0,
  57. signList: [],
  58. sign_give_point: 0,
  59. nextContinuousSignRewardList: {},
  60. };
  61. },
  62. computed: {
  63. buttonStyle() {
  64. let styleObject = {};
  65. if (this.dataConfig.toneConfig.tabVal) {
  66. styleObject['background'] = `linear-gradient(90deg, ${this.dataConfig.bntBgColor.color[0].item} 0%, ${this.dataConfig.bntBgColor.color[1].item} 100%)`;
  67. styleObject['color'] = this.dataConfig.bntTxtColor.color[0].item;
  68. }
  69. return styleObject;
  70. },
  71. signStyle() {
  72. let color = this.dataConfig.styleConfig.tabVal ? this.dataConfig.moduleColor.color : this.dataConfig.moduleColor2.color;
  73. let borderRadius = `${this.dataConfig.fillet.val * 2}rpx`;
  74. if (this.dataConfig.fillet.type) {
  75. borderRadius =
  76. `${this.dataConfig.fillet.valList[0].val * 2}rpx ${this.dataConfig.fillet.valList[1].val * 2}rpx ${this.dataConfig.fillet.valList[2].val * 2}rpx ${this.dataConfig.fillet.valList[3].val * 2}rpx`;
  77. }
  78. return {
  79. 'border-radius': borderRadius,
  80. 'background': `linear-gradient(270deg, ${color[0].item} 0%, ${color[1].item} 100%)`,
  81. };
  82. },
  83. signWrapStyle() {
  84. return {
  85. 'padding': `${this.dataConfig.topConfig.val * 2}rpx ${this.dataConfig.prConfig.val * 2}rpx ${this.dataConfig.bottomConfig.val * 2}rpx`,
  86. 'margin-top': `${this.dataConfig.mbConfig.val * 2}rpx`,
  87. 'background': this.dataConfig.bottomBgColor.color[0].item,
  88. };
  89. },
  90. numStyle() {
  91. let styleObject = {};
  92. if (this.dataConfig.toneConfig.tabVal) {
  93. styleObject['background'] = this.dataConfig.labelBgColor.color[0].item;
  94. styleObject['color'] = this.dataConfig.labelTxtColor.color[0].item;
  95. }
  96. return styleObject;
  97. },
  98. },
  99. mounted() {
  100. const t = new Date();
  101. const d = t.getDay();
  102. this.today = d;
  103. this.getSign();
  104. },
  105. methods: {
  106. goUserSgin() {
  107. uni.navigateTo({
  108. url: '/pages/users/user_sgin/index'
  109. })
  110. },
  111. getSign() {
  112. getSign().then(res => {
  113. this.nextContinuousSignRewardList = res.data.nextContinuousSignRewardList[0];
  114. this.sign_give_point = res.data.sign_give_point;
  115. this.signList = res.data.signList[0];
  116. });
  117. },
  118. },
  119. }
  120. </script>
  121. <style lang="scss" scoped>
  122. .signIn {
  123. padding: 24rpx;
  124. border-radius: 0rpx 0rpx 16rpx 16rpx;
  125. background: #FFFFFF;
  126. .week-wrap {
  127. height: 156rpx;
  128. border-radius: 16rpx;
  129. background: linear-gradient(to right, #FFE8F5, #F1FBFD);
  130. .week {
  131. flex: 1;
  132. font-weight: 500;
  133. font-size: 22rpx;
  134. line-height: 30rpx;
  135. color: #999999;
  136. .item {
  137. flex: 1;
  138. }
  139. .image {
  140. width: 48rpx;
  141. margin-bottom: 16rpx;
  142. }
  143. }
  144. .button {
  145. width: 88rpx;
  146. height: 48rpx;
  147. border-radius: 24rpx;
  148. margin: 0 20rpx;
  149. background: linear-gradient(90deg, var(--view-theme) 0%, var(--view-gradient) 100%);
  150. text-align: center;
  151. font-size: 24rpx;
  152. line-height: 48rpx;
  153. color: #FFFFFF;
  154. }
  155. }
  156. .text-wrap {
  157. height: 140rpx;
  158. border-radius: 16rpx;
  159. background: #FFFFFF;
  160. .image {
  161. width: 88rpx;
  162. height: 88rpx;
  163. margin-left: 20rpx;
  164. }
  165. .text {
  166. flex: 1;
  167. padding: 0 20rpx;
  168. font-size: 24rpx;
  169. color: #999999;
  170. }
  171. .name-wrap {
  172. margin-bottom: 14rpx;
  173. }
  174. .name {
  175. font-weight: 500;
  176. font-size: 30rpx;
  177. color: #282828;
  178. }
  179. .num {
  180. border-radius: 16rpx;
  181. margin-left: 4rpx;
  182. background: var(--view-theme);
  183. font-size: 20rpx;
  184. line-height: 32rpx;
  185. color: var(--view-theme);
  186. .inner {
  187. height: 32rpx;
  188. padding: 0 6rpx 0 8rpx;
  189. border-radius: 16rpx;
  190. }
  191. .opacity {
  192. background: rgba(255, 255, 255, 0.9);
  193. }
  194. }
  195. .icon {
  196. width: 24rpx;
  197. height: 24rpx;
  198. }
  199. .button {
  200. width: 140rpx;
  201. height: 52rpx;
  202. border-radius: 26rpx;
  203. margin: 0 20rpx;
  204. background: linear-gradient(90deg, var(--view-theme) 0%, var(--view-gradient) 100%);
  205. text-align: center;
  206. font-size: 24rpx;
  207. line-height: 52rpx;
  208. color: #FFFFFF;
  209. }
  210. }
  211. }
  212. </style>