From 51bc736e0734de5adef5c1538925f54c066240f5 Mon Sep 17 00:00:00 2001 From: binbin_pan Date: Wed, 8 Jan 2025 18:59:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E5=86=99=E7=AD=BE=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/my/signature.vue | 41 +++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/src/pages/my/signature.vue b/src/pages/my/signature.vue index 82c3025..fa65091 100644 --- a/src/pages/my/signature.vue +++ b/src/pages/my/signature.vue @@ -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) + }, }) }