challenge.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <g-toast :is-show="isShowToast">
  3. <view class="challenge-num">
  4. <view class="challenage-num-top">
  5. <view class="challenage-num-body">
  6. <view class="challenge-num-item">
  7. <view>
  8. <text class="label">参加挑战:</text>
  9. <text class="spec">
  10. {{ userServerInfo.challenge_result.data.challenge_num || 0 }}
  11. </text>
  12. <text class="label">场</text>
  13. </view>
  14. <view>
  15. <text class="label">参加竞猜:</text>
  16. <text class="spec">
  17. {{ userServerInfo.challenge_result.data.guessing_num || 0 }}
  18. </text>
  19. <text class="label">场</text>
  20. </view>
  21. </view>
  22. <view class="challenge-num-item">
  23. <view>
  24. <text class="label">挑战成功:</text>
  25. <text class="spec">
  26. {{ userServerInfo.challenge_result.data.challenge_success || 0 }}
  27. </text>
  28. <text class="label">场</text>
  29. </view>
  30. <view>
  31. <text class="label">挑战失败:</text>
  32. <text class="spec">
  33. {{ userServerInfo.challenge_result.data.challenge_fail || 0 }}
  34. </text>
  35. <text class="label">场</text>
  36. </view>
  37. </view>
  38. <view class="challenge-num-item">
  39. <view>
  40. <text class="label">猜赢了:</text>
  41. <text class="spec">
  42. {{ userServerInfo.challenge_result.data.guessing_success || 0 }}
  43. </text>
  44. <text class="label">场</text>
  45. </view>
  46. <view>
  47. <text class="label">猜输了:</text>
  48. <text class="spec">
  49. {{ userServerInfo.challenge_result.data.guessing_fail || 0 }}
  50. </text>
  51. <text class="label">场</text>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. <view class="challenge-num-btn" @click="toChallenge">查看详情</view>
  57. </view>
  58. </g-toast>
  59. </template>
  60. <script>
  61. import { toClieckedToast } from "../../utils/api/toast.js"
  62. import GToast from "../../components/global/toast.vue"
  63. export default {
  64. components: {
  65. GToast
  66. },
  67. data() {
  68. return {
  69. serverUserInfo: uni.getStorageSync("serverUserInfo"),
  70. initToast: true
  71. }
  72. },
  73. computed: {
  74. isShowToast() {
  75. let { challenge_result } = this.serverUserInfo
  76. return this.initToast && challenge_result && challenge_result.type === 1
  77. }
  78. },
  79. methods: {
  80. toChallenge() {
  81. let { challenge_result } = this.serverUserInfo
  82. toClieckedToast({
  83. id: challenge_result.id
  84. }).then(res => {
  85. this.serverUserInfo.challenge_result = {}
  86. uni.setStorage({
  87. key: "serverUserInfo",
  88. data: this.serverUserInfo,
  89. success() {
  90. uni.navigateTo({
  91. url: "../../pages/challenge/index"
  92. })
  93. }
  94. })
  95. })
  96. }
  97. }
  98. }
  99. </script>
  100. <style scoped lang="scss">
  101. .challenge-num {
  102. display: flex;
  103. flex-direction: column;
  104. align-items: center;
  105. .challenage-num-top{
  106. width: 626rpx;
  107. height: 612rpx;
  108. background: url(https://api.jiuweiyun.cn/public/uploads/weapp/icon/challenge_res.png) center no-repeat;
  109. background-size: 100%;
  110. margin: 0 auto 94rpx auto;
  111. position: relative;
  112. .challenage-num-body {
  113. width: 570rpx;
  114. height: 385rpx;
  115. position: absolute;
  116. bottom: 28rpx;
  117. left: 28rpx;
  118. border-radius: 24rpx;
  119. padding: 84rpx 30rpx 44rpx 30rpx;
  120. display: flex;
  121. justify-content: space-between;
  122. flex-direction: column;
  123. box-sizing: border-box;
  124. .challenge-num-item {
  125. display: flex;
  126. align-items: center;
  127. justify-content: space-between;
  128. .label {
  129. color: #5D330D;
  130. font-size: 32rpx;
  131. margin-right: 10rpx;
  132. }
  133. .spec {
  134. color: #DD372D;
  135. font-size: 48rpx;
  136. }
  137. }
  138. }
  139. }
  140. .challenge-num-btn {
  141. width: 502rpx;
  142. height: 96rpx;
  143. border-radius: 96rpx;
  144. background: linear-gradient(180deg, #FEEB71 0%, #F89018 100%);
  145. color: #984100;
  146. font-size: 32rpx;
  147. font-weight: bold;
  148. line-height: 96rpx;
  149. text-align: center;
  150. }
  151. }
  152. </style>