success.uvue 5.0 KB

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