feat: 工单图片上传与样式的调整

This commit is contained in:
2025-10-27 20:05:35 +08:00
parent 2ee8d6a72e
commit d0711c7f12
4 changed files with 52 additions and 10 deletions

View File

@@ -47,13 +47,38 @@
class="bg-F5F7FA border-box p-12 rounded-10 font-size-14 font-500 color-171717 mb-12"
>
<view class="font-500 line-height-22 mb-12">照片上传</view>
<view
class="bg-white p-24 rounded-5 inline-block"
@click="handleChooseImage"
class="w-80 h-80 bg-white rounded-8 overflow-hidden flex flex-items-center flex-justify-center"
>
<uni-icons fontFamily="znicons" size="24" color="#6A717F">
{{ zniconsMap["zn-camera"] }}
</uni-icons>
<view
v-if="contentImgUrl"
class="w-full h-full relative inline-block"
>
<image
class="w-full h-full block"
:src="contentImgUrl"
mode="aspectFill"
/>
<uni-icons
class="close-btn absolute z-10"
type="close"
size="20"
color="#6A717F"
@click="handleDeleteImage"
>
</uni-icons>
</view>
<view
v-else
class="w-full h-full flex flex-items-center flex-justify-center"
@click="handleChooseImage"
>
<uni-icons fontFamily="znicons" size="24" color="#6A717F">
{{ zniconsMap["zn-camera"] }}
</uni-icons>
</view>
</view>
</view>
</view>
@@ -72,8 +97,9 @@
</view>
<image
v-if="contentImgUrl"
class="right rounded-6"
src="https://picsum.photos/300/300"
:src="contentImgUrl"
mode="aspectFill"
/>
</view>
@@ -123,12 +149,16 @@ const handleChooseImage = () => {
});
};
const handleDeleteImage = () => {
contentImgUrl.value = "";
};
const updateImagehandle = (file) => {
if (!file) {
return;
}
updateImageFile(file).then((res) => {
contentImgUrl.value = res.data?.url || "";
contentImgUrl.value = res.data;
});
};
@@ -220,4 +250,9 @@ onMounted(() => {
<style scoped lang="scss">
@import "./styles/index.scss";
.close-btn {
top: 0;
right: 0;
}
</style>