| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- <template>
- <view class="body">
- <view class="content">
- <view class="top">
- <image class="logo" mode="aspectFit" src="/static/logo.png"></image>
- <image class="right-logo" mode="aspectFit" src="/static/40.png"></image>
- </view>
- <view class="main">
- <view class="main-content">
- <view class="rank">
- <view class="statistic">
- <text class="statistic-title">总用时:</text>
- <view class="statistic-right">
- <text class="statistic-value">{{durationMin}}</text><text
- class="statistic-unit">min</text>
- </view>
- </view>
- <view class="statistic">
- <text class="statistic-title">总里程:</text>
- <view class="statistic-right">
- <text class="statistic-value">{{distanceKm}}</text><text
- class="statistic-unit">Km</text>
- </view>
- </view>
- <view class="statistic">
- <text class="statistic-title">脑力值:</text>
- <view class="statistic-right">
- <text class="statistic-value">{{accuracy}}</text><text class="statistic-unit">%</text>
- </view>
- </view>
- </view>
- <text class="name">{{nameSub}}</text>
- </view>
- </view>
- <!-- <view class="bottom">
- <view class="bottom-left">
- <image src="../../static/medal.webp" class="medal" mode="aspectFit"></image>
- <text class="medal_count">x{{syscount}}</text>
- </view>
- <view class="bottom-right">
- <text class="bottom-text">提示:</text>
- <text class="bottom-text">可以在“成就”中查看详细数据</text>
- </view>
- </view> -->
- </view>
-
- <my-fab></my-fab>
- </view>
- </template>
- <script>
- import tools from '../../common/tools';
- export default {
- data() {
- return {
- status: "", // success: 挑战成功, ok: 挑战完成(没在规定时间完成,但打了所有点), fail: 挑战结束
- name: "", // 用户名
- duration: 0, // 总用时,秒
- distance: 0, // 总里程,米
- cal: 0, // 卡路里,卡 int
- accuracy: 0, // 脑力值百分比
- syscount: 0 // 点数
- }
- },
- computed: {
- nameSub() {
- const maxlen = 8;
- const nameLen = tools.calStrLen(this.name);
- console.log('nameLen', nameLen);
- if (nameLen <= 6) {
- return '选手: ' + this.name;
- }
- // else if (nameLen >= maxlen) {
- // return this.name.substring(0,maxlen-1) + '...';
- // }
- else {
- return this.name;
- }
- },
- durationMin() {
- return Math.round(this.duration * 10 / 60) / 10;
- },
- distanceKm() {
- return Math.round(this.distance * 10 / 1000) / 10;
- }
- },
- onLoad(event) { // 类型非必填,可自动推导
- console.log('[challenge result] onLoad');
- this.status = event["status"] ?? "";
- this.name = event["name"] ?? "";
- this.duration = event["duration"] ?? 0;
- this.distance = event["distance"] ?? 0;
- this.cal = event["cal"] ?? 0;
- this.accuracy = event["accuracy"] ?? 0;
- this.syscount = event["syscount"] ?? 0;
- },
- methods: {
- }
- }
- </script>
- <style>
- .body {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- }
- .content {
- width: 750rpx;
- /* margin: 0 auto; */
- }
- .top {
- width: 100%;
- height: 10vh;
- padding: 0 60rpx;
- flex-direction: row;
- align-items: center;
- justify-content: space-between;
- }
- .logo {
- width: 183rpx;
- height: 52rpx;
- }
- .right-logo {
- width: 75rpx;
- height: 52rpx;
- }
- .main {
- width: 100%;
- flex-direction: column;
- justify-content: flex-start;
- }
- .main-content {
- /* width: 100%; */
- /* height: 570px; */
- margin-top: 25rpx;
- margin-bottom: 10rpx;
- height: 1100rpx;
- background-image: url("/static/challenge/success_bg.webp");
- background-repeat: no-repeat;
- background-position-x: center;
- background-position-y: top;
- background-size: contain;
- }
- .rank {
- width: 530rpx;
- margin-left: 100rpx;
- margin-top: 748rpx;
- }
- .name {
- width: 246rpx;
- /* 确保文本在一行内显示 */
- white-space: nowrap;
- /* 超出容器部分的文本隐藏起来 */
- overflow: hidden;
- /* 使用省略号表示被截断的文本 */
- /* text-overflow: ellipsis; */
- text-align: center;
- margin-left: 196rpx;
- margin-top: 36rpx;
- font-family: Source Han Sans CN;
- font-weight: 500;
- font-size: 36rpx;
- color: #ffffff;
- }
- .statistic {
- height: 73.9rpx;
- flex-direction: row;
- align-items: center;
- justify-content: space-between;
- }
- .statistic-right {
- flex-direction: row;
- align-items: baseline;
- }
- .statistic-title {
- font-family: Source Han Sans CN;
- font-weight: 500;
- font-size: 46rpx;
- color: #ffffff;
- }
- .statistic-value {
- font-family: Source Han Sans CN;
- font-weight: 700;
- font-size: 56rpx;
- color: #ffffff;
- font-weight: bold;
- }
- .statistic-unit {
- font-family: Source Han Sans CN;
- font-size: 40rpx;
- color: #ffffff;
- padding-left: 10rpx;
- }
- /* .bottom {
- width: 100%;
- flex-direction: row;
- justify-content: space-between;
- padding: 30px 30px 30px 30px;
- }
- .bottom-left {
- flex-direction: row;
- justify-content: flex-start;
- }
- .bottom-right {
- width: 116px;
- flex-direction: column;
- justify-content: center;
- }
- .medal {
- width: 78px;
- height: 81px;
- margin-right: 10px;
- }
- .medal_count {
- font-family: Source Han Sans CN;
- font-weight: 900;
- color: #ffee29;
- font-size: 50px;
- margin-top: 10px;
- }
- .bottom-text {
- line-height: normal;
- font-family: Source Han Sans CN;
- font-weight: 500;
- font-size: 12px;
- color: #ffffff;
- } */
- </style>
|