Ver código fonte

项目简介ok

shaogen1995 11 horas atrás
pai
commit
fe53e084d1

+ 0 - 82
src/components/ZRichText/index.module.scss

@@ -1,82 +0,0 @@
-.ZRichText {
-  width: 1000px;
-  height: 100%;
-
-  :global {
-    .txtBox {
-      width: 100%;
-      height: 100%;
-      border: 1px solid #ccc;
-
-      a{
-        color: #fff !important;
-      }
-
-      // 隐藏媒体功能
-      .control-item.media {
-        display: none;
-      }
-
-      .bf-container {
-        height:100%;
-      }
-
-      .bf-content {
-        height: calc(100% - 92px);
-        padding-bottom: 0px;
-      }
-
-
-
-      .bf-controlbar {
-        position: relative;
-
-        .upImgBox {
-          position: absolute;
-          bottom: 13px;
-          right: 15px;
-          cursor: pointer;
-          color: var(--themeColor);
-          // display: none;
-        }
-
-        .upImgBoxNo {
-          display: none;
-        }
-
-      }
-    }
-
-    .noUpThumb {
-      position: relative;
-      overflow: hidden;
-      opacity: 0;
-      transition: top .2s;
-      color: #ff4d4f;
-      top: -10px;
-    }
-
-    .noUpThumbAc {
-      top: 0;
-      opacity: 1;
-    }
-
-    .bf-media .bf-image {
-      float: initial !important;
-      display: block;
-      margin: 10px auto;
-      text-align: center;
-
-      // 不让拖动放大缩小图片(会报错)
-      .bf-csize-icon {
-        display: none !important;
-      }
-
-      img {
-        max-width: 500px;
-        max-height: 300px;
-      }
-    }
-
-  }
-}

+ 0 - 216
src/components/ZRichText/index.tsx

