Parcourir la source

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

lanxin il y a 11 heures
Parent
commit
d8446673c5

+ 5 - 5
public/knowlege/asset-manifest.json

@@ -1,20 +1,20 @@
 {
 {
   "files": {
   "files": {
     "main.css": "./static/css/main.592aab85.css",
     "main.css": "./static/css/main.592aab85.css",
-    "main.js": "./static/js/main.f6c967f0.js",
+    "main.js": "./static/js/main.fa046c4b.js",
     "static/css/912.a53e8d10.chunk.css": "./static/css/912.a53e8d10.chunk.css",
     "static/css/912.a53e8d10.chunk.css": "./static/css/912.a53e8d10.chunk.css",
-    "static/js/912.3d7cf3e1.chunk.js": "./static/js/912.3d7cf3e1.chunk.js",
+    "static/js/912.91ec5b14.chunk.js": "./static/js/912.91ec5b14.chunk.js",
     "static/js/258.d9c4f188.chunk.js": "./static/js/258.d9c4f188.chunk.js",
     "static/js/258.d9c4f188.chunk.js": "./static/js/258.d9c4f188.chunk.js",
     "static/media/bg_jiaohu-min.jpg": "./static/media/bg_jiaohu-min.a9768d99e466f68ab764.jpg",
     "static/media/bg_jiaohu-min.jpg": "./static/media/bg_jiaohu-min.a9768d99e466f68ab764.jpg",
     "index.html": "./index.html",
     "index.html": "./index.html",
     "main.592aab85.css.map": "./static/css/main.592aab85.css.map",
     "main.592aab85.css.map": "./static/css/main.592aab85.css.map",
-    "main.f6c967f0.js.map": "./static/js/main.f6c967f0.js.map",
+    "main.fa046c4b.js.map": "./static/js/main.fa046c4b.js.map",
     "912.a53e8d10.chunk.css.map": "./static/css/912.a53e8d10.chunk.css.map",
     "912.a53e8d10.chunk.css.map": "./static/css/912.a53e8d10.chunk.css.map",
-    "912.3d7cf3e1.chunk.js.map": "./static/js/912.3d7cf3e1.chunk.js.map",
+    "912.91ec5b14.chunk.js.map": "./static/js/912.91ec5b14.chunk.js.map",
     "258.d9c4f188.chunk.js.map": "./static/js/258.d9c4f188.chunk.js.map"
     "258.d9c4f188.chunk.js.map": "./static/js/258.d9c4f188.chunk.js.map"
   },
   },
   "entrypoints": [
   "entrypoints": [
     "static/css/main.592aab85.css",
     "static/css/main.592aab85.css",
-    "static/js/main.f6c967f0.js"
+    "static/js/main.fa046c4b.js"
   ]
   ]
 }
 }

Fichier diff supprimé car celui-ci est trop grand
+ 1 - 1
public/knowlege/index.html


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 1
public/knowlege/static/js/912.3d7cf3e1.chunk.js.map


Fichier diff supprimé car celui-ci est trop grand
+ 2 - 2
public/knowlege/static/js/912.3d7cf3e1.chunk.js


Fichier diff supprimé car celui-ci est trop grand
+ 1 - 0
public/knowlege/static/js/912.91ec5b14.chunk.js.map


Fichier diff supprimé car celui-ci est trop grand
+ 3 - 3
public/knowlege/static/js/main.f6c967f0.js


public/knowlege/static/js/main.f6c967f0.js.LICENSE.txt → public/knowlege/static/js/main.fa046c4b.js.LICENSE.txt


Fichier diff supprimé car celui-ci est trop grand
+ 1 - 1
public/knowlege/static/js/main.f6c967f0.js.map


+ 30 - 14
src/pages/A9knowlege/components/Panel/index.module.scss

@@ -16,33 +16,45 @@
   flex: 1;
   flex: 1;
   padding-right: 20px;
   padding-right: 20px;
   overflow-y: auto;
   overflow-y: auto;
