Skip to content

Commit

Permalink
Merge pull request #96 from ArtisanCloud/dev/michaelhu
Browse files Browse the repository at this point in the history
fix(product): display ID,remote product detail image,change product t…
  • Loading branch information
Matrix-X authored Aug 14, 2023
2 parents a9f2a38 + 111a6be commit 392d680
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
return treeDataSource;
};
console.log(state.categoryTree);
// console.log(state.categoryTree);
return travel(state.categoryTree);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<a-row :gutter="32">
<a-col :span="12">
<a-form-item label="产品名称" field="name">
<a-input v-model="formModel.name" />
<a-textarea v-model="formModel.name" style="height: 80px" />
</a-form-item>
</a-col>
<a-col :span="12">
Expand Down Expand Up @@ -158,6 +158,7 @@
:custom-request="uploadCoverImages"
:default-file-list="state.coverUrlList"
image-preview
:on-before-remove="changeCoverImage"
/>
</a-form-item>
</a-col>
Expand All @@ -173,6 +174,7 @@
:custom-request="uploadDetailImages"
:file-list="state.detailUrlList"
image-preview
:on-before-remove="changeDetailImages"
/>
</a-form-item>
</a-col>
Expand All @@ -195,6 +197,7 @@
import {
FieldRule,
Message,
Modal,
RequestOption,
UploadRequest,
} from '@arco-design/web-vue';
Expand Down Expand Up @@ -250,6 +253,28 @@
submitLoading: false,
});
const changeCoverImage = async (option: any) => {
// console.log(option);
const index = formModel.value.coverImageIds?.indexOf(option.response.id);
// console.log(index, formModel.value.coverImageIds);
if (index !== -1) {
formModel.value.coverImageIds?.splice(index ?? 0, 1);
return true;
}
return false;
};
const changeDetailImages = async (option: any) => {
// console.log(option);
const index = formModel.value.detailImageIds?.indexOf(option.response.id);
if (index !== -1) {
formModel.value.detailImageIds?.splice(index ?? 0, 1);
return true;
}
return false;
};
const onSubmit = async () => {
if (state.submitLoading) {
return;
Expand All @@ -276,6 +301,7 @@
option: RequestOption
) => {
return uploadMediaImages(option, (data: any) => {
// console.log(data);
formModel.value.coverImageIds?.push(data.id);
});
};
Expand All @@ -284,6 +310,7 @@
option: RequestOption
) => {
return uploadMediaImages(option, (data: any) => {
// console.log(data);
formModel.value.detailImageIds?.push(data.id);
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<a-row :gutter="32">
<a-col :span="12">
<a-form-item label="产品名称" field="name">
<a-input v-model="formModel.name" />
<a-textarea v-model="formModel.name" style="height: 80px" />
</a-form-item>
</a-col>
<a-col :span="12">
Expand Down Expand Up @@ -332,7 +332,7 @@
const changeCoverImage = async (option: any) => {
// console.log(option);
const index = formModel.value.coverImageIds?.indexOf(option.uid);
// console.log(index);
// console.log(index, formModel.value.coverImageIds);
if (index !== -1) {
formModel.value.coverImageIds?.splice(index ?? 0, 1);
return true;
Expand All @@ -343,6 +343,7 @@
const changeDetailImages = async (option: any) => {
// console.log(option);
const index = formModel.value.detailImageIds?.indexOf(option.uid);
// console.log(index, formModel.value.coverImageIds);
if (index !== -1) {
formModel.value.detailImageIds?.splice(index ?? 0, 1);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
@page-change="pageChanged"
@page-size-change="pageSizeChanged"
>
<template #ID="{ rowIndex }">
<a-typography-text>{{ rowIndex + 1 }}</a-typography-text>
</template>
<template #coverURL="{ record }">
<a-image width="72" :src="record.coverImages[0]?.url"></a-image>
</template>
Expand Down Expand Up @@ -123,8 +126,8 @@
const columns = reactive([
{
title: 'ID',
dataIndex: 'id',
width: 60,
slotName: 'ID',
},
{
title: '产品名称',
Expand Down

0 comments on commit 392d680

Please sign in to comment.