减少请求次数
This commit is contained in:
parent
08fd4dcb80
commit
7aa44b6ca0
@ -32,32 +32,32 @@ import SoftwareManagementShow from '../../route/proj/edit/ProjConfigModListShow.
|
||||
import DisplayOrder from '../../route/proj/edit/ProjConfigMenuList.tsx'
|
||||
import DisplayOrderShow from '../../route/proj/edit/ProjConfigMenuListShow.tsx'
|
||||
export default function CardProj(props: any) {
|
||||
// 选项数组
|
||||
const [tagArray, setTagArray] = useState([])
|
||||
// 获取标签
|
||||
const getTag = () => {
|
||||
get({
|
||||
messageApi,
|
||||
url: `/api/proj/tag/list-tag`,
|
||||
onBefore() {
|
||||
// // 选项数组
|
||||
// const [tagArray, setTagArray] = useState([])
|
||||
// // 获取标签
|
||||
// const getTag = () => {
|
||||
// get({
|
||||
// messageApi,
|
||||
// url: `/api/proj/tag/list-tag`,
|
||||
// onBefore() {
|
||||
|
||||
},
|
||||
onSuccess(data: any) {
|
||||
// console.log('标签信息', data);
|
||||
const newarrty: any = (data.data).map((item: any) => ({
|
||||
value: item.key,
|
||||
label: item.value
|
||||
}));
|
||||
// console.log('标签信息', newarrty);
|
||||
// },
|
||||
// onSuccess(data: any) {
|
||||
// // console.log('标签信息', data);
|
||||
// const newarrty: any = (data.data).map((item: any) => ({
|
||||
// value: item.key,
|
||||
// label: item.value
|
||||
// }));
|
||||
// // console.log('标签信息', newarrty);
|
||||
|
||||
setTagArray(newarrty)
|
||||
// setTagArray(newarrty)
|
||||
|
||||
},
|
||||
onFinally() {
|
||||
// },
|
||||
// onFinally() {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// 更新标签状态
|
||||
const upTag = (dataId:string,projId:string) => {
|
||||
post<any>({
|
||||
@ -73,6 +73,7 @@ export default function CardProj(props: any) {
|
||||
onSuccess() {
|
||||
// console.log(data);
|
||||
// props.upData
|
||||
// props.updata()
|
||||
},
|
||||
onFinally() {
|
||||
|
||||
@ -107,11 +108,11 @@ export default function CardProj(props: any) {
|
||||
const isShow = data.pay.chargeAdditionals.includes('PKG') || data.pay.charge.includes('ALL')
|
||||
|
||||
const [messageApi, messageContext] = useMessage();
|
||||
const [projCategoryId, setProjCategoryId] = useState(data.projCategoryId);
|
||||
const [projCategoryName, setProjCategoryName] = useState(data.projCategoryName);
|
||||
// const [projCategoryId, setProjCategoryId] = useState(data.projCategoryId);
|
||||
// const [projCategoryName, setProjCategoryName] = useState(data.projCategoryName);
|
||||
const [charge, setCharge] = useState('');
|
||||
const [payCharge, setPayCharge] = useState('');
|
||||
const indexListContext = useContext(IndexListContext);
|
||||
// const indexListContext = useContext(IndexListContext);
|
||||
/**
|
||||
* 生成状态
|
||||
*/
|
||||
@ -164,7 +165,7 @@ export default function CardProj(props: any) {
|
||||
// console.log('额外收费视频',videoDemoValue);
|
||||
// console.log('额外收费加急',URGENTvalue);
|
||||
// console.log('基础服务费',basicsValue);
|
||||
getTag()
|
||||
// getTag()
|
||||
}, [])
|
||||
|
||||
return (
|
||||
@ -185,7 +186,7 @@ export default function CardProj(props: any) {
|
||||
<div className='cp-time'>
|
||||
{data.gmtCreate}
|
||||
</div>
|
||||
{tagArray.map((item:any) => {
|
||||
{props.tagArray.map((item:any) => {
|
||||
return (
|
||||
<div className='proj-progress' key={item.value} style={{
|
||||
background:(data.tagDataIds).includes(item.value)?'#ff7b00':'',
|
||||
|
@ -29,11 +29,11 @@ export default function ListProj() {
|
||||
// // setKeywords(state.keyword)
|
||||
// }
|
||||
const keywords = state ? state.keyword : ''
|
||||
const name = state ? state.name : ''
|
||||
const name = state ? state.name : ''
|
||||
|
||||
const chargeAdditionals = state? state.chargeAdditionals:''
|
||||
const tagDataId = state? state.tagDataId:''
|
||||
const authorId = state? state.authorId:''
|
||||
const chargeAdditionals = state ? state.chargeAdditionals : ''
|
||||
const tagDataId = state ? state.tagDataId : ''
|
||||
const authorId = state ? state.authorId : ''
|
||||
// console.log(keywords);
|
||||
// const images = [syminga,symingb,symingc,symingd]
|
||||
const listProjRef: MutableRefObject<HTMLDivElement | null> = useRef(null);
|
||||
@ -62,9 +62,9 @@ export default function ListProj() {
|
||||
rows: 10,
|
||||
keywords: keywords,
|
||||
charge: name,
|
||||
chargeAdditionals:chargeAdditionals,
|
||||
tagDataId:tagDataId,
|
||||
authorId:authorId,
|
||||
chargeAdditionals: chargeAdditionals,
|
||||
tagDataId: tagDataId,
|
||||
authorId: authorId,
|
||||
projCategoryId: indexListContext.category,
|
||||
status: indexListContext.status ? indexListContext.status : getMenuActive()
|
||||
}
|
||||
@ -73,8 +73,8 @@ export default function ListProj() {
|
||||
setIsLoading(true);
|
||||
},
|
||||
onSuccess({ data }) {
|
||||
console.log('数据',data);
|
||||
|
||||
console.log('数据', data);
|
||||
|
||||
setPage(data.page);
|
||||
setTotal(data.total);
|
||||
setProjs(data.rows);
|
||||
@ -91,7 +91,35 @@ export default function ListProj() {
|
||||
}
|
||||
})
|
||||
}
|
||||
// 选项数组
|
||||
const [tagArray, setTagArray] = useState([])
|
||||
// 获取标签
|
||||
const getTag = () => {
|
||||
get({
|
||||
messageApi,
|
||||
url: `/api/proj/tag/list-tag`,
|
||||
onBefore() {
|
||||
|
||||
},
|
||||
onSuccess(data: any) {
|
||||
// console.log('标签信息', data);
|
||||
const newarrty: any = (data.data).map((item: any) => ({
|
||||
value: item.key,
|
||||
label: item.value
|
||||
}));
|
||||
// console.log('标签信息', newarrty);
|
||||
|
||||
setTagArray(newarrty)
|
||||
|
||||
},
|
||||
onFinally() {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
useEffect(()=>{
|
||||
getTag()
|
||||
},[])
|
||||
// 更新数据
|
||||
const upreqData = () => {
|
||||
get<IListPage<IProj>>({
|
||||
@ -103,9 +131,9 @@ export default function ListProj() {
|
||||
rows: 10,
|
||||
keywords: keywords,
|
||||
charge: name,
|
||||
chargeAdditionals:chargeAdditionals,
|
||||
tagDataId:tagDataId,
|
||||
authorId:authorId,
|
||||
chargeAdditionals: chargeAdditionals,
|
||||
tagDataId: tagDataId,
|
||||
authorId: authorId,
|
||||
projCategoryId: indexListContext.category,
|
||||
status: indexListContext.status ? indexListContext.status : getMenuActive()
|
||||
}
|
||||
@ -121,7 +149,7 @@ export default function ListProj() {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
const renderList = () => {
|
||||
if (projs.length == 0) {
|
||||
@ -143,7 +171,8 @@ export default function ListProj() {
|
||||
return (
|
||||
<div className='projListBox' key={new Date().getTime() + ':' + item.projId}>
|
||||
<CardProj item={item}
|
||||
updata = {upreqData}
|
||||
updata={upreqData}
|
||||
tagArray={tagArray}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
@ -168,7 +197,7 @@ export default function ListProj() {
|
||||
setTimeout(() => {
|
||||
setShowPage(true)
|
||||
}, 0);
|
||||
}, [indexListContext.status, keywords, name,chargeAdditionals,tagDataId,authorId])
|
||||
}, [indexListContext.status, keywords, name, chargeAdditionals, tagDataId, authorId])
|
||||
|
||||
useEffect(() => {
|
||||
reqData(page);
|
||||
|
Loading…
Reference in New Issue
Block a user