|
|
@@ -1,4 +1,4 @@
|
|
|
-import { useEffect } from "react";
|
|
|
+import { useEffect, useMemo } from "react";
|
|
|
import Taro, { FC } from "@tarojs/taro";
|
|
|
import { AtFloatLayout } from "taro-ui";
|
|
|
import { AtFloatLayoutProps } from "taro-ui/types/float-layout";
|
|
|
@@ -7,13 +7,24 @@ import BorderImg from "../../../../images/line01@2x.png";
|
|
|
import CloseIcon from "../../../../images/icon_back@2x-min.png";
|
|
|
import { SIGHT_LIST } from "../../constants";
|
|
|
import { addVisitApi } from "../../../../api";
|
|
|
+import { getBaseURL } from "@dage/service";
|
|
|
import "./index.scss";
|
|
|
|
|
|
+const baseUrl = getBaseURL();
|
|
|
+
|
|
|
export interface SightDetailLayoutProps extends AtFloatLayoutProps {
|
|
|
item: (typeof SIGHT_LIST)[0];
|
|
|
}
|
|
|
|
|
|
export const SightDetailLayout: FC<SightDetailLayoutProps> = (props) => {
|
|
|
+ const realUrl = useMemo(
|
|
|
+ () =>
|
|
|
+ props.item.imgUrl ||
|
|
|
+ // @ts-ignore
|
|
|
+ `${baseUrl}${props.item.thumb}`,
|
|
|
+ [props.item]
|
|
|
+ );
|
|
|
+
|
|
|
useEffect(() => {
|
|
|
if (props.isOpened) {
|
|
|
addVisitApi({
|
|
|
@@ -25,8 +36,8 @@ export const SightDetailLayout: FC<SightDetailLayoutProps> = (props) => {
|
|
|
|
|
|
const handlePreview = () => {
|
|
|
Taro.previewImage({
|
|
|
- current: props.item.imgUrl,
|
|
|
- urls: [props.item.imgUrl],
|
|
|
+ current: realUrl,
|
|
|
+ urls: [realUrl],
|
|
|
});
|
|
|
};
|
|
|
|
|
|
@@ -48,8 +59,7 @@ export const SightDetailLayout: FC<SightDetailLayoutProps> = (props) => {
|
|
|
|
|
|
<View className="sight-layout-main">
|
|
|
<Image
|
|
|
- // @ts-ignore
|
|
|
- src={props.item.imgUrl || props.item.thumb}
|
|
|
+ src={realUrl}
|
|
|
className="sight-layout__img"
|
|
|
mode="aspectFill"
|
|
|
onClick={handlePreview}
|