shenwu há 7 meses atrás
pai
commit
21e03ad234

+ 3 - 2
src/components/CropperImg/index.tsx

@@ -70,7 +70,7 @@ const CropperImg: React.FC<Props> = (props) => {
   useEffect(() => {
     if (cropperRef.current && debouncedValue?.width) {
       console.log(cropperRef.current?.cropper, debouncedValue);
-      cropperRef.current?.cropper.setData(debouncedValue);
+      // cropperRef.current?.cropper.setData(debouncedValue);
     }
   }, [debouncedValue]);
 
@@ -140,6 +140,7 @@ const CropperImg: React.FC<Props> = (props) => {
                 border: '1px solid #efefef',
               }}
               initialAspectRatio={1}
+              aspectRatio={size && size?.width / size?.height}
               preview=".img-preview"
               src={image}
               viewMode={1}
@@ -159,7 +160,7 @@ const CropperImg: React.FC<Props> = (props) => {
               //     cropperRef.current = instance;
               //     instance.zoomTo(0.6);
               // }}
-              crop={() => {}}
+              crop={() => { }}
             />
           </Col>
           <Col span={8}>

+ 4 - 4
src/components/uploadImg/index.tsx

@@ -1,6 +1,6 @@
 import CropperImg from '@/components/CropperImg';
 import { useOss } from '@/Hook/useOss';
-import {  PlusOutlined } from '@ant-design/icons';
+import { PlusOutlined } from '@ant-design/icons';
 import { message, Upload } from 'antd';
 import { RcFile } from 'antd/es/upload';
 import dayjs from 'dayjs';
@@ -34,12 +34,12 @@ const UploadImg: React.FC<Props> = ({ value, onChange, size, type, isCropper, is
     <div>
       <div style={{ height: 45, display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
         {' '}
-        <PlusOutlined/>
+        <PlusOutlined />
       </div>
       <div style={{ display: 'flex', flexFlow: 'column' }}>
         <span>上传图片</span>
         <span style={{ color: '#999', fontSize: 10 }}>
-          {size?.width} * {size?.height}
+          &gt;={size?.width} *  &gt;={size?.height}
         </span>
       </div>
     </div>
@@ -63,7 +63,7 @@ const UploadImg: React.FC<Props> = ({ value, onChange, size, type, isCropper, is
         accept="image/png,image/jpg,image/jpeg"
         action="#"
         showUploadList={false}
-        customRequest={() => {}}
+        customRequest={() => { }}
         className={imageUrl ? styles.upLoadTrue : ''}
         beforeUpload={(file: RcFile): any => {
           if (file.size > 10485760) {

+ 4 - 3
src/pages/MiniApp/CompConfig/components/hot_category.tsx

@@ -18,22 +18,23 @@ export function HotCategory(props: {
         remark?: string;
         configs?: any[];
     }
+    tabs?: any
 }) {
     const { token } = useToken()
     const [tag, setTag] = useState<any>(null)
     const prevTag = usePrevious(tag);
     let { initialState } = useModel("@@initialState")
     let { state } = useModel("appPageConifg")
-    const { data: { configs, componentName, showRightButton } } = props
+    const { data: { configs, componentName, showRightButton }, tabs } = props
     const [bookData, setBookData] = useState([])
     let publicData = useMemo(() => {
         return {
             appId: initialState?.selectApp?.id || "",
             distributorId: initialState?.currentUser?.distributorId,
             appType: initialState?.selectApp?.appType || "",
-            workDirection: state.tabs
+            workDirection: tabs || state.tabs
         }
-    }, [initialState?.selectApp, initialState?.currentUser?.distributorId, state.index,state.tabs])
+    }, [initialState?.selectApp, initialState?.currentUser?.distributorId, state.index, state.tabs, tabs])
     let apiobj = useApi(initialState?.selectApp?.appCategory || 1)
     let getList = useAjax((params) => apiobj.getBookPageList(params))
     useEffect(() => {

+ 1 - 1
src/pages/MiniApp/CompConfig/template.tsx

@@ -196,7 +196,7 @@ export function Template(params: { data: any, formRef: any }) {
                                     {/* 热门书籍*/}
                                     {item.componentType === "hot_books" && <HotBooks data={item} />}
                                     {/* 热门分类 */}
-                                    {item.componentType === "hot_category" && <HotCategory data={item} />}
+                                    {item.componentType === "hot_category" && <HotCategory data={item} tabs={state.tabs} />}
                                 </div>
                                 <div className={styles.compBoxM} />
                             </React.Fragment>