@@ -1,216 +0,0 @@
-import React, {
-  useCallback,
-  useEffect,
-  useMemo,
-  useRef,
-  useState,
-} from "react";
-import styles from "./index.module.scss";
-
-// 引入编辑器组件
-
-// 安装---npm install braft-editor --save --force
-// npm install braft-utils --save --force
-import { ContentUtils } from "braft-utils";
-import BraftEditor from "braft-editor";
-// 引入编辑器样式
-import "braft-editor/dist/index.css";
-
-import classNames from "classnames";
-import { MessageFu } from "@/utils/message";
-import { fileDomInitialFu } from "@/utils/domShow";
-import { baseURL } from "@/utils/http";
-
-import { forwardRef, useImperativeHandle } from "react";
-import { API_upFile } from "@/store/action/layout";
-
-type Props = {
-  check: boolean; //表单校验,为fasle表示不校验
-  dirCode: string; //文件的code码
-  isLook: boolean; //是否是查看进来
-  ref: any; //当前自己的ref,给父组件调用
-  myUrl: string; //上传的api地址
-  full?: boolean;
-};
-
-function ZRichText({ check, dirCode, isLook, myUrl, full }: Props, ref: any) {
-  // 添加 上传 图片的dom
-  useEffect(() => {
-    setTimeout(() => {
-      const dom = document.querySelector(".bf-controlbar")!;
-      const div = document.createElement("div");
-      div.className = "upImgBox";
-      // div.title = "上传图片";
-      div.innerHTML = "上传图片/视频";
-      div.onclick = async () => {
-        myInput.current?.click();
-      };
-      dom.appendChild(div);
-    }, 20);
-
-    // 监听 富文本 的 class 变化,在全屏的时候会 富文本会添加上 fullscreen 的类
-    // 修复顶部样式冲突问题
-
-    const editorDom = document.querySelector(".bf-container") as HTMLDivElement;
-
-    const observer = new MutationObserver(() => {
-      // console.log("change");
-      const dom = document.querySelector(".layoutRightTop") as HTMLDivElement;
-
-      if (editorDom.className.includes("fullscreen")) dom.style.zIndex = "-1";
-      else dom.style.zIndex = "100";
-    });
-
-    observer.observe(editorDom, {
-      attributes: true,
-    });
-
-    // 销毁监听
-    return () => {
-      observer.disconnect();
-    };
-  }, []);
-
-  useEffect(() => {
-    const controlbarDom = document.querySelectorAll(".txtBox .bf-controlbar ");
-    const contentDom = document.querySelectorAll(".txtBox .bf-content ");
-    if (controlbarDom) {
-      controlbarDom.forEach((v: any) => {
-        v.style.display = isLook ? "none" : "block";
-      });
-      contentDom.forEach((v: any) => {
-        v.style.height = isLook ? "100%" : "";
-      });
-    }
-  }, [isLook]);
-
-  // 编辑器文本
-  const [editorValue, setEditorValue] = useState(
-    // 初始内容
-    BraftEditor.createEditorState("")
-  );
-
-  // 判断 富文本是否为空
-  const isTxtFlag = useMemo(() => {
-    const txt: string = editorValue.toHTML();
-    if (
-      txt.replaceAll("<p>", "").replaceAll("</p>", "").replaceAll(" ", "") ===
-      ""
-    ) {
-      return true;
-    } else return false;
-  }, [editorValue]);
-
-  const myInput = useRef<HTMLInputElement>(null);
-
-  // 上传图片
-  const handeUpPhoto = useCallback(
-    async (e: React.ChangeEvent<HTMLInputElement>) => {
-      if (e.target.files) {
-        // 拿到files信息
-        const filesInfo = e.target.files[0];
-
-        let type = ["image/jpeg", "image/png", "video/mp4"];
-        let size = 5;
-        let txt = "图片只支持png、jpg和jpeg格式!";
-        let txt2 = "图片最大支持5M!";
-
-        const isVideoFlag = filesInfo.name.endsWith(".mp4");
-
-        // 校验格式
-        if (!type.includes(filesInfo.type)) {
-          e.target.value = "";
-          if (isVideoFlag) {
-            // 上传视频
-            size = 500;
-            txt = "视频只支持mp4格式!";
-            txt2 = "视频最大支持500M!";
-          }
-
-          return MessageFu.warning(txt);
-        }
-        // 校验大小
-        if (filesInfo.size > size * 1024 * 1024) {
-          e.target.value = "";
-          return MessageFu.warning(txt2);
-        }
-        // 创建FormData对象
-        const fd = new FormData();
-        // 把files添加进FormData对象(‘photo’为后端需要的字段)
-        fd.append("type", isVideoFlag ? "video" : "img");
-        fd.append("dirCode", dirCode);
-        fd.append("file", filesInfo);
-
-        e.target.value = "";
-
-        try {
-          const res = await API_upFile(fd, myUrl);
-          if (res.code === 0) {
-            MessageFu.success("上传成功!");
-            // 在光标位置插入图片
-            const newTxt = ContentUtils.insertMedias(editorValue, [
-              {
-                type: "IMAGE",
-                url: baseURL + res.data.filePath,
-              },
-            ]);
-
-            setEditorValue(newTxt);
-          }
-          fileDomInitialFu();
-        } catch (error) {
-          fileDomInitialFu();
-        }
-      }
-    },
-    [dirCode, editorValue, myUrl]
-  );
-
-  // 让父组件调用的 回显 富文本
-  const ritxtShowFu = useCallback((val: string) => {
-    setEditorValue(BraftEditor.createEditorState(val));
-  }, []);
-
-  // 让父组件调用的返回 富文本信息 和 表单校验 isTxtFlag为ture表示未通过校验
-  const fatherBtnOkFu = useCallback(() => {
-    return { val: editorValue.toHTML(), flag: isTxtFlag };
-  }, [editorValue, isTxtFlag]);
-
-  // 可以让父组件调用子组件的方法
-  useImperativeHandle(ref, () => ({
-    ritxtShowFu,
-    fatherBtnOkFu,
-  }));
-
-  return (
-    <div className={styles.ZRichText} style={{ width: full ? "100%" : "" }}>
-      <input
-        id="upInput"
-        type="file"
-        accept=".png,.jpg,.jpeg,.mp4"
-        ref={myInput}
-        onChange={(e) => handeUpPhoto(e)}
-      />
-
-      <div className="txtBox">
-        <BraftEditor
-          readOnly={isLook}
-          placeholder="请输入内容"
-          value={editorValue}
-          onChange={(e) => setEditorValue(e)}
-          imageControls={["remove"]}
-        />
-      </div>
-      <div
-        className={classNames(
-          "noUpThumb",
-          check && isTxtFlag ? "noUpThumbAc" : ""
-        )}
-      >
-        请输入正文!
-      </div>
-    </div>
-  );
-}
-
-export default forwardRef(ZRichText);

