|
@@ -1,4 +1,4 @@
|
|
|
-import React, { useCallback, useMemo } from "react";
|
|
|
+import React, { useCallback, useEffect, useMemo } from "react";
|
|
|
import styles from "./index.module.scss";
|
|
|
import demoImg from "@/assets/img/demo.jpg";
|
|
|
import { Button } from "antd";
|
|
@@ -8,9 +8,10 @@ import { MessageFu } from "@/utils/message";
|
|
|
import { removeTokenInfo } from "@/utils/storage";
|
|
|
import history from "@/utils/history";
|
|
|
import { baseURL } from "@/utils/http";
|
|
|
+import { useDispatch, useSelector } from "react-redux";
|
|
|
+import { B1_APIgetList } from "@/store/action/B1Scene";
|
|
|
+import { RootState } from "@/store";
|
|
|
|
|
|
-
|
|
|
-// 待完善
|
|
|
const isTokenFlagFu = (val: boolean, url: string) => {
|
|
|
if (val) {
|
|
|
// token 有效
|
|
@@ -24,23 +25,13 @@ const isTokenFlagFu = (val: boolean, url: string) => {
|
|
|
};
|
|
|
|
|
|
function Scene() {
|
|
|
- const list1 = useMemo(() => {
|
|
|
- return [
|
|
|
- { id: 1, sceneCode: "1194", name: "鸦片战争博物馆", img: demoImg },
|
|
|
- { id: 2, sceneCode: "1194", name: "海战博物馆A厅", img: demoImg },
|
|
|
- { id: 3, sceneCode: "1194", name: "海战博物馆B厅", img: demoImg },
|
|
|
- {
|
|
|
- id: 4,
|
|
|
- sceneCode: "1194",
|
|
|
- name: "海战博物馆C厅海战博物馆C厅海战博物馆C厅",
|
|
|
- img: demoImg,
|
|
|
- },
|
|
|
- { id: 5, sceneCode: "1194", name: "海战博物馆D厅", img: demoImg },
|
|
|
- { id: 6, sceneCode: "1194", name: "虎门故事展厅", img: demoImg },
|
|
|
- { id: 7, sceneCode: "1194", name: "虎门故事展厅777", img: demoImg },
|
|
|
- ];
|
|
|
- }, []);
|
|
|
+ const list = useSelector((state: RootState) => state.B1Scene.list);
|
|
|
+
|
|
|
+ const dispatch = useDispatch();
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
+ dispatch(B1_APIgetList());
|
|
|
+ }, [dispatch]);
|
|
|
|
|
|
const lookFu = useCallback(async (code: string) => {
|
|
|
const res = await isTokenFlagAPI();
|
|
@@ -62,9 +53,14 @@ function Scene() {
|
|
|
{/* 场景编辑器 */}
|
|
|
<div className="box1">
|
|
|
<div className="box1RowBox">
|
|
|
- {list1.map((v) => (
|
|
|
+ {list.map((v) => (
|
|
|
<div className="box1Row" key={v.id}>
|
|
|
- <ImageLazy src={v.img} width="100%" height={180} offline={true} />
|
|
|
+ <ImageLazy
|
|
|
+ src={`${baseURL}/backstage/sceneCover/${v.sceneCode}.jpg`}
|
|
|
+ width="100%"
|
|
|
+ height={180}
|
|
|
+ offline={true}
|
|
|
+ />
|
|
|
<div className="txt">{v.name}</div>
|
|
|
<div className="button">
|
|
|
<Button type="primary" onClick={() => lookFu(v.sceneCode)}>
|