动态选择标签
This commit is contained in:
parent
7aa44b6ca0
commit
ab94e9468a
@ -58,6 +58,10 @@ export default function CardProj(props: any) {
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
const data = props.item;
|
||||
const [tagIdArray, setTagIdArray] = useState(data.tagDataIds)
|
||||
// 动态显示标签状态
|
||||
// const [tagStatus, setTagStatus] = useState('')
|
||||
// 更新标签状态
|
||||
const upTag = (dataId: string, projId: string) => {
|
||||
post<any>({
|
||||
@ -70,16 +74,30 @@ export default function CardProj(props: any) {
|
||||
onBefore() {
|
||||
|
||||
},
|
||||
onSuccess() {
|
||||
// console.log(data);
|
||||
onSuccess(data) {
|
||||
// console.log(data.data.data);
|
||||
// props.upData
|
||||
// props.updata()
|
||||
// setTagStatus(data.data.data)
|
||||
// 根据返回的状态更新 tagIdArray
|
||||
if (data.data.data === 'SAVE') {
|
||||
setTagIdArray((prevArray: any) => [...prevArray, dataId]);
|
||||
} else if (data.data.data === 'DELETE') {
|
||||
setTagIdArray((prevArray: any[]) => prevArray.filter(id => id !== dataId));
|
||||
}
|
||||
|
||||
},
|
||||
onFinally() {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
// 更改data加入数组
|
||||
// const upData = (tagId:string) => {
|
||||
// if(tagStatus=='SAVE'){
|
||||
// setTagIdArray(tagIdArray.push(tagId))
|
||||
// }
|
||||
// }
|
||||
// 第四步 登陆页面设置
|
||||
const [loginPageOpne, setLoginPageOpne] = useState(false)
|
||||
const [loginPageShowOpne, setLoginPageShowOpne] = useState(false)
|
||||
@ -93,7 +111,7 @@ export default function CardProj(props: any) {
|
||||
const [displayOrderOpen, setDisplayOrderOpen] = useState(false)
|
||||
const [displayOrderShowOpen, setDisplayOrderShowOpen] = useState(false)
|
||||
|
||||
const data = props.item;
|
||||
|
||||
const pkg = data.pay.chargeAdditionals.match(/PKG:(\d+)/);
|
||||
const video = data.pay.chargeAdditionals.match(/VIDEO_DEMO:(\d+)/);
|
||||
const URGENT = data.pay.chargeAdditionals.match(/URGENT:(\d+)/);
|
||||
@ -188,14 +206,18 @@ export default function CardProj(props: any) {
|
||||
</div>
|
||||
{props.tagArray.map((item: any) => {
|
||||
return (
|
||||
|
||||
<div className='proj-progress' key={item.value} style={{
|
||||
background:(data.tagDataIds).includes(item.value)?'#ff7b00':'',
|
||||
color:(data.tagDataIds).includes(item.value)?'#ffffff':'#5a5a5a',
|
||||
border:(data.tagDataIds).includes(item.value)?'none':' 1px solid #5a5a5a',
|
||||
background: tagIdArray.includes(item.value) ? '#ff7b00' : '',
|
||||
color: tagIdArray.includes(item.value) ? '#ffffff' : '#5a5a5a',
|
||||
border: tagIdArray.includes(item.value) ? 'none' : ' 1px solid #5a5a5a',
|
||||
|
||||
}}
|
||||
onClick={() => {
|
||||
|
||||
upTag(item.value, data.projId)
|
||||
props.updata()
|
||||
// upData(item.value)
|
||||
// props.updata()
|
||||
}}
|
||||
>
|
||||
{item.label}
|
||||
|
@ -73,7 +73,7 @@ export default function ListProj() {
|
||||
setIsLoading(true);
|
||||
},
|
||||
onSuccess({ data }) {
|
||||
console.log('数据', data);
|
||||
// console.log('数据', data);
|
||||
|
||||
setPage(data.page);
|
||||
setTotal(data.total);
|
||||
@ -121,34 +121,34 @@ export default function ListProj() {
|
||||
getTag()
|
||||
},[])
|
||||
// 更新数据
|
||||
const upreqData = () => {
|
||||
get<IListPage<IProj>>({
|
||||
messageApi: messageApi,
|
||||
url: '/api/proj/listpage/self',
|
||||
config: {
|
||||
params: {
|
||||
page: page,
|
||||
rows: 10,
|
||||
keywords: keywords,
|
||||
charge: name,
|
||||
chargeAdditionals: chargeAdditionals,
|
||||
tagDataId: tagDataId,
|
||||
authorId: authorId,
|
||||
projCategoryId: indexListContext.category,
|
||||
status: indexListContext.status ? indexListContext.status : getMenuActive()
|
||||
}
|
||||
},
|
||||
onBefore() {
|
||||
setIsLoading(true);
|
||||
},
|
||||
onSuccess({ data }) {
|
||||
setProjs(data.rows);
|
||||
},
|
||||
onFinally() {
|
||||
setIsLoading(false);
|
||||
}
|
||||
})
|
||||
}
|
||||
// const upreqData = () => {
|
||||
// get<IListPage<IProj>>({
|
||||
// messageApi: messageApi,
|
||||
// url: '/api/proj/listpage/self',
|
||||
// config: {
|
||||
// params: {
|
||||
// page: page,
|
||||
// rows: 10,
|
||||
// keywords: keywords,
|
||||
// charge: name,
|
||||
// chargeAdditionals: chargeAdditionals,
|
||||
// tagDataId: tagDataId,
|
||||
// authorId: authorId,
|
||||
// projCategoryId: indexListContext.category,
|
||||
// status: indexListContext.status ? indexListContext.status : getMenuActive()
|
||||
// }
|
||||
// },
|
||||
// onBefore() {
|
||||
// setIsLoading(true);
|
||||
// },
|
||||
// onSuccess({ data }) {
|
||||
// setProjs(data.rows);
|
||||
// },
|
||||
// onFinally() {
|
||||
// setIsLoading(false);
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
|
||||
|
||||
const renderList = () => {
|
||||
@ -171,7 +171,7 @@ export default function ListProj() {
|
||||
return (
|
||||
<div className='projListBox' key={new Date().getTime() + ':' + item.projId}>
|
||||
<CardProj item={item}
|
||||
updata={upreqData}
|
||||
// updata={upreqData}
|
||||
tagArray={tagArray}
|
||||
/>
|
||||
</div>
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { useContext} from "react";
|
||||
|
||||
import { IndexListContext } from "../../context/IndexListContext.ts";
|
||||
import ListProj from "../../components/list/ListProj.tsx";
|
||||
import ListProjAgent from "../../components/list/ListProjAgent.tsx";
|
||||
|
@ -455,13 +455,36 @@ export default function Index() {
|
||||
// console.log(Boolean(keywords));
|
||||
|
||||
// if (location.pathname.includes('/home')) {
|
||||
if (!keywords && !type && !chargeAdditionals && !tagDataId) {
|
||||
setKeywords('')
|
||||
setType(null)
|
||||
setchargeAdditionals(null)
|
||||
settagDataId(null)
|
||||
}
|
||||
// if (!keywords && !type && !chargeAdditionals && !tagDataId) {
|
||||
// setKeywords('')
|
||||
// setType(null)
|
||||
// setchargeAdditionals(null)
|
||||
// settagDataId(null)
|
||||
// }
|
||||
// if (location.pathname.includes('/home')) {
|
||||
// nav('/home', {
|
||||
// state: {
|
||||
// keyword: keywords,
|
||||
// name: type,
|
||||
// chargeAdditionals: chargeAdditionals,
|
||||
// tagDataId: tagDataId,
|
||||
// authorId: authorId
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// console.log('监听',Boolean(authorId));
|
||||
if (location.pathname.includes('/home')) {
|
||||
if (!keywords && !type && !chargeAdditionals && !tagDataId && !authorId) {
|
||||
nav('/home', {
|
||||
state: {
|
||||
keyword: '',
|
||||
name: '',
|
||||
chargeAdditionals: '',
|
||||
tagDataId: '',
|
||||
authorId: ''
|
||||
}
|
||||
})
|
||||
} else {
|
||||
nav('/home', {
|
||||
state: {
|
||||
keyword: keywords,
|
||||
@ -472,6 +495,7 @@ export default function Index() {
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
}, [type, chargeAdditionals, keywords, tagDataId, authorId]);
|
||||
|
Loading…
Reference in New Issue
Block a user