/** * 设置按钮颜色状态 * 用于EarthComp.vue */ import { defHttp } from '/@/utils/http/axios'; import { useUserStore } from '/@/store/modules/user'; import { useEarthMapStore } from '/@/store/modules/earthMap'; import circleDot2 from '@/assets/earthMap/circleDot2.png'; import circleDot1 from '@/assets/earthMap/circleDot1.png'; import circleDot3 from '@/assets/earthMap/circleDot3.png'; let userStore = useUserStore(); let store = useEarthMapStore(); export default function setIconByRef(ref, el) { const status = store.statusByNodeId.get(ref); if (status != undefined && status != null) { let img = store.imgByRef.get(ref); const icon = el.children[0].children[2]; if (!img) { img = document.createElement('img'); store.imgByRef.set(ref, img); } if (icon.nodeName == 'I') { icon.replaceWith(img); } if (status == 1) { img.src = circleDot2; } else if (status == 0) { img.src = circleDot1; } else { img.src = circleDot3; } img.setAttribute('style', 'width:16px;height:16px;margin-top:7px'); } }