|  | @@ -0,0 +1,56 @@
 | 
	
		
			
				|  |  | +import { defineComponent, onMounted, onUnmounted, reactive } from "vue";
 | 
	
		
			
				|  |  | +import state, { getMusicDetail } from "/src/state";
 | 
	
		
			
				|  |  | +import MusicScore from "../../view/music-score";
 | 
	
		
			
				|  |  | +import styles from "./index.module.less";
 | 
	
		
			
				|  |  | +import { getQuery } from "/src/utils/queryString";
 | 
	
		
			
				|  |  | +import { closeToast, showLoadingToast } from "vant";
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +export default defineComponent({
 | 
	
		
			
				|  |  | +	name: "music-list",
 | 
	
		
			
				|  |  | +	setup() {
 | 
	
		
			
				|  |  | +		const query: any = getQuery();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		const detailData = reactive({
 | 
	
		
			
				|  |  | +			isLoading: true,
 | 
	
		
			
				|  |  | +		});
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		const communicateCb = (res: any) => {
 | 
	
		
			
				|  |  | +			// 播放进度
 | 
	
		
			
				|  |  | +			if (res?.data?.api === "playProgress") {
 | 
	
		
			
				|  |  | +				if (res?.data.data) {
 | 
	
		
			
				|  |  | +					console.log(res.data)
 | 
	
		
			
				|  |  | +				}
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +		};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		onMounted(async () => {
 | 
	
		
			
				|  |  | +			const id = query.id || '';
 | 
	
		
			
				|  |  | +			await getMusicDetail(id);
 | 
	
		
			
				|  |  | +			detailData.isLoading = false;
 | 
	
		
			
				|  |  | +			state.isSingleLine = true;
 | 
	
		
			
				|  |  | +			window.addEventListener("message", communicateCb);
 | 
	
		
			
				|  |  | +		});
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		onUnmounted(() => {
 | 
	
		
			
				|  |  | +			window.removeEventListener("message", communicateCb);
 | 
	
		
			
				|  |  | +		});
 | 
	
		
			
				|  |  | +		/** 渲染完成 */
 | 
	
		
			
				|  |  | +		const handleRendered = async () => {
 | 
	
		
			
				|  |  | +			console.log('渲染完成')
 | 
	
		
			
				|  |  | +		};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		return () => (
 | 
	
		
			
				|  |  | +			<div class={styles.detail}>
 | 
	
		
			
				|  |  | +				<div id="scrollContainer" class={[styles.container, "hideCursor"]}>
 | 
	
		
			
				|  |  | +					{/* 曲谱渲染 */}
 | 
	
		
			
				|  |  | +					{!detailData.isLoading && 
 | 
	
		
			
				|  |  | +					<MusicScore 
 | 
	
		
			
				|  |  | +						onRendered={handleRendered} 
 | 
	
		
			
				|  |  | +						musicColor={'#FFFFFF'}
 | 
	
		
			
				|  |  | +					/>}
 | 
	
		
			
				|  |  | +				</div>
 | 
	
		
			
				|  |  | +			</div>
 | 
	
		
			
				|  |  | +		);
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +});
 |