| 
					
				 | 
			
			
				@@ -1,6 +1,20 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import { defineComponent, onMounted, onUnmounted, reactive, watch } from "vue"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import { api_musicSheetCreationWav2mp3, api_musicSheetSave, api_subjectList } from "../../api"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import { NButton, NForm, NFormItem, NIcon, NModal, NSelect, NSpace, useMessage } from "naive-ui"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { defineComponent, nextTick, onMounted, onUnmounted, reactive, watch } from "vue"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	api_musicSheetCreationWav2mp3, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	api_musicSheetCreationSaveMusic, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	api_subjectList, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} from "../../api"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	NButton, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	NForm, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	NFormItem, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	NIcon, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	NModal, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	NProgress, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	NSelect, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	NSpace, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	useMessage, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} from "naive-ui"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import styles from "./index.module.less"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { Close } from "@vicons/ionicons5"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { SelectMixedOption } from "naive-ui/es/select/src/interface"; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -18,12 +32,13 @@ export default defineComponent({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			default: () => ({}), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	emits: ["update:show"], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	emits: ["update:show", "success"], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	setup(props, { emit }) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		const message = useMessage(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		const model = reactive({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			subjects: [] as SelectMixedOption[], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			saveLoading: false, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			saveProgress: 0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			productOpen: false, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			productIfameSrc: "", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		}); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -56,10 +71,7 @@ export default defineComponent({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				imgs = imgs.filter((item: any) => item.base64); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				if (imgs.length === 3) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					message.success("生成成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					handleUploadImg(imgs); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				} else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					message.error("生成失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				console.log("🚀 ~ 上传之前", [...imgs]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			} 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -69,6 +81,7 @@ export default defineComponent({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				const fileName = `${Date.now()}p${i}.png`; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				const file = dataURLtoFile(imgs[i].base64, fileName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				imgs[i].url = await api_uploadFile(file, fileName, () => {}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				model.saveProgress = (i + 1) * 20; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			froms.musicImg = imgs[0]?.url || ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			froms.musicSvg = imgs[1]?.url || ""; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -105,9 +118,10 @@ export default defineComponent({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		const createMusic = async () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			await api_musicSheetSave({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			await api_musicSheetCreationSaveMusic({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				musicSheetCreationId: props.item.id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				musicSheetName: props.item.name || "曲谱名称", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				musicSheetCategoriesId: 29, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				musicSheetCategoriesId: "", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				audioType: "MP3", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				mp3Type: "MP3", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				xmlFileUrl: props.item.xml, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -119,7 +133,7 @@ export default defineComponent({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				background: [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 						audioFileUrl: froms.mp3, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-						track: "", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						track: "P1", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				musicImg: froms.musicImg, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -133,18 +147,34 @@ export default defineComponent({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			froms.mp3 = data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const handleClose = () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            model.saveLoading = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            model.saveProgress = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		/** 自动生成图片 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		const handleAutoProduct = () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		const handleAutoProduct = async () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            model.saveProgress = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			const xml = props.item.xml; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			if (!xml) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				message.error("没有生成xml文件"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                handleClose(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const res = await fetch(xml) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (res.status > 299 || res.status < 200){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                message.error("xml文件不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                handleClose(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			const origin = /(localhost|192)/.test(location.host) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				? "https://test.lexiaoya.cn" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				: location.origin; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			model.productIfameSrc = `${origin}/instrument/#/product-img?xmlUrl=${xml}&productXmlImg=1`; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			model.productOpen = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            setTimeout(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                model.saveProgress = 10; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }, 800) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		const handleUpload = () => { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -153,11 +183,15 @@ export default defineComponent({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		const handleSubmit = async () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			await wav2mp3(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			model.saveProgress = 70; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			await createMusic(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			model.saveProgress = 100; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			emit("success"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            message.success("上传成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			setTimeout(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				model.saveLoading = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				emit("update:show", false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			}, 1000); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			}, 300); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return () => ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			<> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -184,7 +218,7 @@ export default defineComponent({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 									v-model:value={froms.subjectId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 								></NSelect> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 							</NFormItem> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-							<NFormItem label="是否公开"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+							{/* <NFormItem label="是否公开"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 								<NSpace class={styles.checkbox} wrapItem={false}> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 									<NButton 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 										secondary 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -203,6 +237,9 @@ export default defineComponent({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 										不公开 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 									</NButton> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 								</NSpace> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+							</NFormItem> */} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+							<NFormItem label="上传进度" style={{ display: model.saveLoading ? "" : "none" }}> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+								<NProgress percentage={model.saveProgress} /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 							</NFormItem> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 						</NForm> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 						<div class={styles.btns}> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -213,7 +250,7 @@ export default defineComponent({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 						</div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 					</div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				</NModal> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                { model.productOpen && <iframe class={styles.productIframe} src={model.productIfameSrc}></iframe>} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				{model.productOpen && <iframe class={styles.productIframe} src={model.productIfameSrc}></iframe>} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			</> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	}, 
			 |