Browse Source

图片

qin_26
liwenxuan 5 months ago
parent
commit
6c5ab4debb
  1. 29
      src/components/DesignForm/public/expand/lowcodeImage.vue

29
src/components/DesignForm/public/expand/lowcodeImage.vue

@ -67,6 +67,7 @@ const value = computed({
get: () => { get: () => {
if (props.data.control.imgUrl == "") { if (props.data.control.imgUrl == "") {
return props.modelValue ? props.modelValue : errimg; return props.modelValue ? props.modelValue : errimg;
//return props.modelValue ? props.modelValue : '';
} else { } else {
return props.data.control.imgUrl; return props.data.control.imgUrl;
} }
@ -99,21 +100,27 @@ onMounted(()=>{
} */ } */
}else{ }else{
if(props.type==2&&hasELCard(ancestors)){ if(props.type==2&&hasELCard(ancestors)){
if(value.value=="/src/assets/404_images/imgNotFound.png"){
}else{
props.data.control.uploadedImgs = completionImageDetails(value.value) props.data.control.uploadedImgs = completionImageDetails(value.value)
if(props.data.control.useDefaultImg==false&&props.data.control.onSiteShot==""){ if(props.data.control.useDefaultImg==false&&props.data.control.onSiteShot==""){
toShow.value = true toShow.value = true
} }
} }
} }
},1000) }
},100)
}) })
function completionImageDetails(urlString:string) { function completionImageDetails(urlString:string) {
// URL // URL
const urls = urlString.split(',').map(url => url.trim()).filter(url => url); const urls = urlString.split(',').map(url => url.trim()).filter(url => url);
//console.log(urls)
if (urls.length === 0) { if (urls.length === 0) {
/* throw new Error('未提供有效的图片URL'); */ /* throw new Error('未提供有效的图片URL'); */
return {} return {}
} }
@ -131,7 +138,9 @@ function completionImageDetails(urlString:string) {
// 18ID // 18ID
const randomId = Math.floor(Math.random() * 9e17) + 1e17; const randomId = Math.floor(Math.random() * 9e17) + 1e17;
if(url=="/src/assets/404_images/imgNotFound.png"){
return {}
}else{
return { return {
name: fileName, name: fileName,
percentage: 100, percentage: 100,
@ -151,6 +160,10 @@ function completionImageDetails(urlString:string) {
msg: "成功!" msg: "成功!"
} }
}; };
}
}); });
} }
@ -287,7 +300,15 @@ function selectFile(){
</script> </script>
<template> <template>
<img
v-if="props.data.control.useDefaultImg&&props.type==4"
:src="props.modelValue"
class="avatar"
:style="getFormItemInputStyle(configStyle, 2)"
/>
<el-upload <el-upload
v-if="props.type!=4"
v-bind="$props" v-bind="$props"
class="upload-demo" class="upload-demo"
:action="uploadUrl" :action="uploadUrl"
@ -403,7 +424,7 @@ function selectFile(){
<el-dialog v-model="dialogVisible"> <el-dialog v-model="dialogVisible" style="width:90%">
<img w-full :src="dialogImageUrl" alt="Preview Image" /> <img w-full :src="dialogImageUrl" alt="Preview Image" />
</el-dialog> </el-dialog>
</template> </template>

Loading…
Cancel
Save