From 3821b3102d6f7cddb6df6b73ab027ba986c700b3 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Tue, 19 Sep 2023 17:54:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=91=E7=9A=84=E8=B5=84=E6=BA=90/=E6=96=87?= =?UTF-8?q?=E7=AB=A0=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Information/Pages/selfList.jsx | 162 +++++++++++++++++++++++ src/forge/Information/api.js | 26 ++++ src/forge/Information/fetch.js | 1 + src/forge/Information/index.jsx | 16 +++ src/forge/Information/index.scss | 104 +++++++++++++++ 5 files changed, 309 insertions(+) create mode 100644 src/forge/Information/Pages/selfList.jsx diff --git a/src/forge/Information/Pages/selfList.jsx b/src/forge/Information/Pages/selfList.jsx new file mode 100644 index 000000000..b7b315c21 --- /dev/null +++ b/src/forge/Information/Pages/selfList.jsx @@ -0,0 +1,162 @@ +import React,{ useState, useEffect } from 'react'; +import { Breadcrumb , Spin , Pagination , Modal, Button } from 'antd'; +import { Link } from 'react-router-dom'; +import { getNewsMyList , getSourceMyList , delNewsMyList , delSourceMyList } from '../api'; +import moment from 'moment'; +import nodata from '../img/nodata.png'; +import '../index.scss'; + + +function SelfList(props){ + const [ status , setStatus ] = useState(1); + const [ isSpin , setIsSpin ] = useState(true); + const [ source , setSource ] = useState(undefined); + const [ list , setList ] = useState(undefined); + const [ page , setPage ] = useState(1); + const [ total , setTotal ] = useState(0); + + const [ visible ,setVisible ] = useState(false); + const [ deleId , setDeleId] = useState(undefined); + const pathname = props.location.pathname; + const { id , temp } = props; + const limit = 15; + + useEffect(()=>{ + if(id){ + setIsSpin(true); + if(source && source===true){ + getSource(); + }else{ + getNew(); + } + } + },[status, page , id,source]) + + + useEffect(()=>{ + if(pathname){ + if(pathname.indexOf("/source/self")>-1){ + setSource(true); + }else{ + setSource(false); + } + } + },[pathname]) + + function getSource(){ + getSourceMyList({ + auditStatus:status, + zoneId:id, + pageSize:limit + }).then(result=>{ + setList(result.data.rows); + setTotal(result.data.total); + setIsSpin(false); + }) + } + + function getNew(){ + getNewsMyList(id,{ + auditStatus:status, + pageSize:limit + }).then(result=>{ + setList(result.data.rows); + setTotal(result.data.total); + setIsSpin(false); + }) + } + + function cancelFunc(){ + setVisible(false); + setDeleId(undefined); + } + function sureFunc(){ + if(source){ + delSourceMyList(deleId).then(response=>{ + setVisible(false); + props.showNotification("删除成功!"); + getSource(); + }) + }else{ + delNewsMyList(deleId).then(response=>{ + setVisible(false); + props.showNotification("删除成功!"); + getNew(); + }) + } + } + + return( +
+ +
+ +
+

确定删除该{source?"资源":"文章"}?

+

{source?"删除后所有资源文件将被清楚,请谨慎操作":"此操作将发出文章删除申请,管理员同意申请后该文章将被删除"}

+
+
+
+ + +
+
+ + {source ? "资源发布":"领域资讯"} + 我的{source ? "资源":"文章"} + + + + + +
+ ) +} +export default SelfList; \ No newline at end of file diff --git a/src/forge/Information/api.js b/src/forge/Information/api.js index a40168604..9a226ea52 100644 --- a/src/forge/Information/api.js +++ b/src/forge/Information/api.js @@ -60,6 +60,19 @@ export function getNewsDetail(id){ method: 'get', }) } +export function getNewsMyList(id,params){ + return fetch({ + url:`/cms/doc/zone/${id}/myDocList`, + method:"get", + params + }) +} +export function delNewsMyList(id){ + return fetch({ + url:`/cms/doc/${id}`, + method:"delete" + }) +} /**开源项目 */ export function getProjectsLists(id,params){ @@ -127,6 +140,19 @@ export function getSourceDetail(id){ method: 'get' }) } +export function getSourceMyList(params){ + return fetch({ + url:`/zone/zoneFront/myResourceList`, + method:"get", + params + }) +} +export function delSourceMyList(id){ + return fetch({ + url:`/zone/zoneFront/removeResource/${id}`, + method:"delete" + }) +} // 创建专区 export function postCreateZone(data) { diff --git a/src/forge/Information/fetch.js b/src/forge/Information/fetch.js index 29cc15d28..897cc41d1 100644 --- a/src/forge/Information/fetch.js +++ b/src/forge/Information/fetch.js @@ -7,6 +7,7 @@ function beforeFetch(actionUrl){ } const service = axios.create({ + headers:{Authorization:"a57ec217a1963611f9a0ff591b305dc3d5b3ba1f"}, baseURL: actionUrl, timeout: 1800000, // 请求超时时间 }); diff --git a/src/forge/Information/index.jsx b/src/forge/Information/index.jsx index 81fcd9844..14960da68 100644 --- a/src/forge/Information/index.jsx +++ b/src/forge/Information/index.jsx @@ -33,6 +33,10 @@ const Source = Loadable({ loader: () => import("./Pages/source"), loading: Loading, }); +const SourceSelfList = Loadable({ + loader: () => import("./Pages/selfList"), + loading: Loading, +}); const HeaderPage = Loadable({ loader: () => import("./Pages/headerPage"), loading: Loading, @@ -129,6 +133,12 @@ function Index(props){
{ (!sourcedetail && deptId!=="apply") && (id ? :
)} + ( + + )} + > ( @@ -141,6 +151,12 @@ function Index(props){ )} > + ( + + )} + > ( diff --git a/src/forge/Information/index.scss b/src/forge/Information/index.scss index ef77e5445..908032fe6 100644 --- a/src/forge/Information/index.scss +++ b/src/forge/Information/index.scss @@ -1562,4 +1562,108 @@ position: absolute; } } +} +.selfBoxContent{ + width: 1200px; + margin:0px auto; + padding-bottom: 40px; + border-radius: 4px; + .selfMenu{ + width: 540px; + margin:20px auto 25px; + background-color: #fff; + display: flex; + border-radius: 4px; + box-shadow:0px 0px 10px rgba(61, 85, 183, 0.1); + li{ + flex: 1; + border-right: 1px solid rgba(141, 149, 172, 0.17); + font-size:17px; + text-align:center; + color:#3d485d; + height: 50px; + line-height: 50px; + cursor: pointer; + &:first-child{ + border-radius: 4px 0px 0px 4px; + } + &:last-child{ + border-right: none; + border-radius: 0px 4px 4px 0px; + } + &.active{ + background-color: #466aff; + color: #fff; + } + } + } + .selfListPanel{ + padding:17px 0px; + background-color: #fff; + margin-top: 26px; + min-height: 400px; + li{ + padding:0px 25px; + &:hover{ + background-color: #f3f5f8; + .s-info-right{ + display: block!important; + } + } + &>div{ + border-bottom: 1px dashed rgba(170, 175, 190, 0.15); + padding:15px 0px; + .s-name{ + position: relative; + color:#1f2329; + font-size:18px; + padding-left: 16px; + height: 26px; + line-height: 26px; + display: block; + &::before{ + position: absolute; + left: 0px; + height: 8px; + width: 8px; + background-color: #466aff; + border-radius: 50%; + top:10px; + content: ""; + } + } + .s-info{ + display: flex; + justify-content: space-between; + width: 100%; + margin-top: 14px; + height: 20px; + color:#4c5876; + align-items: center; + .s-info-right{ + display: none; + transition: 0.3s; + } + } + } + } + } +} +.delSModal{ + .ant-modal-title{ + text-align: left; + } + .delBoxCon{ + width:334px; + display:flex; + margin:0px auto 20px; + align-items:flex-start; + } + .delBoxBtn{ + text-align: center; + .ant-btn{ + width: 95px; + margin:0px 20px; + } + } } \ No newline at end of file