| | |
| | | /> |
| | | </view> |
| | | </view> |
| | | <CSignatureLayer |
| | | v-if="drawSelf" |
| | | ref="drawLayer" |
| | | /> |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | import { $fetchCommon } from '@fetchers/FCommon'; |
| | | import { $bridge } from '@components/common/Bridge'; |
| | | import { $hostBoot } from '@components/bases/HostBoot'; |
| | | import CSignatureLayer from '@components/forms/userSignature/CSignatureLayer'; |
| | | import project from '@project'; |
| | | import './cUserSignature.scss'; |
| | | |
| | |
| | | components: { |
| | | AtInput, |
| | | AtIcon, |
| | | CSignatureLayer, |
| | | }, |
| | | props: { |
| | | // 表单数据资源(表单组件内部机制专用) |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | // id: 'CUserSignatureCanvas' + Date.now() + parseInt(Math.random() * 10000), |
| | | // cavWidth: 1000, |
| | | // cavHeight: 1600, |
| | | drawSelf: process.env.TARO_ENV === 'weapp', |
| | | }; |
| | | }, |
| | | computed: {}, |
| | |
| | | this.itemRes.onChange(url); |
| | | }); |
| | | } |
| | | // TODO: 普通h5、小程序中,使用 canvas 签名 |
| | | // 小程序中 |
| | | else if (process.env.TARO_ENV === 'weapp') { |
| | | this.$refs.drawLayer.$onDraw(sign => { |
| | | if (sign.indexOf('http') >= 0) { |
| | | this.itemRes.onChange(sign); |
| | | } else { |
| | | this.itemRes.onChange(sign); |
| | | } |
| | | }); |
| | | } |
| | | // TODO: 普通h5,使用 canvas 签名 |
| | | }, |
| | | _transBase64ToBlob(base64) { |
| | | const arr = base64.split(','); |
| | |
| | | if (res2.state.code === 2000) { |
| | | const serverUrl = $fetchCommon.transImgPath( |
| | | 'fix', |
| | | res2.data.src || res2.data.file || res2.data.url |
| | | res2.data.src || res2.data.file || res2.data.url, |
| | | ); |
| | | this.itemRes.onChange(serverUrl); |
| | | callback('success'); |
| | |
| | | } else if (process.env.TARO_ENV === 'weapp') { |
| | | $(this.$refs.input.$el) |
| | | .find('.at-input__container') |
| | | .append(this.$refs.drawing.$el); |
| | | .append(this.$refs.drawing); |
| | | } |
| | | }, |
| | | }; |