| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380 |
- <!--
- http://localhost:5173/custom/#/pages/yuedong/challenge/success?id=13&matchType=3&pagetype=challenge_result&status=success&name=天生我材必有用
- http://localhost:5174/custom/#/pages/yuedong/challenge/success?actId=18&matchType=3&pagetype=challenge_result&distance=1320&status=success&name=天生我材必有用&cal=13500100&duration=3600&accuracy=50&syscount=25
- https://oss-mbh5.colormaprun.com/custom/#/pages/yuedong/challenge/index?pagetype=challenge_result&distance=1320&status=success&name=天生我材必有用&cal=13500100&duration=3600&accuracy=50&syscount=25
- -->
- <template>
- <view class="body">
- <view class="content">
- <view class="topBg"></view>
- <view class="top uni-column">
- <view class="topLogo"></view>
- </view>
- <view class="main">
- <view class="main-content">
- <view class="namebox uni-column">
- <image class="nameLogo" mode="aspectFit" src="/static/yuedong/challenge/logo.png"></image>
- <text class="name">{{nameSub}}</text>
- </view>
- <view class="rank">
- <image class="rankTopLogo" mode="aspectFit" src="/static/yuedong/challenge/yuedong.png"></image>
- <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">{{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">{{accuracy}}</text><text class="statistic-unit">%</text>
- </view>
- </view>
- <view class="statistic">
- <text class="statistic-title">悦动豆:</text>
- <view class="statistic-right">
- <text class="statistic-value">{{syscount}}</text><text class="statistic-unit"></text>
- </view>
- </view>
- <image class="rankBtmLogo" mode="aspectFit" src="/static/yuedong/challenge/rfydpz.png"></image>
- </view>
- </view>
- </view>
- <!-- <view class="btnRankList" @click="btnRankList">点击查看排行榜</view> -->
- </view>
- <my-fab></my-fab>
- </view>
- </template>
- <script>
- import tools from '/common/tools';
- import {
- token,
- apiCardUrlQuery,
- apiMatchFininshInfoQuery,
- checkResCode
- } from '/common/api';
- export default {
- data() {
- return {
- token: "",
- matchType: 0, // 游戏类型 1 普通活动 2 线下赛 3 线上赛
- ecId: 0, // 卡片id
- ecName: "", // 卡片名称
- logo: "",
- sublogo: "",
- subTitle: "",
- accuracyLable: "",
- status: "", // success: 挑战成功, ok: 挑战完成(没在规定时间完成,但打了所有点), fail: 挑战结束
- name: "", // 用户名
- duration: 0, // 总用时,秒
- distance: 0, // 总里程,米
- cal: 0, // 卡路里,卡 int
- accuracy: 0, // 脑力值百分比
- syscount: 0, // 点数
- actId: 0, // 活动或关联id
- urlRs: [], // Url集合
- }
- },
- computed: {
- nameSub() {
- return this.name;
- /* const nameLen = tools.calStrLen(this.name);
- console.log('nameLen', nameLen);
- if (nameLen <= 10) {
- 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.token = event["token"] ?? token;
- this.actId = event["id"] ?? 0;
- this.matchType = event["matchType"] ?? 0;
- this.logo = event["logo"] ?? "logo.webp";
- this.logo = "/static/shanda/" + this.logo;
- this.sublogo = event["sublogo"] ?? "";
- if (this.sublogo != "") {
- this.sublogo = "/static/shanda/" + this.sublogo;
- }
- this.subTitle = event["subTitle"] ?? "";
- this.accuracyLable = event["accuracyLable"] ?? "校园文化";
- 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;
- // console.log("event:", JSON.stringify(event));
- // uni.showToast({
- // title: 'event:' + JSON.stringify(event),
- // icon: 'none',
- // duration: 10000
- // });
- // this.cardUrlQuery();
- this.matchFininshInfoQuery();
- },
- methods: {
- // 根据游戏id查询卡片信息
- cardUrlQuery() {
- uni.request({
- url: apiCardUrlQuery,
- header: {
- "Content-Type": "application/x-www-form-urlencoded",
- "token": this.token,
- },
- method: "POST",
- data: {
- actId: this.actId,
- matchType: this.matchType
- },
- success: (res) => {
- // console.log("cardUrlQuery", res);
- if (res.data.code == 0) {
- const data = res.data.data;
- this.ecId = data.ecId;
- this.ecName = data.ecName;
- this.urlRs = data.urlRs;
- }
- },
- fail: (err) => {
- console.log("cardUrlQuery err", err);
- },
- });
- },
- // 查询赛事结束显示信息
- matchFininshInfoQuery() {
- uni.request({
- url: apiMatchFininshInfoQuery,
- header: {
- "Content-Type": "application/x-www-form-urlencoded",
- "token": this.token,
- },
- method: "POST",
- data: {
- actId: this.actId,
- matchType: this.matchType
- },
- success: (res) => {
- console.log("matchFininshInfoQuery", res);
- if (res.data.code == 0) {
- const data = res.data.data.finishInfo;
- this.duration = data.totalTime;
- this.distance = data.distance;
- this.accuracy = data.rightAnswerPer;
- this.syscount = data.sysScore;
- }
- },
- fail: (err) => {
- console.log("matchFininshInfoQuery err", err);
- },
- });
- },
- btnRankList() {
- // console.log("urlRs", this.urlRs);
- // const rankListUrl = this.urlRs.find(item => item.name === 'rankListUrl');
- const rankListUrl = this.urlRs.rankListUrl;
- // console.log("rankListUrl", rankListUrl);
- if (rankListUrl != null) {
- let url = "";
- if (rankListUrl.indexOf('?') !== -1) {
- url = rankListUrl + '&token=' + this.token + '&id=' + this.ecId;
- } else {
- url = rankListUrl + '?token=' + this.token + '&id=' + this.ecId;
- }
- console.log("url", url);
- // uni.navigateTo({
- // url: url
- // });
- window.location.href = url;
- } else {
- uni.showToast({
- // title: '网址错误:' + rankListUrl,
- title: '请升级APP到最新版才能查看排行榜',
- icon: 'none',
- duration: 3000
- });
- }
- }
- }
- }
- </script>
- <style>
- .body {
- background-color: #2d2d2d;
- }
- .content {
- position: relative;
- width: 750rpx;
- min-height: 100vh;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: flex-end;
- }
-
- .topBg {
- position: absolute;
- top: 0;
- z-index: 1;
- width: 100%;
- height: 60vh;
- background-color: #c7e848;
- }
- .top {
- z-index: 10;
- width: 100%;
- height: 72vh;
- background-image: url("/static/yuedong/challenge/success_bg.png");
- background-repeat: no-repeat;
- background-position-x: center;
- background-position-y: bottom;
- background-size: 100% auto;
- }
- .topLogo {
- z-index: 10;
- width: 100%;
- height: 8vh;
- background-image: url("/static/yuedong/challenge/logo2.png");
- background-repeat: no-repeat;
- background-position-x: 40rpx;
- background-position-y: bottom;
- background-size: 360rpx auto;
- }
- .main {
- width: 100%;
- height: 28vh;
- flex-direction: column;
- justify-content: flex-start;
- align-items: center;
- }
- .main-content {
- display: flex;
- flex-direction: row;
- width: 100%;
- /* height: 400rpx; */
- }
- .namebox {
- width: 330rpx;
- margin-top: 40rpx;
- }
- .nameLogo {
- width: 200rpx;
- height: 200rpx;
- }
- .name {
- width: 280rpx;
- white-space: nowrap;
- overflow: hidden;
- text-align: center;
- margin-top: 10rpx;
- margin-left: 20rpx;
- font-family: Source Han Sans CN;
- font-weight: 500;
- font-size: 32rpx;
- color: #ffffff;
- }
- .rank {
- margin-left: 20rpx;
- margin-top: 0rpx;
- }
- .rankTopLogo {
- width: 300rpx;
- height: 120rpx;
- }
- .rankBtmLogo {
- width: 320rpx;
- height: 50rpx;
- margin-left: 5rpx;
- }
-
- .statistic {
- margin-left: 10rpx;
- height: 30rpx;
- margin-bottom: 16rpx;
- flex-direction: row;
- align-items: center;
- justify-content: flex-start;
- }
- .statistic-right {
- flex-direction: row;
- align-items: baseline;
- }
- .statistic-title {
- font-family: Source Han Sans CN;
- font-weight: 500;
- font-size: 28rpx;
- color: #ffffff;
- }
- .statistic-value {
- font-family: Source Han Sans CN;
- font-size: 28rpx;
- color: #ffffff;
- font-weight: bold;
- }
- .statistic-unit {
- font-family: Source Han Sans CN;
- font-size: 25rpx;
- color: #ffffff;
- padding-left: 10rpx;
- }
- .btnRankList {
- /* opacity: 30%; */
- width: 194px;
- height: 35px;
- margin-bottom: 60rpx;
- background: #b0352e;
- border-radius: 18px;
- align-items: center;
- color: #ffffff;
- font-size: 16px;
- line-height: 32px;
- }
- </style>
|