添加标签

This commit is contained in:
xixi 2024-07-31 18:41:25 +08:00
parent 547c63f2bb
commit 08fd4dcb80
6 changed files with 174 additions and 79 deletions

View File

@ -15,7 +15,7 @@ import {
import { Button, Dropdown, Tag, Modal, Carousel } from 'antd';
import { GenerateStatus, ProjChargeType } from "../../interfaces/proj/IProj.ts";
import { useNavigate } from "react-router-dom";
import { Axios, put, downloadUrl } from "../../util/AjaxUtils.ts";
import { Axios, post, downloadUrl, get } from "../../util/AjaxUtils.ts";
import { useContext, useEffect, useState } from "react";
import { IndexListContext } from "../../context/IndexListContext.ts";
import useMessage from "antd/es/message/useMessage";
@ -32,6 +32,53 @@ 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() {
},
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() {
}
})
}
// 更新标签状态
const upTag = (dataId:string,projId:string) => {
post<any>({
messageApi,
url: `/api/proj/tag/save-or-delete`,
body: {
dataId,
projId
},
onBefore() {
},
onSuccess() {
// console.log(data);
// props.upData
},
onFinally() {
}
})
}
// 第四步 登陆页面设置
const [loginPageOpne, setLoginPageOpne] = useState(false)
const [loginPageShowOpne, setLoginPageShowOpne] = useState(false)
@ -117,7 +164,7 @@ export default function CardProj(props: any) {
// console.log('额外收费视频',videoDemoValue);
// console.log('额外收费加急',URGENTvalue);
// console.log('基础服务费',basicsValue);
getTag()
}, [])
return (
@ -138,16 +185,30 @@ export default function CardProj(props: any) {
<div className='cp-time'>
{data.gmtCreate}
</div>
{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',
}}
onClick={()=>{
upTag(item.value,data.projId)
props.updata()
}}
>
{item.label}
</div>
)
})}
</div>
<div style={{ display: payCharge == '全托管' ? 'block' : 'none' }}>
<div className='proj-progress'>
{data.progress == 'DONE' ? '已下证' : data.progress == 'SUBMIT_FOR_REVIEW' ? '已提交版权中心' : data.progress == 'PRODUCTION' ? '正在制作中' : '等待制作中'}
</div>
</div>
{/* <div style={{ display: payCharge !== '' ? 'block' : 'none' }}>
<div className='proj-progress' style={{display:data.progress?'block':'none'}}>
@ -187,12 +248,12 @@ export default function CardProj(props: any) {
<Carousel autoplay dots={false}>
<div className='cpb-left-imgX'>
<img src={downloadUrl(data.loginpage.loginpagePreviewImgs,true)} height={'143px'} alt="" />
<img src={downloadUrl(data.loginpage.loginpagePreviewImgs, true)} height={'143px'} alt="" />
</div>
<div className='cpb-left-imgX'>
<img src={downloadUrl(data.codeTypePage.previewImgs,true)} height={'143px'} alt="" />
<img src={downloadUrl(data.codeTypePage.previewImgs, true)} height={'143px'} alt="" />
</div>
@ -325,8 +386,8 @@ export default function CardProj(props: any) {
) : <></>
}
</div> */}
<div className='cpbc-bot' style={{color:'#FFA415'}}>
:{data.apply.authorName }
<div className='cpbc-bot' style={{ color: '#FFA415' }}>
:{data.apply.authorName}
</div>
</div>
{/* <div className='cline'></div> */}

View File

