实现安装协议信息填写后去签名页面,分步提交

This commit is contained in:
WindowBird 2025-09-11 18:01:31 +08:00
parent ef8c6d1705
commit b5ef305654
2 changed files with 78 additions and 56 deletions

View File

@ -46,9 +46,9 @@
</uv-button>
<uv-button
customStyle="margin-top: 10px"
text="已阅读协议并去签名"
text="确认协议并提交"
type="primary"
@click="goToSignature"
@click="submit"
>
</uv-button>
<!-- <uv-button-->
@ -148,9 +148,7 @@ export default {
},
})
},
goToSignature() {
uni.navigateTo(/pages/)
},
handleUploadSuccess(result) {
console.log('图片上传成功:', result.url)
this.userInfo.businessLicenseUrl = result.url
@ -170,13 +168,13 @@ export default {
})
return
}
if (this.userInfo.signatureUrl === '') {
uni.showToast({
icon: 'error',
title: '请确认签名',
})
return
}
// if (this.userInfo.signatureUrl === '') {
// uni.showToast({
// icon: 'error',
// title: '',
// })
// return
// }
// catchthentrue
this.$refs.form
@ -188,6 +186,9 @@ export default {
})
//
console.log('表单数据:', this.userInfo)
uni.navigateTo({
url: '/pages/signature/signature',
})
})
.catch(errors => {
uni.showToast({
@ -207,39 +208,39 @@ export default {
hideKeyboard() {
uni.hideKeyboard()
},
async onClick(type) {
if (type === 'openSmooth') {
this.openSmooth = !this.openSmooth
return
}
if (type === 'save') {
await this.$refs.signatureRef.canvasToTempFilePath({
success: async res => {
//
console.log('签名返回是否为空', res.isEmpty)
if (res.isEmpty) {
this.userInfo.signatureUrl = ''
return
}
//
// H5 base64
this.tempUrl = res.tempFilePath
console.log('临时路径', res.tempFilePath)
this.userInfo.signatureUrl = await tempUrlToRealUrl(res.tempFilePath)
console.log('签名路径', this.userInfo.signatureUrl)
console.log('签名上传成功')
uni.showToast({ title: '签名上传成功', icon: 'success' })
},
})
return
}
if (type === 'clear') {
this.userInfo.signatureUrl = ''
}
if (this.$refs.signatureRef) this.$refs.signatureRef[type]()
},
// async onClick(type) {
// if (type === 'openSmooth') {
// this.openSmooth = !this.openSmooth
// return
// }
// if (type === 'save') {
// await this.$refs.signatureRef.canvasToTempFilePath({
// success: async res => {
// //
// console.log('', res.isEmpty)
// if (res.isEmpty) {
// this.userInfo.signatureUrl = ''
// return
// }
//
// //
// // H5 base64
// this.tempUrl = res.tempFilePath
// console.log('', res.tempFilePath)
//
// this.userInfo.signatureUrl = await tempUrlToRealUrl(res.tempFilePath)
// console.log('', this.userInfo.signatureUrl)
// console.log('')
// uni.showToast({ title: '', icon: 'success' })
// },
// })
// return
// }
// if (type === 'clear') {
// this.userInfo.signatureUrl = ''
// }
// if (this.$refs.signatureRef) this.$refs.signatureRef[type]()
// },
},
}
</script>

View File

@ -1,39 +1,59 @@
<template>
<view style="width: 100vw; height: 100vh">
<l-signature landscape></l-signature>
<view style="width: 100vw; height: 80vh; background-color: #8f939c">
<l-signature
ref="signatureRef"
:openSmooth="openSmooth"
:penColor="penColor"
:penSize="penSize"
disableScroll
></l-signature>
</view>
<view style="transform: rotate(90deg)">
<view style="width: 100vw; height: 20vh; background-color: #ffffff">
<button @click="onClick('clear')">清空</button>
<button @click="onClick('undo')">撤消</button>
<button @click="onClick('save')">保存</button>
<button @click="onClick('openSmooth')">压感{{ openSmooth ? '' : '' }}</button>
<button @click="onClick('save')">提交</button>
</view>
</template>
<script>
import { tempUrlToRealUrl } from '../../utils/tempUrl-to-realUrl'
export default {
data() {
return {
title: 'Hello',
penColor: 'red',
penColor: 'white',
penSize: 5,
url: '',
openSmooth: true,
signatureUrl: '',
}
},
methods: {
onClick(type) {
async onClick(type) {
if (type === 'openSmooth') {
this.openSmooth = !this.openSmooth
return
}
if (type === 'save') {
this.$refs.signatureRef.canvasToTempFilePath({
success: res => {
await this.$refs.signatureRef.canvasToTempFilePath({
success: async res => {
//
console.log(res.isEmpty)
console.log('签名返回是否为空', res.isEmpty)
if (res.isEmpty) {
this.signatureUrl = ''
return
}
//
// H5 base64
this.url = res.tempFilePath
this.tempUrl = res.tempFilePath
console.log('临时路径', res.tempFilePath)
this.signatureUrl = await tempUrlToRealUrl(res.tempFilePath)
console.log('签名路径', this.signatureUrl)
console.log('签名上传成功')
uni.showToast({ title: '签名上传成功', icon: 'success' })
},
})
return
@ -43,3 +63,4 @@ export default {
},
}
</script>
<style lang="scss"></style>