瀏覽代碼

fix: token

chenlei 1 年之前
父節點
當前提交
5d3e58d209

+ 1 - 1
src/pages/home/components/Menu/index.tsx

@@ -47,7 +47,7 @@ export const Menu: FC<MenuProps> = observer((props) => {
             link:
               "/subModule/pages/iframe/index?url=" +
               encodeURIComponent(
-                "https://houseoss.4dkankan.com/project/wuxicishanbwg/index.html?m=TEST"
+                "https://houseoss.4dkankan.com/project/wuxicishanbwg/index.html?m=SG-igv7wQAyyyG_01&showBack=1"
               ),
           },
           {

+ 15 - 5
src/pages/home/components/SightDetailLayout/index.tsx

@@ -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}

+ 9 - 1
src/pages/home/index.scss

@@ -12,6 +12,15 @@
     &.hide {
       animation: loading-leave 1s ease-in forwards;
     }
+    &.close {
+      display: none;
+      top: -200%;
+      left: -200%;
+      width: 0;
+      height: 0;
+      opacity: 0;
+      z-index: -1;
+    }
   }
   &-container {
     position: relative;
@@ -177,7 +186,6 @@
 @keyframes loading-leave {
   100% {
     opacity: 0;
-    z-index: -1;
   }
 }
 

+ 10 - 7
src/pages/home/index.tsx

@@ -43,6 +43,7 @@ const PointIcon = memo(() => {
 
 const HomePage: FC = () => {
   const [loaded, setLoaded] = useState(false);
+  const [hideLoading, setHideLoading] = useState(false);
   const [showMenu, setShowMenu] = useState(false);
   const [showSearch, setShowSearch] = useState(false);
   const [showSight, setShowSight] = useState(false);
@@ -87,6 +88,10 @@ const HomePage: FC = () => {
     nextTick(() => {
       setLoaded(true);
       swiperRef.current?.setIsRunning(true);
+
+      setTimeout(() => {
+        setHideLoading(true);
+      }, 1000);
     });
   };
 
@@ -182,12 +187,7 @@ const HomePage: FC = () => {
             </View>
           </View>
 
-          <Image
-            className="home__bg"
-            src={BgImg}
-            mode="widthFix"
-            // onLoad={handleLoaded}
-          />
+          <Image className="home__bg" src={BgImg} mode="widthFix" />
           <Image className="home__btm-bg" src={BtmBgImg} mode="widthFix" />
         </View>
 
@@ -211,7 +211,10 @@ const HomePage: FC = () => {
       </View>
 
       <Video
-        className={classNames("home-loading", { hide: loaded })}
+        className={classNames("home-loading", {
+          hide: loaded,
+          close: hideLoading,
+        })}
         src="https://houseoss.4dkankan.com/project/wx-csbwg-public/videos/loading.mp4"
         autoplay
         muted

+ 2 - 1
src/utils/index.ts

@@ -6,8 +6,9 @@ export const NICKNAME_key = "nickname";
 
 export const getSceneUrl = (scene?: number) => {
   const name = getStorageSync(NICKNAME_key);
+  const token = getStorageSync(TOKEN_KEY);
 
-  return `https://app.4dage.com/projects/wxcs/web/index.html?platform=wx&name=${name}${
+  return `http://app.4dage.com/projects/wxcs/web/index.html?platform=wx&name=${name}&token=${token}${
     typeof scene === "number" ? `&scene=${scene}` : ""
   }`;
 };