shaogen1995 2 years ago
parent
commit
d71f92df38

+ 2 - 2
重写子系统/public/model.html

@@ -18,8 +18,8 @@
   <div id="ui"></div>
   <script>
     let url = getQueryVariable("m");
-    // fdage.embed(url, {
-    fdage.embed('https://lsbwg.4dage.com' + url, {
+    fdage.embed(url, {
+      // fdage.embed('https://lsbwg.4dage.com' + url, {
       // fdage.embed('http://192.168.20.55:8041/api' + url, {
       transparentBackground: true,
       width: 800,

+ 2 - 0
重写子系统/src/App.tsx

@@ -12,6 +12,7 @@ import MessageCom from "./components/Message";
 
 // 使用 React.lazy 懒加载页面
 const A1Home = React.lazy(() => import("./pages/A1Home"));
+const A2Goods = React.lazy(() => import("./pages/A2Goods"));
 
 const NotFound = React.lazy(() => import("@/components/NotFound"));
 
@@ -28,6 +29,7 @@ function App() {
           <Switch>
             {/* 封面页 */}
             <Route path="/" exact component={A1Home} />
+            <Route path="/goods" component={A2Goods} />
             {/* 找不到页面 */}
             <Route path="*" component={NotFound} />
           </Switch>

+ 11 - 1
重写子系统/src/pages/A2Goods/index.tsx

@@ -18,6 +18,8 @@ import { baseURL } from "@/utils/http";
 import classNames from "classnames";
 import { LeftOutlined, RightOutlined } from "@ant-design/icons";
 import MemoImageLazy from "@/components/ImageLazy";
+import { urlParameter } from "@/utils/history";
+import { useLocation } from "react-router-dom";
 
 type Props = {
   id?: number;
@@ -28,6 +30,9 @@ function A2Goods({ id, closePageFu }: Props) {
   // 从分享链接进来的id
   const uidRef = useRef("");
 
+  // 获取地址栏参数
+  const location = useLocation();
+
   // 底部 tab
   const botTabTemp = useMemo(() => {
     const arr: A2_TabType = [
@@ -133,8 +138,13 @@ function A2Goods({ id, closePageFu }: Props) {
     if (id) getInfoFu(id);
     else {
       // 从分享的链接单独进来,从地址栏获取id
+      const obj = urlParameter(location.search);
+      if (obj.id) {
+        uidRef.current = obj.id;
+        getInfoFu(obj.id);
+      } else alert("参数错误!");
     }
-  }, [getInfoFu, id]);
+  }, [getInfoFu, id, location.search]);
 
   // 没有附件信息
   const [noFile, setNoFile] = useState(false);