+  display: grid;
+  grid-template-columns: max-content 1fr;
+  column-gap: 16px;
+  row-gap: 10px;
+  grid-auto-rows: min-content;
+  align-items: start;
 }
 }
 
 
 .panelLine {
 .panelLine {
-  display: flex;
-  align-items: flex-start;
-  gap: 16px;
-  margin-bottom: 10px;
+  display: contents;
 
 
+  i {
+    font-style: italic;
+  }
   p:first-child {
   p:first-child {
     position: relative;
     position: relative;
-    white-space: nowrap;
     font-weight: bold;
     font-weight: bold;
+    max-width: 100px;
 
 
     span {
     span {
       position: relative;
       position: relative;
       z-index: 1;
       z-index: 1;
-    }
-    &::after {
-      content: '';
-      position: absolute;
-      left: 2px;
-      right: 2px;
-      bottom: 0;
-      height: 8px;
-      background: #af8764;
+
+      &::after {
+        content: '';
+        position: absolute;
+        left: 2px;
+        right: 2px;
+        bottom: 0;
+        height: 8px;
+        background: #af8764;
+        z-index: -1;
+      }
     }
     }
   }
   }
+  > div {
+    white-space: pre-wrap;
+    word-break: break-all;
+  }
 }
 }
 
 
 .panelClose {
 .panelClose {
@@ -52,4 +64,8 @@
   width: 61px;
   width: 61px;
   height: 25px;
   height: 25px;
   cursor: pointer;
   cursor: pointer;
+
+  &.panelCloseEn {
+    height: 23px;
+  }
 }
 }

+ 8 - 3
src/pages/A9knowlege/components/Panel/index.tsx

@@ -1,5 +1,8 @@
 import React from 'react'
 import React from 'react'
+import { useSelector } from 'react-redux'
+import classNames from 'classnames'
 import styles from './index.module.scss'
 import styles from './index.module.scss'
+import { RootState } from '@/store'
 
 
 type Props = {
 type Props = {
   detail?: any
   detail?: any
@@ -7,7 +10,9 @@ type Props = {
 }
 }
 
 
 function Panel({ detail, onClose }: Props) {
 function Panel({ detail, onClose }: Props) {
+  const { myLangue } = useSelector((state: RootState) => state.A0Layout)
   const title = detail?.label || '文物简介'
   const title = detail?.label || '文物简介'
+  const isEn = myLangue === 'EN'
 
 
   return (
   return (
     <div className={styles.panel}>
     <div className={styles.panel}>
@@ -21,15 +26,15 @@ function Panel({ detail, onClose }: Props) {
                 <span>{block.label}</span>
                 <span>{block.label}</span>
               </p>
               </p>
             ) : null}
             ) : null}
-            <p>{block.value}</p>
+            <div dangerouslySetInnerHTML={{ __html: block.value }} />
           </div>
           </div>
         ))}
         ))}
       </div>
       </div>
 
 
       <img
       <img
         draggable={false}
         draggable={false}
-        className={styles.panelClose}
-        src={require('../../images/btn_close_red.png')}
+        className={classNames(styles.panelClose, isEn && styles.panelCloseEn)}
+        src={require(isEn ? '../../images/btn_close_en.png' : '../../images/btn_close_red.png')}
         alt=''
         alt=''
         onClick={() => onClose && onClose()}
         onClick={() => onClose && onClose()}
       />
       />

+ 8 - 0
src/pages/A9knowlege/components/Panel2/index.module.scss

@@ -28,6 +28,10 @@
   font-size: 14px;
   font-size: 14px;
   margin-bottom: 15px;
   margin-bottom: 15px;
   // white-space: pre-line;
   // white-space: pre-line;
+
+  p {
+    padding-bottom: 5px;
+  }
 }
 }
 
 
 .panelImg {
 .panelImg {
@@ -48,4 +52,8 @@
   width: 61px;
   width: 61px;
   height: 25px;
   height: 25px;
   cursor: pointer;
   cursor: pointer;
+
+  &.panelCloseEn {
+    height: 23px;
+  }
 }
 }

+ 6 - 2
src/pages/A9knowlege/components/Panel2/index.tsx

@@ -1,6 +1,8 @@
 import React from 'react'
 import React from 'react'
+import { useSelector } from 'react-redux'
 import classNames from 'classnames'
 import classNames from 'classnames'
 import styles from './index.module.scss'
 import styles from './index.module.scss'
