success.uvue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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: 390px;
  107. /* margin: 0 auto; */
  108. }
  109. .top {
  110. width: 100%;
  111. height: 10vh;
  112. padding: 0 36px;
  113. flex-direction: row;
  114. align-items: center;
  115. justify-content: space-between;
  116. }
  117. .logo {
  118. width: 91.5px;
  119. height: 26px;
  120. }
  121. .right-logo {
  122. width: 37.5px;
  123. height: 26px;
  124. }
  125. .main {
  126. width: 100%;
  127. height: 90vh;
  128. flex-direction: column;
  129. justify-content: flex-start;
  130. }
  131. .main-content {
  132. height: 570px;
  133. margin-top: 20px;
  134. background-image: url("/static/challenge/success_bg.webp");
  135. background-repeat: no-repeat;
  136. background-position-x: center;
  137. background-position-y: center;
  138. background-size: contain;
  139. }
  140. .rank {
  141. width: 292px;
  142. margin-left: 43px;
  143. margin-top: 386px;
  144. }
  145. .name {
  146. width: 125px;
  147. /* 确保文本在一行内显示 */
  148. white-space: nowrap;
  149. /* 超出容器部分的文本隐藏起来 */
  150. overflow: hidden;
  151. /* 使用省略号表示被截断的文本 */
  152. /* text-overflow: ellipsis; */
  153. text-align: center;
  154. margin-left: 103px;
  155. margin-top: 19px;
  156. font-family: Source Han Sans CN;
  157. font-weight: 500;
  158. font-size: 18px;
  159. color: #ffffff;
  160. }
  161. .statistic {
  162. height: 38.8px;
  163. flex-direction: row;
  164. align-items: center;
  165. justify-content: space-between;
  166. }
  167. .statistic-right {
  168. flex-direction: row;
  169. align-items: baseline;
  170. }
  171. .statistic-title {
  172. font-family: Source Han Sans CN;
  173. font-weight: 500;
  174. font-size: 23px;
  175. color: #ffffff;
  176. }
  177. .statistic-value {
  178. font-family: Source Han Sans CN;
  179. font-weight: 700;
  180. font-size: 28px;
  181. color: #ffffff;
  182. font-weight: bold;
  183. }
  184. .statistic-unit {
  185. font-family: Source Han Sans CN;
  186. font-size: 20px;
  187. color: #ffffff;
  188. padding-left: 5px;
  189. }
  190. .bottom {
  191. width: 100%;
  192. flex-direction: row;
  193. justify-content: space-between;
  194. padding: 30px 30px 30px 30px;
  195. }
  196. .bottom-left {
  197. flex-direction: row;
  198. justify-content: flex-start;
  199. }
  200. .bottom-right {
  201. width: 116px;
  202. flex-direction: column;
  203. justify-content: center;
  204. }
  205. /*.medal {
  206. width: 78px;
  207. height: 81px;
  208. margin-right: 10px;
  209. }
  210. .medal_count {
  211. font-family: Source Han Sans CN;
  212. font-weight: 900;
  213. color: #ffee29;
  214. font-size: 50px;
  215. margin-top: 10px;
  216. }
  217. .bottom-text {
  218. line-height: normal;
  219. font-family: Source Han Sans CN;
  220. font-weight: 500;
  221. font-size: 12px;
  222. color: #ffffff;
  223. } */
  224. </style>