diff --git a/pages/InstallationAgreement/InstallationAgreement.vue b/pages/InstallationAgreement/InstallationAgreement.vue
index 580f699..cb57fb9 100644
--- a/pages/InstallationAgreement/InstallationAgreement.vue
+++ b/pages/InstallationAgreement/InstallationAgreement.vue
@@ -33,33 +33,27 @@
>
-
-
-
+
+
+
+
+
-
-
@@ -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;
+}
diff --git a/utils/tempUrl-to-realUrl.js b/utils/tempUrl-to-realUrl.js
index b5fb4bc..3fbc79a 100644
--- a/utils/tempUrl-to-realUrl.js
+++ b/utils/tempUrl-to-realUrl.js
@@ -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