+import { RootState } from '@/store'
 
 
 type Props = {
 type Props = {
   detail?: any
   detail?: any
@@ -8,6 +10,8 @@ type Props = {
 }
 }
 
 
 function Panel({ detail, onClose }: Props) {
 function Panel({ detail, onClose }: Props) {
+  const { myLangue } = useSelector((state: RootState) => state.A0Layout)
+  const isEn = myLangue === 'EN'
   const title = detail?.label || ''
   const title = detail?.label || ''
   const content = detail?.content || ''
   const content = detail?.content || ''
   const imgs = detail?.imgs || []
   const imgs = detail?.imgs || []
@@ -34,8 +38,8 @@ function Panel({ detail, onClose }: Props) {
 
 
       <img
       <img
         draggable={false}
         draggable={false}
-        className={styles.panelClose}
-        src={require('../../images/btn_close_red.png')}
+        className={classNames(styles.panelClose, isEn && styles.panelCloseEn)}
+        src={require(isEn ? '../../images/btn_close_en.png' : '../../images/btn_close_red.png')}
         alt=''
         alt=''
         onClick={() => onClose && onClose()}
         onClick={() => onClose && onClose()}
       />
       />

BIN
src/pages/A9knowlege/images/btn_close_en.png


+ 21 - 3
src/pages/A9knowlege/index.tsx

@@ -1,4 +1,5 @@
-import React, { useRef, useState, useEffect } from 'react'
+import React, { useRef, useState, useEffect, useCallback } from 'react'
+import { useSelector } from 'react-redux'
 import http from '@/utils/axios'
 import http from '@/utils/axios'
 import styles from './index.module.scss'
 import styles from './index.module.scss'
 import { echPageBackFu } from '@/components/MenuSider/data'
 import { echPageBackFu } from '@/components/MenuSider/data'
@@ -8,8 +9,10 @@ import Panel from './components/Panel'
 import Panel2 from './components/Panel2'
 import Panel2 from './components/Panel2'
 import ModelPanel from './components/ModelPanel'
 import ModelPanel from './components/ModelPanel'
 import { DotLoading } from 'antd-mobile'
 import { DotLoading } from 'antd-mobile'
+import { RootState } from '@/store'
 
 
 function A9knowlege() {
 function A9knowlege() {
+  const { myLangue } = useSelector((state: RootState) => state.A0Layout)
   // 控制 sidebar 显示
   // 控制 sidebar 显示
   const [sidebarVisible, setSidebarVisible] = useState(true)
   const [sidebarVisible, setSidebarVisible] = useState(true)
   const [detail, setDetail] = useState<any>(null)
   const [detail, setDetail] = useState<any>(null)
@@ -34,6 +37,17 @@ function A9knowlege() {
     setSidebarVisible(!sidebarVisible)
     setSidebarVisible(!sidebarVisible)
   }
   }
 
 
+  // 将 myLangue 传递给 iframe:URL 参数 + load 后及语言变化时 postMessage
+  const sendLangueToIframe = useCallback(() => {
+    iframeRef.current?.contentWindow?.postMessage({ action: 'setLangue', langue: myLangue }, '*')
+  }, [myLangue])
+  useEffect(() => {
+    sendLangueToIframe()
+  }, [sendLangueToIframe])
+  const onIframeLoad = useCallback(() => {
+    sendLangueToIframe()
+  }, [sendLangueToIframe])
+
   useEffect(() => {
   useEffect(() => {
     const handleMessage = (event: MessageEvent) => {
     const handleMessage = (event: MessageEvent) => {
       if (event.data && event.data.id) {
       if (event.data && event.data.id) {
@@ -67,7 +81,10 @@ function A9knowlege() {
         return
         return
       }
       }
 
 
-      const { label, name, rtf } = response.data
+      const isEn = myLangue === 'EN'
+      const label = isEn ? response.data.enLabel : response.data.label
+      const name = isEn ? response.data.enName : response.data.name
+      const rtf = isEn ? response.data.enRtf : response.data.rtf
       let detailData: any = { name }
       let detailData: any = { name }
 
 
       // 存在 label 显示 Panel
       // 存在 label 显示 Panel
@@ -123,8 +140,9 @@ function A9knowlege() {
       <iframe
       <iframe
         ref={iframeRef}
         ref={iframeRef}
         className={styles.iframe}
         className={styles.iframe}
-        src='knowlege/index.html'
+        src={`knowlege/index.html?lang=${myLangue}`}
         title='knowlege'
         title='knowlege'
+        onLoad={onIframeLoad}
       />
       />
 
 
       <div
       <div