+ 195 - 0
src/components/ZRichTextOne/index.module.scss

@@ -0,0 +1,195 @@
+.ZRichTextOne {
+  width: 1000px;
+
+  :global {
+    // 正文
+    .formRightZW {
+      width: 700px;
+      top: -3px;
+      position: relative;
+      display: flex;
+      align-items: center;
+      justify-content: space-between;
+      height: 32px;
+
+      .formRightZWRR {
+        display: flex;
+      }
+    }
+
+    // 从查看进来
+    .formRightZWLook {
+      .ant-checkbox-wrapper {
+        pointer-events: none;
+      }
+    }
+
+    .txtBox {
+      width: 100%;
+      position: relative;
+
+      a {
+        color: #fff !important;
+      }
+
+      // 隐藏媒体功能
+      .control-item.media {
+        display: none;
+      }
+
+      button {
+        &:nth-of-type(7) {
+          display: none !important;
+        }
+        &:nth-of-type(8) {
+          display: none !important;
+        }
+        &:nth-of-type(18) {
+          display: none !important;
+        }
+        &:nth-of-type(19) {
+          display: none !important;
+        }
+      }
+
+      .bf-container {
+        height: 100%;
+      }
+
+      .bf-content {
+        height: 300px;
+        padding-bottom: 0px;
+      }
+
+      .bf-controlbar {
+        position: relative;
+
+        .upImgBox {
+          position: absolute;
+          bottom: 13px;
+          right: 15px;
+          cursor: pointer;
+          color: var(--themeColor);
+          // display: none;
+        }
+
+        .upImgBoxNo {
+          display: none;
+        }
+      }
+
+      .zztxtRow {
+        margin-bottom: 20px;
+        border: 1px solid #ccc;
+
+        .zztxtRow1 {
+          padding: 0 20px;
+          height: 40px;
+          display: flex;
+          align-items: center;
+          justify-content: space-between;
+          background-color: #e8e8e8;
+
+          .zztxtRow1_1 {
+            display: flex;
+            align-items: center;
+
+            .zztxtRow1_1_1 {
+              font-weight: 700;
+              font-size: 16px;
+              margin-right: 20px;
+            }
+
+            .zztxtRow1_1_2 {
+              display: flex;
+              align-items: center;
+              width: 580px;
+              height: 32px;
+            }
+          }
+        }
+
+        .zztxtRow1_2 {
+          display: flex;
+          align-items: center;
+
+          .anticon {
+            cursor: pointer;
+            font-size: 18px;
+          }
+
+          .zztxtRow1_2Icon {
+            position: relative;
+            top: 2px;
+          }
+
+          .zztxtRow1_2IconNo {
+            pointer-events: none;
+            opacity: 0.2;
+          }
+        }
+      }
+
+      .zztxtRowErr {
+        border-color: #ff4d4f;
+      }
+    }
+
+    // 从查看进来
+    .txtBoxLook {
+      .button-remove {
+        display: none !important;
+      }
+      .bf-controlbar {
+        pointer-events: auto !important;
+        display: flex;
+        justify-content: flex-end;
+        button {
+          display: none;
+          &:last-child {
+            display: inline-block;
+          }
+        }
+        div {
+          display: none;
+        }
+        .separator-line {
+          display: none;
+        }
+      }
+    }
+
+    .noUpThumb {
+      position: relative;
+      overflow: hidden;
+      opacity: 0;
+      transition: top 0.2s;
+      color: #ff4d4f;
+      top: -20px;
+    }
+
+    .noUpThumbAc {
+      top: -10px;
+      opacity: 1;
+    }
+
+    .bf-media .bf-image {
+      float: initial !important;
+      display: block;
+      margin: 0px auto;
+      text-align: center;
+
+      // 不让拖动放大缩小图片(会报错)
+      .bf-csize-icon {
+        display: none !important;
+      }
+
+      img {
+        max-width: 500px;
+        max-height: 300px;
+      }
+    }
+
+    // .bf-video-wrap
+  }
+}

