手写签名

This commit is contained in:
binbin_pan 2025-01-08 18:59:30 +08:00
parent 6293881de0
commit 51bc736e07
1 changed files with 25 additions and 16 deletions

View File

@ -49,24 +49,28 @@ const getSignData = () => {
//
const complete = (e) => {
signType.value = 0
console.log(e) // base
uploadImg(e)
toBase64(e)
.then((res) => {
console.log('🚀 ~ .then ~ res:', res)
// console.log('🚀 ~ .then ~ res:', res)
// signType.value = 0
// imgPath.value = res
// isRotate.value = true
const params = {
signUrl: res,
signType: 0,
}
updateSign(params)
.then((res) => {
console.log('🚀 ~ .updateSign ~ res:', res)
getSignData()
})
.catch((err) => {
console.log('🚀 ~ .updateSign ~ err:', err)
})
// const params = {
// signUrl: res,
// signType: 0,
// }
// uploadImg(res)
// updateSign(params)
// .then((res) => {
// console.log('🚀 ~ .updateSign ~ res:', res)
// getSignData()
// })
// .catch((err) => {
// console.log('🚀 ~ .updateSign ~ err:', err)
// })
})
.catch((err) => {
console.log(err)
@ -107,7 +111,7 @@ const open = () => {
//
const preview = () => {
console.log('预览')
console.log('预览', imgPath.value)
uni.previewImage({
urls: [imgPath.value],
})
@ -120,8 +124,10 @@ const handlePhoto = () => {
sizeType: ['compressed'],
sourceType: ['album', 'camera'],
success: (res) => {
console.log('🚀 ~ handlePhoto ~ res.tempFilePaths[0]:', res)
// imgPath.value = res.tempFilePaths[0]
// isRotate.value = false
signType.value = 1
uploadImg(res.tempFilePaths[0])
},
})
@ -136,10 +142,11 @@ const uploadImg = (path) => {
// Authorization: this.token,
},
success: (res) => {
console.log('🚀 ~ uploadImg ~ res:', res)
// imgPath.value = JSON.parse(res.data).data.url
const params = {
signUrl: JSON.parse(res.data).data.url,
signType: 1,
signType: signType.value,
}
updateSign(params)
.then((res) => {
@ -150,7 +157,9 @@ const uploadImg = (path) => {
console.log('🚀 ~ .then ~ err:', err)
})
},
fail: (err) => {},
fail: (err) => {
console.log('🚀 ~ uploadImg ~ err:', err)
},
})
}
</script>