1405/02/22-fix bug in upload image in mobile

This commit is contained in:
2026-05-12 17:36:54 +03:30
parent fc5273a660
commit 5c0db3bae6
3 changed files with 29 additions and 16 deletions
+3
View File
@@ -15,6 +15,7 @@ declare module '@vue/runtime-core' {
ABadge: typeof import('ant-design-vue/es')['Badge'] ABadge: typeof import('ant-design-vue/es')['Badge']
AButton: typeof import('ant-design-vue/es')['Button'] AButton: typeof import('ant-design-vue/es')['Button']
ACard: typeof import('ant-design-vue/es')['Card'] ACard: typeof import('ant-design-vue/es')['Card']
ACheckbox: typeof import('ant-design-vue/es')['Checkbox']
AConfigProvider: typeof import('ant-design-vue/es')['ConfigProvider'] AConfigProvider: typeof import('ant-design-vue/es')['ConfigProvider']
ADivider: typeof import('ant-design-vue/es')['Divider'] ADivider: typeof import('ant-design-vue/es')['Divider']
ADrawer: typeof import('ant-design-vue/es')['Drawer'] ADrawer: typeof import('ant-design-vue/es')['Drawer']
@@ -34,6 +35,7 @@ declare module '@vue/runtime-core' {
APagination: typeof import('ant-design-vue/es')['Pagination'] APagination: typeof import('ant-design-vue/es')['Pagination']
APopconfirm: typeof import('ant-design-vue/es')['Popconfirm'] APopconfirm: typeof import('ant-design-vue/es')['Popconfirm']
APopover: typeof import('ant-design-vue/es')['Popover'] APopover: typeof import('ant-design-vue/es')['Popover']
ARadio: typeof import('ant-design-vue/es')['Radio']
ARadioButton: typeof import('ant-design-vue/es')['RadioButton'] ARadioButton: typeof import('ant-design-vue/es')['RadioButton']
ARadioGroup: typeof import('ant-design-vue/es')['RadioGroup'] ARadioGroup: typeof import('ant-design-vue/es')['RadioGroup']
ASelect: typeof import('ant-design-vue/es')['Select'] ASelect: typeof import('ant-design-vue/es')['Select']
@@ -46,6 +48,7 @@ declare module '@vue/runtime-core' {
ATabs: typeof import('ant-design-vue/es')['Tabs'] ATabs: typeof import('ant-design-vue/es')['Tabs']
ATextarea: typeof import('ant-design-vue/es')['Textarea'] ATextarea: typeof import('ant-design-vue/es')['Textarea']
ATooltip: typeof import('ant-design-vue/es')['Tooltip'] ATooltip: typeof import('ant-design-vue/es')['Tooltip']
AUpload: typeof import('ant-design-vue/es')['Upload']
BaseButton: typeof import('./src/core/components/BaseButton/index.ts')['default'] BaseButton: typeof import('./src/core/components/BaseButton/index.ts')['default']
BaseCard: typeof import('./src/core/components/BaseCard/index.ts')['default'] BaseCard: typeof import('./src/core/components/BaseCard/index.ts')['default']
BaseDatePicker: typeof import('./src/core/components/BaseDatePicker/index.ts')['default'] BaseDatePicker: typeof import('./src/core/components/BaseDatePicker/index.ts')['default']
@@ -4,12 +4,14 @@
class="w-[96px] h-[96px] overflow-hidden border border-solid border-blue-600 bg-gray-50 rounded-md p-2" class="w-[96px] h-[96px] overflow-hidden border border-solid border-blue-600 bg-gray-50 rounded-md p-2"
> >
<AUpload <AUpload
accept=".jpg,.jpeg,.png,.webp"
v-model:file-list="fileList" v-model:file-list="fileList"
name="file" name="file"
list-type="picture-card" list-type="picture-card"
:showUploadList="true" :showUploadList="true"
:multiple="false" :multiple="false"
:action="uploadURL" :action="uploadURL"
:capture="undefined"
:headers="fileHeader" :headers="fileHeader"
:before-upload="beforeUpload" :before-upload="beforeUpload"
@change="handleChange" @change="handleChange"
@@ -3,18 +3,20 @@
<div class="border border-solid border-blue-600 bg-gray-50 w-full rounded-md p-2"> <div class="border border-solid border-blue-600 bg-gray-50 w-full rounded-md p-2">
<div class="flex"> <div class="flex">
<AUpload <AUpload
v-model:file-list="fileList" accept=".jpg,.jpeg,.png,.webp"
name="file" v-model:file-list="fileList"
list-type="picture-card" name="file"
:show-upload-list="false" list-type="picture-card"
:action="uploadURL" :show-upload-list="false"
:headers="fileHeader" :action="uploadURL"
:showUploadList="true" :capture="undefined"
:before-upload="beforeUpload" :headers="fileHeader"
@change="handleChange" :showUploadList="true"
:before-upload="beforeUpload"
@change="handleChange"
> >
<div> <div>
<BaseIcon icon="vuesax-linear:add" color="#6B7280" /> <BaseIcon icon="vuesax-linear:add" color="#6B7280"/>
<div class="text-gray-500 text-center text-xs font-normal">بارگذاری فایل</div> <div class="text-gray-500 text-center text-xs font-normal">بارگذاری فایل</div>
</div> </div>
</AUpload> </AUpload>
@@ -24,13 +26,13 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import type { UploadChangeParam, UploadProps } from 'ant-design-vue' import type {UploadChangeParam, UploadProps} from 'ant-design-vue'
import { uploadURL } from '@root/config' import {uploadURL} from '@root/config'
import { getToken } from '@/utils' import {getToken} from '@/utils'
import { usePrefix } from '@core/composable/usePrefix' import {usePrefix} from '@core/composable/usePrefix'
import { message } from 'ant-design-vue' import {message} from 'ant-design-vue'
const { prefixCls } = usePrefix('product-image-uploader') const {prefixCls} = usePrefix('product-image-uploader')
const loading = ref<boolean>(false) const loading = ref<boolean>(false)
const fileHeader = { const fileHeader = {
@@ -94,9 +96,11 @@ function handleChange(info: UploadChangeParam) {
margin: 0 !important; margin: 0 !important;
border: none; border: none;
} }
.ant-upload-picture-card-wrapper { .ant-upload-picture-card-wrapper {
width: fit-content; width: fit-content;
} }
.ant-upload { .ant-upload {
width: 78px !important; width: 78px !important;
height: 78px !important; height: 78px !important;
@@ -104,18 +108,22 @@ function handleChange(info: UploadChangeParam) {
border: dashed 1px #93c5fd; border: dashed 1px #93c5fd;
border-radius: 4px; border-radius: 4px;
} }
.ant-upload-list-picture-card-container { .ant-upload-list-picture-card-container {
margin: 0; margin: 0;
width: 78px !important; width: 78px !important;
height: 78px !important; height: 78px !important;
} }
.ant-upload-list-picture-card .ant-upload-list-item { .ant-upload-list-picture-card .ant-upload-list-item {
padding: 0; padding: 0;
border: none; border: none;
} }
.ant-upload-list-picture-card .ant-upload-list-item-info { .ant-upload-list-picture-card .ant-upload-list-item-info {
border-radius: 4px; border-radius: 4px;
} }
.ant-upload-list { .ant-upload-list {
display: flex !important; display: flex !important;
flex-wrap: wrap; flex-wrap: wrap;