liuyg
2022-03-15 7366b0a279425cb6218bec8ba19774e5e8399b91
src/store/modules/mobiles/urlParameter.js
@@ -1,22 +1,26 @@
window.urlParameterLayer = null;
window.divIcon = null;
const urlParameter = {
    state: {
        urlParameterData: {},
        urlParameterLayer: null // 自定义标签图层
        // urlParameterLayer: null // 自定义标签图层
    },
    actions: {
        addurlParameterLayerIcon ({
        addurlParameterLayerIcon({
            state,
            commit,
            dispatch
        }, val) {
            const list = val.list
            if (val.clear) {
                //     state.urlParameterLayer.remove();
                state.urlParameterLayer.clear()
                //     window.urlParameterLayer.remove();
                window.urlParameterLayererLayer.clear()
            }
            for (const i in list) {
                // console.log(list[i], 112233)
                const divIcon = new global.DC.DivIcon(
                window.divIcon = new global.DC.DivIcon(
                    new global.DC.Position(
                        Number(list[i].jd),
                        Number(list[i].wd),
@@ -33,7 +37,7 @@
                          </div>
                      `
                )
                divIcon.on(global.DC.MouseEventType.CLICK, (e) => {
                window.divIcon.on(global.DC.MouseEventType.CLICK, (e) => {
                    const lntLat = [+list[i].jd, +list[i].wd]
                    const d = {
                        position: {},
@@ -48,27 +52,27 @@
                    }
                    dispatch('setMobileWindows', d)
                })
                state.urlParameterLayer.addOverlay(divIcon)
                window.urlParameterLayer.addOverlay(window.divIcon)
            }
        }
    },
    mutations: {
        initurlParameterLayer (state, val) {
            if (!state.urlParameterLayer) {
                state.urlParameterLayer = new global.DC.HtmlLayer('urlParameterLayer')
                state.mviewer.addLayer(state.urlParameterLayer)
        initurlParameterLayer(state, val) {
            if (!window.urlParameterLayer) {
                window.urlParameterLayer = new global.DC.HtmlLayer('urlParameterLayer')
                global.viewer.addLayer(window.urlParameterLayer)
            }
        },
        set_urlParameterData (state, val) {
        set_urlParameterData(state, val) {
            state.urlParameterData = val
        },
        clearurlParameterLayerIcon (state, val) {
            if (state.urlParameterLayer) {
                state.urlParameterLayer.clear()
        clearurlParameterLayerIcon(state, val) {
            if (window.urlParameterLayer) {
                window.urlParameterLayer.clear()
            }
        }
    }
}
export default urlParameter
export default urlParameter