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 { url } = await CommonApi.cosUpload(file);
const res = await CommonApi.cosUpload(file);
console.log(`sign upload url`, res);
// 传递答案
answer.value = url;
answer.value = res;
}
</script>
<template>
<van-field :label="element.stem" :required="element.config.is_required === 1" label-align="top" :border="false"
readonly>
<van-field
: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 #label>
<contenteditable v-model="element.stem" className="contenteditable-label" :active="active" @blur="emitValue"
:errorMessage="errorMessage"></contenteditable>
<contenteditable
v-model="element.stem"
className="contenteditable-label"
:active="active"
@blur="emitValue"
:errorMessage="errorMessage"
></contenteditable>
</template>
<template #input>
<div class="sign-question">
<canvas ref="signatureCanvas" :width="canvasWidth" :height="canvasHeight"
style="border: 1px dashed #ccc; border-radius: 4px">
<canvas
ref="signatureCanvas"
:width="canvasWidth"
:height="canvasHeight"
style="border: 1px dashed #ccc; border-radius: 4px"
>
</canvas>
<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" :class="isEraser ? 'mobilefont-huabi' : 'mobilefont-rubber'"
@click="togglePen"></span>
<span
class="icon mobilefont"
:class="isEraser ? 'mobilefont-huabi' : 'mobilefont-rubber'"
@click="togglePen"
></span>
<span class="icon mobilefont mobilefont-shangchuan" @click="handleUploadImg"></span>
</div>
<div class="sign-tips">请在空白区域书写您的签名</div>