Commit 79b17618 authored by Facius's avatar Facius

improvement: 分数页面百分比计算

parent 5d16abe4
...@@ -60,7 +60,7 @@ export default { ...@@ -60,7 +60,7 @@ export default {
} }
}, },
defaultImage() { defaultImage() {
return process.uniEnv.qn_base_url + 'morentouxiang.png' return process.uniEnv.qn_base_url + 'morentouxiang-w.png'
}, },
buttonStyle() { buttonStyle() {
return { return {
......
...@@ -8,13 +8,16 @@ ...@@ -8,13 +8,16 @@
:border-bottom="false" :border-bottom="false"
title-bold title-bold
></u-navbar> ></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 考试错题已自动加入<text class="blue-text">"错题记录"</text> 方便练习</view
> >
<view class="content"> <view :class="['content', { 'is-full': isFull }]">
<view class="content-view"> <view class="content-view">
<image mode="widthFix" class="back-image" :src="backImage"></image> <image mode="widthFix" class="back-image" :src="backImage"></image>
<view class="chart-view"> <view class="chart-view">
<CircleProgress <CircleProgress
class="progress-view" class="progress-view"
...@@ -28,7 +31,7 @@ ...@@ -28,7 +31,7 @@
<view class="progress-content"> <view class="progress-content">
<view class="progress-score">{{ info.score }}</view> <view class="progress-score">{{ info.score }}</view>
<view class="progress-info">{{ resultText }}</view> <view class="progress-info">{{ resultText }}</view>
<view class="percent-text">超越了{{ info.percent }}%的学员</view> <view class="percent-text">超越了{{ falsePercent }}%的学员</view>
</view> </view>
</CircleProgress> </CircleProgress>
</view> </view>
...@@ -111,8 +114,11 @@ export default { ...@@ -111,8 +114,11 @@ export default {
borderRadius: '24rpx', borderRadius: '24rpx',
} }
}, },
isFull() {
return this.info.score >= 100
},
isPass() { isPass() {
return this.info.score > 60 return this.info.score >= 60
}, },
resultText() { resultText() {
return this.isPass ? '合格' : '不合格' return this.isPass ? '合格' : '不合格'
...@@ -135,13 +141,30 @@ export default { ...@@ -135,13 +141,30 @@ export default {
weixinImage() { weixinImage() {
return process.uniEnv.qn_base_url + 'weixin.png' 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() { onLoad() {
this.info = { this.info = {
name: '我就是昵称', name: '我就是昵称',
image: '', image: '',
score: 80, score: 74,
percent: 60,
time: 1626402760689, time: 1626402760689,
category: '高处安装、维护、拆除作业人员', category: '高处安装、维护、拆除作业人员',
type: '模拟考试', type: '模拟考试',
...@@ -181,13 +204,18 @@ export default { ...@@ -181,13 +204,18 @@ export default {
.content { .content {
height: 100%; height: 100%;
overflow: auto; overflow: auto;
padding: 64rpx 48rpx 56rpx 48rpx; padding: 64rpx 48rpx 44rpx 48rpx;
&.is-full {
padding-top: 0rpx;
border-radius: 24rpx;
}
.content-view { .content-view {
background-color: #ffffff; background-color: #ffffff;
border-radius: 24rpx; border-radius: 24rpx;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
z-index: 1; z-index: 1;
padding-bottom: 36rpx;
.back-image { .back-image {
position: absolute; position: absolute;
width: 100%; 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