+ 160 - 0
src/components/ZRichTextOne/index.tsx

@@ -0,0 +1,160 @@
+import React, { useCallback, useMemo, useRef, useState } from 'react'
+import styles from './index.module.scss'
+
+// 引入编辑器组件
+
+// 安装---npm install braft-editor --save --force
+// npm install braft-utils --save --force
+import { ContentUtils } from 'braft-utils'
+import BraftEditor from 'braft-editor'
+// 引入编辑器样式
+import 'braft-editor/dist/index.css'
+
+import classNames from 'classnames'
+import { MessageFu } from '@/utils/message'
+import { fileDomInitialFu } from '@/utils/domShow'
+import { baseURL } from '@/utils/http'
+import { forwardRef, useImperativeHandle } from 'react'
+import { API_upFile } from '@/store/action/layout'
+import { Button } from 'antd'
+
+type Props = {
+  check: boolean //表单校验,为fasle表示不校验
+  isLook: boolean //是否是查看进来
+  ref: any //当前自己的ref,给父组件调用
+  myUrl: string //上传的api地址
+}
+
+function ZRichTextOne({ check, isLook, myUrl }: Props, ref: any) {
+  const [section, setSection] = useState(BraftEditor.createEditorState(''))
+
+  // 判断 富文本是否为空
+  const isTxtFlag = useMemo(() => {
+    let flag = false
+
+    // 不是按章节发布,检查第一个富文本
+    const txt = section.toText()
+    const txtHtml = section.toHTML()
+    const txtRes = txt.replaceAll('\n', '').replaceAll(' ', '')
+    if (!txtRes && !txtHtml.includes('class="media-wrap')) flag = true
+
+    return flag
+  }, [section])
+
+  const myInput = useRef<HTMLInputElement>(null)
+
+  // 上传图片、视频
+  const handeUpPhoto = useCallback(
+    async (e: React.ChangeEvent<HTMLInputElement>) => {
+      if (e.target.files) {
+        // 拿到files信息
+        const filesInfo = e.target.files[0]
+
+        let type = ['image/jpeg', 'image/png', 'video/mp4']
+        let size = 5
+        let txt = '图片只支持png、jpg和jpeg格式!'
+        let txt2 = '图片最大支持5M!'
+
+        // 校验格式
+        if (!type.includes(filesInfo.type)) {
+          e.target.value = ''
+          return MessageFu.warning(txt)
+        }
+
+        // 校验大小
+        if (filesInfo.size > size * 1024 * 1024) {
+          e.target.value = ''
+          return MessageFu.warning(txt2)
+        }
+
+        // 创建FormData对象
+        const fd = new FormData()
+        // 把files添加进FormData对象(‘photo’为后端需要的字段)
+        fd.append('type', 'img')
+        fd.append('file', filesInfo)
+
+        e.target.value = ''
+
+        try {
+          const res = await API_upFile(fd, myUrl)
+          if (res.code === 0) {
+            MessageFu.success('上传成功')
+            // 在光标位置插入图片
+            const newTxt = ContentUtils.insertMedias(section, [
+              {
+                type: 'IMAGE',
+                url: baseURL + (res.data.compressedUrl || res.data.originalUrl)
+              }
+            ])
+
+            setSection(newTxt)
+          }
+          fileDomInitialFu()
+        } catch (error) {
+          fileDomInitialFu()
+        }
+      }
+    },
+    [myUrl, section]
+  )
+
+  // 让父组件调用的 回显 富文本
+  const ritxtShowFu = useCallback((val: any) => {
+    if (val) setSection(BraftEditor.createEditorState(val))
+  }, [])
+
+  // 让父组件调用的返回 富文本信息 和 表单校验 isTxtFlag为ture表示未通过校验
+  const fatherBtnOkFu = useCallback(() => {
+    return { val: section.toHTML(), flag: isTxtFlag }
+  }, [isTxtFlag, section])
+
+  // 可以让父组件调用子组件的方法
+  useImperativeHandle(ref, () => ({
+    ritxtShowFu,
+    fatherBtnOkFu
+  }))
+
+  return (
+    <div className={styles.ZRichTextOne} id='ZRichTextOne'>
+      <input
+        id='upInput'
+        type='file'
+        accept='.png,.jpg,.jpeg,.mp4'
+        ref={myInput}
+        onChange={e => handeUpPhoto(e)}
+      />
+
+      <div className={classNames('formRightZW', isLook ? 'formRightZWLook' : '')}>
+        <div className='formRightZWRR'>
+          <div hidden={isLook}>
+            <Button
+              onClick={() => {
+                myInput.current?.click()
+              }}
+            >
+              上传图片
+            </Button>
+          </div>
+        </div>
+      </div>
+
+      <div className={classNames('txtBox', isLook ? 'txtBoxLook' : '')}>
+        <div className={classNames('zztxtRow')}>
+          {/* 主体 */}
+          <BraftEditor
+            readOnly={isLook}
+            placeholder={isLook ? '(空)' : '请输入内容'}
+            value={section}
+            onChange={e => setSection(e)}
+            imageControls={['remove']}
+          />
+        </div>
+      </div>
+      <div className={classNames('noUpThumb', check && isTxtFlag ? 'noUpThumbAc' : '')}>
+        {`请完整输入正文!`}
+      </div>
+    </div>
+  )
+}
+
+export default forwardRef(ZRichTextOne)

