baseline: 小军 WMS 二开代码原始快照(含 SynOABusiness.cs Debugger.Break)
This commit is contained in:
commit
c2b0e7be0d
6522 files changed
+3530643
No files matched your search
@@ -0,0 +1,149 @@
|
||||
<template>
|
||||
<view class="progress_box" ref="progress_box" id="progress_box">
|
||||
<canvas class="progress_bg" canvas-id="cpbg" id="cpbg"></canvas>
|
||||
<canvas class="progress_bar" canvas-id="cpbar" id="cpbar"></canvas>
|
||||
<view class="progress_txt">
|
||||
<text v-if="progressNo!=100">完成{{completedCount}}</text>
|
||||
<text v-if="progressNo!=100">一共{{allCount}}</text>
|
||||
<text v-if="progressNo==100">全部完成</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props:{
|
||||
completedCount:{
|
||||
type: Number,
|
||||
default:0
|
||||
},
|
||||
allCount:{
|
||||
type: Number,
|
||||
default:0
|
||||
}
|
||||
},
|
||||
|
||||
watch:{
|
||||
completedCount(val, oldVal){
|
||||
this.drawCircle(this.progress_txt);
|
||||
},
|
||||
allCount(val, oldVal){
|
||||
this.drawCircle(this.progress_txt);
|
||||
}
|
||||
},
|
||||
|
||||
mounted: function() {
|
||||
this.drawProgressbg();
|
||||
this.drawCircle(this.progress_txt); //参数为1-100
|
||||
},
|
||||
|
||||
computed: {
|
||||
progressNo(){
|
||||
if(this.allCount == 0) {
|
||||
return 0;
|
||||
}
|
||||
return Math.round(this.completedCount/this.allCount*100);
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
drawProgressbg: function() {
|
||||
let lineWidth = 8;
|
||||
let width = document.getElementById('progress_box').offsetWidth;
|
||||
let height = document.getElementById('progress_box').offsetHeight;
|
||||
document.getElementById('cpbg').style.height = height + "px";
|
||||
document.getElementById('cpbg').style.width = width + "px";
|
||||
let cx = width / 2;
|
||||
let cy = height / 2;
|
||||
let r = cx<cy?cx- lineWidth:cy- lineWidth;
|
||||
// 自定义组件实例 this ,表示在这个自定义组件下查找拥有 canvas-id 的 <canvas/>
|
||||
var ctx = uni.createCanvasContext('cpbg', this);
|
||||
ctx.setLineWidth(lineWidth); // 设置圆环的宽度
|
||||
ctx.setStrokeStyle('#E9E9E9'); // 设置圆环的颜色
|
||||
ctx.setLineCap('round'); // 设置圆环端点的形状
|
||||
ctx.beginPath(); //开始一个新的路径
|
||||
ctx.arc(cx, cy, r, 0.75 * Math.PI, 0.25 * Math.PI, false);
|
||||
//设置一个原点(110,110),半径为100的圆的路径到当前路径
|
||||
ctx.stroke(); //对当前路径进行描边
|
||||
ctx.draw();
|
||||
},
|
||||
drawCircle: function(step) {
|
||||
let lineWidth = 8;
|
||||
let width = document.getElementById('progress_box').offsetWidth;
|
||||
let height = document.getElementById('progress_box').offsetHeight;
|
||||
document.getElementById('cpbar').style.height = height + "px";
|
||||
document.getElementById('cpbar').style.width = width + "px";
|
||||
let cx = width / 2;
|
||||
let cy = height / 2;
|
||||
let r = cx<cy?cx- lineWidth:cy- lineWidth;
|
||||
var ctx = uni.createCanvasContext('cpbar', this);
|
||||
// 进度条的渐变(中心x坐标-半径-边宽,中心Y坐标,中心x坐标+半径+边宽,中心Y坐标)
|
||||
var gradient = ctx.createLinearGradient(0, cy, width,cy);
|
||||
gradient.addColorStop('0', '#FFA68C');
|
||||
gradient.addColorStop('1.0', '#FF3B1D');
|
||||
ctx.setLineWidth(lineWidth);
|
||||
ctx.setStrokeStyle(gradient);
|
||||
ctx.setLineCap('round');
|
||||
ctx.beginPath();
|
||||
// 参数step 为绘制的百分比
|
||||
step = 0.015 * this.progressNo + 0.75;
|
||||
if (step >= 2) {
|
||||
step = step % 2;
|
||||
}
|
||||
ctx.arc(cx, cy, r, 0.75 * Math.PI, step * Math.PI, false);
|
||||
ctx.stroke();
|
||||
ctx.draw();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.progress_box {
|
||||
text-align: center;
|
||||
}
|
||||
.progress_bg {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
overflow: hidden;
|
||||
margin: auto;
|
||||
|
||||
}
|
||||
.progress_bar {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
overflow: hidden;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.progress_txt {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
font-size: 25rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.progress_txt text{
|
||||
flex-grow: 0;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.progress_info {
|
||||
font-size: 36upx;
|
||||
padding-left: 16upx;
|
||||
letter-spacing: 2upx;
|
||||
font-size: 52upx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.progress_dot {
|
||||
width: 16upx;
|
||||
height: 16upx;
|
||||
border-radius: 50%;
|
||||
background-color: #fb9126;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user