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;
  imgId:number
  name: string;
  x: string;
  y: string;
  ind: number;
  son: TabType[];
};

export const mapData1: MapType[] = [
  {
    id: 1,
    imgId:1,
    name: "虎门故事",
    x: "33%",
    y: "7%",
    ind: 23,
    son: [
      {
        id: 1.1,
        name: "虎门故事",
        x: "21%",
        y: "25%",
        b: "auto",
        r: "auto",
        type: "底部",
        link: "/scene/?m=1194",
      },
      {
        id: 1.2,
        name: "鸦片战争博物馆",
        x: "9%",
        y: "30%",
        b: "auto",
        r: "auto",
        type: "底部",
        link: "/scene/?m=1194",
      },
    ],
  },
  {
    id: 2,
    imgId:1,
    name: "鸦片战争博物馆",
    x: "31%",
    y: "6%",
    ind: 22,
    son: [
      {
        id: 2.1,
        name: "虎门故事",
        x: "21%",
        y: "25%",
        b: "auto",
        r: "auto",
        type: "底部",
        link: "/scene/?m=1194",
      },
      {
        id: 2.2,
        name: "鸦片战争博物馆",
        x: "9%",
        y: "30%",
        b: "auto",
        r: "auto",
        type: "底部",
        link: "/scene/?m=1194",
      },
    ],
  },
  {
    id: 3,
    imgId:3,
    name: "海战馆",
    x: "16%",
    y: "41%",
    ind: 22,
    son: [
      {
        id: 2.1,
        name: "海战馆",
        x: "39.4%",
        y: "10%",
        b: "auto",
        r: "auto",
        type: "顶部",
        link: "/scene/?m=1194",
      },
    ],
  },
];

export const maoData2 = [
  {
    id: 4,
    name: "镇远炮台",
    x: "8%",
    y: "45%",
    b: "auto",
    r: "auto",
    ind: 21,
    type: "left",
    link: "/scene/?m=1194",
  },
  {
    id: 5,
    name: "靖远炮台",
    x: "11%",
    y: "42%",
    b: "auto",
    r: "auto",
    ind: 21,
    type: "left",
    link: "/scene/?m=1194",
    loc: "顶部",
  },
  {
    id: 6,
    name: "南山顶炮台",
    x: "12%",
    y: "41%",
    b: "auto",
    r: "auto",
    ind: 21,
    type: "left",
    link: "/scene/?m=1194",
    loc: "顶部",
  },
  {
    id: 7,
    name: "威远炮台",
    x: "10%",
    y: "47%",
    b: "auto",
    r: "auto",
    ind: 21,
    type: "left",
    link: "/scene/?m=1194",
  },
  {
    id: 8,
    name: "威胜东台",
    x: "12%",
    y: "46%",
    b: "auto",
    r: "auto",
    ind: 21,
    type: "left",
    link: "/scene/?m=1194",
  },
  // --------------
  {
    id: 9,
    name: "沙角炮台",
    x: "auto",
    y: "auto",
    b: "11%",
    r: "26.8%",
    ind: 21,
    type: "right",
    link: "/scene/?m=1194",
    loc: "顶部",
  },
  {
    id: 10,
    name: "林则徐纪念馆旧址",
    x: "auto",
    y: "auto",
    b: "11%",
    r: "25.4%",
    ind: 21,
    type: "right",
    link: "/scene/?m=1194",
    loc: "顶部",
  },
  {
    id: 11,
    name: "捕鱼台",
    x: "auto",
    y: "auto",
    b: "6%",
    r: "22.8%",
    ind: 21,
    type: "right",
    link: "/scene/?m=1194",
    loc: "顶部",
  },
];

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