fix[design]: 签名题日志

- 添加 log ,检查上传的问题
This commit is contained in:
Huangzhe
2025-03-23 18:11:11 +08:00
parent 88547d722b
commit 67c3f25d98

View File

@@ -188,32 +188,54 @@ const emitValue = () => {
/** /**
* 上传文件 * 上传文件
*/ */
async function handleUploadImg () { async function handleUploadImg() {
const file = new File([saveCanvas('blob')!], 'sign.png', { type: 'image/png' }); const file = new File([saveCanvas('blob')!], 'sign.png', { type: 'image/png' });
const { url } = await CommonApi.cosUpload(file); const res = await CommonApi.cosUpload(file);
console.log(`sign upload url`, res);
// 传递答案 // 传递答案
answer.value = url; answer.value = res;
} }
</script> </script>
<template> <template>
<van-field :label="element.stem" :required="element.config.is_required === 1" label-align="top" :border="false" <van-field
readonly> :label="element.stem"
:required="element.config.is_required === 1"
label-align="top"
:border="false"
readonly
>
<template #left-icon> {{ isPreview ? element.title : index + 1 }}. </template> <template #left-icon> {{ isPreview ? element.title : index + 1 }}. </template>
<template #label> <template #label>
<contenteditable v-model="element.stem" className="contenteditable-label" :active="active" @blur="emitValue" <contenteditable
:errorMessage="errorMessage"></contenteditable> v-model="element.stem"
className="contenteditable-label"
:active="active"
@blur="emitValue"
:errorMessage="errorMessage"
></contenteditable>
</template> </template>
<template #input> <template #input>
<div class="sign-question"> <div class="sign-question">
<canvas ref="signatureCanvas" :width="canvasWidth" :height="canvasHeight" <canvas
style="border: 1px dashed #ccc; border-radius: 4px"> ref="signatureCanvas"
:width="canvasWidth"
:height="canvasHeight"
style="border: 1px dashed #ccc; border-radius: 4px"
>
</canvas> </canvas>
<div class="sign-text" :class="{ show: true }"> <div class="sign-text" :class="{ show: true }">
<span class="icon mobilefont mobilefont-qingkong" title="清空" @click="clearCanvas"></span> <span
class="icon mobilefont mobilefont-qingkong"
title="清空"
@click="clearCanvas"
></span>
<span class="icon mobilefont mobilefont-chexiao" @click="undo"></span> <span class="icon mobilefont mobilefont-chexiao" @click="undo"></span>
<span class="icon mobilefont" :class="isEraser ? 'mobilefont-huabi' : 'mobilefont-rubber'" <span
@click="togglePen"></span> class="icon mobilefont"
:class="isEraser ? 'mobilefont-huabi' : 'mobilefont-rubber'"
@click="togglePen"
></span>
<span class="icon mobilefont mobilefont-shangchuan" @click="handleUploadImg"></span> <span class="icon mobilefont mobilefont-shangchuan" @click="handleUploadImg"></span>
</div> </div>
<div class="sign-tips">请在空白区域书写您的签名</div> <div class="sign-tips">请在空白区域书写您的签名</div>