修改提交签署协议的逻辑,先提交签名后提交协议

This commit is contained in:
WindowBird 2025-09-10 16:48:44 +08:00
parent feb12dee06
commit 8c16aef2a4
2 changed files with 73 additions and 37 deletions

View File

@ -33,33 +33,27 @@
></l-signature>
</view>
</uv-form-item>
<uv-button
customStyle="margin-top: 10px"
text="清空签名"
type="error"
@click="onClick('clear')"
></uv-button>
<uv-button
customStyle="margin-top: 10px"
text="确认签名"
type="primary"
@click="onClick('save')"
></uv-button>
<uv-button
customStyle="margin-top: 10px"
text="提交协议"
type="primary"
@click="submit"
></uv-button>
<view class="btn-signature">
<uv-button
customStyle="margin-top: 10px"
text="清空签名"
type="error"
@click="onClick('clear')"
></uv-button>
<uv-button
customStyle="margin-top: 10px"
text="确认签名"
type="primary"
@click="onClick('save')"
></uv-button>
<uv-button
customStyle="margin-top: 10px"
text="提交协议"
type="primary"
@click="submit"
></uv-button>
</view>
</uv-form>
<uv-action-sheet
ref="sexSelect"
:actions="actions"
description="如果选择保密会报错"
title="请选择性别"
@select="sexSelect"
>
</uv-action-sheet>
</view>
</template>
@ -75,7 +69,7 @@ export default {
code: '',
phone: '',
location: '',
businessLicense: '',
businessLicenseUrl: '',
signatureUrl: '',
},
@ -106,6 +100,18 @@ export default {
message: '请填写正确的统一社会信用代码',
trigger: ['blur', 'change'],
},
// license: {
// type: 'string',
// required: true,
// message: '',
// trigger: ['blur', 'change'],
// },
// signature: {
// type: 'string',
// required: true,
// message: '',
// trigger: ['blur', 'change'],
// },
},
radio: '',
switchVal: false,
@ -114,15 +120,31 @@ export default {
methods: {
handleUploadSuccess(result) {
console.log('图片上传成功:', result.url)
this.userInfo.businessLicense = result.url
this.userInfo.businessLicenseUrl = result.url
uni.showToast({
title: '上传成功',
icon: 'success',
})
},
//
submit() {
this.onClick('save')
async submit() {
// await this.onClick('save')
if (this.userInfo.businessLicenseUrl === '') {
uni.showToast({
icon: 'error',
title: '请上传营业执照',
})
return
}
if (this.userInfo.signatureUrl === '') {
uni.showToast({
icon: 'error',
title: '请确认签名',
})
return
}
// catchthentrue
this.$refs.form
.validate()
@ -146,24 +168,26 @@ export default {
reset() {
this.$refs.form.resetFields()
this.$refs.form.clearValidate()
this.userInfo.businessLicense = ''
this.userInfo.businessLicenseUrl = ''
},
hideKeyboard() {
uni.hideKeyboard()
},
onClick(type) {
async onClick(type) {
if (type === 'openSmooth') {
this.openSmooth = !this.openSmooth
return
}
if (type === 'save') {
this.$refs.signatureRef.canvasToTempFilePath({
await this.$refs.signatureRef.canvasToTempFilePath({
success: async res => {
//
console.log(res.isEmpty)
console.log('@@@@@')
console.log('@@@@@', res)
console.log('签名返回是否为空', res.isEmpty)
if (res.isEmpty) {
this.userInfo.signatureUrl = ''
return
}
//
// H5 base64
@ -172,10 +196,15 @@ export default {
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]()
},
},
@ -186,4 +215,10 @@ export default {
.page {
padding: 10rpx 30rpx;
}
.btn-signature {
display: flex;
align-items: center;
justify-content: space-around;
}
</style>

View File

@ -45,7 +45,8 @@ export const tempUrlToRealUrl = async (tempFilePath, options = {}) => {
const qiniuUrl = `${domain}/${uploadResult.key}`
if (showToast) {
uni.showToast({ title: '上传成功', icon: 'success' })
// console.log('签名上传成功')
// uni.showToast({ title: '签名上传成功', icon: 'success' })
}
return qiniuUrl