shaogen1995 1 semana atrás
pai
commit
0b9b4adc44

BIN
.nvmrc


+ 39 - 1
src/pages/A1atlas/A1add.tsx

@@ -9,6 +9,7 @@ import { A1AddInfoType, TypeA1dict } from './data'
 import { A1_APIgetInfo, A1_APIsave } from '@/store/action/A1atlas'
 import TextArea from 'antd/es/input/TextArea'
 import ZRichTexts from '@/components/ZRichTexts'
+import ZupOne from '@/components/ZupOne'
 
 type Props = {
   addInfo: A1AddInfoType
@@ -19,6 +20,8 @@ type Props = {
 function A1add({ addInfo, addFu, closeFu }: Props) {
   // 富文本的ref
   const ZRichTextRef = useRef<any>(null)
+  // 封面图的ref
+  const ZupThumbRef = useRef<any>(null)
 
   const { dictAll: treeData } = useSelector((state: RootState) => state.A1atlas)
 
@@ -66,6 +69,13 @@ function A1add({ addInfo, addFu, closeFu }: Props) {
       // 设置富文本
       if (res.data.rtf) ZRichTextRef.current?.ritxtShowFu(JSON.parse(res.data.rtf))
 
+      // 设置封面图
+      ZupThumbRef.current?.setFileComFileFu({
+        fileName: '',
+        filePath: res.data.thumbPc || '',
+        thumb: res.data.thumb || ''
+      })
+
       settypeSon(res.data.typeSon ? res.data.typeSon : '2')
       FormBoxRef.current?.setFieldsValue({
         ...res.data,
@@ -94,6 +104,9 @@ function A1add({ addInfo, addFu, closeFu }: Props) {
   // 通过校验点击确定
   const onFinish = useCallback(
     async (values: any) => {
+      // 封面图
+      const coverUrl1 = ZupThumbRef.current?.fileComFileResFu()
+
       // 富文本
       const rtf = ZRichTextRef.current?.fatherBtnOkFu() || { flag: true }
 
@@ -117,7 +130,9 @@ function A1add({ addInfo, addFu, closeFu }: Props) {
         parentId,
         type: 'dict',
         rtf: JSON.stringify(rtf.val || ''),
-        sort: 999
+        sort: 999,
+        thumb: coverUrl1.thumb || '',
+        thumbPc: coverUrl1.filePath || ''
       }
       // console.log(123, obj)
       // if (1 + 1 === 2) {
@@ -220,6 +235,29 @@ function A1add({ addInfo, addFu, closeFu }: Props) {
             <div className='fromRowTit'>关闭时,该节点会关闭详情页</div>
           </div>
 
+          <Form.Item label='模板' name='label'>
+            <TextArea maxLength={2000} showCount placeholder='请输入内容' />
+          </Form.Item>
+
+          <div className='fromRow fromRow2'>
+            <div className='fromRowll'>封面图:</div>
+            <div className='fromRowrr'>
+              <ZupOne
+                ref={ZupThumbRef}
+                isLook={false}
+                fileCheck={false}
+                dirCode='A1atlasCover'
+                myUrl='cms/dict/upload'
+                format={['image/jpeg', 'image/png']}
+                formatTxt='png、jpg和jpeg'
+                checkTxt='请上传封面图!'
+                upTxt='最多1张'
+                myType='thumb'
+                size={5}
+              />
+            </div>
+          </div>
+
           <Form.Item label='详情页类型' name='typeSon'>
             <Radio.Group
               onChange={e => settypeSon(e.target.value)}

+ 1 - 0
src/pages/A1atlas/data.ts

@@ -12,6 +12,7 @@ export type TypeA1dict = {
   typeSon: '1' | '2'
   preset: '1' | '0'
   thumb: string
+  thumbPc: string
   // ---
   children?: TypeA1dict[]
 }

+ 16 - 0
src/pages/A1atlas/index.tsx

@@ -10,6 +10,7 @@ import { MessageFu } from '@/utils/message'
 import A1add from './A1add'
 import MyPopconfirm from '@/components/MyPopconfirm'
 import A1page from './A1page'
+import ImageLazy from '@/components/ImageLazy'
 
 function A1atlas() {
   const [loding, setLoding] = useState(false)
@@ -315,6 +316,21 @@ function A1atlas() {
                   : '(空)'}
               </div>
             </div>
+            <div className='A1Rrow'>
+              <div className='A1Rrow1'>封面图:</div>
+              <div className='A1Rrow2'>
+                {rightData.thumb ? (
+                  <ImageLazy
+                    width={120}
+                    height={120}
+                    src={rightData.thumb || rightData.thumbPc}
+                    srcBig={rightData.thumbPc || rightData.thumb}
+                  />
+                ) : (
+                  '(空)'
+                )}
+              </div>
+            </div>
 
             <div className='A1Rrow'>
               <div className='A1Rrow1'>详情页内容:</div>

+ 1 - 1
src/store/action/layout.ts

@@ -40,7 +40,7 @@ export const API_upFile = (data: any, url: string) => {
     },
     // 取消上传
     cancelToken: new CancelToken(function executor(c) {
-      domShowFu('#UpAsyncLoding', false)
+      // domShowFu('#UpAsyncLoding', false)
       store.dispatch({
         type: 'layout/closeUpFile',
         payload: { fu: c, state: true }