Просмотр исходного кода

Merge branch 'master' of http://192.168.0.115:3000/lanxin/Chengzhebei

lanxin 3 месяцев назад
Родитель
Сommit
536f994b4c
31 измененных файлов с 222 добавлено и 19 удалено
  1. BIN
      public/unityMo/Build/Build.data.unityweb
  2. BIN
      public/unityMo/Build/Build.framework.js.unityweb
  3. 1 1
      public/unityMo/Build/Build.loader.js
  4. BIN
      public/unityMo/Build/Build.wasm.unityweb
  5. BIN
      public/unityMo/StreamingAssets/aa/WebGL/089c7ab93c27a929ecb0cbb575f4147c.bundle
  6. BIN
      public/unityMo/StreamingAssets/aa/WebGL/f1791d0a6f5c2c029b608731c7e720bd.bundle
  7. BIN
      public/unityMo/StreamingAssets/aa/catalog.bin
  8. 1 1
      public/unityMo/StreamingAssets/aa/catalog.hash
  9. 1 1
      public/unityMo/StreamingAssets/aa/settings.json
  10. 5 0
      public/unityMo/export_main.js
  11. 1 1
      public/unityMo/index.html
  12. BIN
      public/unityPc/Build/Build.data.unityweb
  13. BIN
      public/unityPc/Build/Build.framework.js.unityweb
  14. 1 1
      public/unityPc/Build/Build.loader.js
  15. BIN
      public/unityPc/Build/Build.wasm.unityweb
  16. BIN
      public/unityPc/StreamingAssets/aa/WebGL/089c7ab93c27a929ecb0cbb575f4147c.bundle
  17. BIN
      public/unityPc/StreamingAssets/aa/catalog.bin
  18. 1 1
      public/unityPc/StreamingAssets/aa/catalog.hash
  19. 1 1
      public/unityPc/StreamingAssets/aa/settings.json
  20. 5 0
      public/unityPc/export_main.js
  21. 2 1
      src/App.tsx
  22. 9 4
      src/components/Zback/index.tsx
  23. 2 2
      src/pages/A0base/data.ts
  24. 14 2
      src/pages/A6ybwx/index.tsx
  25. 47 2
      src/pages/A9knowlege/components/Chart/index.tsx
  26. 50 0
      src/pages/A9knowlege/components/ChartInput/index.module.scss
  27. 70 0
      src/pages/A9knowlege/components/ChartInput/index.tsx
  28. BIN
      src/pages/A9knowlege/images/btn-min.png
  29. BIN
      src/pages/A9knowlege/images/img_pop_02@2x-min.jpg
  30. BIN
      src/pages/A9knowlege/images/img_pop_03-min.png
  31. 11 1
      src/pages/A9knowlege/index.tsx

BIN
public/unityMo/Build/Build.data.unityweb


BIN
public/unityMo/Build/Build.framework.js.unityweb


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
public/unityMo/Build/Build.loader.js


BIN
public/unityMo/Build/Build.wasm.unityweb


BIN
public/unityMo/StreamingAssets/aa/WebGL/089c7ab93c27a929ecb0cbb575f4147c.bundle


BIN
public/unityMo/StreamingAssets/aa/WebGL/f1791d0a6f5c2c029b608731c7e720bd.bundle


BIN
public/unityMo/StreamingAssets/aa/catalog.bin


+ 1 - 1
public/unityMo/StreamingAssets/aa/catalog.hash

@@ -1 +1 @@
-751682cd4e991e86f598c29c3f55b8a5
+958ec67bcb94090d954ef97cd60d083d

Разница между файлами не показана из-за своего большого размера
+ 1 - 1
public/unityMo/StreamingAssets/aa/settings.json


+ 5 - 0
public/unityMo/export_main.js

@@ -35,6 +35,11 @@ window.loadScene = function (sceneName) {
     window.onCancelDownload();
 }
 
