添加提醒标签

This commit is contained in:
xixi 2024-11-04 11:55:51 +08:00
parent e086624dfa
commit a3aaef6485
5 changed files with 224 additions and 31 deletions

View File

@ -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,8 +67,9 @@ export default function CardProj(props: any) {
// data.generate.generateStatus == GenerateStatus.SUCCESS ?'查看':'编辑'
const [tagIdArray, setTagIdArray] = useState(data.tagDataIds)
// 动态显示标签状态
// const [tagStatus, setTagStatus] = useState('')
const [RemindIdArray, setRemindIdArray] = useState(data.projRemindIds)
const downAll = (projId: string, name: string) => {
setHasDown(true)
@ -141,6 +142,40 @@ export default function CardProj(props: any) {
}
})
}
// 保存提示标签
const saveRemind= (projRemindId: string, projId: string) => {
post<any>({
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<any>({
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) {
<div className='cp-time'>
{data.gmtCreate}
</div>
{/* 标签 */}
{props.tagArray.map((item: any) => {
return (
@ -576,7 +612,52 @@ export default function CardProj(props: any) {
</div>
</div>
</div>
<div className='promptTags'>
<div style={{ marginTop: 2 }}>
</div>
{/* {props.tagArray.map((item: any) => {
return (
<div className='proj-progress' key={item.value} style={{
background: tagIdArray.includes(item.value) ? '#ff7b00' : '',
color: tagIdArray.includes(item.value) ? '#ffffff' : '#5a5a5a',
border: tagIdArray.includes(item.value) ? ' 1px solid #ff7b00' : ' 1px solid #5a5a5a',
}}
onClick={() => {
upTag(item.value, data.projId)
}}
>
{item.label}
</div>
)
})} */}
{props.remindTagArray.map((item: any) => {
return (
<div className='proj-progress' key={item.value} style={{
background: RemindIdArray.includes(item.value) ? '#ff7b00' : '',
color: RemindIdArray.includes(item.value) ? '#ffffff' : '#5a5a5a',
border: RemindIdArray.includes(item.value) ? ' 1px solid #ff7b00' : ' 1px solid #5a5a5a',
}}
onClick={() => {
if(RemindIdArray.includes(item.value)){
deleteRemind(item.value, data.projId)
}else{
saveRemind(item.value, data.projId)
}
}}
>
<ClockCircleOutlined style={{marginRight:3}} /> {item.label}
</div>
)
})}
</div>
{/* <div className="card-proj-title">
<div className='titleLift'>

View File

@ -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;

View File

@ -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() {
<CardProj item={item}
// updata={upreqData}
tagArray={tagArray}
remindTagArray={remindTagArray}
/>
</div>
)
@ -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); //注释掉了 不知道者干嘛的 写上之后刷新要两次才不掉状态

View File

@ -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<string | null>(null)
const [payStatus, setpayStatus] = useState<string | null>(null)
const [authorId, setauthorId] = useState('')
const [projRemindId,setprojRemindId] = useState<string | null>(null)
//退款状态
const [applyStatus, setapplyStatus] = useState<string | null>(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<string | null>('')
// 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={'选择标签'}
/>
<Select
allowClear
value={projRemindId}
style={{ height: '31px', width: '130px', marginLeft: 20, display: showSearchBox ? 'block' : 'none' }}
onChange={(value: string) => {
// console.log(`selected ${value}`);
setprojRemindId(value)
// alert(`selected ${value}`)
// lyp
nav('/home', {
state: {
keyword: keywords,
type: type,
chargeAdditionals: chargeAdditionals,
tagDataId: tagDataId,
authorId: authorId,
payStatus: payStatus,
projRemindId:value
}
})
}}
options={
remindTagArray
}
placeholder={'选择提醒'}
/>
<Select
allowClear
@ -1266,7 +1332,8 @@ export default function Index() {
chargeAdditionals: chargeAdditionals,
tagDataId: tagDataId,
authorId: authorId,
payStatus: value
payStatus: value,
projRemindId: projRemindId
}
})

View File

@ -516,7 +516,7 @@
}
}
@media (max-width: 1400px) {
@media (max-width: 1550px) {
.index {
height: 100vh;
display: flex;