+ 3 - 7
src/components/ZRichTexts/index.tsx

@@ -31,16 +31,15 @@ export type SectionArrType = {
 
 
 type Props = {
 type Props = {
   check: boolean //表单校验,为fasle表示不校验
   check: boolean //表单校验,为fasle表示不校验
-  dirCode: string //文件的code码
   isLook: boolean //是否是查看进来
   isLook: boolean //是否是查看进来
   ref: any //当前自己的ref,给父组件调用
   ref: any //当前自己的ref,给父组件调用
   myUrl: string //上传的api地址
   myUrl: string //上传的api地址
   isOne?: boolean //只显示单个富文本
   isOne?: boolean //只显示单个富文本
-  upAudioBtnNone?: boolean //是否能上传无障碍音频
+  upAudioBtnNone?: boolean //是否能上传无障碍音频 true为否
 }
 }
 
 
 function ZRichTexts(
 function ZRichTexts(
-  { check, dirCode, isLook, myUrl, isOne = false, upAudioBtnNone = false }: Props,
+  { check, isLook, myUrl, isOne = false, upAudioBtnNone = false }: Props,
   ref: any
   ref: any
 ) {
 ) {
   const [sectionArr, setSectionArr] = useState<SectionArrType[]>([
   const [sectionArr, setSectionArr] = useState<SectionArrType[]>([
@@ -121,7 +120,6 @@ function ZRichTexts(
         const fd = new FormData()
         const fd = new FormData()
         // 把files添加进FormData对象(‘photo’为后端需要的字段)
         // 把files添加进FormData对象(‘photo’为后端需要的字段)
         fd.append('type', isVideoFlag ? 'video' : 'img')
         fd.append('type', isVideoFlag ? 'video' : 'img')
-        fd.append('dirCode', dirCode)
         fd.append('file', filesInfo)
         fd.append('file', filesInfo)
 
 
         e.target.value = ''
         e.target.value = ''
@@ -147,7 +145,7 @@ function ZRichTexts(
         }
         }
       }
       }
     },
     },
-    [dirCode, myUrl, sectionArr]
+    [myUrl, sectionArr]
   )
   )
 
 
   // 让父组件调用的 回显 富文本
   // 让父组件调用的 回显 富文本
@@ -289,7 +287,6 @@ function ZRichTexts(
                 fileInfo={sectionArr[0].fileInfo}
                 fileInfo={sectionArr[0].fileInfo}
                 upDataFu={info => upSectionFu(info, 0)}
                 upDataFu={info => upSectionFu(info, 0)}
                 delFu={() => delSectionFu(0)}
                 delFu={() => delSectionFu(0)}
-                dirCode={dirCode}
                 myUrl={myUrl}
                 myUrl={myUrl}
                 isLook={isLook}
                 isLook={isLook}
               />
               />
@@ -356,7 +353,6 @@ function ZRichTexts(
                   fileInfo={item.fileInfo}
                   fileInfo={item.fileInfo}
                   upDataFu={info => upSectionFu(info, index)}
                   upDataFu={info => upSectionFu(info, index)}
                   delFu={() => delSectionFu(index)}
                   delFu={() => delSectionFu(index)}
-                  dirCode={dirCode}
                   myUrl={myUrl}
                   myUrl={myUrl}
                   isLook={isLook}
                   isLook={isLook}
                 />
                 />

+ 2 - 4
src/components/ZupAudio/index.tsx

@@ -16,13 +16,12 @@ type Props = {
   fileInfo: ZupAudioType
   fileInfo: ZupAudioType
   upDataFu: (info: ZupAudioType) => void
   upDataFu: (info: ZupAudioType) => void
   delFu: () => void
   delFu: () => void
-  dirCode: string
   myUrl: string
   myUrl: string
   size?: number
   size?: number
   isLook?: boolean
   isLook?: boolean
 }
 }
 
 
-function ZupAudio({ size = 10, isLook = false, fileInfo, upDataFu, delFu, dirCode, myUrl }: Props) {
+function ZupAudio({ size = 10, isLook = false, fileInfo, upDataFu, delFu, myUrl }: Props) {
   // 上传 无障碍音频的 点击
   // 上传 无障碍音频的 点击
   const handeUpAudio = useCallback(
   const handeUpAudio = useCallback(
     async (e: React.ChangeEvent<HTMLInputElement>) => {
     async (e: React.ChangeEvent<HTMLInputElement>) => {
@@ -47,7 +46,6 @@ function ZupAudio({ size = 10, isLook = false, fileInfo, upDataFu, delFu, dirCod
         const fd = new FormData()
         const fd = new FormData()
 
 
         fd.append('type', 'audio')
         fd.append('type', 'audio')
-        fd.append('dirCode', dirCode)
         fd.append('file', filesInfo)
         fd.append('file', filesInfo)
         e.target.value = ''
         e.target.value = ''
 
 
@@ -64,7 +62,7 @@ function ZupAudio({ size = 10, isLook = false, fileInfo, upDataFu, delFu, dirCod
         }
         }
       }
       }
     },
     },
-    [dirCode, myUrl, size, upDataFu]
+    [myUrl, size, upDataFu]
   )
   )
 
 
   // 上传附件的ref
   // 上传附件的ref

+ 10 - 0
src/pages/A1intro/index.module.scss

@@ -1,4 +1,14 @@
 .A1intro {
 .A1intro {
+  background-color: #fff;
+  border-radius: 10px;
+  padding: 20px;
+  display: flex;
+  justify-content: space-between;
   :global {
   :global {
+    #ZRichTextOne {
+      .bf-content {
+        height: 600px;
+      }
+    }
   }
   }
 }
 }

+ 68 - 2
src/pages/A1intro/index.tsx

@@ -1,9 +1,75 @@
-import React from 'react'
+import React, { useCallback, useEffect, useRef, useState } from 'react'
 import styles from './index.module.scss'
 import styles from './index.module.scss'
+import { Button } from 'antd'
+import ZRichTextOne from '@/components/ZRichTextOne'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import { useDispatch, useSelector } from 'react-redux'
+import { A1_APIgetInfo, A1_APIsetInfo } from '@/store/action/A1intro'
+import { RootState } from '@/store'
+import { MessageFu } from '@/utils/message'
 function A1intro() {
 function A1intro() {
+  const dispatch = useDispatch()
+
+  const getInfo = useCallback(() => {
+    dispatch(A1_APIgetInfo())
+  }, [dispatch])
+
+  // 富文本的ref
+  const ZRichTextRef = useRef<any>(null)
+
+  const [isEdit, setIsEdit] = useState(false)
+
+  const description = useSelector((state: RootState) => state.A0Layout.A1intro || '{}')
+
+  useEffect(() => {
+    if (!isEdit) {
+      getInfo()
+      ZRichTextRef.current?.ritxtShowFu(description)
+    }
+  }, [description, getInfo, isEdit])
+
+  // 点击确定
+  const btnOk = useCallback(async () => {
+    const rtf = ZRichTextRef.current?.fatherBtnOkFu() || { flag: true }
+    const res = await A1_APIsetInfo(rtf.val)
+    if (res.code === 0) {
+      MessageFu.success('修改成功')
+      setIsEdit(false)
+    }
+  }, [])
+
   return (
   return (
     <div className={styles.A1intro}>
     <div className={styles.A1intro}>
-      <h1>A1intro</h1>
+      <div className='pageTitle'>项目简介</div>
+
+      <div className='A1ll'>
+        <ZRichTextOne
+          check={false}
+          myUrl='file/upload?upPath=A1intro'
+          isLook={!isEdit}
+          ref={ZRichTextRef}
+        />
+      </div>
+      <div className='A1rr'>
+        {isEdit ? (
+          <>
+            <MyPopconfirm
+              txtK='取消'
+              onConfirm={() => {
+                setIsEdit(false)
+              }}
+            />
+            &emsp;
+            <Button type='primary' onClick={btnOk}>
+              确定
+            </Button>
+          </>
+        ) : (
+          <Button type='primary' onClick={() => setIsEdit(true)}>
+            修改
+          </Button>
+        )}
+      </div>
     </div>
     </div>
   )
   )
 }
 }

+ 0 - 7
src/pages/Layout/index.tsx

@@ -15,7 +15,6 @@ import classNames from 'classnames'
 import { RouterType, RouterTypeRow } from '@/types'
 import { RouterType, RouterTypeRow } from '@/types'
 import tabLeftArr from './data'
 import tabLeftArr from './data'
 import MyPopconfirm from '@/components/MyPopconfirm'
 import MyPopconfirm from '@/components/MyPopconfirm'
-import store from '@/store'
 import SpinLodingSon from '@/components/SpinLodingSon'
 import SpinLodingSon from '@/components/SpinLodingSon'
 import { userGetInfoAPI } from '@/store/action/Z1user'
 import { userGetInfoAPI } from '@/store/action/Z1user'
 
 
@@ -54,9 +53,6 @@ function Layout() {
         })
         })
       }
       }
 
 
