import store from "@/store";

export type TabType = {
  id: number;
  name: string;
  x: string;
  y: string;
  b: string;
  r: string;
  type: "底部" | "顶部";
  link: string;
};

type MapType = {
  id: number;
  name: string;
  x: string;
  y: string;
  ind: number;
  son: TabType[];
};

export const mapData1: MapType[] = [
  {
    id: 1,
    name: "虎门故事",
    x: "37%",
    y: "6%",
    ind: 21,
    son: [
      {
        id: 1.1,
        name: "虎门故事",
        x: "20%",
        y: "10%",
        b: "auto",
        r: "auto",
        type: "底部",
        link: "https://www.baidu.com/",
      },
      {
        id: 1.2,
        name: "消烟池",
        x: "auto",
        y: "auto",
        b: "40%",
        r: "40%",
        type: "顶部",
        link: "https://www.baidu.com/",
      },
    ],
  },
  {
    id: 2,
    name: "鸦片战争博物馆",
    x: "35%",
    y: "5.6%",
    ind: 20,
    son: [
      {
        id: 2.1,
        name: "22222-1111",
        x: "20%",
        y: "10%",
        b: "auto",
        r: "auto",
        type: "顶部",
        link: "https://www.baidu.com/",
      },
    ],
  },
  {
    id: 3,
    name: "海战馆",
    x: "20.3%",
    y: "44%",
    ind: 20,
    son: [
      {
        id: 2.1,
        name: "22222-1111",
        x: "20%",
        y: "10%",
        b: "auto",
        r: "auto",
        type: "顶部",
        link: "https://www.baidu.com/",
      },
    ],
  },
];
// 沙角炮台
// 林则徐纪念馆旧址
// 捕鱼台

export const maoData2 = [
  {
    id: 4,
    name: "南山顶炮台",
    x: "10%",
    y: "40%",
    b: "auto",
    r: "auto",
    ind: 21,
    type: "left",
    link: "https://www.baidu.com/",
  },
  {
    id: 5,
    name: "威远炮台",
    x: "auto",
    y: "auto",
    b: "5%",
    r: "10%",
    ind: 21,
    type: "right",
    link: "https://www.baidu.com/",
  },
];

// 设置图片加载完成的仓库数据
export const imgLodingFu = (id: number) => {
  const oldArr = store.getState().A0layout.imgLodingArr;
  if (oldArr.includes(id)) {
  } else {
    store.dispatch({ type: "layout/imgLoding", payload: [...oldArr, id] });
  }
};
