shaogen1995 7 months ago
parent
commit
671118b6e5

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


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

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

+ 5 - 1
展示端/src/pages/A5order/index.module.scss

@@ -189,9 +189,13 @@
                 border-radius: 4px;
                 color: #fff;
               }
-              div.A5LA1btn {
+              .A5LA1btn2 {
                 background-color: var(--themeColor);
               }
+              .A5LA1btnNo {
+                font-size: 12px;
+                background-color: #828282;
+              }
             }
             .A5file {
               font-size: 16px;

+ 10 - 6
展示端/src/pages/A5order/index.tsx

@@ -118,8 +118,8 @@ function A5order() {
       domShowFu('#AsyncSpinLoding', true)
 
       setText({
-        1: values.unit.replaceAll(/(\n|\r|\r\n)/g, '<br />'),
-        2: values.remark.replaceAll(/(\n|\r|\r\n)/g, '<br />')
+        1: values.unit || ''.replaceAll(/(\n|\r|\r\n)/g, '<br />'),
+        2: values.remark || ''.replaceAll(/(\n|\r|\r\n)/g, '<br />')
       })
 
       const time = dayjs(new Date()).format('YYYY-MM-DD HH:mm')
@@ -353,9 +353,13 @@ function A5order() {
                 {time ? null : (
                   <div className='A5LA1'>
                     预约单模板
-                    <a className='A5LA1btn' href={baseURL + templateUrl} download='预约单模板'>
-                      下载
-                    </a>
+                    {templateUrl ? (
+                      <a className='A5LA1btn' href={baseURL + templateUrl} download='预约单模板'>
+                        下载
+                      </a>
+                    ) : (
+                      <div className='A5LA1btn A5LA1btnNo'>暂无文件</div>
+                    )}
                   </div>
                 )}
 
@@ -366,7 +370,7 @@ function A5order() {
                       <span>仅限jpg,png格式;大小不超过5M;最多1个文件</span>
                     </div>
                     <div
-                      className='A5LA1btn'
+                      className='A5LA1btn A5LA1btn2'
                       onClick={() => myInput.current?.click()}
                       hidden={!!fileObj.filePath}
                     >

+ 22 - 8
展示端/src/pages/A6my/index.tsx

@@ -12,6 +12,8 @@ import { A6tableType1, A6tableType2 } from './type'
 import { FileType } from '@/types'
 import { baseURL } from '@/utils/http'
 import { MessageFu } from '@/utils/message'
+import history from '@/utils/history'
+import { ImageViewer } from 'antd-mobile'
 
 function A6my() {
   const [topAc, setTopAc] = useState(
@@ -60,9 +62,14 @@ function A6my() {
     [getList1, getList2]
   )
 
+  const lookImgFu = useCallback((url: string) => {
+    MessageFu.info('可长按图片保存')
+    ImageViewer.show({ image: baseURL + url })
+  }, [])
+
   return (
     <div className={styles.A6my}>
-      <TopCom txt='我的申请' />
+      <TopCom txt='我的申请' backFu={() => history.push('/')} />
       <div className='A6main'>
         <div className='A6top'>
           {['预约申请', '认证申请'].map(item => (
@@ -218,13 +225,20 @@ function A6my() {
                       {item.file.map((item2: FileType) => (
                         <div key={item2.id} className='A6_2fileRow'>
                           <div className='A6_2filell'>{item2.fileName}</div>
-                          <a
-                            href={baseURL + item2.filePath}
-                            className='A6_2filerr'
-                            download={item2.fileName}
-                          >
-                            下载
-                          </a>
+
+                          {item2.fileName.endsWith('.pdf') || item2.fileName.endsWith('.PDF') ? (
+                            <a
+                              href={baseURL + item2.filePath}
+                              className='A6_2filerr'
+                              download={item2.fileName}
+                            >
+                              下载
+                            </a>
+                          ) : (
+                            <div className='A6_2filerr' onClick={() => lookImgFu(item2.filePath)}>
+                              查看
+                            </div>
+                          )}
                         </div>
                       ))}
                     </div>

+ 1 - 1
展示端/src/pages/A8proof/index.tsx

@@ -89,7 +89,7 @@ function A8proof() {
       <input
         id='upInput'
         type='file'
-        accept='.pdf,.jpg,.png'
+        // accept='.pdf,.jpg,.png'
         ref={myInput}
         onChange={e => handeUpPhoto(e)}
       />

+ 2 - 1
展示端/src/pages/B2myz/index.tsx

@@ -5,6 +5,7 @@ import ZexhiBtn from '@/components/ZexhiBtn'
 import noImg from '@/assets/img/exhibit/no.png'
 import { B2_APIgetList } from '@/store/action/all'
 import { B2ListType, B2SonListType } from './type'
+import history from '@/utils/history'
 
 function B2myz() {
   const [loding, setLoding] = useState(false)
@@ -66,7 +67,7 @@ function B2myz() {
         )}
       </div>
 
-      <ZexhiBtn onlyBack nextFu={() => {}} />
+      <ZexhiBtn onlyBack nextFu={() => {}} backFu={() => history.push('/exhi')} />
     </div>
   )
 }

+ 22 - 23
展示端/src/pages/Z1login/index.tsx

@@ -1,26 +1,24 @@
-import React, { useCallback, useEffect, useState } from 'react'
+import React, { useCallback, useEffect } from 'react'
 import styles from './index.module.scss'
 import TopCom from '@/components/TopCom'
 import { Button } from 'antd'
-import history, { toHomeFu } from '@/utils/history'
+import history from '@/utils/history'
 import { setTokenInfo } from '@/utils/storage'
 import { MessageFu } from '@/utils/message'
 import { useParams } from 'react-router-dom'
+import { API_login } from '@/store/action/all'
 function Z1login() {
   // 获取地址栏参数 1:课程 2:展馆
   const urlObjTemp: any = useParams()
 
   // 获取用户openID(微信授权)
   const getUserCode = useCallback(() => {
-    console.log(123, urlObjTemp.key)
-
-    // window.location.href = 'http://192.168.20.55:3001/#/login?code=xxxx'
     //此处的ID是在文档的开发-基本配置里面
-    // let appid = 'wx3d4f2e0cfc3b8e54'
-    // let url = `https://sit-hqbooking.4dage.com/web/#/login${urlObjTemp.key}`
-    // 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`
+    let appid = 'wxcf0db4440f05e3a5'
+    let url = `https://sit-hqbooking.4dage.com/web/#/login/${urlObjTemp.key}`
+    window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${encodeURIComponent(
+      url
+    )}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
   }, [urlObjTemp.key])
 
   // 获取地址栏参数的方法
@@ -44,21 +42,22 @@ function Z1login() {
     return r[2]
   }, [])
 
-  useEffect(() => {
-    let code = getQueryCode('code')
-    console.log('-----------', code)
-    if (code) {
-      // 发请求,拿token
-      // 用户信息存到本地
-      setTokenInfo({
-        token:
-          'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJvakpPdDZBc1MyTUhKSUFLMWtqSV9FTllyRnIwIiwibG9naW5UeXBlIjoid3giLCJpZCI6MSwidXNlck5hbWUiOiJvakpPdDZBc1MyTUhKSUFLMWtqSV9FTllyRnIwIiwiZXhwIjoxNzM0NjU3NjgyLCJyb2xlS2V5cyI6WyJ3ZWJfdXNlciJdLCJpYXQiOjE3MzQ1NzEyODIsImp0aSI6IjBkOTNlZTBkLTI0NjAtNDliZi1iM2Y2LTdjY2ZjNzMwNjVlMSJ9.01BrenscrgsUxvM6z6GFap0d78qnnmAVQuW1VTA_3mI'
-      })
-      // 跳到首页
+  const API_loginFu = useCallback(async (code: string) => {
+    const res = await API_login(code)
+    if (res.code === 0) {
+      // console.log(123, res)
+      // // 跳到首页
+      setTokenInfo(res.data)
       MessageFu.success('登录成功!')
-      history.replace(urlObjTemp.key === '1' ? '/' : '/exhi')
+      history.replace(window.location.href.includes('/login/1') ? '/' : '/exhi')
     }
-  }, [getQueryCode, urlObjTemp.key])
+  }, [])
+
+  useEffect(() => {
+    let code = getQueryCode('code')
+    // console.log('-----------', code)
+    if (code) API_loginFu(code)
+  }, [API_loginFu, getQueryCode])
 
   return (
     <div className={styles.Z1login}>

+ 7 - 0
展示端/src/store/action/all.ts

@@ -111,6 +111,13 @@ export const B2_APIgetList = () => {
   return http.get('exhibition/my/apply')
 }
 
+/**
+ * 用code获取token
+ */
+export const API_login = (code: string) => {
+  return http.get(`show/wx/mpLogin?code=${code}`)
+}
+
 // --------------------------------------------
 
 /**

+ 19 - 0
展示端/src/utils/download.ts

@@ -0,0 +1,19 @@
+import { baseURL } from './http'
+import { MessageFu } from './message'
+
+export const XXXXXXXX = (url: string) => {
+  if (url) {
+    try {
+      const input = document.createElement('input')
+      const body = document.body
+      body.appendChild(input)
+      input.value = baseURL + url
+      input.select()
+      document.execCommand('copy')
+      body.removeChild(input)
+      MessageFu.success('已复制到剪贴板,请在浏览器中粘贴并下载')
+    } catch (error) {
+      MessageFu.warning('错误')
+    }
+  } else MessageFu.warning('暂无文件')
+}