-      // 页面权限id,存到仓库
-      store.dispatch({ type: 'layout/authorityIds', payload: isOkIdArr })
-
       const tempArr: RouterTypeRow[] = []
       const tempArr: RouterTypeRow[] = []
 
 
       // 权限数据存到仓库
       // 权限数据存到仓库
@@ -77,9 +73,6 @@ function Layout() {
         }
         }
       })
       })
 
 
-      // 权限数据存到仓库
-      store.dispatch({ type: 'layout/userRolePermissions', payload: roleArrStoreArr })
-
       setRouterCom(tempArr)
       setRouterCom(tempArr)
 
 
       // 如果当前页面没有权限了,跳转有权限的第一个页面
       // 如果当前页面没有权限了,跳转有权限的第一个页面

+ 22 - 0
src/store/action/A1intro.ts

@@ -0,0 +1,22 @@
+import http from '@/utils/http'
+import { AppDispatch } from '..'
+
+/**
+ * 项目简介-获取简介
+ */
+
+export const A1_APIgetInfo = (): any => {
+  return async (dispatch: AppDispatch) => {
+    const res = await http.get('issue/getIntro')
+    if (res.code === 0) {
+      dispatch({ type: 'layout/A1intro', payload: res.data.description || '' })
+    }
+  }
+}
+
+/**
+ * 项目简介-修改简介
+ */
+export const A1_APIsetInfo = (description: string) => {
+  return http.post('issue/setIntro', { description })
+}

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

