This commit is contained in:
13121765685 2025-12-28 20:59:06 +08:00
parent 5adfc94746
commit 1025a0e26e
3 changed files with 33 additions and 7 deletions

View File

@ -163,18 +163,19 @@ watch(dialogVisible, (val) => {
const initCanvas = async () => { const initCanvas = async () => {
if (!canvas.value || !canvasWrapper.value) return if (!canvas.value || !canvasWrapper.value) return
console.log('记载');
imageLoading.value = true imageLoading.value = true
imageLoadError.value = false imageLoadError.value = false
try { try {
const img = new Image() const img = new Image()
img.crossOrigin = 'anonymous' img.crossOrigin = 'anonymous'
const objectURL = await fetchImage(props.imageUrl)
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
img.onload = () => resolve() img.onload = () => resolve()
img.onerror = () => reject(new Error('Failed to load image')) img.onerror = () => reject(new Error('Failed to load image'))
img.src = props.imageUrl img.src = objectURL
}) })
const canvasEl = canvas.value const canvasEl = canvas.value
@ -294,7 +295,19 @@ const handleTouchStart = (e) => {
lastY = coords.y lastY = coords.y
isDrawing.value = true isDrawing.value = true
} }
async function fetchImage(url) {
const cacheBusterUrl = url + '?v=1.0.0';
const response = await fetch(cacheBusterUrl, {
method: 'GET',
mode: 'cors',
credentials: 'omit',
cache: 'no-cache'
});
const blob = await response.blob();
const imgurl = URL.createObjectURL(blob);
console.log(imgurl,'imgurlimgurlimgurl');
return imgurl;
}
const handleTouchMove = (e) => { const handleTouchMove = (e) => {
e.preventDefault() e.preventDefault()
if (!isDrawing.value || !ctx.value) return if (!isDrawing.value || !ctx.value) return

View File

@ -463,7 +463,7 @@
</el-button> </el-button>
<!-- 已发货状态查看物流 --> <!-- 已发货状态查看物流 -->
<el-button <el-button
v-if="getStatusTagType(selectedOrderForAction).type=='yfh'" v-if="getStatusTagType(selectedOrderForAction).type=='yfh'||getStatusTagType(selectedOrderForAction).type=='ywc'"
type="success" type="success"
size="large" size="large"
class="action-btn" class="action-btn"

View File

@ -163,18 +163,19 @@ watch(dialogVisible, (val) => {
const initCanvas = async () => { const initCanvas = async () => {
if (!canvas.value || !canvasWrapper.value) return if (!canvas.value || !canvasWrapper.value) return
console.log('记载');
imageLoading.value = true imageLoading.value = true
imageLoadError.value = false imageLoadError.value = false
try { try {
const img = new Image() const img = new Image()
img.crossOrigin = 'anonymous' img.crossOrigin = 'anonymous'
const objectURL = await fetchImage(props.imageUrl)
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
img.onload = () => resolve() img.onload = () => resolve()
img.onerror = () => reject(new Error('Failed to load image')) img.onerror = () => reject(new Error('Failed to load image'))
img.src = props.imageUrl img.src = objectURL
}) })
const canvasEl = canvas.value const canvasEl = canvas.value
@ -294,7 +295,19 @@ const handleTouchStart = (e) => {
lastY = coords.y lastY = coords.y
isDrawing.value = true isDrawing.value = true
} }
async function fetchImage(url) {
const cacheBusterUrl = url + '?v=1.0.0';
const response = await fetch(cacheBusterUrl, {
method: 'GET',
mode: 'cors',
credentials: 'omit',
cache: 'no-cache'
});
const blob = await response.blob();
const imgurl = URL.createObjectURL(blob);
console.log(imgurl,'imgurlimgurlimgurl');
return imgurl;
}
const handleTouchMove = (e) => { const handleTouchMove = (e) => {
e.preventDefault() e.preventDefault()
if (!isDrawing.value || !ctx.value) return if (!isDrawing.value || !ctx.value) return