update
This commit is contained in:
@@ -19,7 +19,7 @@ onMounted(() => {
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { Plus } from '@element-plus/icons-vue';
|
||||
import { tr } from "element-plus/es/locales.mjs"
|
||||
|
||||
const router = useRouter();
|
||||
// 上传前的校验
|
||||
const beforeUpload = (file) => {
|
||||
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
|
||||
@@ -83,7 +83,12 @@ const handleError = (error) => {
|
||||
|
||||
const uploadItems = ref([])
|
||||
|
||||
const initializeUploadItems = () => {
|
||||
const initializeUploadItems = (item) => {
|
||||
if (!item) {
|
||||
router.push({
|
||||
name: 'home'
|
||||
});
|
||||
}
|
||||
const count = globalStore.people_count;
|
||||
|
||||
const items = Array(count).fill(null).map(() => ({
|
||||
@@ -97,8 +102,8 @@ const initializeUploadItems = () => {
|
||||
const route = useRoute()
|
||||
const imageUrl = ref(globalStore.select_template);
|
||||
|
||||
watch(imageUrl, () => {
|
||||
initializeUploadItems()
|
||||
watch(imageUrl, (item) => {
|
||||
initializeUploadItems(item)
|
||||
}, { immediate: true })
|
||||
|
||||
const uploadRefs = ref([]);
|
||||
@@ -210,7 +215,6 @@ const generateImage = async (options) => {
|
||||
}
|
||||
}
|
||||
|
||||
const router = useRouter();
|
||||
const goBack = () => {
|
||||
router.back();
|
||||
};
|
||||
@@ -370,7 +374,6 @@ const showPhotoSquare = () => {
|
||||
isPhotoSquareVisible.value = true;
|
||||
};
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -421,7 +424,7 @@ const showPhotoSquare = () => {
|
||||
>
|
||||
<el-button class="upload-img-wrapper upload-btn" :style="buttonPosition(index + 1)">
|
||||
<div class="scene-item item scene-item-img" :class="{ uploaded: item.imageUrl, 'no-pointer-events': disableClick }"
|
||||
:style="{ width: buttonPosition(index + 1)['--item-width'] }">
|
||||
:style="{ width: buttonPosition(index + 1)['--item-width'], 'z-index': 11 }">
|
||||
<img
|
||||
v-if="!item.imageUrl"
|
||||
src="../assets/images/upload-img.png"
|
||||
@@ -454,12 +457,10 @@ const showPhotoSquare = () => {
|
||||
</div>
|
||||
</div>
|
||||
<MyPhoto
|
||||
v-if="isMyPhotoVisible"
|
||||
@go-photo-square="showPhotoSquare"
|
||||
v-model:show="isMyPhotoVisible"
|
||||
/>
|
||||
<PhotoSquare
|
||||
v-else
|
||||
@go-my-photo="showMyPhoto"
|
||||
v-model:show="isPhotoSquareVisible"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user