@@ -24,7 +24,6 @@ export const API_LoginGetCode = () => {
   return http.get('user/getCode', { responseType: 'blob' })
   return http.get('user/getCode', { responseType: 'blob' })
 }
 }
 
 
-// 待完善
 const CancelToken = axios.CancelToken
 const CancelToken = axios.CancelToken
 /**
 /**
  * 上传封面图和附件
  * 上传封面图和附件

+ 7 - 15
src/store/reducer/layout.ts

@@ -1,4 +1,4 @@
-import { LookDomType, RouterTypeRow } from '@/types'
+import { LookDomType } from '@/types'
 import { MessageType } from '@/utils/message'
 import { MessageType } from '@/utils/message'
 
 
 // 初始化状态
 // 初始化状态
@@ -25,11 +25,8 @@ const initState = {
     fu: () => {},
     fu: () => {},
     state: false
     state: false
   },
   },
-  // 页面权限id集合
-  authorityIds: [] as number[],
-
-  // 用户工作台常用功能
-  userRolePermissions: [] as RouterTypeRow[]
+  // 项目简介
+  A1intro: ''
 }
 }
 
 
 // 定义 action 类型
 // 定义 action 类型
@@ -37,8 +34,7 @@ type LayoutActionType =
   | { type: 'layout/lookBigImg'; payload: { url: string; show: boolean } }
   | { type: 'layout/lookBigImg'; payload: { url: string; show: boolean } }
   | { type: 'layout/lookDom'; payload: LookDomType }
   | { type: 'layout/lookDom'; payload: LookDomType }
   | { type: 'layout/message'; payload: MessageType }
   | { type: 'layout/message'; payload: MessageType }
-  | { type: 'layout/authorityIds'; payload: number[] }
-  | { type: 'layout/userRolePermissions'; payload: RouterTypeRow[] }
+  | { type: 'layout/A1intro'; payload: string }
   | {
   | {
       type: 'layout/closeUpFile'
       type: 'layout/closeUpFile'
       payload: {
       payload: {
@@ -56,19 +52,15 @@ export default function layoutReducer(state = initState, action: LayoutActionTyp
     // 查看视频
     // 查看视频
     case 'layout/lookDom':
     case 'layout/lookDom':
       return { ...state, lookDom: action.payload }
       return { ...state, lookDom: action.payload }
-
     // antd轻提示(兼容360浏览器)
     // antd轻提示(兼容360浏览器)
     case 'layout/message':
     case 'layout/message':
       return { ...state, message: action.payload }
       return { ...state, message: action.payload }
     // 上传文件点击取消
     // 上传文件点击取消
     case 'layout/closeUpFile':
     case 'layout/closeUpFile':
       return { ...state, closeUpFile: action.payload }
       return { ...state, closeUpFile: action.payload }
-    // 页面权限id集合
-    case 'layout/authorityIds':
-      return { ...state, authorityIds: action.payload }
-    // 用户工作台常用功能
-    case 'layout/userRolePermissions':
-      return { ...state, userRolePermissions: action.payload }
+    // 项目简介
+    case 'layout/A1intro':
+      return { ...state, A1intro: action.payload }
 
 
     default:
     default:
       return state
       return state