|
@@ -12,7 +12,7 @@
|
|
|
height="300"
|
|
|
type="2d"
|
|
|
></canvas>
|
|
|
- <view style="border:none" class="wxad">
|
|
|
+ <view style="border: none" class="wxad">
|
|
|
<ad
|
|
|
:ad-intervals="100"
|
|
|
ad-type="banner"
|
|
@@ -22,10 +22,19 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <view class="split"> </view>
|
|
|
+ <view class="history">
|
|
|
+ <view class="title">
|
|
|
+ <view class="title-left">考试情况</view>
|
|
|
+ <view class="title-right">历史成绩<van-icon name="arrow" size="26rpx" /></view>
|
|
|
+
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
@@ -51,6 +60,7 @@ export default {
|
|
|
const dpr = wx.getSystemInfoSync().pixelRatio;
|
|
|
canvas.width = res[0].width * dpr;
|
|
|
canvas.height = res[0].height * dpr;
|
|
|
+ ctx.dpr = dpr;
|
|
|
ctx.scale(dpr, dpr);
|
|
|
that.drawHalfCircleAndScore(ctx);
|
|
|
// ctx.fillRect(0, 0, 100, 100);
|
|
@@ -62,9 +72,19 @@ export default {
|
|
|
* @param ctx {WechatMiniprogram.CanvasContext}
|
|
|
*/
|
|
|
drawHalfCircleAndScore(ctx) {
|
|
|
- let x1 = 85;
|
|
|
+ console.log(ctx);
|
|
|
+ let x1 = ctx.canvas.width / ctx.dpr / 2;
|
|
|
let y1 = 100;
|
|
|
let r1 = 70;
|
|
|
+ //绘制白环
|
|
|
+ ctx.moveTo(x1, y1);
|
|
|
+ ctx.lineCap = "round";
|
|
|
+ ctx.lineWidth = 40;
|
|
|
+ ctx.strokeStyle = "#ffffff";
|
|
|
+ ctx.beginPath();
|
|
|
+ ctx.arc(x1, y1, r1, Math.PI, 0, false);
|
|
|
+ ctx.stroke();
|
|
|
+
|
|
|
//绘制灰环
|
|
|
ctx.moveTo(x1, y1);
|
|
|
ctx.lineCap = "round";
|
|
@@ -75,7 +95,7 @@ export default {
|
|
|
ctx.stroke();
|
|
|
// ctx.draw()
|
|
|
|
|
|
- //绘制渐变
|
|
|
+ //绘制渐变环
|
|
|
ctx.moveTo(x1, y1);
|
|
|
var arcColor = ctx.createLinearGradient(15, 125, 155, 125);
|
|
|
arcColor.addColorStop(0, "#FF6D4E");
|
|
@@ -89,24 +109,31 @@ export default {
|
|
|
console.log(ctx);
|
|
|
// ctx.draw()
|
|
|
//绘制文字
|
|
|
+
|
|
|
ctx.moveTo(x1, y1);
|
|
|
- ctx.textAlign = "center";
|
|
|
+ ctx.textAlign = "right";
|
|
|
ctx.lineWidth = 1;
|
|
|
ctx.font = "30px sans-serif";
|
|
|
+ let score = 0;
|
|
|
+ let scoreWidth = ctx.measureText(String(score)).width;
|
|
|
+ console.log(scoreWidth);
|
|
|
ctx.beginPath();
|
|
|
ctx.fillStyle = "#FF4D53";
|
|
|
- ctx.fillText("20", x1, y1);
|
|
|
+ ctx.fillText("100", x1 + 10, y1);
|
|
|
|
|
|
+ ctx.textAlign = "right";
|
|
|
ctx.font = "14px sans-serif";
|
|
|
- ctx.fillText("分", x1 + 25, y1);
|
|
|
- ctx.stroke();
|
|
|
+ ctx.fillText("分", x1 + 10 + scoreWidth, y1);
|
|
|
|
|
|
+ ctx.textAlign = "center";
|
|
|
ctx.font = "18px sans-serif";
|
|
|
ctx.fillStyle = "#333333";
|
|
|
ctx.fillText("很遗憾考试不合格", x1, y1 + 40);
|
|
|
- ctx.stroke();
|
|
|
},
|
|
|
},
|
|
|
+ components: {
|
|
|
+
|
|
|
+ },
|
|
|
};
|
|
|
</script>
|
|
|
|
|
@@ -117,6 +144,7 @@ export default {
|
|
|
background-image: url("https://ct.zzxcx.net/ctjk/mp-wx/threeExamScore/topBg.png");
|
|
|
background-size: 100%;
|
|
|
padding: 0 30rpx;
|
|
|
+
|
|
|
overflow-x: hidden;
|
|
|
.score {
|
|
|
background: #fff;
|
|
@@ -130,8 +158,33 @@ export default {
|
|
|
width: 340rpx;
|
|
|
height: 300rpx;
|
|
|
margin: 0 auto;
|
|
|
+ transform: translateY(-15%);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+.split {
|
|
|
+ width: 100%;
|
|
|
+ height: 20rpx;
|
|
|
+ border-bottom: 2rpx dashed #888;
|
|
|
+}
|
|
|
+.history {
|
|
|
+ background: #fff;
|
|
|
+ .title {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ padding-top: 40rpx;
|
|
|
+ padding-left: 30rpx;
|
|
|
+ padding-right: 30rpx;
|
|
|
+ font-size: 26rpx;
|
|
|
+ .title-left {
|
|
|
+ font-size: 34rpx;
|
|
|
+ color: #0a1a33;
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+ .title-right{
|
|
|
+ color: #8A9099;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|