修改
This commit is contained in:
parent
c85d8901d7
commit
f7a022c3e8
@ -1,14 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="signature-wrap">
|
<view class="signature-wrap">
|
||||||
<canvas
|
<canvas :canvas-id="cid" :id="cid" @touchstart="onTouchStart" @touchmove="onTouchMove" @touchend="onTouchEnd"
|
||||||
:canvas-id="cid"
|
style="height:600rpx" :style="[{ width: formatSize(width)}, customStyle]"></canvas>
|
||||||
:id="cid"
|
|
||||||
@touchstart="onTouchStart"
|
|
||||||
@touchmove="onTouchMove"
|
|
||||||
@touchend="onTouchEnd"
|
|
||||||
style="height:600rpx"
|
|
||||||
:style="[{ width: formatSize(width)}, customStyle]"
|
|
||||||
></canvas>
|
|
||||||
<slot />
|
<slot />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@ -27,7 +20,9 @@
|
|||||||
* @event {Function} init 当创建完 canvas 实例后触发,向外提供 canvas实例,撤回,清空方法
|
* @event {Function} init 当创建完 canvas 实例后触发,向外提供 canvas实例,撤回,清空方法
|
||||||
* @example <v-sign @init="signInit"></v-sign>
|
* @example <v-sign @init="signInit"></v-sign>
|
||||||
*/
|
*/
|
||||||
import { formatSize } from './utils'
|
import {
|
||||||
|
formatSize
|
||||||
|
} from './utils'
|
||||||
// convas 实例
|
// convas 实例
|
||||||
let canvasCtx
|
let canvasCtx
|
||||||
|
|
||||||
@ -100,13 +95,11 @@ export default {
|
|||||||
width: this.lineWidth || this.penLineWidth || 4
|
width: this.lineWidth || this.penLineWidth || 4
|
||||||
},
|
},
|
||||||
// 屏幕坐标
|
// 屏幕坐标
|
||||||
coordinates: [
|
coordinates: [{
|
||||||
{
|
|
||||||
type: e.type,
|
type: e.type,
|
||||||
x: pos.x,
|
x: pos.x,
|
||||||
y: pos.y
|
y: pos.y
|
||||||
}
|
}]
|
||||||
]
|
|
||||||
})
|
})
|
||||||
this.drawLine()
|
this.drawLine()
|
||||||
},
|
},
|
||||||
@ -160,7 +153,10 @@ export default {
|
|||||||
if (coordinatesLen < 2) {
|
if (coordinatesLen < 2) {
|
||||||
// only start, no move event
|
// only start, no move event
|
||||||
startPos = coordinates[coordinatesLen - 1]
|
startPos = coordinates[coordinatesLen - 1]
|
||||||
endPos = { x: startPos.x + 1, y: startPos.y }
|
endPos = {
|
||||||
|
x: startPos.x + 1,
|
||||||
|
y: startPos.y
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
startPos = coordinates[coordinatesLen - 2]
|
startPos = coordinates[coordinatesLen - 2]
|
||||||
endPos = coordinates[coordinatesLen - 1]
|
endPos = coordinates[coordinatesLen - 1]
|
||||||
@ -182,8 +178,7 @@ export default {
|
|||||||
},
|
},
|
||||||
canvasToTempFilePath(conf = {}) {
|
canvasToTempFilePath(conf = {}) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
uni.canvasToTempFilePath(
|
uni.canvasToTempFilePath({
|
||||||
{
|
|
||||||
canvasId: this.cid,
|
canvasId: this.cid,
|
||||||
...conf,
|
...conf,
|
||||||
success: res => {
|
success: res => {
|
||||||
@ -220,12 +215,24 @@ export default {
|
|||||||
* y = (1-t)²*y0 + 2t(1-t)*y1 + t²*y2
|
* y = (1-t)²*y0 + 2t(1-t)*y1 + t²*y2
|
||||||
*/
|
*/
|
||||||
caculateBezier(P0, P2, B, t = 0.5) {
|
caculateBezier(P0, P2, B, t = 0.5) {
|
||||||
const { x: x0, y: y0 } = P0
|
const {
|
||||||
const { x: x2, y: y2 } = P2
|
x: x0,
|
||||||
const { x, y } = B
|
y: y0
|
||||||
|
} = P0
|
||||||
|
const {
|
||||||
|
x: x2,
|
||||||
|
y: y2
|
||||||
|
} = P2
|
||||||
|
const {
|
||||||
|
x,
|
||||||
|
y
|
||||||
|
} = B
|
||||||
let x1 = (x - (1 - t) * (1 - t) * x0 - t * t * x2) / (2 * t * (1 - t))
|
let x1 = (x - (1 - t) * (1 - t) * x0 - t * t * x2) / (2 * t * (1 - t))
|
||||||
let y1 = (y - (1 - t) * (1 - t) * y0 - t * t * y2) / (2 * t * (1 - t))
|
let y1 = (y - (1 - t) * (1 - t) * y0 - t * t * y2) / (2 * t * (1 - t))
|
||||||
return { x: x1, y: y1 }
|
return {
|
||||||
|
x: x1,
|
||||||
|
y: y1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,7 +51,8 @@
|
|||||||
"path": "pages/confirmCompletion/confirmCompletion",
|
"path": "pages/confirmCompletion/confirmCompletion",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "当前工单",
|
"navigationBarTitleText": "当前工单",
|
||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": false,
|
||||||
|
"disableScroll": true
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
"path": "pages/taskReturn/taskReturn",
|
"path": "pages/taskReturn/taskReturn",
|
||||||
|
|||||||
@ -101,8 +101,14 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</u-popup>
|
</u-popup>
|
||||||
<u-mask :show="show" @click="show = false">
|
<!-- <u-popup v-model="show" mode='bottom' :closeable='true' :safe-area-inset-bottom='true' @touchmove.stop.prevent
|
||||||
|
height='900'>
|
||||||
<signature @userSignaturePictureUrl='userSignaturePicture' @click.native.stop
|
<signature @userSignaturePictureUrl='userSignaturePicture' @click.native.stop
|
||||||
|
style='background-color: #F4F5F7;width: 100%;height: 800rpx;'>
|
||||||
|
</signature>
|
||||||
|
</u-popup> -->
|
||||||
|
<u-mask :show="show" @click="show = false" @touchmove.stop.prevent>
|
||||||
|
<signature @userSignaturePictureUrl='userSignaturePicture' @click.native.stop v-if='show'
|
||||||
style='background-color: #F4F5F7;position:absolute;bottom:0%;width: 100%;height: 800rpx;'></signature>
|
style='background-color: #F4F5F7;position:absolute;bottom:0%;width: 100%;height: 800rpx;'></signature>
|
||||||
</u-mask>
|
</u-mask>
|
||||||
<u-toast ref="uToast" />
|
<u-toast ref="uToast" />
|
||||||
@ -284,7 +290,9 @@
|
|||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.app {
|
.app {
|
||||||
font-size: 36rpx;
|
font-size: 36rpx;
|
||||||
padding: 0 0 100rpx;
|
padding: 0;
|
||||||
|
overflow: scroll;
|
||||||
|
height: 100vh;
|
||||||
|
|
||||||
.finishmask {
|
.finishmask {
|
||||||
height: 300rpx;
|
height: 300rpx;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="" style="background-color: #F4F5F7;">
|
<view class="" style="background-color: #F4F5F7;" @touchmove.stop.prevent>
|
||||||
<Signature @init="onSignInit" style='background-color: #fff;'></Signature>
|
<Signature @init="onSignInit" style='background-color: #fff;'></Signature>
|
||||||
<view class="btns">
|
<view class="btns">
|
||||||
<button @click="clear">清空</button>
|
<button @click="clear">清空</button>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user