Commit 79b17618 authored by Facius's avatar Facius

improvement: 分数页面百分比计算

parent 5d16abe4
......@@ -60,7 +60,7 @@ export default {
}
},
defaultImage() {
return process.uniEnv.qn_base_url + 'morentouxiang.png'
return process.uniEnv.qn_base_url + 'morentouxiang-w.png'
},
buttonStyle() {
return {
......
......@@ -8,13 +8,16 @@
:border-bottom="false"
title-bold
></u-navbar>
<view class="top-view" @click="$u.throttle(handleClickRecord, 500)">
<view
class="top-view"
v-if="!isFull"
@click="$u.throttle(handleClickRecord, 500)"
>
考试错题已自动加入<text class="blue-text">"错题记录"</text> 方便练习</view
>
<view class="content">
<view :class="['content', { 'is-full': isFull }]">
<view class="content-view">
<image mode="widthFix" class="back-image" :src="backImage"></image>
<view class="chart-view">
<CircleProgress
class="progress-view"
......@@ -28,7 +31,7 @@
<view class="progress-content">
<view class="progress-score">{{ info.score }}</view>
<view class="progress-info">{{ resultText }}</view>
<view class="percent-text">超越了{{ info.percent }}%的学员</view>
<view class="percent-text">超越了{{ falsePercent }}%的学员</view>
</view>
</CircleProgress>
</view>
......@@ -111,8 +114,11 @@ export default {
borderRadius: '24rpx',
}
},
isFull() {
return this.info.score >= 100
},
isPass() {
return this.info.score > 60
return this.info.score >= 60
},
resultText() {
return this.isPass ? '合格' : '不合格'
......@@ -135,13 +141,30 @@ export default {
weixinImage() {
return process.uniEnv.qn_base_url + 'weixin.png'
},
// 模考成绩60分以下则百分数在55%—65% 区间内取随机值;
// 模考成绩大于60分小于80分则百分数在66%—85% 区间内取随机值;
// 模考成绩大于80分小于90分则百分数在86%—93% 区间内取随机值;
// 模考成绩大于90分小于100分则百分数在94%—99% 区间内取随机值)
falsePercent() {
var random = [94, 99]
if (this.info.score < 60) {
random = [55, 65]
} else if (this.info.score >= 60 && this.info.score < 80) {
random = [66, 85]
} else if (this.info.score >= 80 && this.info.score < 90) {
random = [86, 93]
} else if (this.info.score >= 90) {
random = [94, 99]
}
return this.$u.random(random[0], random[1])
},
},
onLoad() {
this.info = {
name: '我就是昵称',
image: '',
score: 80,
percent: 60,
score: 74,
time: 1626402760689,
category: '高处安装、维护、拆除作业人员',
type: '模拟考试',
......@@ -181,13 +204,18 @@ export default {
.content {
height: 100%;
overflow: auto;
padding: 64rpx 48rpx 56rpx 48rpx;
padding: 64rpx 48rpx 44rpx 48rpx;
&.is-full {
padding-top: 0rpx;
border-radius: 24rpx;
}
.content-view {
background-color: #ffffff;
border-radius: 24rpx;
position: relative;
overflow: hidden;
z-index: 1;
padding-bottom: 36rpx;
.back-image {
position: absolute;
width: 100%;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment