Procházet zdrojové kódy

Merge branch '2023-8-28'

liushengqiang před 1 rokem
rodič
revize
4473964d61
1 změnil soubory, kde provedl 34 přidání a 13 odebrání
  1. 34 13
      src/pc/component/upload-to-resources/index.tsx

+ 34 - 13
src/pc/component/upload-to-resources/index.tsx

@@ -77,6 +77,7 @@ export default defineComponent({
 			}
 		};
 		const handleUploadImg = async (imgs: any[]) => {
+			if (!props.show) return;
 			for (let i = 0; i < imgs.length; i++) {
 				const fileName = `${Date.now()}p${i}.png`;
 				const file = dataURLtoFile(imgs[i].base64, fileName);
@@ -88,6 +89,7 @@ export default defineComponent({
 			froms.musicJianSvg = imgs[2]?.url || "";
 			model.productOpen = false;
 			imgs = [];
+			if (!props.show) return;
 			handleSubmit();
 		};
 		/** base64转file */
@@ -177,16 +179,16 @@ export default defineComponent({
 				if (err) {
 					return;
 				}
-                if (!props.item.xml) {
-                    message.error("没有生成xml文件");
-                    handleClose();
-                    return;
-                }
-                if (!props.item.filePath) {
-                    message.error("没有生成wav文件");
-                    handleClose();
-                    return;
-                }
+				if (!props.item.xml) {
+					message.error("没有生成xml文件");
+					handleClose();
+					return;
+				}
+				if (!props.item.filePath) {
+					message.error("没有生成wav文件");
+					handleClose();
+					return;
+				}
 				model.saveLoading = true;
 				handleAutoProduct();
 			});
@@ -194,9 +196,11 @@ export default defineComponent({
 		const handleSubmit = async () => {
 			await wav2mp3();
 			model.saveProgress = 70;
+			if (!props.show) return;
 			await createMusic();
 			model.saveProgress = 100;
 			emit("success");
+			if (!props.show) return;
 			message.success("上传成功");
 			setTimeout(() => {
 				model.saveLoading = false;
@@ -205,7 +209,14 @@ export default defineComponent({
 		};
 		return () => (
 			<>
-				<NModal autoFocus={false} show={props.show} onUpdate:show={(val) => emit("update:show", val)}>
+				<NModal
+					autoFocus={false}
+					show={props.show}
+					onUpdate:show={(val) => {
+						model.productOpen = false;
+						emit("update:show", val);
+					}}
+				>
 					<div class={styles.setbox}>
 						<div class={styles.head}>
 							<div>上传到我的资源</div>
@@ -214,7 +225,10 @@ export default defineComponent({
 								quaternary
 								circle
 								size="small"
-								onClick={() => emit("update:show", false)}
+								onClick={() => {
+									model.productOpen = false;
+									emit("update:show", false);
+								}}
 							>
 								<NIcon component={Close} size={18} />
 							</NButton>
@@ -268,7 +282,14 @@ export default defineComponent({
 							</NFormItem>
 						</NForm>
 						<div class={styles.btns}>
-							<NButton onClick={() => emit("update:show", false)}>取消</NButton>
+							<NButton
+								onClick={() => {
+									model.productOpen = false;
+									emit("update:show", false);
+								}}
+							>
+								取消
+							</NButton>
 							<NButton type="primary" loading={model.saveLoading} onClick={() => handleUpload()}>
 								确定
 							</NButton>