|
@@ -46,23 +46,112 @@
|
|
|
</view> -->
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <view class="finish_btn" @click="submits()">
|
|
|
+ 完成签署
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import Handwriting from "@/common/signature.js";
|
|
|
export default {
|
|
|
name: 'sign_commit',
|
|
|
data() {
|
|
|
return {
|
|
|
+ handwriting: '',
|
|
|
+ lineColor: "black",
|
|
|
+ slideValue: 50,
|
|
|
+ commitment_electr_signature: '',
|
|
|
+ isUploading: false,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onReady(res) {
|
|
|
+ this.handwriting = new Handwriting({
|
|
|
+ lineColor: this.lineColor,
|
|
|
+ slideValue: this.slideValue, // 0, 25, 50, 75, 100
|
|
|
+ canvasName: "handWriting",
|
|
|
+ });
|
|
|
+ // this.$refs.uForm.setRules(this.rules);
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ retDraw() {
|
|
|
+ this.handwriting.retDraw()
|
|
|
+ this.commitment_electr_signature = ''
|
|
|
+ // this.$set(this.form, "commitment_electr_signature", "");
|
|
|
+ },
|
|
|
+ uploadScaleStart(event) {
|
|
|
+ this.handwriting.uploadScaleStart(event);
|
|
|
+ },
|
|
|
+ uploadScaleMove(event) {
|
|
|
+ this.handwriting.uploadScaleMove(event);
|
|
|
+ },
|
|
|
+ uploadScaleEnd(event) {
|
|
|
+ this.handwriting.uploadScaleEnd(event);
|
|
|
+ },
|
|
|
+ subCanvas() {
|
|
|
+ console.log("签名-------");
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ if (this.commitment_electr_signature) {
|
|
|
+ resolve();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.handwriting.saveCanvas().then((res) => {
|
|
|
+ if (this.handwriting.linePrack.length) {
|
|
|
+ console.log('签名-----res', res)
|
|
|
+ // this.$set(this.form, "commitment_electr_signature", res);
|
|
|
+ this.commitment_electr_signature = res
|
|
|
+ }
|
|
|
+ resolve(res)
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ uni.showToast({
|
|
|
+ title: "签名上传失败",
|
|
|
+ icon: "error",
|
|
|
+ });
|
|
|
|
|
|
+ });
|
|
|
+ this.isUploading = false
|
|
|
+ });
|
|
|
+ },
|
|
|
+ async submits() {
|
|
|
+ if (this.isUploading) {
|
|
|
+ return;
|
|
|
}
|
|
|
- }
|
|
|
+ this.isUploading = true
|
|
|
+ await this.subCanvas()
|
|
|
+ if (!this.commitment_electr_signature) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请签名",
|
|
|
+ icon: "none",
|
|
|
+ })
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ await this.submitApi()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //提交表单
|
|
|
+ async submitApi() {
|
|
|
+ if (this.commitment_electr_signature) {
|
|
|
+ this.commitment_electr_signature = await this.$method.uploadFile(
|
|
|
+ this.commitment_electr_signature,
|
|
|
+ 0
|
|
|
+ );
|
|
|
+ console.log('----commitment_electr_signature', this.commitment_electr_signature)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
+<style>
|
|
|
+ page {
|
|
|
+ background-color: #eaeef1;
|
|
|
+ }
|
|
|
+</style>
|
|
|
<style lang="scss" scoped>
|
|
|
.sign_commit {
|
|
|
- .appointmentItem {
|
|
|
+ padding-bottom: 50rpx;
|
|
|
+ .appointmentItem {
|
|
|
margin: 24rpx 0 40rpx;
|
|
|
.title {
|
|
|
font-size: 30rpx;
|
|
@@ -87,7 +176,7 @@ export default {
|
|
|
}
|
|
|
.commitment {
|
|
|
padding: 12rpx;
|
|
|
- height: 300rpx;
|
|
|
+ height: 900rpx;
|
|
|
background: #ffffff;
|
|
|
overflow-y: auto;
|
|
|
}
|
|
@@ -108,5 +197,16 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ .finish_btn {
|
|
|
+ // width: 100%;
|
|
|
+ height: 100rpx;
|
|
|
+ line-height: 100rpx;
|
|
|
+ text-align: center;
|
|
|
+ background-color:#1890ff;
|
|
|
+ font-size: 32rpx;
|
|
|
+ color: #fff;
|
|
|
+ border-radius: 10rpx;
|
|
|
+ margin: 20rpx 24rpx;
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|