signIn.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <v-page>
  3. <v-header>
  4. <template #title>
  5. <view>
  6. {{ $t("base.e9") }}
  7. <!-- <span class="color-theme-1">123</span> -->
  8. </view>
  9. </template>
  10. </v-header>
  11. <view class="layout-main p-x-lg">
  12. <view
  13. class="coin bg-panel-2 d-flex align-center justify-center container-tips"
  14. >
  15. <view class="tips"> {{ $t("base.f1") }} {{day_money}} {{ $t("base.f6") }}</view>
  16. <view class="money d-flex align-center justify-center">
  17. <img
  18. src="static/img/jinbi.png"
  19. class="money-img"
  20. mode=""
  21. /><view>{{qian_money}}</view>
  22. </view>
  23. </view>
  24. <view class="axn-7-20">
  25. {{ $t("base.f2") }} {{seven_money}} {{ $t("base.f7") }}
  26. </view>
  27. <view class="axn-list d-flex align-center justify-center">
  28. <view
  29. class="axn-list__item"
  30. v-for="item in 7"
  31. :key="item"
  32. :class="[
  33. item <=signInCount ? 'success' : 'default',
  34. ]"
  35. >
  36. <view>Day {{ item }}</view>
  37. <view>
  38. <img
  39. class="axn-list__status axn-list__status--default"
  40. src="static/img/jinbi.png"
  41. alt=""
  42. />
  43. <img
  44. class="axn-list__status axn-list__status--danger"
  45. src="static/img/close.png"
  46. alt=""
  47. />
  48. <img
  49. class="axn-list__status axn-list__status--success"
  50. src="static/img/dui.png"
  51. alt=""
  52. />
  53. </view>
  54. </view>
  55. </view>
  56. <view class="m-b-lg sign-btn">
  57. <v-button
  58. type="blue"
  59. block
  60. class="w-max rounded-md"
  61. key="loginbtn"
  62. @click="handleSubmit"
  63. >{{ $t("base.f0") }}</v-button
  64. >
  65. </view>
  66. </view>
  67. <van-toast id="van-toast" />
  68. </v-page>
  69. </template>
  70. <script>
  71. import Member from "@/api/member";
  72. export default {
  73. components: {},
  74. data() {
  75. return {
  76. secondaryShow: false,
  77. signInCount: 0, //已连续签到天数
  78. loadingSubmit:false,
  79. qian_money: 0,
  80. day_money: "4MED",
  81. seven_money: "10MED",
  82. };
  83. },
  84. onLoad() {
  85. this.init();
  86. },
  87. methods: {
  88. async handleSubmit() {
  89. if(this.loadingSubmit){
  90. return
  91. }
  92. uni.showLoading({
  93. title:"loading...",
  94. })
  95. this.$set(this,'loadingSubmit',true)
  96. try{
  97. let sign=await Member.sign();
  98. uni.hideLoading()
  99. this.init()
  100. }catch(e){
  101. uni.hideLoading();
  102. uni.showToast({
  103. title:e||"签到失败",
  104. icon:'none'
  105. })
  106. }
  107. this.$set(this,'loadingSubmit',false)
  108. },
  109. async init() {
  110. uni.showLoading({
  111. title:'loading...'
  112. })
  113. try {
  114. let signList = await Member.signList();
  115. this.$set(this,'signInCount',signList.data.days || 0)
  116. this.$set(this,'day_money',signList.data.sign_reward || "4MED")
  117. this.$set(this,'seven_money',signList.data.lx_sign_reward || "10MED")
  118. this.$set(this,'qian_money',signList.data.qian_money || 0)
  119. } catch (e) {
  120. uni.showToast({
  121. title: e || "网络错误",
  122. icon: "none",
  123. });
  124. }
  125. },
  126. },
  127. };
  128. </script>
  129. <style lang="scss" scoped>
  130. .container-tips {
  131. flex-direction: column;
  132. padding: 90rpx 0;
  133. .tips {
  134. font-family: PingFang-SC-Regular;
  135. font-size: 26rpx;
  136. font-weight: normal;
  137. font-stretch: normal;
  138. // color: rgba(#ffffff, 0.5);
  139. margin-bottom: 60rpx;
  140. }
  141. .money {
  142. font-size: 63rpx;
  143. color: #f9aa0d;
  144. .money-img {
  145. width: 50rpx;
  146. height: 50rpx;
  147. display: inline-block;
  148. margin-right: 10rpx;
  149. }
  150. }
  151. }
  152. .axn-7-20 {
  153. text-align: center;
  154. font-family: PingFang-SC-Medium;
  155. font-size: 26rpx;
  156. // color: rgba(#ffffff, 0.5);
  157. padding: 56rpx 128rpx 48rpx;
  158. }
  159. .axn-list {
  160. flex-wrap: wrap;
  161. .axn-list__item {
  162. box-sizing: border-box;
  163. width: 133rpx;
  164. background-blend-mode: normal, normal;
  165. border-radius: 10px;
  166. margin-bottom: 34rpx;
  167. text-align: center;
  168. margin-right: 30rpx;
  169. font-family: PingFang-SC-Medium;
  170. font-size: 30rpx;
  171. color: #ffffff;
  172. text-align: center;
  173. padding: 28rpx 0;
  174. &:nth-of-type(4) {
  175. margin-right: 0;
  176. }
  177. .axn-list__status--default,
  178. .axn-list__status--success,
  179. .axn-list__status--danger {
  180. display: none;
  181. }
  182. &.default {
  183. // background-image: $gradient-blue;
  184. background-image: var(--sign-in-default);
  185. .axn-list__status--default {
  186. display: inline-block;
  187. }
  188. }
  189. &.success {
  190. background-image: var(--sign-in-success);
  191. .axn-list__status--success {
  192. display: inline-block;
  193. }
  194. }
  195. &.danger {
  196. background: var(--sign-in-danger);
  197. .axn-list__status--danger {
  198. display: inline-block;
  199. }
  200. }
  201. }
  202. .axn-list__status {
  203. margin-top: 28rpx;
  204. width: 28rpx;
  205. height: 28rpx;
  206. }
  207. }
  208. .sign-btn {
  209. width: 344rpx;
  210. margin: 30rpx auto;
  211. }
  212. </style>