From 8c16aef2a44ab25d2182953be63c85e6e19e25fd Mon Sep 17 00:00:00 2001
From: WindowBird <13870814+windows-bird@user.noreply.gitee.com>
Date: Wed, 10 Sep 2025 16:48:44 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8F=90=E4=BA=A4=E7=AD=BE?=
=?UTF-8?q?=E7=BD=B2=E5=8D=8F=E8=AE=AE=E7=9A=84=E9=80=BB=E8=BE=91=EF=BC=8C?=
=?UTF-8?q?=E5=85=88=E6=8F=90=E4=BA=A4=E7=AD=BE=E5=90=8D=E5=90=8E=E6=8F=90?=
=?UTF-8?q?=E4=BA=A4=E5=8D=8F=E8=AE=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../InstallationAgreement.vue | 107 ++++++++++++------
utils/tempUrl-to-realUrl.js | 3 +-
2 files changed, 73 insertions(+), 37 deletions(-)
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