|
@@ -1,25 +1,29 @@
|
|
|
-import React, { useCallback, useEffect, useRef, useState } from 'react'
|
|
|
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
|
import styles from './index.module.scss'
|
|
|
|
|
|
import LazyImg from '@/components/LazyImg'
|
|
|
|
|
|
// 图片导入
|
|
|
-import topBgImg from '@/assets/img/goods/close.png'
|
|
|
+import closeImg from '@/assets/img/goods/close.png'
|
|
|
import li1Img from '@/assets/img/expert/li1.png'
|
|
|
import li3Img from '@/assets/img/expert/li3.png'
|
|
|
+import topBgImg from '@/assets/img/expert/topBg.png'
|
|
|
|
|
|
import { getExpertInfo } from '@/store/action/all'
|
|
|
import { FileType, GoodsRow } from '@/types'
|
|
|
import { baseURL } from '@/utils/http'
|
|
|
import { Carousel } from 'antd'
|
|
|
import store from '@/store'
|
|
|
+import classNames from 'classnames'
|
|
|
+import { ImageViewer } from 'antd-mobile'
|
|
|
|
|
|
type Props = {
|
|
|
editId: number
|
|
|
closeFu: () => void
|
|
|
+ isApp?: boolean
|
|
|
}
|
|
|
|
|
|
-function A4look({ editId, closeFu }: Props) {
|
|
|
+function A4look({ editId, closeFu, isApp }: Props) {
|
|
|
const getInfoFu = useCallback(async (id: number) => {
|
|
|
const res = await getExpertInfo(id)
|
|
|
if (res.code === 0) {
|
|
@@ -45,61 +49,95 @@ function A4look({ editId, closeFu }: Props) {
|
|
|
videoRef.current?.pause()
|
|
|
}, [])
|
|
|
|
|
|
+ // 点击图片查看大图
|
|
|
+ const lookBigImg = useCallback(
|
|
|
+ (url: string) => {
|
|
|
+ if (isApp) {
|
|
|
+ ImageViewer.show({ image: baseURL + url })
|
|
|
+ } else {
|
|
|
+ store.dispatch({
|
|
|
+ type: 'layout/lookBigImg',
|
|
|
+ payload: { url: baseURL + url, show: true }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ [isApp]
|
|
|
+ )
|
|
|
+
|
|
|
+ // 轮播图信息渲染
|
|
|
+ const swInfo = useMemo(() => {
|
|
|
+ return (
|
|
|
+ <Carousel arrows infinite={false} beforeChange={beforeChange}>
|
|
|
+ {file.map(v => (
|
|
|
+ <div key={v.id} className='Limg'>
|
|
|
+ {v.type === 'img' ? (
|
|
|
+ <div onClick={() => lookBigImg(v.filePath)}>
|
|
|
+ <LazyImg src={baseURL + v.thumb} />
|
|
|
+ </div>
|
|
|
+ ) : (
|
|
|
+ <video ref={videoRef} controls src={baseURL + v.filePath}></video>
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
+ ))}
|
|
|
+ </Carousel>
|
|
|
+ )
|
|
|
+ }, [beforeChange, file, lookBigImg])
|
|
|
+
|
|
|
return (
|
|
|
- <div id='LookGood' className={styles.A4look}>
|
|
|
+ <div id='LookGood' className={classNames(styles.A4look, isApp ? styles.A4lookM : '')}>
|
|
|
{/* 关闭按钮 */}
|
|
|
- <img onClick={closeFu} className='Lcolse' src={topBgImg} alt='' />
|
|
|
-
|
|
|
- <div className='A4Lmani'>
|
|
|
- <div className='A4Lll'>
|
|
|
- <Carousel arrows infinite={false} beforeChange={beforeChange}>
|
|
|
- {file.map(v => (
|
|
|
- <div key={v.id} className='Limg'>
|
|
|
- {v.type === 'img' ? (
|
|
|
- <div
|
|
|
- onClick={() =>
|
|
|
- store.dispatch({
|
|
|
- type: 'layout/lookBigImg',
|
|
|
- payload: { url: baseURL + v.filePath, show: true }
|
|
|
- })
|
|
|
- }
|
|
|
- >
|
|
|
- <LazyImg src={baseURL + v.thumb} />
|
|
|
- </div>
|
|
|
- ) : (
|
|
|
- <video ref={videoRef} controls src={baseURL + v.filePath}></video>
|
|
|
- )}
|
|
|
+ <img onClick={closeFu} className='Lcolse' src={closeImg} alt='' />
|
|
|
+
|
|
|
+ {isApp ? (
|
|
|
+ <div className='A4LMmain'>
|
|
|
+ <img className='A4LMtimg' src={topBgImg} alt='' />
|
|
|
+
|
|
|
+ <div className='A4LMcen' style={{ minHeight: file.length > 1 ? '300px' : '260px' }}>
|
|
|
+ <div className='A4LMcen1'>{swInfo}</div>
|
|
|
+ <div className='A4LMcen2'>
|
|
|
+ <div>
|
|
|
+ <span>简介:</span>
|
|
|
+ {info.intro || '(空)'}
|
|
|
</div>
|
|
|
- ))}
|
|
|
- </Carousel>
|
|
|
- </div>
|
|
|
|
|
|
- <div className='A4Lrr'>
|
|
|
- <div className='A4Lrr1'>
|
|
|
- <h1>{info.name}</h1>
|
|
|
+ <div>
|
|
|
+ <span>介绍:</span>
|
|
|
+ {info.remark || '(空)'}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
+ </div>
|
|
|
+ ) : (
|
|
|
+ <div className='A4Lmani'>
|
|
|
+ <div className='A4Lll'>{swInfo}</div>
|
|
|
|
|
|
- <div className='A4Lrr2'>
|
|
|
- <div className='A4Lrr2_1'>
|
|
|
- <img src={li1Img} alt='' />
|
|
|
- <span>简介:</span>
|
|
|
+ <div className='A4Lrr'>
|
|
|
+ <div className='A4Lrr1'>
|
|
|
+ <h1>{info.name}</h1>
|
|
|
</div>
|
|
|
|
|
|
- <div className='A4Lrr2_2'>{info.intro || '(空)'}</div>
|
|
|
- </div>
|
|
|
+ <div className='A4Lrr2'>
|
|
|
+ <div className='A4Lrr2_1'>
|
|
|
+ <img src={li1Img} alt='' />
|
|
|
+ <span>简介:</span>
|
|
|
+ </div>
|
|
|
|
|
|
- <div className='A4Lrr2'>
|
|
|
- <div className='A4Lrr2_1'>
|
|
|
- <img src={li3Img} alt='' />
|
|
|
- <span>介绍:</span>
|
|
|
+ <div className='A4Lrr2_2'>{info.intro || '(空)'}</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
|
|
|
- <div className='A4Lrr3 mySorrl'>
|
|
|
- <div dangerouslySetInnerHTML={{ __html: info.remark || '(空)' }}></div>
|
|
|
+ <div className='A4Lrr2'>
|
|
|
+ <div className='A4Lrr2_1'>
|
|
|
+ <img src={li3Img} alt='' />
|
|
|
+ <span>介绍:</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div className='A4Lrr3 mySorrl'>
|
|
|
+ <div dangerouslySetInnerHTML={{ __html: info.remark || '(空)' }}></div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ )}
|
|
|
</div>
|
|
|
)
|
|
|
}
|