chenlei hace 6 días
padre
commit
23bc957200

+ 12 - 2
src/pages/A9knowlege/components/Panel2/index.module.scss

@@ -29,16 +29,26 @@
   margin-bottom: 15px;
   // white-space: pre-line;
 
+  ol li {
+    list-style-type: decimal;
+    list-style-position: inside;
+  }
+  img {
+    display: block;
+    margin: 0 auto;
+    max-height: 200px;
+  }
   p {
     padding-bottom: 5px;
   }
   :global {
-    img {
+    .character {
+      display: inline-block;
       position: relative;
       top: -2px;
       display: inline-block;
       margin: 0 2px;
-      height: 13px;
+      height: 12px;
       object-fit: contain;
     }
   }

+ 17 - 1
src/pages/A9knowlege/components/Panel2/index.tsx

@@ -9,7 +9,23 @@ type Props = {
   onClose?: () => void
 }
 
-const normalizeContent = (content: string) => content.replace(/<\/p>\s*<div\s+class=(?:"|\\")media-wrap image-wrap(?:"|\\")(?:\s*[^>]*)>([\s\S]*?)<\/div>\s*<p(?:\s+[^>]*)?>/gi, '$1')
+const normalizeContent = (content: string) =>
+  content.replace(/<\/p>\s*<div\s+class=(?:"|\\")media-wrap image-wrap(?:"|\\")(?:\s*[^>]*)>([\s\S]*?)<\/div>\s*<p(?:\s+[^>]*)?>/gi, (match, innerContent) => {
+    const imgSrcs = ['20260403_09483427262', '20260403_09485292864', '20260403_09431697861']
+    const hasMatchingImg = imgSrcs.some(src => innerContent.includes(src))
+    if (hasMatchingImg) {
+      const modifiedInner = innerContent.replace(/<img([^>]*?)>/gi, (imgMatch: any, attrs: any) => {
+        if (attrs.includes('class=')) {
+          return imgMatch.replace(/class="([^"]*)"/, 'class="$1 character"')
+        } else {
+          return '<img class="character"' + attrs + '>'
+        }
+      })
+      return modifiedInner
+    } else {
+      return match
+    }
+  })
 
 function Panel({ detail, onClose }: Props) {
   const { myLangue } = useSelector((state: RootState) => state.A0Layout)

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

@@ -81,6 +81,11 @@ function A9knowlege() {
         return
       }
 
+      if (response.data.link) {
+        setDetail(response.data)
+        return
+      }
+
       const isEn = myLangue === 'EN'
       const label = isEn ? response.data.enLabel : response.data.label
       const name = isEn ? response.data.enName : response.data.name
@@ -124,11 +129,6 @@ function A9knowlege() {
         }
       }
 
-      if (response.data.link) {
-        setDetail(response.data)
-        return
-      }
-
       setDetail(null)
     } catch (error) {
       console.error('获取详情失败:', error)
@@ -142,18 +142,9 @@ function A9knowlege() {
     <div className={styles.A9knowlege}>
       <Zback clickFu={() => echPageBackFu()} />
 
-      <iframe
-        ref={iframeRef}
-        className={styles.iframe}
-        src={`knowlege/index.html?lang=${myLangue}`}
-        title='knowlege'
-        onLoad={onIframeLoad}
-      />
-
-      <div
-        className={`${styles.sidebar} ${!sidebarVisible ? styles.sidebarHidden : ''}`}
-        onTransitionEnd={handleTransitionEnd}
-      >
+      <iframe ref={iframeRef} className={styles.iframe} src={`knowlege/index.html?lang=${myLangue}`} title='knowlege' onLoad={onIframeLoad} />
+
+      <div className={`${styles.sidebar} ${!sidebarVisible ? styles.sidebarHidden : ''}`} onTransitionEnd={handleTransitionEnd}>
         {animationCompleted && sidebarVisible && (
           <>
             {detailLoading ? (
@@ -174,10 +165,7 @@ function A9knowlege() {
           </>
         )}
 
-        <div
-          className={`${styles.sidebarHideBtn} ${!sidebarVisible ? styles.hide : ''}`}
-          onClick={toggleSidebar}
-        ></div>
+        <div className={`${styles.sidebarHideBtn} ${!sidebarVisible ? styles.hide : ''}`} onClick={toggleSidebar}></div>
       </div>
     </div>
   )