success.uvue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <view class="body">
  3. <view class="content">
  4. <view class="top">
  5. <image class="logo" mode="aspectFit" src="/static/logo.png"></image>
  6. <image class="right-logo" mode="aspectFit" src="/static/40.png"></image>
  7. </view>
  8. <view class="main">
  9. <view class="main-content">
  10. <view class="rank">
  11. <view class="statistic">
  12. <text class="statistic-title">总用时:</text>
  13. <view class="statistic-right">
  14. <text class="statistic-value">{{durationMin}}</text><text
  15. class="statistic-unit">min</text>
  16. </view>
  17. </view>
  18. <view class="statistic">
  19. <text class="statistic-title">总里程:</text>
  20. <view class="statistic-right">
  21. <text class="statistic-value">{{distanceKm}}</text><text
  22. class="statistic-unit">Km</text>
  23. </view>
  24. </view>
  25. <view class="statistic">
  26. <text class="statistic-title">脑力值:</text>
  27. <view class="statistic-right">
  28. <text class="statistic-value">{{accuracy}}</text><text class="statistic-unit">%</text>
  29. </view>
  30. </view>
  31. </view>
  32. <text class="name">{{nameSub}}</text>
  33. </view>
  34. </view>
  35. <!-- <view class="bottom">
  36. <view class="bottom-left">
  37. <image src="../../static/medal.webp" class="medal" mode="aspectFit"></image>
  38. <text class="medal_count">x{{syscount}}</text>
  39. </view>
  40. <view class="bottom-right">
  41. <text class="bottom-text">提示:</text>
  42. <text class="bottom-text">可以在“成就”中查看详细数据</text>
  43. </view>
  44. </view> -->
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. import tools from '../../common/tools';
  50. export default {
  51. data() {
  52. return {
  53. status: "", // success: 挑战成功, ok: 挑战完成(没在规定时间完成,但打了所有点), fail: 挑战结束
  54. name: "", // 用户名
  55. duration: 0, // 总用时,秒
  56. distance: 0, // 总里程,米
  57. cal: 0, // 卡路里,卡 int
  58. accuracy: 0, // 脑力值百分比
  59. syscount: 0 // 点数
  60. }
  61. },
  62. computed: {
  63. nameSub() {
  64. const maxlen = 8;
  65. const nameLen = tools.calStrLen(this.name);
  66. console.log('nameLen', nameLen);
  67. if (nameLen <= 6) {
  68. return '选手: ' + this.name;
  69. }
  70. // else if (nameLen >= maxlen) {
  71. // return this.name.substring(0,maxlen-1) + '...';
  72. // }
  73. else {
  74. return this.name;
  75. }
  76. },
  77. durationMin() {
  78. return Math.round(this.duration * 10 / 60) / 10;
  79. },
  80. distanceKm() {
  81. return Math.round(this.distance * 10 / 1000) / 10;
  82. }
  83. },
  84. onLoad(event) { // 类型非必填,可自动推导
  85. console.log('[challenge result] onLoad');
  86. this.status = event["status"] ?? "";
  87. this.name = event["name"] ?? "";
  88. this.duration = event["duration"] ?? 0;
  89. this.distance = event["distance"] ?? 0;
  90. this.cal = event["cal"] ?? 0;
  91. this.accuracy = event["accuracy"] ?? 0;
  92. this.syscount = event["syscount"] ?? 0;
  93. },
  94. methods: {
  95. }
  96. }
  97. </script>
  98. <style>
  99. .body {
  100. display: flex;
  101. flex-direction: column;
  102. align-items: center;
  103. justify-content: center;
  104. }
  105. .content {
  106. width: 750rpx;
  107. /* margin: 0 auto; */
  108. }
  109. .top {
  110. width: 100%;
  111. height: 10vh;
  112. padding: 0 60rpx;
  113. flex-direction: row;
  114. align-items: center;
  115. justify-content: space-between;
  116. }
  117. .logo {
  118. width: 183rpx;
  119. height: 52rpx;
  120. }
  121. .right-logo {
  122. width: 75rpx;
  123. height: 52rpx;
  124. }
  125. .main {
  126. width: 100%;
  127. flex-direction: column;
  128. justify-content: flex-start;
  129. }
  130. .main-content {
  131. /* width: 100%; */
  132. /* height: 570px; */
  133. margin-top: 25rpx;
  134. margin-bottom: 10rpx;
  135. height: 1100rpx;
  136. background-image: url("/static/challenge/success_bg.webp");
  137. background-repeat: no-repeat;
  138. background-position-x: center;
  139. background-position-y: top;
  140. background-size: contain;
  141. }
  142. .rank {
  143. width: 530rpx;
  144. margin-left: 100rpx;
  145. margin-top: 748rpx;
  146. }
  147. .name {
  148. width: 246rpx;
  149. /* 确保文本在一行内显示 */
  150. white-space: nowrap;
  151. /* 超出容器部分的文本隐藏起来 */
  152. overflow: hidden;
  153. /* 使用省略号表示被截断的文本 */
  154. /* text-overflow: ellipsis; */
  155. text-align: center;
  156. margin-left: 196rpx;
  157. margin-top: 36rpx;
  158. font-family: Source Han Sans CN;
  159. font-weight: 500;
  160. font-size: 36rpx;
  161. color: #ffffff;
  162. }
  163. .statistic {
  164. height: 73.9rpx;
  165. flex-direction: row;
  166. align-items: center;
  167. justify-content: space-between;
  168. }
  169. .statistic-right {
  170. flex-direction: row;
  171. align-items: baseline;
  172. }
  173. .statistic-title {
  174. font-family: Source Han Sans CN;
  175. font-weight: 500;
  176. font-size: 46rpx;
  177. color: #ffffff;
  178. }
  179. .statistic-value {
  180. font-family: Source Han Sans CN;
  181. font-weight: 700;
  182. font-size: 56rpx;
  183. color: #ffffff;
  184. font-weight: bold;
  185. }
  186. .statistic-unit {
  187. font-family: Source Han Sans CN;
  188. font-size: 40rpx;
  189. color: #ffffff;
  190. padding-left: 10rpx;
  191. }
  192. /* .bottom {
  193. width: 100%;
  194. flex-direction: row;
  195. justify-content: space-between;
  196. padding: 30px 30px 30px 30px;
  197. }
  198. .bottom-left {
  199. flex-direction: row;
  200. justify-content: flex-start;
  201. }
  202. .bottom-right {
  203. width: 116px;
  204. flex-direction: column;
  205. justify-content: center;
  206. }
  207. .medal {
  208. width: 78px;
  209. height: 81px;
  210. margin-right: 10px;
  211. }
  212. .medal_count {
  213. font-family: Source Han Sans CN;
  214. font-weight: 900;
  215. color: #ffee29;
  216. font-size: 50px;
  217. margin-top: 10px;
  218. }
  219. .bottom-text {
  220. line-height: normal;
  221. font-family: Source Han Sans CN;
  222. font-weight: 500;
  223. font-size: 12px;
  224. color: #ffffff;
  225. } */
  226. </style>