1404/11/14-add upload image product
This commit is contained in:
@@ -5,7 +5,7 @@ import pkg from './package.json'
|
|||||||
|
|
||||||
const baseURL: string = 'https://ghatreh.gold/server/'
|
const baseURL: string = 'https://ghatreh.gold/server/'
|
||||||
|
|
||||||
const uploadURL = `${baseURL}/site/file`
|
const uploadURL = `${baseURL}admin/file`
|
||||||
const baseURLStorage = baseURL
|
const baseURLStorage = baseURL
|
||||||
const prefixCls = 'hr-tamin'
|
const prefixCls = 'hr-tamin'
|
||||||
const version = pkg.version
|
const version = pkg.version
|
||||||
|
|||||||
@@ -76,9 +76,9 @@ const handleCancel = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const beforeUpload = (file: UploadProps['fileList'][number]) => {
|
const beforeUpload = (file: UploadProps['fileList'][number]) => {
|
||||||
const isLt100k = file.size / 1024 / 1024 < 0.2
|
const isLt100k = file.size / 1024 / 1024 < 0.4
|
||||||
if (!isLt100k) {
|
if (!isLt100k) {
|
||||||
message.error('حداکثر حجم بارگذاری 200 کیلو بایت میباشد')
|
message.error('حداکثر حجم بارگذاری 400 کیلو بایت میباشد')
|
||||||
}
|
}
|
||||||
return isLt100k
|
return isLt100k
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ export interface Product{
|
|||||||
weight: number
|
weight: number
|
||||||
auto_open_at: string
|
auto_open_at: string
|
||||||
auto_close_at: string
|
auto_close_at: string
|
||||||
|
description:string
|
||||||
|
file_id:number| null
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MethodePrices {
|
export interface MethodePrices {
|
||||||
|
|||||||
@@ -161,6 +161,9 @@
|
|||||||
/>
|
/>
|
||||||
<!-- <a-time-picker v-model:value="form.auto_close_at"/>-->
|
<!-- <a-time-picker v-model:value="form.auto_close_at"/>-->
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<a-form-item label="توضیحات" name="description" >
|
||||||
|
<BasicTextArea v-model:value="form.description" />
|
||||||
|
</a-form-item>
|
||||||
</div>
|
</div>
|
||||||
</a-form>
|
</a-form>
|
||||||
</template>
|
</template>
|
||||||
@@ -435,12 +438,12 @@ const ProductIndexImage = ref<Array<FileList>>([]);
|
|||||||
|
|
||||||
function uploadedIndexFile(id: number) {
|
function uploadedIndexFile(id: number) {
|
||||||
// console.log(id)
|
// console.log(id)
|
||||||
form.value.original_image_id = id;
|
form.value.file_id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteIndexFile() {
|
function deleteIndexFile() {
|
||||||
form.value.original_image_id = null;
|
form.value.file_id = null;
|
||||||
form.value.original_image = null;
|
form.value.file_id = null;
|
||||||
ProductIndexImage.value = [];
|
ProductIndexImage.value = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -607,6 +610,20 @@ async function edit(record: Customer) {
|
|||||||
|
|
||||||
form.value.auto_open_at = dayjs(customForm.auto_open_at, "HH:mm:ss");
|
form.value.auto_open_at = dayjs(customForm.auto_open_at, "HH:mm:ss");
|
||||||
form.value.auto_close_at = dayjs(customForm.auto_close_at, "HH:mm:ss");
|
form.value.auto_close_at = dayjs(customForm.auto_close_at, "HH:mm:ss");
|
||||||
|
|
||||||
|
// نمایش فایل موجود اگر وجود داشته باشد
|
||||||
|
const file = (record as any).file;
|
||||||
|
if (file && file.src) {
|
||||||
|
ProductIndexImage.value = [{
|
||||||
|
uid: `file-${file.id}`,
|
||||||
|
name: file.original_name || `index-image-${file.id}`,
|
||||||
|
url: file.src,
|
||||||
|
src: file.src,
|
||||||
|
status: 'done' as const
|
||||||
|
}] as any;
|
||||||
|
} else {
|
||||||
|
ProductIndexImage.value = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//add
|
//add
|
||||||
@@ -674,6 +691,8 @@ const resetData = () => {
|
|||||||
percent_fee_sell: 0,
|
percent_fee_sell: 0,
|
||||||
cash_fee_sell: 0
|
cash_fee_sell: 0
|
||||||
};
|
};
|
||||||
|
ProductIndexImage.value = [];
|
||||||
|
ImageFileList.value = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
//delete
|
//delete
|
||||||
|
|||||||
Reference in New Issue
Block a user