shaogen1995 5 月之前
父節點
當前提交
0979284a4c

+ 1 - 0
展示端/public/myData/data.js

@@ -1,4 +1,5 @@
 const infoTemo = {
 const infoTemo = {
+  serverUrl: 'https://ysxwyzl.4dage.com',
   swArr: [
   swArr: [
     {
     {
       id: 2,
       id: 2,

+ 2 - 0
展示端/src/App.tsx

@@ -12,6 +12,7 @@ import MessageCom from './components/Message'
 import screenImg from '@/assets/img/landtip.png'
 import screenImg from '@/assets/img/landtip.png'
 
 
 const A1home = React.lazy(() => import('./pages/A1home'))
 const A1home = React.lazy(() => import('./pages/A1home'))
+const A2scene = React.lazy(() => import('./pages/A2scene'))
 
 
 export default function App() {
 export default function App() {
   // 从仓库中获取查看图片的信息
   // 从仓库中获取查看图片的信息
@@ -36,6 +37,7 @@ export default function App() {
         <React.Suspense fallback={<SpinLoding />}>
         <React.Suspense fallback={<SpinLoding />}>
           <Switch>
           <Switch>
             {/* <Route path='/codeSucc/:id' component={A3codeSucc} /> */}
             {/* <Route path='/codeSucc/:id' component={A3codeSucc} /> */}
+            <Route path='/scene/:id' component={A2scene} />
             <Route path='/' component={A1home} />
             <Route path='/' component={A1home} />
           </Switch>
           </Switch>
         </React.Suspense>
         </React.Suspense>

+ 12 - 8
展示端/src/pages/A1home/index.tsx

@@ -14,11 +14,6 @@ type NumListRowType = {
 }
 }
 
 
 function A1home() {
 function A1home() {
-  // 新窗口打开页面
-  const openPage = useCallback((url: string) => {
-    window.open(url, '_self')
-  }, [])
-
   const [list, setList] = useState<A1listType[]>([])
   const [list, setList] = useState<A1listType[]>([])
 
 
   const listRef = useRef<A1listType[]>([])
   const listRef = useRef<A1listType[]>([])
@@ -82,14 +77,22 @@ function A1home() {
     [list]
     [list]
   )
   )
 
 
+  // 新窗口打开页面
+  const openPage = useCallback((url: string) => {
+    window.open(url, '_self')
+  }, [])
+
   return (
   return (
     <div className={styles.A1home}>
     <div className={styles.A1home}>
       <div className='A1top'>
       <div className='A1top'>
         <Swiper loop autoplay>
         <Swiper loop autoplay>
           {myInfo.swArr.map(item => (
           {myInfo.swArr.map(item => (
             <Swiper.Item key={item.id}>
             <Swiper.Item key={item.id}>
-              <div onClick={() => openPage(item.link)}>
-                <img src={`./myData/img/${item.id}h.jpg`} alt='' />
+              <div
+                //  onClick={() => history.push(`/scene/${item.id}`)}
+                onClick={() => openPage(item.link)}
+              >
+                <img src={`${myInfo.serverUrl}/bwCN/myData/img/${item.id}h.jpg`} alt='' />
               </div>
               </div>
             </Swiper.Item>
             </Swiper.Item>
           ))}
           ))}
@@ -104,8 +107,9 @@ function A1home() {
             .map(item => (
             .map(item => (
               <div className='A1_1row' key={item.id}>
               <div className='A1_1row' key={item.id}>
                 <img
                 <img
-                  src={`./myData/img/${item.id}s.jpg`}
+                  src={`${myInfo.serverUrl}/bwCN/myData/img/${item.id}s.jpg`}
                   alt=''
                   alt=''
+                  // onClick={() => history.push(`/scene/${item.id}`)}
                   onClick={() => openPage(item.link)}
                   onClick={() => openPage(item.link)}
                 />
                 />
                 <div className='A1_1row1'>{item.name}</div>
                 <div className='A1_1row1'>{item.name}</div>

+ 9 - 0
展示端/src/pages/A2scene/index.module.scss

@@ -0,0 +1,9 @@
+.A2scene {
+  overflow: hidden;
+  :global {
+    iframe {
+      width: 100%;
+      height: 100%;
+    }
+  }
+}

+ 32 - 0
展示端/src/pages/A2scene/index.tsx

@@ -0,0 +1,32 @@
+import React, { useEffect, useState } from 'react'
+import styles from './index.module.scss'
+import { useParams } from 'react-router-dom'
+import { myInfo } from '@/utils/history'
+function A2scene() {
+  const urlObjTemp: any = useParams()
+
+  const [url, setUrl] = useState('')
+
+  useEffect(() => {
+    if (urlObjTemp.id) {
+      const obj = myInfo.swArr.find(v => v.id === Number(urlObjTemp.id))
+      if (obj && obj.link) {
+        setUrl(obj.link)
+        // // 新窗口打开页面
+        // window.open(obj.link, '_blank')
+      }
+    }
+
+    console.log(123, urlObjTemp.id)
+  }, [urlObjTemp])
+
+  return (
+    <div className={styles.A2scene}>
+      {url ? <iframe src={url} frameBorder='0' title='场景'></iframe> : null}
+    </div>
+  )
+}
+
+const MemoA2scene = React.memo(A2scene)
+
+export default MemoA2scene

+ 1 - 0
展示端/src/utils/history.ts

@@ -27,6 +27,7 @@ export type A1listType = {
 }
 }
 
 
 type MyInfoType = {
 type MyInfoType = {
+  serverUrl: string
   swArr: A1listType[]
   swArr: A1listType[]
 }
 }
 
 

展示端/public/myData/img/1h.jpg → 静态资料_直接放服务器/img/1h.jpg


展示端/public/myData/img/1s.jpg → 静态资料_直接放服务器/img/1s.jpg


展示端/public/myData/img/2h.jpg → 静态资料_直接放服务器/img/2h.jpg


展示端/public/myData/img/2s.jpg → 静态资料_直接放服务器/img/2s.jpg


展示端/public/myData/img/3h.jpg → 静态资料_直接放服务器/img/3h.jpg


展示端/public/myData/img/3s.jpg → 静态资料_直接放服务器/img/3s.jpg