|
@@ -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);
|