+//设置懒惰模式, 设置后所有动画将会暂停, 切换场景不会重置, 所以在不需要懒惰模式的时候必须要切换回来, 默认为false
+window.setLazyMode = function (isLazyMode) {
+    window.unityInstance.SendMessage('SceneLoader', 'SetLazyMode', isLazyMode ? 1 : 0)
+}
+
 //是否正在加载场景
 window.isLoadingScene = function () {
     return isLoadingScene

+ 1 - 1
public/unityMo/index.html

@@ -66,7 +66,7 @@
         frameworkUrl: buildUrl + "/Build.framework.js.unityweb",
         codeUrl: buildUrl + "/Build.wasm.unityweb",
         streamingAssetsUrl: "StreamingAssets",
-        devicePixelRatio: 2,
+        devicePixelRatio: 1,
         companyName: "FDage",
         productName: "Chenzhebei-ShanxiMuseum",
         productVersion: "0.1",

BIN
public/unityPc/Build/Build.data.unityweb


BIN
public/unityPc/Build/Build.framework.js.unityweb


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
public/unityPc/Build/Build.loader.js


BIN
public/unityPc/Build/Build.wasm.unityweb


BIN
public/unityPc/StreamingAssets/aa/WebGL/089c7ab93c27a929ecb0cbb575f4147c.bundle


BIN
public/unityPc/StreamingAssets/aa/catalog.bin


+ 1 - 1
public/unityPc/StreamingAssets/aa/catalog.hash

@@ -1 +1 @@
-69f93f75b6fe967b5f46a11f86e35afa
+a9b29854fdc52059e5415a9caf1e0ba1

Разница между файлами не показана из-за своего большого размера
+ 1 - 1
public/unityPc/StreamingAssets/aa/settings.json


+ 5 - 0
public/unityPc/export_main.js

@@ -35,6 +35,11 @@ window.loadScene = function (sceneName) {
     window.onCancelDownload();
 }
 
+//设置懒惰模式, 设置后所有动画将会暂停, 切换场景不会重置, 所以在不需要懒惰模式的时候必须要切换回来, 默认为false
+window.setLazyMode = function (isLazyMode) {
+    window.unityInstance.SendMessage('SceneLoader', 'SetLazyMode', isLazyMode ? 1 : 0)
+}
+
 //是否正在加载场景
 window.isLoadingScene = function () {
     return isLoadingScene

+ 2 - 1
src/App.tsx

@@ -67,7 +67,8 @@ export default function App() {
   useEffect(() => {
     // 打包环境 刷新页面从 首页 开始
     if (!envFlag && myData.isLdong) {
-      if (window.location.hash !== '#/') {
+      // #/knowlege?l=look 从后台管理直接打开知识图谱
+      if (window.location.hash !== '#/' && window.location.hash !== '#/knowlege?l=look') {
         window.location.href = window.location.href.split('#')[0] + '#/'
       }
     }

+ 9 - 4
src/components/Zback/index.tsx

@@ -2,6 +2,7 @@ import React from 'react'
 import styles from './index.module.scss'
 import { useSelector } from 'react-redux'
 import { RootState } from '@/store'
+import classNames from 'classnames'
 
 type Props = {
   clickFu: () => void
@@ -11,10 +12,14 @@ function Zback({ clickFu }: Props) {
   const { myLangue } = useSelector((state: RootState) => state.A0Layout)
 
   return (
-    <div className={styles.Zback} onClick={(e) => {
-      e.stopPropagation()
-      clickFu()
-    }} id='Zback'>
+    <div
+      className={classNames(styles.Zback, 'Zback')}
+      onClick={e => {
+        e.stopPropagation()
+        clickFu()
+      }}
+      id='Zback'
+    >
       <img
         className='backImg'
         src={require(`@/assets/img/btn_back${myLangue === 'EN' ? 'En' : ''}.png`)}

+ 2 - 2
src/pages/A0base/data.ts

@@ -1,6 +1,6 @@
 import store from '@/store'
 import { callIframeFu } from '@/utils/history'
-import { isPc } from '@/utils/http'
+import { envFlag, isPc } from '@/utils/http'
 
 // 获取unityDom
 const getUnityDomFu = () => {
@@ -13,7 +13,7 @@ export const lodingUnityFu = () => {
   const modalIframe = getUnityDomFu()
   if (modalIframe) {
     modalIframe.style.display = 'block'
-    modalIframe.src = `unity${isPc ? 'Pc' : 'Mo'}/index.html`
+    modalIframe.src = `unity${envFlag ? 'Pc' : isPc ? 'Pc' : 'Mo'}/index.html`
   }
 }
 

+ 14 - 2
src/pages/A6ybwx/index.tsx

@@ -11,6 +11,7 @@ import Skip from '@/components/Skip'
 import { domDelOwnFu } from '@/utils/utilsSome'
 import { cutUnityFu, getUnityKey } from '../A0base/data'
 import Zloding from '@/components/Zloding'
+import { callIframeFu } from '@/utils/history'
 
 function A6ybwx() {
   // 开场视频-------------
@@ -34,6 +35,17 @@ function A6ybwx() {
 
   const [gotoTab, setGotoTab] = useState(0)
 
+  useEffect(() => {
+    if (gotoTab !== 0) {
+      // 停止动画
+      callIframeFu('setLazyMode', 1)
+    } else {
+      // 恢复动画
+      callIframeFu('setLazyMode', 0)
+    }
+    // console.log('xxxxxxx', gotoTab)
+  }, [gotoTab])
+
   window.onClickMainHotspot = (hotspotName: string) => {
     console.log('调用了onClickMainHotspot', hotspotName)
 
@@ -79,7 +91,7 @@ function A6ybwx() {
         domDelOwnFu('.videoBox')
       }, 100)
       // 切换场景
-      cutUnityFu('RoomScene', () => { })
+      cutUnityFu('RoomScene', () => {})
     }
   }, [isEnter])
 
@@ -137,7 +149,7 @@ function A6ybwx() {
       {gotoTab === 3 && <SangzangHome setGotoTab={setGotoTab} />}
 
       {/* 进度条 */}
-      <Zloding isShow={isEnter && lodingScene} bacNum={2}/>
+      <Zloding isShow={isEnter && lodingScene} bacNum={2} />
     </div>
   )
 }

+ 47 - 2
src/pages/A9knowlege/components/Chart/index.tsx

@@ -2,12 +2,14 @@ import React, { useState, useRef, useEffect } from 'react'
 import axios from 'axios'
 import styles from './index.module.scss'
 import { decrypt } from '@/utils/encrypt'
+import ChartInput from '../ChartInput'
+import { useSelector } from 'react-redux'
+import { RootState } from '@/store'
 
 const questions = [
   '程哲碑有哪些特殊之处?',
   '碑主程哲是一个怎样的人?',
-  '程哲碑的造像艺术有何特点?',
-  '什么是“碑禁政策”?'
+  '程哲碑的造像艺术有何特点?'
 ]
 
 const FASTGPT_API_URL = 'https://cloud.fastgpt.cn/api'
@@ -20,12 +22,16 @@ interface Message {
 }
 
 function Chart() {
+  const { isHH } = useSelector((state: RootState) => state.A0Layout)
   const [messages, setMessages] = useState<Message[]>([])
   const [inputValue, setInputValue] = useState('')
   const [isLoading, setIsLoading] = useState(false)
   const [showQuickQuestions, setShowQuickQuestions] = useState(true)
+  const [showChartInput, setShowChartInput] = useState(false)
   const messagesEndRef = useRef<HTMLDivElement>(null)
   const inputRef = useRef<HTMLInputElement>(null)
+  const savedTransformRef = useRef<string>('')
+  const savedLeftRef = useRef<string>('')
 
   useEffect(() => {
     messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' })
@@ -155,6 +161,35 @@ function Chart() {
     setShowQuickQuestions(true)
   }
 
+  const handleInputClick = () => {
+    if (isHH) {
+      return
+    }
+
+    const rootElement = document.querySelector('#root') as HTMLElement
+    if (rootElement) {
+      savedTransformRef.current = rootElement.style.transform || ''
+      savedLeftRef.current = rootElement.style.left || ''
+
+      const currentTransform = rootElement.style.transform
+      if (currentTransform && currentTransform.includes('rotate(90deg)')) {
+        rootElement.style.transform = ''
+        rootElement.style.left = '0'
+      }
+
+      setShowChartInput(true)
+    }
+  }
+
+  const handleCloseChartInput = () => {
+    const rootElement = document.querySelector('#root') as HTMLElement
+    if (rootElement) {
+      rootElement.style.transform = savedTransformRef.current || ''
+      rootElement.style.left = savedLeftRef.current || ''
+    }
+    setShowChartInput(false)
+  }
+
   return (
     <div className={styles.chart}>
       <div className={styles.chartWrap}>
@@ -199,15 +234,25 @@ function Chart() {
           <input
             ref={inputRef}
             type='text'
+            readOnly={!isHH}
             placeholder='请输入您想了解的内容...'
             value={inputValue}
             onChange={e => setInputValue(e.target.value)}
             onKeyPress={handleInputKeyPress}
+            onClick={handleInputClick}
             disabled={isLoading}
           />
           <div className={styles.btn} onClick={handleSendMessage.bind(null, inputValue)} />
         </div>
       </div>
+
+      {showChartInput && (
+        <ChartInput
+          onClose={handleCloseChartInput}
+          onSend={handleSendMessage}
+          isLoading={isLoading}
+        />
+      )}
     </div>
   )
 }

+ 50 - 0
src/pages/A9knowlege/components/ChartInput/index.module.scss

@@ -0,0 +1,50 @@
+.chartInput {
+  position: fixed;
+  inset: 0;
+  padding: 58px 30px 30px;
+  background: url('../../images/img_pop_02@2x-min.jpg') no-repeat right bottom / 100% 100%;
+  z-index: 9999;
+  display: flex;
+  flex-direction: column;
+
+  :global {
+    .Zback {
+      top: 20px;
+      left: 22px;
+      width: 57px;
+      height: 28px;
+    }
+  }
+}
+
+.textarea {
+  padding: 13px;
+  width: 100%;
+  height: 262px;
+  border-radius: 5px;
+  color: #7c4b36;
+  border: 1px solid #7c4b36;
+  background: rgba(124, 75, 54, 0.1);
+  outline: none;
+  resize: none;
+  font-size: 16px;
+  font-family: inherit;
+  cursor: text;
+
+  &::placeholder {
+    color: #7c4b36;
+    opacity: 0.6;
+  }
+
+  &:disabled {
+    cursor: not-allowed;
+    opacity: 0.6;
+  }
+}
+
+.button {
+  margin-top: 5px;
+  width: 100%;
+  transition: opacity 0.3s;
+  user-select: none;
+}

+ 70 - 0
src/pages/A9knowlege/components/ChartInput/index.tsx

@@ -0,0 +1,70 @@
+import React, { useState, useRef, useEffect } from 'react'
+import styles from './index.module.scss'
+import Zback from '@/components/Zback'
+
+interface ChartInputProps {
+  onClose: () => void
+  onSend: (message: string) => void
+  isLoading?: boolean
+}
+
+function ChartInput({ onClose, onSend, isLoading = false }: ChartInputProps) {
+  const [inputValue, setInputValue] = useState('')
+  const textareaRef = useRef<HTMLTextAreaElement>(null)
+
+  useEffect(() => {
+    textareaRef.current?.focus()
+  }, [])
+
+  const handleSend = () => {
+    const text = inputValue.trim()
+    if (!text || isLoading) return
+
+    onSend(text)
+    setInputValue('')
+    onClose()
+  }
+
+  const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
+    if (e.key === 'Enter' && !e.shiftKey) {
+      e.preventDefault()
+      handleSend()
+    }
+  }
+
+  const handleButtonClick = (e: React.MouseEvent) => {
+    e.stopPropagation()
+    handleSend()
+  }
+
+  const handleContainerClick = (e: React.MouseEvent) => {
+    e.stopPropagation()
+  }
+
+  return (
+    <div className={styles.chartInput} onClick={handleContainerClick}>
+      <Zback clickFu={onClose} />
+
+      <textarea
+        ref={textareaRef}
+        className={styles.textarea}
+        placeholder='请输入您想了解的内容...'
+        value={inputValue}
+        onChange={e => setInputValue(e.target.value)}
+        onKeyDown={handleKeyDown}
+        disabled={isLoading}
+      />
+      <img
+        src={require('../../images/btn-min.png')}
+        alt='button'
+        className={styles.button}
+        onClick={handleButtonClick}
+        style={{ cursor: isLoading ? 'not-allowed' : 'pointer', opacity: isLoading ? 0.6 : 1 }}
+      />
+    </div>
+  )
+}
+
+const MemoChartInput = React.memo(ChartInput)
+
+export default MemoChartInput

BIN
src/pages/A9knowlege/images/btn-min.png


BIN
src/pages/A9knowlege/images/img_pop_02@2x-min.jpg


BIN
src/pages/A9knowlege/images/img_pop_03-min.png


+ 11 - 1
src/pages/A9knowlege/index.tsx

@@ -6,8 +6,18 @@ import Panel2 from './components/Panel2'
 import ModelPanel from './components/ModelPanel'
 import { echPageBackFu } from '@/components/MenuSider/data'
 import Zback from '@/components/Zback'
+import ChartInput from './components/ChartInput'
 
 function A9knowlege() {
+  // 是否显示返回按钮
+  const [backShow, setBackShow] = useState(false)
+
+  useEffect(() => {
+    if (!window.location.href.includes('?l=look')) {
+      setBackShow(true)
+    }
+  }, [])
+
   const echartRef = useRef<HTMLDivElement | null>(null)
   const chartInstance = useRef<any>(null)
   const [detail, setDetail] = useState<any>(null)
@@ -130,7 +140,7 @@ function A9knowlege() {
 
   return (
     <div className={styles.A9knowlege}>
-      <Zback clickFu={() => echPageBackFu()} />
+      {backShow ? <Zback clickFu={() => echPageBackFu()} /> : null}
 
       <div className={styles.main}>
         <div id='echart-container' ref={echartRef} />