shaogen1995 8 months ago
parent
commit
19ed1a5d06

File diff suppressed because it is too large
+ 1 - 1
展示端/.vscode/file-note.json


+ 6 - 1
展示端/src/App.tsx

@@ -5,7 +5,7 @@ import MessageCom from './components/Message'
 import RouterOrder from './components/RouterOrder'
 import screenImg from '@/assets/img/landtip.png'
 import AsyncSpinLoding from './components/AsyncSpinLoding'
-import { isMobileFu } from './utils/history'
+import { homeJudgeFu, isMobileFu } from './utils/history'
 
 export default function AppM() {
   const setFullFu = useCallback(() => {
@@ -35,6 +35,11 @@ export default function AppM() {
     }
   }, [setFullFu])
 
+  // 2个不同模块的首页判断
+  useEffect(() => {
+    homeJudgeFu()
+  }, [])
+
   return (
     <div id='AppM'>
       {/* 关于路由 */}

BIN
展示端/src/assets/img/exhibit/icon_left.png


BIN
展示端/src/assets/img/exhibit/icon_right.png


BIN
展示端/src/assets/img/exhibit/no.png


BIN
展示端/src/assets/img/exhibit/top.png


+ 2 - 8
展示端/src/components/AuthRoute.tsx

@@ -17,14 +17,8 @@ export default function AuthRoute({ path, component: Com, ...rest }: AtahType) {
       render={() => {
         if (hasToken()) return <Com />
         else {
-          MessageFu.warning('登录失效!')
-          return (
-            <Redirect
-              to={{
-                pathname: '/login'
-              }}
-            />
-          )
+          MessageFu.info('请先登录!')
+          return <Redirect to={`/login${window.location.hash.includes('exhi') ? '?exhi=1' : ''}`} />
         }
       }}
     />

+ 2 - 2
展示端/src/components/NotFound/index.tsx

@@ -1,4 +1,4 @@
-import history from '@/utils/history'
+import history, { toHomeFu } from '@/utils/history'
 import { Button, Result } from 'antd'
 import { useEffect, useRef } from 'react'
 
@@ -19,7 +19,7 @@ export default function NotFound() {
     <div className='noFindPage'>
       <Result status='404' title='404' subTitle='找不到页面' />
       <div style={{ display: 'flex', justifyContent: 'center' }}>
-        <Button type='primary' onClick={() => history.replace('/')}>
+        <Button type='primary' onClick={() => toHomeFu()}>
           首页
         </Button>
         &emsp;

+ 27 - 7
展示端/src/components/RouterOrder.tsx

@@ -5,17 +5,19 @@ import SpinLoding from './SpinLoding'
 import NotFound from '@/components/NotFound'
 import AuthRoute from './AuthRoute'
 
+const A1home = React.lazy(() => import('@/pages/A1home'))
+const B1exhibit = React.lazy(() => import('@/pages/B1exhibit'))
 const Login = React.lazy(() => import('@/pages/Z1login'))
 
+// 2个不同的首页路由设置
+let homeFlag: '课堂' | '展馆' = '课堂'
+if (window.location.href.includes('exhi')) {
+  homeFlag = '展馆'
+}
+
+// 关于课堂
 const routerArr = [
   {
-    id: 1,
-    name: '首页',
-    path: '/',
-    exact: true,
-    Com: React.lazy(() => import('@/pages/A1home'))
-  },
-  {
     id: 2,
     name: '预约须知',
     path: '/notice',
@@ -64,8 +66,24 @@ const routerArr = [
     exact: true,
     Com: React.lazy(() => import('@/pages/A8proof'))
   },
+
+  // 关于展馆 exhiXXX
   {
     id: 9,
+    name: '展馆-我的预约',
+    path: '/exhiMy',
+    exact: true,
+    Com: React.lazy(() => import('@/pages/B2myz'))
+  },
+  {
+    id: 10,
+    name: '展馆-发起预约',
+    path: '/exhiStart',
+    exact: true,
+    Com: React.lazy(() => import('@/pages/B3start'))
+  },
+  {
+    id: 90,
     name: '找不到页面',
     path: '*',
     exact: false,
@@ -78,6 +96,8 @@ function RouterOrder() {
     <Router history={history}>
       <React.Suspense fallback={<SpinLoding />}>
         <Switch>
+          <Route path='/' component={homeFlag === '课堂' ? A1home : B1exhibit} exact={true} />
+          <Route path='/exhi' component={B1exhibit} exact={true} />
           <Route path='/login' component={Login} exact={true} />
           {routerArr.map(v => (
             <AuthRoute key={v.id} path={v.path} exact={v.exact} component={v.Com} />

+ 2 - 2
展示端/src/components/TopCom/index.tsx

@@ -2,7 +2,7 @@ import React from 'react'
 import styles from './index.module.scss'
 
 import backImg from '@/assets/img/back.png'
-import history from '@/utils/history'
+import history, { toHomeFu } from '@/utils/history'
 import { useSelector } from 'react-redux'
 import { RootState } from '@/store'
 
@@ -22,7 +22,7 @@ function TopCom({ backFu, txt }: Props) {
         alt=''
         onClick={() => {
           if (backFu) backFu()
-          else routerLength ? history.go(-1) : history.replace('/')
+          else routerLength ? history.go(-1) : toHomeFu()
         }}
       />
       {txt}

+ 28 - 0
展示端/src/components/ZexhiBtn/index.module.scss

@@ -0,0 +1,28 @@
+.ZexhiBtn {
+  height: 100px;
+  padding: 0 18px;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  :global {
+    .ZexhiBtn1 {
+      width: 30%;
+      height: 54px;
+      background: #ffffff;
+      border-radius: 5px;
+      border: 1px solid var(--themeColor);
+      font-size: 18px;
+      display: flex;
+      justify-content: center;
+      align-items: center;
+      color: var(--themeColor);
+      font-weight: 700;
+    }
+    .ZexhiBtn2 {
+      width: 65%;
+      border: none;
+      background-color: var(--themeColor2);
+      color: #fff;
+    }
+  }
+}

+ 39 - 0
展示端/src/components/ZexhiBtn/index.tsx

@@ -0,0 +1,39 @@
+import React from 'react'
+import styles from './index.module.scss'
+import { useSelector } from 'react-redux'
+import { RootState } from '@/store'
+import history, { toHomeFu } from '@/utils/history'
+
+type Props = {
+  nextFu: () => void
+  nextOk?: boolean
+  onlyBack?: boolean
+  backFu?: () => void
+}
+
+function ZexhiBtn({ nextFu, nextOk = true, onlyBack = false, backFu }: Props) {
+  const routerLength = useSelector((state: RootState) => state.A0Layout.routerLength)
+  return (
+    <div className={styles.ZexhiBtn}>
+      <div
+        onClick={() => {
+          if (backFu) backFu()
+          else routerLength ? history.go(-1) : toHomeFu()
+        }}
+        className='ZexhiBtn1'
+        style={{ width: onlyBack ? '100%' : '' }}
+      >
+        返回
+      </div>
+      {onlyBack ? null : (
+        <div className={`ZexhiBtn1 ZexhiBtn2 ${nextOk ? '' : 'myBtnNo'}`} onClick={nextFu}>
+          下一步
+        </div>
+      )}
+    </div>
+  )
+}
+
+const MemoZexhiBtn = React.memo(ZexhiBtn)
+
+export default MemoZexhiBtn

+ 52 - 0
展示端/src/pages/B1exhibit/index.module.scss

@@ -0,0 +1,52 @@
+.B1exhibit {
+  padding-bottom: 120px;
+  overflow-y: auto;
+  :global {
+    .B1top {
+      width: 100%;
+      height: auto;
+      object-fit: fill !important;
+    }
+    .B1tit {
+      font-size: 24px;
+      font-weight: 700;
+      color: var(--themeColor);
+      margin: 10px 0 24px;
+      text-align: center;
+    }
+    .B1txt {
+      padding: 0 30px;
+      color: #303030;
+      font-size: 16px;
+      letter-spacing: 3px;
+      line-height: 24px;
+    }
+    .B1btn {
+      position: absolute;
+      bottom: 0;
+      left: 0;
+      width: 100%;
+      height: 100px;
+      background-color: #fff;
+      display: flex;
+      align-items: center;
+      justify-content: space-between;
+      padding: 0 30px;
+      & > div {
+        height: 54px;
+        line-height: 54px;
+        text-align: center;
+        font-size: 20px;
+        font-weight: 700;
+        border-radius: 5px;
+        background-color: var(--themeColor);
+        width: 40%;
+        color: #fff;
+      }
+      .B1btn2 {
+        background-color: var(--themeColor2);
+        width: 57%;
+      }
+    }
+  }
+}

File diff suppressed because it is too large
+ 31 - 0
展示端/src/pages/B1exhibit/index.tsx


+ 65 - 0
展示端/src/pages/B2myz/index.module.scss

@@ -0,0 +1,65 @@
+.B2myz {
+  background-image: url('../../assets/img/notice/bg03.jpg');
+  background-size: 100% 100%;
+  :global {
+    .B2main {
+      height: calc(100% - 100px);
+      padding: 24px 18px;
+      overflow-y: auto;
+      .B2row {
+        height: 500px;
+        background-image: url('../../assets/img/my/listBg.png');
+        background-size: 100% 100%;
+        margin-bottom: 30px;
+        padding: 27px;
+        font-size: 16px;
+        .B2row1 {
+          position: relative;
+          border-bottom: 2px dashed #bebebe;
+          position: relative;
+          height: 86px;
+          & > p {
+            width: 90%;
+
+            margin-bottom: 8px;
+            span {
+              font-weight: 700;
+              color: var(--themeColor2);
+            }
+          }
+        }
+
+        .B2row2 {
+          margin-top: 15px;
+
+          .B2row2_1 {
+            font-size: 16px;
+            color: var(--themeColor);
+            font-weight: 700;
+          }
+          & > p {
+            margin-top: 2px;
+          }
+        }
+      }
+
+      .B2No {
+        width: 100%;
+        height: 80%;
+        display: flex;
+        flex-direction: column;
+        justify-content: center;
+        align-items: center;
+        & > img {
+          width: 150px;
+          height: auto;
+        }
+        & > p {
+          margin-top: 15px;
+          font-size: 20px;
+          color: var(--themeColor);
+        }
+      }
+    }
+  }
+}

+ 95 - 0
展示端/src/pages/B2myz/index.tsx

@@ -0,0 +1,95 @@
+import React from 'react'
+import styles from './index.module.scss'
+import ZexhiBtn from '@/components/ZexhiBtn'
+
+import noImg from '@/assets/img/exhibit/no.png'
+
+const list = [
+  {
+    id: 1,
+    time1: '2024-12-19',
+    time2: '14:30-16:00',
+
+    son: [
+      {
+        id: 1.1,
+        name: '阿三大苏打是',
+        phone: '18702025050',
+        ID: '421083199504071216'
+      },
+      {
+        id: 1.2,
+        name: '阿三',
+        phone: '18702025050',
+        ID: '421083199504071216'
+      },
+      {
+        id: 1.3,
+        name: '王大锤',
+        phone: '18702025050',
+        ID: '421083199504071216'
+      }
+    ]
+  },
+  {
+    id: 2,
+    time1: '2024-12-39',
+    time2: '14:30-16:00',
+
+    son: [
+      {
+        id: 1.1,
+        name: '阿三大苏打是',
+        phone: '18702025050',
+        ID: '421083199504071216'
+      }
+    ]
+  }
+]
+
+function B2myz() {
+  return (
+    <div className={styles.B2myz}>
+      <div className='B2main'>
+        {list.length ? (
+          <>
+            {list.map(item => (
+              <div className='B2row' key={item.id}>
+                <div className='B2row1'>
+                  <p>
+                    <span>预约日期:</span>
+                    {item.time1}
+                  </p>
+                  <p>
+                    <span>入馆时间:</span>
+                    {item.time2}
+                  </p>
+                </div>
+
+                {item.son.map((item2, index2) => (
+                  <div className='B2row2' key={item2.id}>
+                    <div className='B2row2_1'>参观人信息{index2 + 1}</div>
+                    <p>参观人姓名:{item2.name}</p>
+                    <p>联系方式:{item2.phone}</p>
+                    <p>身份证号:{item2.ID}</p>
+                  </div>
+                ))}
+              </div>
+            ))}
+          </>
+        ) : (
+          <div className='B2No'>
+            <img src={noImg} alt='' />
+            <p>暂无预约信息</p>
+          </div>
+        )}
+      </div>
+
+      <ZexhiBtn onlyBack nextFu={() => {}} />
+    </div>
+  )
+}
+
+const MemoB2myz = React.memo(B2myz)
+
+export default MemoB2myz

+ 4 - 0
展示端/src/pages/B3start/index.module.scss

@@ -0,0 +1,4 @@
+.B3start {
+  :global {
+  }
+}

+ 13 - 0
展示端/src/pages/B3start/index.tsx

@@ -0,0 +1,13 @@
+import React from 'react'
+import styles from './index.module.scss'
+function B3start() {
+  return (
+    <div className={styles.B3start}>
+      <h1>B3start</h1>
+    </div>
+  )
+}
+
+const MemoB3start = React.memo(B3start)
+
+export default MemoB3start

+ 8 - 4
展示端/src/pages/Z1login/index.tsx

@@ -1,8 +1,8 @@
-import React, { useCallback, useEffect } from 'react'
+import React, { useCallback, useEffect, useState } from 'react'
 import styles from './index.module.scss'
 import TopCom from '@/components/TopCom'
 import { Button } from 'antd'
-import history from '@/utils/history'
+import history, { toHomeFu } from '@/utils/history'
 import { setTokenInfo } from '@/utils/storage'
 import { MessageFu } from '@/utils/message'
 function Z1login() {
@@ -15,6 +15,8 @@ function Z1login() {
     // window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${encodeURIComponent(
     //   url
     // )}&response_type=code&scope=SCOPE&state=STATE#wechat_redirect`
+
+    setTime(Date.now())
   }, [])
 
   // 获取地址栏参数的方法
@@ -38,6 +40,8 @@ function Z1login() {
     return r[2]
   }, [])
 
+  const [time, setTime] = useState(0)
+
   useEffect(() => {
     let code = getQueryCode('code')
     console.log('-----------', code)
@@ -47,9 +51,9 @@ function Z1login() {
       setTokenInfo({ token: 'xxxxxxxxxxxx' })
       // 跳到首页
       MessageFu.success('登录成功!')
-      history.push('/')
+      toHomeFu()
     }
-  }, [getQueryCode])
+  }, [getQueryCode, time])
 
   return (
     <div className={styles.Z1login}>

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

@@ -15,6 +15,18 @@ history.listen((_: any, listener: any) => {
 
 export default history
 
+let homeFlag = '课堂'
+
+// 2个不同模块的首页判断
+export const homeJudgeFu = () => {
+  if (window.location.href.includes('exhi')) homeFlag = '展览'
+}
+
+// 去首页
+export const toHomeFu = () => {
+  history.replace(homeFlag === '课堂' ? '/' : '/exhi')
+}
+
 // 判断是手机端还是pc端
 export const isMobileFu = () => {
   if (