|  | @@ -1,5 +1,5 @@
 | 
	
		
			
				|  |  | -import { Row, showToast } from "vant";
 | 
	
		
			
				|  |  | -import { defineComponent, onMounted, reactive, nextTick, ref } from "vue";
 | 
	
		
			
				|  |  | +import { Row, showToast, showConfirmDialog } from "vant";
 | 
	
		
			
				|  |  | +import { defineComponent, onMounted, onUnmounted, reactive, nextTick, ref } from "vue";
 | 
	
		
			
				|  |  |  import state from "/src/state";
 | 
	
		
			
				|  |  |  import request from "/src/utils/request";
 | 
	
		
			
				|  |  |  import { getQuery } from "/src/utils/queryString";
 | 
	
	
		
			
				|  | @@ -10,6 +10,14 @@ import "@varlet/ui/es/button-group/style";
 | 
	
		
			
				|  |  |  import "@varlet/ui/es/switch/style";
 | 
	
		
			
				|  |  |  import { storeData } from "/src/store";
 | 
	
		
			
				|  |  |  import rightHideIcon from './image/right_hide_icon.png';
 | 
	
		
			
				|  |  | +import editIcon from './image/edit.png';
 | 
	
		
			
				|  |  | +import editCloseIcon from './image/edit_close.png';
 | 
	
		
			
				|  |  | +import editSaveIcon from './image/edit_save.png';
 | 
	
		
			
				|  |  | +import editPreIcon from './image/edit_pre.png';
 | 
	
		
			
				|  |  | +import editDeleteIcon from './image/edit_delete.png';
 | 
	
		
			
				|  |  | +import editResetIcon from './image/edit_reset.png';
 | 
	
		
			
				|  |  | +import editReduceIcon from './image/edit_reduce.png';
 | 
	
		
			
				|  |  | +import editAddIcon from './image/edit_add.png';
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  let extStyleConfigJson: any = {};
 | 
	
		
			
				|  |  |  const clientWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
 | 
	
	
		
			
				|  | @@ -70,9 +78,10 @@ function initSvgId() {
 | 
	
		
			
				|  |  |  	if (!svg) return;
 | 
	
		
			
				|  |  |  	const vfstavetempo: HTMLElement[] = Array.from(svg.querySelectorAll(".vf-stavetempo"));
 | 
	
		
			
				|  |  |  	const vftext: HTMLElement[] = Array.from(svg.querySelectorAll(".vf-text"));
 | 
	
		
			
				|  |  | -	const vfstaveSection: HTMLElement[] = []; //Array.from(svg.querySelectorAll(".vf-StaveSection"));
 | 
	
		
			
				|  |  | +	const vfstaveSection: HTMLElement[] = Array.from(svg.querySelectorAll(".vf-StaveSection"));
 | 
	
		
			
				|  |  |  	const vfRepetition: HTMLElement[] = Array.from(svg.querySelectorAll(".vf-Repetition"));
 | 
	
		
			
				|  |  |  	const vflineGroup: HTMLElement[] = Array.from(svg.querySelectorAll(".vf-lineGroup"));
 | 
	
		
			
				|  |  | +	// console.log('速度标记',vfstavetempo)
 | 
	
		
			
				|  |  |  	let tempIndex = 1;
 | 
	
		
			
				|  |  |  	[...vfstavetempo].forEach((ele) => {
 | 
	
		
			
				|  |  |  		setEleId(ele, "temp" + tempIndex);
 | 
	
	
		
			
				|  | @@ -80,6 +89,7 @@ function initSvgId() {
 | 
	
		
			
				|  |  |  	});
 | 
	
		
			
				|  |  |  	let textIndex = 1;
 | 
	
		
			
				|  |  |  	[...vftext].forEach((ele) => {
 | 
	
		
			
				|  |  | +		// console.log(ele.textContent,textIndex)
 | 
	
		
			
				|  |  |  		setEleId(ele, "text" + textIndex);
 | 
	
		
			
				|  |  |  		textIndex++;
 | 
	
		
			
				|  |  |  	});
 | 
	
	
		
			
				|  | @@ -112,10 +122,10 @@ function setEleId(ele: HTMLElement, eleId: string) {
 | 
	
		
			
				|  |  |  	if (!id) {
 | 
	
		
			
				|  |  |  		ele.setAttribute("id", eleId);
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  | -	createModelBox(ele as any);
 | 
	
		
			
				|  |  | +	createModelBox(ele as any, eleId as any);
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -function createModelBox(ele: SVGAElement) {
 | 
	
		
			
				|  |  | +function createModelBox(ele: SVGAElement, eleId?: any) {
 | 
	
		
			
				|  |  |  	const musicContainer = document.getElementById("musicAndSelection")?.getBoundingClientRect() || { x: 0, y: 0 };
 | 
	
		
			
				|  |  |  	const parentLeft = musicContainer.x || 0;
 | 
	
		
			
				|  |  |  	const parentTop = musicContainer.y || 0;
 | 
	
	
		
			
				|  | @@ -128,7 +138,7 @@ function createModelBox(ele: SVGAElement) {
 | 
	
		
			
				|  |  |  	};
 | 
	
		
			
				|  |  |  	const type = ele.getAttribute("class");
 | 
	
		
			
				|  |  |  	moveData.modelList.push({
 | 
	
		
			
				|  |  | -		id: ele.getAttribute("id"),
 | 
	
		
			
				|  |  | +		id: eleId || ele.getAttribute("id"),
 | 
	
		
			
				|  |  |  		bbox,
 | 
	
		
			
				|  |  |  		type,
 | 
	
		
			
				|  |  |  		isMove: false,
 | 
	
	
		
			
				|  | @@ -159,6 +169,22 @@ function getBox(ele: SVGAElement) {
 | 
	
		
			
				|  |  |  	};
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +// 切换开关
 | 
	
		
			
				|  |  | +const switchMoveState = () => {
 | 
	
		
			
				|  |  | +	// 如果编辑过,没有保存,点击取消状态,需要提醒用户是否取消
 | 
	
		
			
				|  |  | +	if (moveData.open && undoData.undoList.length) {
 | 
	
		
			
				|  |  | +		showConfirmDialog({
 | 
	
		
			
				|  |  | +			className: "noSaveModal",
 | 
	
		
			
				|  |  | +			title: "温馨提示",
 | 
	
		
			
				|  |  | +			message: "您有新的修改还未保存,取消后本次编辑的内容将不会保存",
 | 
	
		
			
				|  |  | +		}).then(() => {
 | 
	
		
			
				|  |  | +			moveData.open = false
 | 
	
		
			
				|  |  | +		});
 | 
	
		
			
				|  |  | +	} else {
 | 
	
		
			
				|  |  | +		moveData.open = !moveData.open
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  // 过滤数据
 | 
	
		
			
				|  |  |  export const filterMoveData = async () => {
 | 
	
		
			
				|  |  |  	const examSongId = state.examSongId;
 | 
	
	
		
			
				|  | @@ -216,6 +242,9 @@ export const filterMoveData = async () => {
 | 
	
		
			
				|  |  |  		});
 | 
	
		
			
				|  |  |  		if (res && res.code == 200) {
 | 
	
		
			
				|  |  |  			showToast("保存成功");
 | 
	
		
			
				|  |  | +			undoData.undoList = [];
 | 
	
		
			
				|  |  | +			undoData.activeItem = null;
 | 
	
		
			
				|  |  | +			state.extStyleConfigJson = JSON.stringify(extStyleConfigJson)
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  		clearActiveModel();
 | 
	
		
			
				|  |  |  	}
 | 
	
	
		
			
				|  | @@ -462,6 +491,7 @@ const handleUndo = () => {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  /** 根据移动数据渲染 */
 | 
	
		
			
				|  |  |  export const renderForMoveData = () => {
 | 
	
		
			
				|  |  | +	if (state.isSingleLine || state.musicRenderType !== 'staff') return; 
 | 
	
		
			
				|  |  |  	if (state.extStyleConfigJson) {
 | 
	
		
			
				|  |  |  		try {
 | 
	
		
			
				|  |  |  			extStyleConfigJson = JSON.parse(state.extStyleConfigJson);
 | 
	
	
		
			
				|  | @@ -514,7 +544,7 @@ export const renderForMoveData = () => {
 | 
	
		
			
				|  |  |  					// index = targetIndex + 1
 | 
	
		
			
				|  |  |  					// item.id = `text${index}`
 | 
	
		
			
				|  |  |  					index = targetIndex
 | 
	
		
			
				|  |  | -					item.id = `text${targetIndex+1}`
 | 
	
		
			
				|  |  | +					item.id = `text${targetIndex}`
 | 
	
		
			
				|  |  |  				}
 | 
	
		
			
				|  |  |  				// console.log(66666666,index)
 | 
	
		
			
				|  |  |  				if (index > -1) {
 | 
	
	
		
			
				|  | @@ -544,14 +574,25 @@ export default defineComponent({
 | 
	
		
			
				|  |  |  			// 	initSvgId();
 | 
	
		
			
				|  |  |  			// }
 | 
	
		
			
				|  |  |  			// renderForMoveData();
 | 
	
		
			
				|  |  | +			moveData.modelList = []
 | 
	
		
			
				|  |  |  			nextTick(() => initNoteCoord())
 | 
	
		
			
				|  |  | +			// const hasToolDom = Array.from(document.body.children)?.some((item: any) => item?.id === 'toolBox')
 | 
	
		
			
				|  |  | +			// if (!hasToolDom) {
 | 
	
		
			
				|  |  | +			// 	const toolBox = document.getElementById("toolBox");
 | 
	
		
			
				|  |  | +			// 	toolBox && document.body.appendChild(toolBox);
 | 
	
		
			
				|  |  | +			// }
 | 
	
		
			
				|  |  |  			const toolBox = document.getElementById("toolBox");
 | 
	
		
			
				|  |  |  			toolBox && document.body.appendChild(toolBox);
 | 
	
		
			
				|  |  |  		});
 | 
	
		
			
				|  |  | +		onUnmounted(() => {
 | 
	
		
			
				|  |  | +			moveData.modelList = []
 | 
	
		
			
				|  |  | +			const toolBox = document.getElementById("toolBox");
 | 
	
		
			
				|  |  | +			toolBox && document.body.removeChild(toolBox);
 | 
	
		
			
				|  |  | +		})
 | 
	
		
			
				|  |  |  		return () => (
 | 
	
		
			
				|  |  |  			<div class={[moveData.open ? "" : styles.moveDisabled]}>
 | 
	
		
			
				|  |  |  				<div id="toolBox">
 | 
	
		
			
				|  |  | -					<div class={[styles.toolBox, !showToolBox.value && styles.hideTool]} >
 | 
	
		
			
				|  |  | +					{/* <div class={[styles.toolBox, !showToolBox.value && styles.hideTool]} >
 | 
	
		
			
				|  |  |  						<Switch v-model={moveData.open} />
 | 
	
		
			
				|  |  |  						{moveData.open && (
 | 
	
		
			
				|  |  |  							<>
 | 
	
	
		
			
				|  | @@ -561,12 +602,6 @@ export default defineComponent({
 | 
	
		
			
				|  |  |  										<Button onClick={() => handleAddAndSub('sub')}>减</Button>
 | 
	
		
			
				|  |  |  									</ButtonGroup>
 | 
	
		
			
				|  |  |  								)}
 | 
	
		
			
				|  |  | -								{/* <ButtonGroup size="small">
 | 
	
		
			
				|  |  | -									
 | 
	
		
			
				|  |  | -									<Button>
 | 
	
		
			
				|  |  | -										<Icon name="arrow-down" style={{ transform: "rotate(-90deg)" }} />
 | 
	
		
			
				|  |  | -									</Button>
 | 
	
		
			
				|  |  | -								</ButtonGroup> */}
 | 
	
		
			
				|  |  |  								<Button size="small" onClick={handleUndo} disabled={undoData.undoList.length ? false : true}>
 | 
	
		
			
				|  |  |  									<Icon name="arrow-down" style={{ transform: "rotate(90deg)" }} />
 | 
	
		
			
				|  |  |  								</Button>
 | 
	
	
		
			
				|  | @@ -592,7 +627,41 @@ export default defineComponent({
 | 
	
		
			
				|  |  |  							class={[styles.rightHideIcon, !showToolBox.value ? styles.rightIconShow : '']} 
 | 
	
		
			
				|  |  |  							src={rightHideIcon}
 | 
	
		
			
				|  |  |  							onClick={() => showToolBox.value = true } />
 | 
	
		
			
				|  |  | -					}  
 | 
	
		
			
				|  |  | +					}   */}	
 | 
	
		
			
				|  |  | +					<div class={[styles.editToolBox, !moveData.open && styles.itemDisabled]}>		
 | 
	
		
			
				|  |  | +						{
 | 
	
		
			
				|  |  | +							state.musicRenderType === 'staff' && !state.isSingleLine && 
 | 
	
		
			
				|  |  | +							<>
 | 
	
		
			
				|  |  | +								<div class={[styles.editItem, styles.canEdit]} onClick={switchMoveState}>
 | 
	
		
			
				|  |  | +									<img src={moveData.open ? editCloseIcon : editIcon} />
 | 
	
		
			
				|  |  | +									<span>{moveData.open ? '取消' : '编辑'}</span>
 | 
	
		
			
				|  |  | +								</div>
 | 
	
		
			
				|  |  | +								<div class={styles.editItem} onClick={filterMoveData}>
 | 
	
		
			
				|  |  | +									<img src={editSaveIcon} />
 | 
	
		
			
				|  |  | +									<span>保存</span>
 | 
	
		
			
				|  |  | +								</div>
 | 
	
		
			
				|  |  | +								<div class={[styles.editItem, !undoData.undoList.length && styles.disabled]} onClick={handleUndo}>
 | 
	
		
			
				|  |  | +									<img src={editPreIcon} />
 | 
	
		
			
				|  |  | +									<span>撤回</span>
 | 
	
		
			
				|  |  | +								</div>
 | 
	
		
			
				|  |  | +								<div class={[styles.editItem, moveData.activeIndex <= -1 && styles.disabled]} onClick={handleDeleteMoveNote}>
 | 
	
		
			
				|  |  | +									<img src={editDeleteIcon} />
 | 
	
		
			
				|  |  | +									<span>{moveData.modelList[moveData.activeIndex]?.isDelete ? '回显' : '删除'}</span>
 | 
	
		
			
				|  |  | +								</div>
 | 
	
		
			
				|  |  | +								<div class={styles.editItem} onClick={resetMoveNote}>
 | 
	
		
			
				|  |  | +									<img src={editResetIcon} />
 | 
	
		
			
				|  |  | +									<span>重置</span>
 | 
	
		
			
				|  |  | +								</div>
 | 
	
		
			
				|  |  | +								{
 | 
	
		
			
				|  |  | +									moveData.tool.isAddAndSub && 
 | 
	
		
			
				|  |  | +									<div class={styles.extraItem}>
 | 
	
		
			
				|  |  | +										<img src={editReduceIcon} onClick={() => handleAddAndSub('sub')} />
 | 
	
		
			
				|  |  | +										<img src={editAddIcon} onClick={() => handleAddAndSub('add')} />
 | 
	
		
			
				|  |  | +									</div>								
 | 
	
		
			
				|  |  | +								}		
 | 
	
		
			
				|  |  | +							</>						
 | 
	
		
			
				|  |  | +						}										
 | 
	
		
			
				|  |  | +					</div>		
 | 
	
		
			
				|  |  |  				</div>
 | 
	
		
			
				|  |  |  				{moveData.modelList.map((item: any, index: number) => {
 | 
	
		
			
				|  |  |  					return (
 |