@ -88,20 +88,22 @@
color: #888888;
}
.proj-progress{
height: 29px;
background: #ff7b00;
height: 20px;
/* background: #ff7b00; */
/* background: #01a13f; */
border-radius: 5px;
/* font-family: Microsoft YaHei UI; */
font-weight: 400;
font-size: 14px;
color: #ffffff;
font-size: 12px;
/* color: #5a5a5a; */
/* border: 1px solid #ff7b00; */
text-align: center;
line-height: 29px;
line-height: 20px;
padding-left: 9px;
padding-right: 9px;
margin-left: 19px;
margin-left: 10px;
cursor: pointer;
margin-top: 4px;
}
.cpt-right {
font-size: 14px;

View File

@ -32,7 +32,7 @@ export default function ListProj() {
const name = state ? state.name : ''
const chargeAdditionals = state? state.chargeAdditionals:''
const progress = state? state.progress:''
const tagDataId = state? state.tagDataId:''
const authorId = state? state.authorId:''
// console.log(keywords);
// const images = [syminga,symingb,symingc,symingd]
@ -63,7 +63,7 @@ export default function ListProj() {
keywords: keywords,
charge: name,
chargeAdditionals:chargeAdditionals,
progress:progress,
tagDataId:tagDataId,
authorId:authorId,
projCategoryId: indexListContext.category,
status: indexListContext.status ? indexListContext.status : getMenuActive()
@ -73,7 +73,7 @@ export default function ListProj() {
setIsLoading(true);
},
onSuccess({ data }) {
// console.log('数据',data);
console.log('数据',data);
setPage(data.page);
setTotal(data.total);
@ -93,31 +93,34 @@ export default function ListProj() {
}
// 更新数据
// const upreqData = (currentPage: number) => {
// get<IListPage<IProj>>({
// messageApi: messageApi,
// url: '/api/proj/listpage/self',
// config: {
// params: {
// page: currentPage,
// rows: 10,
// keywords: keywords,
// charge: name,
// 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 = () => {
@ -140,8 +143,7 @@ export default function ListProj() {
return (
<div className='projListBox' key={new Date().getTime() + ':' + item.projId}>
<CardProj item={item}
// upreqData={() => { upreqData(page) }}
// getreqData={reqDataNoScoll}
updata = {upreqData}
/>
</div>
)
@ -160,13 +162,13 @@ export default function ListProj() {
// renderCategory();
// }
//
// if(!keywords && !name && !chargeAdditionals && !progress && !authorId){
// if(!keywords && !name && !chargeAdditionals && !tagDataId && !authorId){
// reqData(1)
// }
setTimeout(() => {
setShowPage(true)
}, 0);
}, [indexListContext.status, keywords, name,chargeAdditionals,progress,authorId])
}, [indexListContext.status, keywords, name,chargeAdditionals,tagDataId,authorId])
useEffect(() => {
reqData(page);

View File

@ -36,7 +36,7 @@ export default function MenuWithTopButton(props: IMenuWithTopButton) {
keyword: props.keywords,
name: props.type,
chargeAdditionals: props.chargeAdditionals,
progress: props.progress,
tagDataId: props.tagDataId,
authorId: props.authorId
}
})

View File

@ -22,6 +22,6 @@ export interface IMenuWithTopButton {
keywords?:string;
type?:string ;
chargeAdditionals?:string;
progress?:string;
tagDataId?:string;
authorId?:string;
}

View File

@ -32,14 +32,40 @@ import { get } from '../../util/AjaxUtils.ts'
import gpsImg from '../../static/right/gps.png'
import backImg from '../../static/right/back.png'
// import { Link } from "react-router-dom";
import { Input,
import {
Input,
// Breadcrumb,
message } from 'antd';
message
} from 'antd';
const { Search } = Input;
export default function Index() {
// 选项数组
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
}));
setTagArray(newarrty)
},
onFinally() {
}
})
}
const dispath = useDispatch()
//redux的belongArray
const redxuState: any = useSelector(state => state)
@ -96,7 +122,7 @@ export default function Index() {
const [keywords, setKeywords] = useState('');
const [type, setType] = useState<string | null>(null)
const [chargeAdditionals, setchargeAdditionals] = useState<string | null>(null)
const [progress, setprogress] = useState<string | null>(null)
const [tagDataId, settagDataId] = useState<string | null>(null)
const [authorId, setauthorId] = useState('')
// const indexListContext = useContext(IndexListContext);
// 所属者信息
@ -127,7 +153,7 @@ export default function Index() {
setKeywords('')
setType(null)
setchargeAdditionals(null)
setprogress(null)
settagDataId(null)
}
const nav = useNavigate();
@ -421,18 +447,19 @@ export default function Index() {
}
getProjOwnerList()
getTag()
}, []);
useEffect(() => {
// console.log('监听', '类型:', type, '关键字:', keywords, '额外付费:', chargeAdditionals,'进度:',progress);
// console.log('监听', '类型:', type, '关键字:', keywords, '额外付费:', chargeAdditionals,'进度:',tagDataId);
// console.log(Boolean(keywords));
// if (location.pathname.includes('/home')) {
if (!keywords && !type && !chargeAdditionals && !progress) {
if (!keywords && !type && !chargeAdditionals && !tagDataId) {
setKeywords('')
setType(null)
setchargeAdditionals(null)
setprogress(null)
settagDataId(null)
}
if (location.pathname.includes('/home')) {
nav('/home', {
@ -440,14 +467,14 @@ export default function Index() {
keyword: keywords,
name: type,
chargeAdditionals: chargeAdditionals,
progress: progress,
tagDataId: tagDataId,
authorId: authorId
}
})
}
// }
}, [type, chargeAdditionals, keywords, progress, authorId]);
}, [type, chargeAdditionals, keywords, tagDataId, authorId]);
const handleSearch = (value: string) => {
// console.log(value);
@ -457,7 +484,7 @@ export default function Index() {
keyword: value,
name: type,
chargeAdditionals: chargeAdditionals,
progress: progress,
tagDataId: tagDataId,
authorId: authorId
}
@ -473,7 +500,7 @@ export default function Index() {
keyword: '',
name: type,
chargeAdditionals: chargeAdditionals,
progress: progress,
tagDataId: tagDataId,
authorId: authorId
}
})
@ -500,7 +527,7 @@ export default function Index() {
keywords={keywords}
type={type ? type : ""}
chargeAdditionals={chargeAdditionals ? chargeAdditionals : ""}
progress={progress ? progress : ""}
tagDataId={tagDataId ? tagDataId : ""}
authorId={authorId ? authorId : ""}
/>
<div className='belongPeopleMenu'>
@ -520,7 +547,7 @@ export default function Index() {
keyword: keywords,
name: type,
chargeAdditionals: chargeAdditionals,
progress: progress,
tagDataId: tagDataId,
authorId: ''
}
})
@ -531,7 +558,7 @@ export default function Index() {
keyword: keywords,
name: type,
chargeAdditionals: chargeAdditionals,
progress: progress,
tagDataId: tagDataId,
authorId: item.projOwnerId
}
})
@ -646,7 +673,7 @@ export default function Index() {
keyword: keywords,
chargeAdditionals: chargeAdditionals,
name: value,
progress: progress,
tagDataId: tagDataId,
authorId: authorId
}
})
@ -676,7 +703,7 @@ export default function Index() {
keyword: keywords,
name: type,
chargeAdditionals: value,
progress: progress,
tagDataId: tagDataId,
authorId: authorId
}
})
@ -692,11 +719,11 @@ export default function Index() {
placeholder={'选择拓展收费'}
/>
<Select
value={progress}
value={tagDataId}
style={{ height: '31px', width: '183px', marginLeft: 20, display: showSearchBox ? 'block' : 'none' }}
onChange={(value: string) => {
// console.log(`selected ${value}`);
setprogress(value)
settagDataId(value)
// alert(`selected ${value}`)
// lyp
@ -705,19 +732,22 @@ export default function Index() {
keyword: keywords,
name: type,
chargeAdditionals: chargeAdditionals,
progress: value,
tagDataId: value,
authorId: authorId
}
})
}}
options={[
{ value: 'PRODUCTION', label: '正在制作中' },
{ value: 'SUBMIT_FOR_REVIEW', label: '已提交版权中心' },
{ value: 'DONE', label: '已下证' },
]}
options={
// [
// { value: 'PRODUCTION', label: '正在制作中' },
// { value: 'SUBMIT_FOR_REVIEW', label: '已提交版权中心' },
// { value: 'DONE', label: '已下证' },
// ]
tagArray
}
placeholder={'选择全托管制作进度'}
placeholder={'选择标签'}
/>
@ -758,7 +788,7 @@ export default function Index() {
keyword: keywords,
name: type,
chargeAdditionals: chargeAdditionals,
progress: progress,
tagDataId: tagDataId,
authorId: authorId
}
})
@ -782,7 +812,7 @@ export default function Index() {
keyword: keywords,
name: type,
chargeAdditionals: chargeAdditionals,
progress: progress,
tagDataId: tagDataId,
authorId: authorId
}
})