signIn.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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">{{ $t(`签到立即获取`) }}</view>
  9. <view class="num acea-row row-middle" :style="[numStyle]">
  10. <view class="inner acea-row row-middle" :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>{{ $t(`连续签到`) }} {{continuousSignDays || 0}}{{ $t(`天`) }}</view>
  17. </view>
  18. <view class="button" :style="[buttonStyle]" @click="goUserSgin">{{ $t(`立即签到`) }}</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>{{ $t(`周`) }}{{ index | weekFormat }}</view>
  27. </view>
  28. </view>
  29. <view class="button" :style="[buttonStyle]" @click="goUserSgin">{{ $t(`签到`) }}</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. continuousSignDays: 0,
  60. nextContinuousSignRewardList: {},
  61. };
  62. },
  63. computed: {
  64. buttonStyle() {
  65. let styleObject = {};
  66. if (this.dataConfig.toneConfig.tabVal) {
  67. styleObject['background'] = `linear-gradient(90deg, ${this.dataConfig.bntBgColor.color[0].item} 0%, ${this.dataConfig.bntBgColor.color[1].item} 100%)`;
  68. styleObject['color'] = this.dataConfig.bntTxtColor.color[0].item;
  69. }
  70. return styleObject;
  71. },
  72. signStyle() {
  73. let color = this.dataConfig.styleConfig.tabVal ? this.dataConfig.moduleColor.color : this.dataConfig.moduleColor2.color;
  74. let borderRadius = `${this.dataConfig.fillet.val * 2}rpx`;
  75. if (this.dataConfig.fillet.type) {
  76. borderRadius =
  77. `${this.dataConfig.fillet.valList[0].val * 2}rpx ${this.dataConfig.fillet.valList[1].val * 2}rpx ${this.dataConfig.fillet.valList[3].val * 2}rpx ${this.dataConfig.fillet.valList[2].val * 2}rpx`;
  78. }
  79. return {
  80. 'border-radius': borderRadius,
  81. 'background': `linear-gradient(270deg, ${color[0].item} 0%, ${color[1].item} 100%)`,
  82. };
  83. },
  84. signWrapStyle() {
  85. return {
  86. 'padding': `${this.dataConfig.topConfig.val * 2}rpx ${this.dataConfig.prConfig.val * 2}rpx ${this.dataConfig.bottomConfig.val * 2}rpx`,
  87. 'margin-top': `${this.dataConfig.mbConfig.val * 2}rpx`,
  88. 'background': this.dataConfig.bottomBgColor.color[0].item,
  89. };
  90. },
  91. numStyle() {
  92. let styleObject = {};
  93. if (this.dataConfig.toneConfig.tabVal) {
  94. styleObject['background'] = this.dataConfig.labelBgColor.color[0].item;
  95. styleObject['color'] = this.dataConfig.labelTxtColor.color[0].item;
  96. }
  97. return styleObject;
  98. },
  99. },
  100. mounted() {
  101. const t = new Date();
  102. const d = t.getDay();
  103. this.today = d;
  104. this.getSign();
  105. },
  106. methods: {
  107. goUserSgin() {
  108. uni.navigateTo({
  109. url: '/pages/users/user_sgin/index'
  110. })
  111. },
  112. getSign() {
  113. getSign().then(res => {
  114. this.continuousSignDays = res.data.continuousSignDays;
  115. this.sign_give_point = res.data.signGivePoint;
  116. this.signList = res.data.signList[0];
  117. });
  118. },
  119. },
  120. }
  121. </script>
  122. <style lang="scss" scoped>
  123. .signIn {
  124. padding: 24rpx;
  125. border-radius: 0rpx 0rpx 16rpx 16rpx;
  126. background: #FFFFFF;
  127. .week-wrap {
  128. height: 156rpx;
  129. border-radius: 16rpx;
  130. background: linear-gradient(to right, #FFE8F5, #F1FBFD);
  131. .week {
  132. flex: 1;
  133. font-weight: 500;
  134. font-size: 22rpx;
  135. line-height: 30rpx;
  136. color: #999999;
  137. .item {
  138. flex: 1;
  139. }
  140. .image {
  141. width: 48rpx;
  142. margin-bottom: 16rpx;
  143. }
  144. }
  145. .button {
  146. width: 88rpx;
  147. height: 48rpx;
  148. border-radius: 24rpx;
  149. margin: 0 20rpx;
  150. background: linear-gradient(90deg, var(--view-theme) 0%, var(--view-gradient) 100%);
  151. text-align: center;
  152. font-size: 24rpx;
  153. line-height: 48rpx;
  154. color: #FFFFFF;
  155. }
  156. }
  157. .text-wrap {
  158. height: 140rpx;
  159. border-radius: 16rpx;
  160. background: #FFFFFF;
  161. .image {
  162. width: 88rpx;
  163. height: 88rpx;
  164. margin-left: 20rpx;
  165. }
  166. .text {
  167. flex: 1;
  168. padding: 0 20rpx;
  169. font-size: 24rpx;
  170. color: #999999;
  171. }
  172. .name-wrap {
  173. margin-bottom: 14rpx;
  174. }
  175. .name {
  176. font-weight: 500;
  177. font-size: 30rpx;
  178. color: #282828;
  179. }
  180. .num {
  181. border-radius: 16rpx;
  182. margin-left: 4rpx;
  183. background: var(--view-theme);
  184. font-size: 20rpx;
  185. line-height: 32rpx;
  186. color: var(--view-theme);
  187. .inner {
  188. height: 32rpx;
  189. padding: 0 6rpx 0 8rpx;
  190. border-radius: 16rpx;
  191. }
  192. .opacity {
  193. background: rgba(255, 255, 255, 0.9);
  194. }
  195. }
  196. .icon {
  197. width: 24rpx;
  198. height: 24rpx;
  199. }
  200. .button {
  201. width: 140rpx;
  202. height: 52rpx;
  203. border-radius: 26rpx;
  204. margin: 0 20rpx;
  205. background: linear-gradient(90deg, var(--view-theme) 0%, var(--view-gradient) 100%);
  206. text-align: center;
  207. font-size: 24rpx;
  208. line-height: 52rpx;
  209. color: #FFFFFF;
  210. }
  211. }
  212. }
  213. </style>