修改提交签署协议的逻辑,先提交签名后提交协议
This commit is contained in:
parent
feb12dee06
commit
8c16aef2a4
|
|
@ -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
|
||||
}
|
||||
|
||||
// 如果有错误,会在catch中返回报错信息数组,校验通过则在then中返回true
|
||||
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>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user