Merge pull request #1304 from dataease/pr@dev@fix_多个时间控件日期显示

fix: 多个时间控件相互影响
This commit is contained in:
fit2cloud-chenyw 2021-11-29 14:36:08 +08:00 committed by GitHub
commit 5d7bd59930
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,10 +7,9 @@
:width="canvas_width"
:height="canvas_height"
/>
<!-- <canvas id="canvas" class="de-canvas" :width="$refs.canvasContainer.clientWidth" :height="$refs.canvasContainer.clientHeight" /> -->
</div>
<div style="height: 50px;display: flex;align-items: center;">
<p id="fulltime" :style="{'fontSize': (parseInt(element.style.fontSize) * 1) + 'px', 'color':element.style.color}" style="width:100%;margin:auto;" />
<p :id="element.id + '_fulltime'" :style="{'fontSize': (parseInt(element.style.fontSize) * 1) + 'px', 'color':element.style.color}" style="width:100%;margin:auto;" />
</div>
</div>
</template>
@ -119,7 +118,7 @@ export default {
}
const nowWeek = this.week[time.getDay()]
var fullTime = showWeek ? (nowDate + ' ' + nowWeek) : nowDate
var fullDoc = document.getElementById('fulltime')
var fullDoc = document.getElementById(this.element.id + '_fulltime')
fullDoc.innerHTML = fullTime
const draw = draws
@ -140,8 +139,6 @@ export default {
draw.beginPath()
draw.moveTo(0, side_length / 2 - 0)
/* draw.moveTo(0, side_length / 2 - 70)
draw.lineTo(0, side_length / 2 - 50) */
draw.lineTo(0, side_length / 2 - 20)
draw.closePath()
draw.stroke()
@ -157,8 +154,6 @@ export default {
draw.beginPath()
draw.moveTo(0, side_length / 2 - 0)
// draw.lineTo(0, side_length / 2 - 50)
// draw.lineTo(0, side_length / 2 - 60)
draw.lineTo(0, side_length / 2 - 10)
draw.closePath()
draw.stroke()
@ -169,21 +164,18 @@ export default {
//
draw.save()
draw.strokeStyle = this.element.style.color
// draw.translate(250, 250)
draw.translate(canvas_w / 2, canvas_h / 2)
const hourzs = h + min / 60//
draw.rotate(hourzs * 30 * Math.PI / 180)
draw.lineWidth = 6
draw.beginPath()
draw.moveTo(0, 0)
/* draw.lineTo(0, -(side_length / 2 - 60) / 3) */
draw.lineTo(0, -(side_length / 2) * 0.5)
draw.closePath()
draw.stroke()
draw.restore()
//
draw.save()
// draw.translate(250, 250)
draw.translate(canvas_w / 2, canvas_h / 2)
draw.rotate(min * 6 * Math.PI / 180)
@ -192,13 +184,11 @@ export default {
draw.beginPath()
draw.moveTo(0, 0)
draw.lineTo(0, -(side_length / 2) * 0.7)
/* draw.lineTo(0, -(side_length / 2 - 60) * 3 / 5) */
draw.closePath()
draw.stroke()
draw.restore()
//
draw.save()
// draw.translate(250, 250)
draw.translate(canvas_w / 2, canvas_h / 2)
draw.rotate(s * 6 * Math.PI / 180)
draw.strokeStyle = this.element.style.color
@ -206,16 +196,13 @@ export default {
draw.beginPath()
draw.moveTo(0, 15)
draw.lineTo(0, -(side_length / 2) * 0.9)
/* draw.lineTo(0, -(side_length / 2 - 60)) */
draw.closePath()
draw.stroke()
draw.restore()
//
// draw.fillStyle = 'rgba(255,255,255,1)'
draw.lineWidth = 2
draw.beginPath()
// draw.arc(250, 250, 4, 0, 360, false)
draw.arc(canvas_w / 2, canvas_h / 2, 4, 0, 360, false)
draw.closePath()
draw.fill()