fix add-point-card invalid
This commit is contained in:
@@ -25,9 +25,10 @@
|
|||||||
:add-text="props.addText ?? '选择文件'"
|
:add-text="props.addText ?? '选择文件'"
|
||||||
:busy="isBusy"
|
:busy="isBusy"
|
||||||
:upload-enabled="!!props.upload"
|
:upload-enabled="!!props.upload"
|
||||||
@add="emit('add')"
|
@add="handleAdd"
|
||||||
@capture-photo="emit('capture-photo')"
|
@action="handleAddAction"
|
||||||
@capture-video="emit('capture-video')"
|
@capture-photo="handleCapturePhoto"
|
||||||
|
@capture-video="handleCaptureVideo"
|
||||||
@file-change="handleFileChange"
|
@file-change="handleFileChange"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -90,13 +91,32 @@ const props = withDefaults(defineProps<Props>(), {
|
|||||||
});
|
});
|
||||||
|
|
||||||
type Emits = {
|
type Emits = {
|
||||||
(event: string): void;
|
add: [];
|
||||||
(event: "update:modelValue", value: string[]): void;
|
action: [value: MediaSelectorAddAction];
|
||||||
(event: "update:photoItems", value: PhotoItem[]): void;
|
"capture-photo": [];
|
||||||
|
"capture-video": [];
|
||||||
|
"update:modelValue": [value: string[]];
|
||||||
|
"update:photoItems": [value: PhotoItem[]];
|
||||||
};
|
};
|
||||||
|
|
||||||
const emit = defineEmits<Emits>();
|
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 photoViewerVisible = ref(false);
|
||||||
const photoViewerImages = ref<string[]>([]);
|
const photoViewerImages = ref<string[]>([]);
|
||||||
const photoViewerItems = ref<MediaSelectorViewerItem[]>([]);
|
const photoViewerItems = ref<MediaSelectorViewerItem[]>([]);
|
||||||
|
|||||||
@@ -91,14 +91,12 @@ interface Props {
|
|||||||
|
|
||||||
const props = defineProps<Props>();
|
const props = defineProps<Props>();
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(event: "add"): void;
|
add: [];
|
||||||
(event: "capture-photo"): void;
|
action: [value: MediaSelectorAddAction];
|
||||||
(event: "capture-video"): void;
|
"capture-photo": [];
|
||||||
(event: "file-change", value: Event): void;
|
"capture-video": [];
|
||||||
|
"file-change": [value: Event];
|
||||||
}>();
|
}>();
|
||||||
const emitExternal = (event: string): void => {
|
|
||||||
(emit as unknown as (eventName: string) => void)(event);
|
|
||||||
};
|
|
||||||
|
|
||||||
const capturePopoverVisible = ref(false);
|
const capturePopoverVisible = ref(false);
|
||||||
const fileInput = ref<HTMLInputElement>();
|
const fileInput = ref<HTMLInputElement>();
|
||||||
@@ -127,15 +125,23 @@ function handleFileAction(): void {
|
|||||||
|
|
||||||
function handleCaptureAction(action: MediaSelectorAddAction): void {
|
function handleCaptureAction(action: MediaSelectorAddAction): void {
|
||||||
capturePopoverVisible.value = false;
|
capturePopoverVisible.value = false;
|
||||||
if (action.emit === "capture-photo" && props.uploadEnabled) {
|
if (action.emit === "capture-photo") {
|
||||||
|
if (props.uploadEnabled) {
|
||||||
photoFileInput.value?.click();
|
photoFileInput.value?.click();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (action.emit === "capture-video" && props.uploadEnabled) {
|
emit("capture-photo");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (action.emit === "capture-video") {
|
||||||
|
if (props.uploadEnabled) {
|
||||||
videoFileInput.value?.click();
|
videoFileInput.value?.click();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
emitExternal(action.emit);
|
emit("capture-video");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
emit("action", action);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleFileChange(event: Event): void {
|
function handleFileChange(event: Event): void {
|
||||||
|
|||||||
@@ -81,10 +81,9 @@
|
|||||||
:add-actions="photoAddActions"
|
:add-actions="photoAddActions"
|
||||||
:loading="isPhotoUploading"
|
:loading="isPhotoUploading"
|
||||||
@add="openPhotoPicker('OTHER')"
|
@add="openPhotoPicker('OTHER')"
|
||||||
|
@action="handlePhotoAction"
|
||||||
@capture-photo="capturePhoto"
|
@capture-photo="capturePhoto"
|
||||||
@capture-video="captureVideo"
|
@capture-video="captureVideo"
|
||||||
@add-point-card="capturePointCard"
|
|
||||||
@add-other="openPhotoPicker('OTHER')"
|
|
||||||
/>
|
/>
|
||||||
<div class="tips orange" v-if="!hasCustomerDeletePermission">当前账户权限编辑客户需要上传照片和积分卡</div>
|
<div class="tips orange" v-if="!hasCustomerDeletePermission">当前账户权限编辑客户需要上传照片和积分卡</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -232,6 +231,7 @@ import CodeScanner from "@/components/CodeScanner.vue";
|
|||||||
import CustomerProfileCard from "@/components/CustomerProfileCard.vue";
|
import CustomerProfileCard from "@/components/CustomerProfileCard.vue";
|
||||||
import CustomerSelector from "@/components/CustomerSelector.vue";
|
import CustomerSelector from "@/components/CustomerSelector.vue";
|
||||||
import MediaSelector from "@/components/mediaSelector/MediaSelector.vue";
|
import MediaSelector from "@/components/mediaSelector/MediaSelector.vue";
|
||||||
|
import type { MediaSelectorAddAction } from "@/components/mediaSelector/types";
|
||||||
import TagSelector from "@/components/TagSelector.vue";
|
import TagSelector from "@/components/TagSelector.vue";
|
||||||
import CustomerTagCard from "@/pages/customer/component/CustomerTagCard.vue";
|
import CustomerTagCard from "@/pages/customer/component/CustomerTagCard.vue";
|
||||||
import { useCurrentStoreStore } from "@/store/currentStoreStore";
|
import { useCurrentStoreStore } from "@/store/currentStoreStore";
|
||||||
@@ -484,6 +484,16 @@ function captureVideo(): void {
|
|||||||
videoInputRef.value?.click();
|
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) => {
|
watch(isCustomerBound, (value) => {
|
||||||
navBarStore.setRightDisabled(value);
|
navBarStore.setRightDisabled(value);
|
||||||
if (!value) {
|
if (!value) {
|
||||||
|
|||||||
@@ -32,9 +32,9 @@
|
|||||||
:show-viewer-actions="false"
|
:show-viewer-actions="false"
|
||||||
:add-actions="attachmentAddActions"
|
:add-actions="attachmentAddActions"
|
||||||
@add="openAttachmentPicker('OTHER')"
|
@add="openAttachmentPicker('OTHER')"
|
||||||
|
@action="handleAttachmentAction"
|
||||||
@capture-photo="capturePhoto"
|
@capture-photo="capturePhoto"
|
||||||
@capture-video="captureVideo"
|
@capture-video="captureVideo"
|
||||||
@add-other="openAttachmentPicker('OTHER')"
|
|
||||||
/>
|
/>
|
||||||
</t-form-item>
|
</t-form-item>
|
||||||
<t-form-item label="纯色封面" label-width="8rem" content-align="right">
|
<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 ProductSkuEditor from "@/pages/product/component/ProductSkuEditor.vue";
|
||||||
import ProductSkuUnitEditor from "@/pages/product/component/ProductSkuUnitEditor.vue";
|
import ProductSkuUnitEditor from "@/pages/product/component/ProductSkuUnitEditor.vue";
|
||||||
import ProductSkuUnitBatchEditor from "@/pages/product/component/ProductSkuUnitBatchEditor.vue";
|
import ProductSkuUnitBatchEditor from "@/pages/product/component/ProductSkuUnitBatchEditor.vue";
|
||||||
|
import type { MediaSelectorAddAction } from "@/components/mediaSelector/types";
|
||||||
import { useNavBarStore } from "@/store/navBarStore";
|
import { useNavBarStore } from "@/store/navBarStore";
|
||||||
import type { PhotoItem } from "@/types/Photo";
|
import type { PhotoItem } from "@/types/Photo";
|
||||||
import type { Product, ProductAttachmentType, ProductCategory, ProductSku, ProductSkuUnit, ProductSpec, ProductType } from "@/types/Product";
|
import type { Product, ProductAttachmentType, ProductCategory, ProductSku, ProductSkuUnit, ProductSpec, ProductType } from "@/types/Product";
|
||||||
@@ -567,6 +568,12 @@ function captureVideo(): void {
|
|||||||
videoInputRef.value?.click();
|
videoInputRef.value?.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleAttachmentAction(action: MediaSelectorAddAction): void {
|
||||||
|
if (action.emit === "add-other") {
|
||||||
|
openAttachmentPicker("OTHER");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function openCoverColorPicker(): void {
|
function openCoverColorPicker(): void {
|
||||||
coverColorDraft.value = solidColorCoverColor.value || DEFAULT_COVER_COLOR;
|
coverColorDraft.value = solidColorCoverColor.value || DEFAULT_COVER_COLOR;
|
||||||
coverColorPickerVisible.value = true;
|
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' />
|
<shortcuts xmlns:android='http://schemas.android.com/apk/res/android' />
|
||||||
|
|||||||
Reference in New Issue
Block a user