diff --git a/src/components/card/CardProj.tsx b/src/components/card/CardProj.tsx index fbb1ad9..d9a36a0 100644 --- a/src/components/card/CardProj.tsx +++ b/src/components/card/CardProj.tsx @@ -15,7 +15,7 @@ import { import { Button, Tag, Modal, Carousel } from 'antd'; import { GenerateStatus } from "../../interfaces/proj/IProj.ts"; import { useNavigate } from "react-router-dom"; -import { Axios, post, downloadUrl, get } from "../../util/AjaxUtils.ts"; +import { Axios, post, downloadUrl, get,del } from "../../util/AjaxUtils.ts"; import { useEffect, useState } from "react"; import useMessage from "antd/es/message/useMessage"; import setImg from '../../static/right/set.png' @@ -67,10 +67,11 @@ export default function CardProj(props: any) { // data.generate.generateStatus == GenerateStatus.SUCCESS ?'查看':'编辑' const [tagIdArray, setTagIdArray] = useState(data.tagDataIds) - // 动态显示标签状态 - // const [tagStatus, setTagStatus] = useState('') - - const downAll = (projId: string, name: string) => { + const [RemindIdArray, setRemindIdArray] = useState(data.projRemindIds) + + + + const downAll = (projId: string, name: string) => { setHasDown(true) if (!hasDown) { get({ @@ -83,7 +84,7 @@ export default function CardProj(props: any) { setDownModal(true); // 打开下载模态框 setHasDown(true); // 设置正在下载状态 }, - onSuccess(data:any) { + onSuccess(data: any) { // 处理下载成功的逻辑 const blob = new Blob([data.data]); // 创建 Blob 对象 const url = window.URL.createObjectURL(blob); // 创建下载链接 @@ -104,7 +105,7 @@ export default function CardProj(props: any) { } }) - + } else { setDownModal(true); } @@ -141,6 +142,40 @@ export default function CardProj(props: any) { } }) } + // 保存提示标签 + const saveRemind= (projRemindId: string, projId: string) => { + post({ + messageApi, + url: `/api/proj/remind/task/save`, + body: { + projRemindId, + projId + }, + onBefore() { + + }, + onSuccess() { + + setRemindIdArray((prevArray: any) => [...prevArray, projRemindId]); + }, + onFinally() { + + } + }) + } + // 删除提示标签 + const deleteRemind= (projRemindId: string, projId: string) => { + // setRemindIdArray((prevArray: any[]) => prevArray.filter(id => id !== projRemindId)); + + del({ + messageApi, + url: `/api/proj/remind/task/delete/proj-id/${projId}/proj-remind-id/${projRemindId}`, + onSuccess() { + setRemindIdArray((prevArray: any[]) => prevArray.filter(id => id !== projRemindId)); + + } + }) + } // 更改data加入数组 // const upData = (tagId:string) => { // if(tagStatus=='SAVE'){ @@ -299,6 +334,7 @@ export default function CardProj(props: any) {
{data.gmtCreate}
+ {/* 标签 */} {props.tagArray.map((item: any) => { return ( @@ -576,7 +612,52 @@ export default function CardProj(props: any) { +
+
+ +
+ {/* {props.tagArray.map((item: any) => { + return ( +
{ + + upTag(item.value, data.projId) + + }} + > + {item.label} +
+ + ) + })} */} + {props.remindTagArray.map((item: any) => { + return ( + +
{ + if(RemindIdArray.includes(item.value)){ + deleteRemind(item.value, data.projId) + }else{ + saveRemind(item.value, data.projId) + } + + }} + > + {item.label} +
+ + ) + })} +
{/*
diff --git a/src/components/card/card-proj.css b/src/components/card/card-proj.css index 3aa4310..a5fe1d4 100644 --- a/src/components/card/card-proj.css +++ b/src/components/card/card-proj.css @@ -19,7 +19,7 @@ border-radius: 6px; background-color: var(--color-light); /* padding: 5px 15px; */ - height: 230px; + height: 270px; /* width: calc(100vw - 330px); */ /* margin-bottom: 20px; */ border-radius: 13px; @@ -37,7 +37,13 @@ padding-left: 21px; padding-right: 29px; } - + .promptTags{ + padding-left: 21px; + display: flex; + /* background-color: red; */ + align-items: center; + /* justify-content: center; */ + } .cpt-left { display: flex; /* align-items: center; */ @@ -570,7 +576,7 @@ border-radius: 6px; background-color: var(--color-light); /* padding: 5px 15px; */ - min-height: 260px; + min-height: 280px; /* width: calc(100vw - 330px); */ /* margin-bottom: 20px; */ border-radius: 13px; @@ -588,7 +594,13 @@ padding-left: 21px; padding-right: 29px; } - + .promptTags{ + padding-left: 21px; + display: flex; + /* background-color: red; */ + align-items: center; + /* justify-content: center; */ + } .cpt-left { display: flex; /* align-items: center; */ @@ -666,8 +678,11 @@ font-size: 12px; /* color: #5a5a5a; */ /* border: 1px solid #ff7b00; */ - text-align: center; - line-height: 20px; + /* text-align: center; + line-height: 20px; */ + display: flex; + align-items: center; + justify-content: center; padding-left: 9px; padding-right: 9px; margin-left: 10px; diff --git a/src/components/list/ListProj.tsx b/src/components/list/ListProj.tsx index 6b8fc8a..edf656c 100644 --- a/src/components/list/ListProj.tsx +++ b/src/components/list/ListProj.tsx @@ -33,6 +33,8 @@ export default function ListProj() { const chargeAdditionals = state ? state.chargeAdditionals : '' const tagDataId = state ? state.tagDataId : '' + const projRemindId = state? state.projRemindId : '' + const authorId = state ? state.authorId : '' const payStatus = state ? state.payStatus : '' // console.log(keywords); @@ -67,6 +69,7 @@ export default function ListProj() { chargeType: type, chargeAdditionals: chargeAdditionals, tagDataId: tagDataId, + projRemindId: projRemindId, authorId: authorId, payStatus: payStatus, projCategoryId: indexListContext.category, @@ -77,7 +80,7 @@ export default function ListProj() { setIsLoading(true); }, onSuccess({ data }) { - // console.log('数据', data); + // console.log('数据', data.rows); // console.log('得到数据'); setPage(data.page); @@ -122,11 +125,37 @@ export default function ListProj() { } }) } + // 提示标签数组 + const [remindTagArray, setRemindTagArray] = useState([]) + // 获取提示标签 + const getremindTag = () => { + get({ + messageApi, + url: `/api/proj/remind/list`, + onBefore() { + + }, + onSuccess(data: any) { + // console.log('标签信息', data.data); + const newarrty: any = (data.data).map((item: any) => ({ + value: item.projRemindId, + label: item.title + })); + // // console.log('标签信息', newarrty); + + setRemindTagArray(newarrty) + + }, + onFinally() { + + } + }) + } useEffect(() => { getTag() // console.log('这啥啊',indexListContext.categoryChangeCount); // console.log('这啥啊2',indexListContext.category) - + getremindTag() }, []) // 更新数据 @@ -182,6 +211,7 @@ export default function ListProj() {
) @@ -211,7 +241,7 @@ export default function ListProj() { }, 0); // console.log('传递',state); - }, [indexListContext.status, keywords, type, chargeAdditionals, tagDataId, authorId, payStatus]) + }, [indexListContext.status, keywords, type, chargeAdditionals, tagDataId, projRemindId,authorId, payStatus]) useEffect(() => { // reqData(page); //注释掉了 不知道者干嘛的 写上之后刷新要两次才不掉状态 diff --git a/src/route/index/Index.tsx b/src/route/index/Index.tsx index a9fe084..33fead1 100644 --- a/src/route/index/Index.tsx +++ b/src/route/index/Index.tsx @@ -53,6 +53,8 @@ export default function Index() { // const [clickBelongpeople, setClickBelongpeople] = useState(true) // 选项数组 const [tagArray, setTagArray] = useState([]) + + // 获取标签 const getTag = () => { get({ @@ -75,6 +77,32 @@ export default function Index() { } }) } + // 提示数组 + const [remindTagArray, setRemindTagArray] = useState([]) + // 获取提示 + const getremindTag = () => { + get({ + messageApi, + url: `/api/proj/remind/list`, + onBefore() { + + }, + onSuccess(data: any) { + // console.log('标签信息', data.data); + const newarrty: any = (data.data).map((item: any) => ({ + value: item.projRemindId, + label: item.title + })); + // // console.log('标签信息', newarrty); + + setRemindTagArray(newarrty) + + }, + onFinally() { + + } + }) + } const dispath = useDispatch() //redux的belongArray const redxuState: any = useSelector(state => state) @@ -141,6 +169,8 @@ export default function Index() { const [tagDataId, settagDataId] = useState(null) const [payStatus, setpayStatus] = useState(null) const [authorId, setauthorId] = useState('') + + const [projRemindId,setprojRemindId] = useState(null) //退款状态 const [applyStatus, setapplyStatus] = useState(null) // 退款关键字 @@ -189,6 +219,7 @@ export default function Index() { setchargeAdditionals(null) settagDataId(null) setpayStatus(null) + setprojRemindId(null) } // 退款页初搜索条件始化 const refunInit = () => { @@ -772,6 +803,7 @@ export default function Index() { } getProjOwnerList() getTag() + getremindTag() }, []); useEffect(() => { if (location.pathname.includes('/home')) { @@ -782,8 +814,8 @@ export default function Index() { chargeAdditionals: chargeAdditionals, tagDataId: tagDataId, authorId: authorId, - payStatus: payStatus - + payStatus: payStatus, + projRemindId: projRemindId } }) } @@ -808,7 +840,7 @@ export default function Index() { }) } - }, [type, chargeAdditionals, keywords, tagDataId, payStatus, authorId, refunKeywords, applyStatus, correctionKeywords, correctionNumType, correctionType, correctionApplyStatus]); + }, [type, chargeAdditionals, keywords, tagDataId,projRemindId, payStatus, authorId, refunKeywords, applyStatus, correctionKeywords, correctionNumType, correctionType, correctionApplyStatus]); // const [menuName,setMenuName] = useState('') // useEffect(()=>{ @@ -824,7 +856,9 @@ export default function Index() { chargeAdditionals: chargeAdditionals, tagDataId: tagDataId, authorId: authorId, - payStatus: payStatus + payStatus: payStatus, + projRemindId: projRemindId + } }) } @@ -840,7 +874,8 @@ export default function Index() { chargeAdditionals: chargeAdditionals, tagDataId: tagDataId, authorId: authorId, - payStatus: payStatus + payStatus: payStatus, + projRemindId: projRemindId } }) @@ -1171,7 +1206,8 @@ export default function Index() { chargeAdditionals: chargeAdditionals, tagDataId: tagDataId, authorId: authorId, - payStatus: payStatus + payStatus: payStatus, + projRemindId: projRemindId } }) @@ -1203,7 +1239,8 @@ export default function Index() { chargeAdditionals: value, tagDataId: tagDataId, authorId: authorId, - payStatus: payStatus + payStatus: payStatus, + projRemindId: projRemindId } }) @@ -1234,23 +1271,52 @@ export default function Index() { chargeAdditionals: chargeAdditionals, tagDataId: value, authorId: authorId, - payStatus: payStatus + payStatus: payStatus, + projRemindId: projRemindId } }) }} options={ - // [ - // { value: 'PRODUCTION', label: '正在制作中' }, - // { value: 'SUBMIT_FOR_REVIEW', label: '已提交版权中心' }, - // { value: 'DONE', label: '已下证' }, - // ] + tagArray } placeholder={'选择标签'} + /> +