fix add-point-card invalid
This commit is contained in:
@@ -25,9 +25,10 @@
|
||||
:add-text="props.addText ?? '选择文件'"
|
||||
:busy="isBusy"
|
||||
:upload-enabled="!!props.upload"
|
||||
@add="emit('add')"
|
||||
@capture-photo="emit('capture-photo')"
|
||||
@capture-video="emit('capture-video')"
|
||||
@add="handleAdd"
|
||||
@action="handleAddAction"
|
||||
@capture-photo="handleCapturePhoto"
|
||||
@capture-video="handleCaptureVideo"
|
||||
@file-change="handleFileChange"
|
||||
/>
|
||||
</div>
|
||||
@@ -90,13 +91,32 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
});
|
||||
|
||||
type Emits = {
|
||||
(event: string): void;
|
||||
(event: "update:modelValue", value: string[]): void;
|
||||
(event: "update:photoItems", value: PhotoItem[]): void;
|
||||
add: [];
|
||||
action: [value: MediaSelectorAddAction];
|
||||
"capture-photo": [];
|
||||
"capture-video": [];
|
||||
"update:modelValue": [value: string[]];
|
||||
"update:photoItems": [value: PhotoItem[]];
|
||||
};
|
||||
|
||||
const emit = defineEmits<Emits>();
|
||||
|
||||
function handleAddAction(action: MediaSelectorAddAction): void {
|
||||
emit("action", action);
|
||||
}
|
||||
|
||||
function handleAdd(): void {
|
||||
emit("add");
|
||||
}
|
||||
|
||||
function handleCapturePhoto(): void {
|
||||
emit("capture-photo");
|
||||
}
|
||||
|
||||
function handleCaptureVideo(): void {
|
||||
emit("capture-video");
|
||||
}
|
||||
|
||||
const photoViewerVisible = ref(false);
|
||||
const photoViewerImages = ref<string[]>([]);
|
||||
const photoViewerItems = ref<MediaSelectorViewerItem[]>([]);
|
||||
|
||||
@@ -91,14 +91,12 @@ interface Props {
|
||||
|
||||
const props = defineProps<Props>();
|
||||
const emit = defineEmits<{
|
||||
(event: "add"): void;
|
||||
(event: "capture-photo"): void;
|
||||
(event: "capture-video"): void;
|
||||
(event: "file-change", value: Event): void;
|
||||
add: [];
|
||||
action: [value: MediaSelectorAddAction];
|
||||
"capture-photo": [];
|
||||
"capture-video": [];
|
||||
"file-change": [value: Event];
|
||||
}>();
|
||||
const emitExternal = (event: string): void => {
|
||||
(emit as unknown as (eventName: string) => void)(event);
|
||||
};
|
||||
|
||||
const capturePopoverVisible = ref(false);
|
||||
const fileInput = ref<HTMLInputElement>();
|
||||
@@ -127,15 +125,23 @@ function handleFileAction(): void {
|
||||
|
||||
function handleCaptureAction(action: MediaSelectorAddAction): void {
|
||||
capturePopoverVisible.value = false;
|
||||
if (action.emit === "capture-photo" && props.uploadEnabled) {
|
||||
photoFileInput.value?.click();
|
||||
if (action.emit === "capture-photo") {
|
||||
if (props.uploadEnabled) {
|
||||
photoFileInput.value?.click();
|
||||
return;
|
||||
}
|
||||
emit("capture-photo");
|
||||
return;
|
||||
}
|
||||
if (action.emit === "capture-video" && props.uploadEnabled) {
|
||||
videoFileInput.value?.click();
|
||||
if (action.emit === "capture-video") {
|
||||
if (props.uploadEnabled) {
|
||||
videoFileInput.value?.click();
|
||||
return;
|
||||
}
|
||||
emit("capture-video");
|
||||
return;
|
||||
}
|
||||
emitExternal(action.emit);
|
||||
emit("action", action);
|
||||
}
|
||||
|
||||
function handleFileChange(event: Event): void {
|
||||
|
||||
@@ -81,10 +81,9 @@
|
||||
:add-actions="photoAddActions"
|
||||
:loading="isPhotoUploading"
|
||||
@add="openPhotoPicker('OTHER')"
|
||||
@action="handlePhotoAction"
|
||||
@capture-photo="capturePhoto"
|
||||
@capture-video="captureVideo"
|
||||
@add-point-card="capturePointCard"
|
||||
@add-other="openPhotoPicker('OTHER')"
|
||||
/>
|
||||
<div class="tips orange" v-if="!hasCustomerDeletePermission">当前账户权限编辑客户需要上传照片和积分卡</div>
|
||||
</div>
|
||||
@@ -232,6 +231,7 @@ import CodeScanner from "@/components/CodeScanner.vue";
|
||||
import CustomerProfileCard from "@/components/CustomerProfileCard.vue";
|
||||
import CustomerSelector from "@/components/CustomerSelector.vue";
|
||||
import MediaSelector from "@/components/mediaSelector/MediaSelector.vue";
|
||||
import type { MediaSelectorAddAction } from "@/components/mediaSelector/types";
|
||||
import TagSelector from "@/components/TagSelector.vue";
|
||||
import CustomerTagCard from "@/pages/customer/component/CustomerTagCard.vue";
|
||||
import { useCurrentStoreStore } from "@/store/currentStoreStore";
|
||||
@@ -484,6 +484,16 @@ function captureVideo(): void {
|
||||
videoInputRef.value?.click();
|
||||
}
|
||||
|
||||
function handlePhotoAction(action: MediaSelectorAddAction): void {
|
||||
if (action.emit === "add-point-card") {
|
||||
capturePointCard();
|
||||
return;
|
||||
}
|
||||
if (action.emit === "add-other") {
|
||||
openPhotoPicker("OTHER");
|
||||
}
|
||||
}
|
||||
|
||||
watch(isCustomerBound, (value) => {
|
||||
navBarStore.setRightDisabled(value);
|
||||
if (!value) {
|
||||
|
||||
@@ -32,9 +32,9 @@
|
||||
:show-viewer-actions="false"
|
||||
:add-actions="attachmentAddActions"
|
||||
@add="openAttachmentPicker('OTHER')"
|
||||
@action="handleAttachmentAction"
|
||||
@capture-photo="capturePhoto"
|
||||
@capture-video="captureVideo"
|
||||
@add-other="openAttachmentPicker('OTHER')"
|
||||
/>
|
||||
</t-form-item>
|
||||
<t-form-item label="纯色封面" label-width="8rem" content-align="right">
|
||||
@@ -214,6 +214,7 @@ import MediaSelector from "@/components/mediaSelector/MediaSelector.vue";
|
||||
import ProductSkuEditor from "@/pages/product/component/ProductSkuEditor.vue";
|
||||
import ProductSkuUnitEditor from "@/pages/product/component/ProductSkuUnitEditor.vue";
|
||||
import ProductSkuUnitBatchEditor from "@/pages/product/component/ProductSkuUnitBatchEditor.vue";
|
||||
import type { MediaSelectorAddAction } from "@/components/mediaSelector/types";
|
||||
import { useNavBarStore } from "@/store/navBarStore";
|
||||
import type { PhotoItem } from "@/types/Photo";
|
||||
import type { Product, ProductAttachmentType, ProductCategory, ProductSku, ProductSkuUnit, ProductSpec, ProductType } from "@/types/Product";
|
||||
@@ -567,6 +568,12 @@ function captureVideo(): void {
|
||||
videoInputRef.value?.click();
|
||||
}
|
||||
|
||||
function handleAttachmentAction(action: MediaSelectorAddAction): void {
|
||||
if (action.emit === "add-other") {
|
||||
openAttachmentPicker("OTHER");
|
||||
}
|
||||
}
|
||||
|
||||
function openCoverColorPicker(): void {
|
||||
coverColorDraft.value = solidColorCoverColor.value || DEFAULT_COVER_COLOR;
|
||||
coverColorPickerVisible.value = true;
|
||||
|
||||
@@ -1,16 +1 @@
|
||||
<!--
|
||||
Copyright 2019 Google Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<shortcuts xmlns:android='http://schemas.android.com/apk/res/android' />
|
||||
|
||||
Reference in New Issue
Block a user