|
@@ -6,6 +6,7 @@
|
|
<a-upload
|
|
<a-upload
|
|
v-model:file-list="albumFile"
|
|
v-model:file-list="albumFile"
|
|
name="file"
|
|
name="file"
|
|
|
|
+ accept=".png,.jpg,.jpeg"
|
|
:show-upload-list="false"
|
|
:show-upload-list="false"
|
|
action="https://v4-test.4dkankan.com/takelook/upload/file"
|
|
action="https://v4-test.4dkankan.com/takelook/upload/file"
|
|
:multiple="true"
|
|
:multiple="true"
|
|
@@ -20,7 +21,7 @@
|
|
</a-upload>
|
|
</a-upload>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
- <div v-else class="scene-sign">
|
|
|
|
|
|
+ <div v-else class="scene-sign" v-if="item.status === 'done'">
|
|
<img v-if="item.response" :src="item.response?.data" />
|
|
<img v-if="item.response" :src="item.response?.data" />
|
|
<span class="delete-scene" @click="deleteAblum(item)">
|
|
<span class="delete-scene" @click="deleteAblum(item)">
|
|
<close-outlined class="delete-scene-icon" />
|
|
<close-outlined class="delete-scene-icon" />
|
|
@@ -62,8 +63,17 @@ const props = defineProps<{ data: string[] }>()
|
|
|
|
|
|
const addMarked = Symbol('add-album')
|
|
const addMarked = Symbol('add-album')
|
|
const albumFile = ref<any[]>([])
|
|
const albumFile = ref<any[]>([])
|
|
|
|
+const albumFileExist = ref<any[]>([])
|
|
|
|
+const totalist = computed(() =>
|
|
|
|
+ uniqBy([albumFile.value, albumFileExist.value], 'response.data')
|
|
|
|
+)
|
|
|
|
|
|
-const current = computed(() => [addMarked, ...albumFile.value])
|
|
|
|
|
|
+const current = computed(() => [
|
|
|
|
+ addMarked
|
|
|
|
+ // ...totalist.value
|
|
|
|
+ // ...albumFileExist.value,
|
|
|
|
+ // ...albumFile.value
|
|
|
|
+])
|
|
const albumList = computed(() =>
|
|
const albumList = computed(() =>
|
|
Array.from(albumFile.value).reduce((prev, cur) => {
|
|
Array.from(albumFile.value).reduce((prev, cur) => {
|
|
if (prev && cur.response?.data) {
|
|
if (prev && cur.response?.data) {
|
|
@@ -84,6 +94,7 @@ const deleteAblum = (item: FileItem) => {
|
|
}
|
|
}
|
|
const emit = defineEmits(['syncList'])
|
|
const emit = defineEmits(['syncList'])
|
|
watchEffect(() => {
|
|
watchEffect(() => {
|
|
|
|
+ console.log('totalist', totalist)
|
|
if (props.data?.length) {
|
|
if (props.data?.length) {
|
|
const mapper = Array.from(props.data).map((i, index) => {
|
|
const mapper = Array.from(props.data).map((i, index) => {
|
|
const tempData = {} as FileItem
|
|
const tempData = {} as FileItem
|
|
@@ -92,10 +103,13 @@ watchEffect(() => {
|
|
data: i,
|
|
data: i,
|
|
ok: 0
|
|
ok: 0
|
|
}
|
|
}
|
|
|
|
+ tempData.status = 'done'
|
|
return tempData
|
|
return tempData
|
|
})
|
|
})
|
|
-
|
|
|
|
- albumFile.value = uniqBy(albumFile.value.concat(mapper), 'response.data')
|
|
|
|
|
|
+ albumFileExist.value = uniqBy(
|
|
|
|
+ albumFileExist.value.concat(mapper),
|
|
|
|
+ 'response.data'
|
|
|
|
+ )
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
@@ -107,7 +121,9 @@ const handleABlumChange = (info: UploadChangeParam) => {
|
|
} else if (info.file.status === 'error') {
|
|
} else if (info.file.status === 'error') {
|
|
message.error(`${info.file.name} file upload failed.`)
|
|
message.error(`${info.file.name} file upload failed.`)
|
|
}
|
|
}
|
|
|
|
+ console.log('check', albumFile)
|
|
}
|
|
}
|
|
|
|
+
|
|
const handleBeforeUpload = (file: any) => {
|
|
const handleBeforeUpload = (file: any) => {
|
|
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'
|
|
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'
|
|
if (!isJpgOrPng) {
|
|
if (!isJpgOrPng) {
|
|
@@ -126,6 +142,7 @@ const handleBeforeUpload = (file: any) => {
|
|
border: 1px solid #ebedf0;
|
|
border: 1px solid #ebedf0;
|
|
border-radius: 4px;
|
|
border-radius: 4px;
|
|
height: 100%;
|
|
height: 100%;
|
|
|
|
+ width: 100%;
|
|
cursor: pointer;
|
|
cursor: pointer;
|
|
display: flex;
|
|
display: flex;
|
|
align-items: center;
|
|
align-items: center;
|