merge
This commit is contained in:
commit
ec8168de59
|
|
@ -8694,6 +8694,14 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"html-parse-stringify": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/html-parse-stringify/-/html-parse-stringify-3.0.1.tgz",
|
||||
"integrity": "sha512-KknJ50kTInJ7qIScF3jeaFRpMpE8/lfiTdzf/twXyPBLAGrLRTmkz3AdTnKeh40X8k9L2fdYwEp/42WGXIRGcg==",
|
||||
"requires": {
|
||||
"void-elements": "3.1.0"
|
||||
}
|
||||
},
|
||||
"html-webpack-plugin": {
|
||||
"version": "4.5.2",
|
||||
"resolved": "http://173.15.15.82:8081/repository/npm-all/html-webpack-plugin/-/html-webpack-plugin-4.5.2.tgz",
|
||||
|
|
@ -9140,6 +9148,29 @@
|
|||
"resolved": "http://173.15.15.82:8081/repository/npm-all/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz",
|
||||
"integrity": "sha512-ygGZLjmXfPHj+ZWh6LwbC37l43MhfztxetbFCoYTM2VjkIUpeHgSNn7QIyVFj7YQ1Wl9Cbw5sholVJPzWvC2MQ=="
|
||||
},
|
||||
"i18next": {
|
||||
"version": "23.4.5",
|
||||
"resolved": "https://registry.npmmirror.com/i18next/-/i18next-23.4.5.tgz",
|
||||
"integrity": "sha512-XXALnva7/5H+kg7TjDsmzY3jRypuSJvjR1eUWtt11yUgsOqjZFq/mnaujJ/XpVWhUJU75QhCUhrZqAarlYpOSQ==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.22.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": {
|
||||
"version": "7.22.11",
|
||||
"resolved": "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.22.11.tgz",
|
||||
"integrity": "sha512-ee7jVNlWN09+KftVOu9n7S8gQzD/Z6hN/I8VBRXW4P1+Xe7kJGXMwu8vds4aGIMHZnNbdpSWCfZZtinytpcAvA==",
|
||||
"requires": {
|
||||
"regenerator-runtime": "^0.14.0"
|
||||
}
|
||||
},
|
||||
"regenerator-runtime": {
|
||||
"version": "0.14.0",
|
||||
"resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz",
|
||||
"integrity": "sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"iconv-lite": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "http://173.15.15.82:8081/repository/npm-all/iconv-lite/-/iconv-lite-0.6.3.tgz",
|
||||
|
|
@ -14850,6 +14881,30 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"react-i18next": {
|
||||
"version": "13.2.0",
|
||||
"resolved": "https://registry.npmmirror.com/react-i18next/-/react-i18next-13.2.0.tgz",
|
||||
"integrity": "sha512-YD8xMc+I0jkHHLotd8ERMzZ53hMaCBVLCndbcbBveJn3FbppRP4jyYOAkmR8XItN01sTD9ilAjoEjpH1i42IgA==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.22.5",
|
||||
"html-parse-stringify": "^3.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": {
|
||||
"version": "7.22.11",
|
||||
"resolved": "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.22.11.tgz",
|
||||
"integrity": "sha512-ee7jVNlWN09+KftVOu9n7S8gQzD/Z6hN/I8VBRXW4P1+Xe7kJGXMwu8vds4aGIMHZnNbdpSWCfZZtinytpcAvA==",
|
||||
"requires": {
|
||||
"regenerator-runtime": "^0.14.0"
|
||||
}
|
||||
},
|
||||
"regenerator-runtime": {
|
||||
"version": "0.14.0",
|
||||
"resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz",
|
||||
"integrity": "sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"react-infinite-scroller": {
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/react-infinite-scroller/-/react-infinite-scroller-1.2.6.tgz",
|
||||
|
|
@ -19166,6 +19221,11 @@
|
|||
"integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==",
|
||||
"dev": true
|
||||
},
|
||||
"void-elements": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/void-elements/-/void-elements-3.1.0.tgz",
|
||||
"integrity": "sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w=="
|
||||
},
|
||||
"w3c-hr-time": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "http://173.15.15.82:8081/repository/npm-all/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz",
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
"editor.md": "^1.5.0",
|
||||
"flv.js": "^1.5.0",
|
||||
"fs-extra": "3.0.1",
|
||||
"i18next": "^23.4.5",
|
||||
"immutability-helper": "^2.6.6",
|
||||
"install": "^0.12.2",
|
||||
"intersection-observer": "^0.12.2",
|
||||
|
|
@ -77,6 +78,7 @@
|
|||
"react-dev-utils": "^9.2.0-next.80",
|
||||
"react-dom": "^16.13.1",
|
||||
"react-hot-loader": "^4.12.20",
|
||||
"react-i18next": "^13.2.0",
|
||||
"react-infinite-scroller": "^1.2.4",
|
||||
"react-loadable": "^5.3.1",
|
||||
"react-monaco-editor": "0.37",
|
||||
|
|
|
|||
|
|
@ -216,15 +216,15 @@ function Index(props) {
|
|||
setNewBranchError(undefined);
|
||||
const value = e.target.value;
|
||||
if (value) {
|
||||
const str = '^*/';
|
||||
const str = '^*';
|
||||
let reg = /\\/g;
|
||||
if(reg.test(value)){
|
||||
setNewBranchError('分支名不能包含下列任何字符:^ * \\ /');
|
||||
setNewBranchError('分支名不能包含下列任何字符:^ * \\ ');
|
||||
}else{
|
||||
for(var i=0;i<str.length;i++){
|
||||
let s = str[i];
|
||||
if(value.indexOf(s) > -1){
|
||||
setNewBranchError('分支名不能包含下列任何字符:^ * \\ /');
|
||||
setNewBranchError('分支名不能包含下列任何字符:^ * \\ ');
|
||||
return;
|
||||
}else{
|
||||
setNewBranchName(e.target.value);
|
||||
|
|
|
|||
|
|
@ -371,7 +371,8 @@ class MessageCount extends Component {
|
|||
const userLogin = current_user && current_user.login;
|
||||
const otherPre = data && data.pull_request && projectDetail && (userLogin === data.pull_request.fork_project_user && projectDetail.permission==="");
|
||||
const permissionByCodeReview = projectDetail && (projectDetail.permission === "Admin" || projectDetail.permission === "Owner" || projectDetail.permission === "Manager" || projectDetail.permission === "Developer" || otherPre);
|
||||
const operate = userLogin && projectDetail && pr_status === 0 && permission;
|
||||
const operate = userLogin && projectDetail && pr_status === 0 && permission ;
|
||||
const cancelOperate = userLogin && pr_status === 0 && ( permissionByCodeReview || otherPre);
|
||||
const open_blockchain = project && project.open_blockchain;
|
||||
return (
|
||||
<div>
|
||||
|
|
@ -521,7 +522,7 @@ class MessageCount extends Component {
|
|||
</Button>
|
||||
)}
|
||||
|
||||
{operate && (
|
||||
{cancelOperate && (
|
||||
<Button
|
||||
type="danger"
|
||||
ghost
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { Link } from 'react-router-dom';
|
|||
import { Input , Form , Select , Checkbox , Button , Spin , AutoComplete, Modal } from 'antd';
|
||||
import { Base64 } from 'js-base64';
|
||||
import { AlignCenter } from '../Component/layout';
|
||||
import { withTranslation } from 'react-i18next';
|
||||
|
||||
import '../css/index.scss';
|
||||
import './new.scss'
|
||||
|
|
@ -378,6 +379,23 @@ class Index extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
changeName=(e)=>{
|
||||
let value = e.target.value;
|
||||
const { t } = this.props;
|
||||
console.log(this.props,t(value,'en'));
|
||||
if(value){
|
||||
let reg = /[a-zA-Z0-9]/g;
|
||||
let strArr = value.match(reg);
|
||||
if(strArr){
|
||||
let str = strArr.join("");
|
||||
this.props.form.setFieldsValue({
|
||||
repository_name:str
|
||||
})
|
||||
}else{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const { getFieldDecorator } = this.props.form;
|
||||
// 项目类型:deposit-托管项目,mirror-镜像项目
|
||||
|
|
@ -537,7 +555,7 @@ class Index extends Component {
|
|||
required: true, message: '请填写项目名称'
|
||||
}],
|
||||
})(
|
||||
<Input placeholder="例如:团队协作方法与研究" maxLength={50}/>
|
||||
<Input placeholder="例如:团队协作方法与研究" maxLength={50}/>// onBlur={this.changeName}
|
||||
)}
|
||||
</Form.Item>
|
||||
</AlignCenter>
|
||||
|
|
@ -745,6 +763,6 @@ class Index extends Component {
|
|||
}
|
||||
}
|
||||
const WrappedIndexForm = Form.create({ name: 'NewWorkForm' })(Index);
|
||||
export default WrappedIndexForm;
|
||||
export default withTranslation()(WrappedIndexForm);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -169,15 +169,15 @@ class UserSubmitComponent extends Component {
|
|||
callback();
|
||||
}
|
||||
if (value) {
|
||||
const str = '^*/';
|
||||
const str = '^*';
|
||||
let reg = /\\/g;
|
||||
if(reg.test(value)){
|
||||
callback(<span>分支名不能包含下列任何字符:^*\/</span>);
|
||||
callback(<span>分支名不能包含下列任何字符:^*\</span>);
|
||||
}else{
|
||||
for(var i=0;i<str.length;i++){
|
||||
let s = str[i];
|
||||
if(value.indexOf(s) > -1){
|
||||
callback(<span>分支名不能包含下列任何字符:^*\/</span>);
|
||||
callback(<span>分支名不能包含下列任何字符:^*\</span>);
|
||||
return;
|
||||
}else{
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import { AlignCenter , WhiteBack , FlexAJ } from '../Component/layout';
|
|||
import axios from 'axios';
|
||||
import { Button, Select , Pagination } from 'antd';
|
||||
import { getBranch } from '../GetData/getData';
|
||||
import { turnbar , returnbar} from 'educoder';
|
||||
|
||||
const Div = styled.div`{
|
||||
padding:20px 30px;
|
||||
|
|
@ -95,6 +96,11 @@ export default ((props)=>{
|
|||
setPage(page);
|
||||
}
|
||||
|
||||
function changeBranch(b){
|
||||
console.log(returnbar(b));
|
||||
setBranch(returnbar(b));
|
||||
}
|
||||
|
||||
return(
|
||||
<WhiteBack>
|
||||
<Title><span className="font-18">分支设置</span></Title>
|
||||
|
|
@ -107,7 +113,7 @@ export default ((props)=>{
|
|||
branch={branch}
|
||||
repo_id={ projectDetail && projectDetail.repo_id}
|
||||
projectsId={projectsId}
|
||||
changeBranch={setBranch}
|
||||
changeBranch={changeBranch}
|
||||
owner={owner}
|
||||
history={props.history}
|
||||
branchList = {branchList}
|
||||
|
|
@ -123,13 +129,13 @@ export default ((props)=>{
|
|||
branch={protectBranch}
|
||||
repo_id={ projectDetail && projectDetail.repo_id}
|
||||
projectsId={projectsId}
|
||||
changeBranch={setProtectBranch}
|
||||
changeBranch={(b)=>{setProtectBranch(returnbar(b))}}
|
||||
owner={owner}
|
||||
history={props.history}
|
||||
branchList = {branchList}
|
||||
tagflag={false}
|
||||
/>
|
||||
<a className={ protectBranchList && protectBranchList.length > 0?"color-blue ml20":"color-grey ml20"} onClick={()=>settingRule(protectBranch)}>设置分支保护</a>
|
||||
<a className={ protectBranchList && protectBranchList.length > 0?"color-blue ml20":"color-grey ml20"} onClick={()=>settingRule(turnbar(protectBranch))}>设置分支保护</a>
|
||||
</AlignCenter>
|
||||
{
|
||||
protectBranchList && protectBranchList.length > 0 &&
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { Form, InputNumber , Select, Button , Checkbox , Radio } from "antd";
|
|||
import Title from "../Component/Title";
|
||||
import { Cancel } from "../Component/layout";
|
||||
import axios from "axios";
|
||||
import { turnbar , returnbar} from 'educoder';
|
||||
|
||||
export default Form.create()(
|
||||
forwardRef(({ form, match, history , showNotification, projectDetail }) => {
|
||||
|
|
@ -68,7 +69,7 @@ export default Form.create()(
|
|||
let url = "";
|
||||
if(protects){
|
||||
// 为true则修改
|
||||
url = `/${owner}/${projectsId}/protected_branches/${branch}.json`;
|
||||
url = `/${owner}/${projectsId}/protected_branches/${turnbar(branch)}.json`;
|
||||
}else{
|
||||
// 否则是保存
|
||||
url = `/${owner}/${projectsId}/protected_branches.json`;
|
||||
|
|
@ -122,7 +123,7 @@ export default Form.create()(
|
|||
}
|
||||
return (
|
||||
<div style={{backgroundColor:"#fff"}}>
|
||||
<Title>新建'{branch}'保护分支规则</Title>
|
||||
<Title>新建'{returnbar(branch)}'保护分支规则</Title>
|
||||
<Form>
|
||||
<div style={{padding:"20px 30px"}}>
|
||||
{helper(
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
.lastLineScroll {
|
||||
max-height: 280px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
.lastTwoScroll {
|
||||
max-height: 520px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
|
@ -3,8 +3,9 @@ import { Button, Tooltip } from 'antd';
|
|||
import Nodata from '../../../forge/Nodata';
|
||||
import { useEffect } from 'react';
|
||||
import { getProjectById } from '../../api';
|
||||
import './index.scss';
|
||||
|
||||
export default ({ detail, projectId }) => {
|
||||
export default ({ detail, projectId, listLen }) => {
|
||||
const [info, setInfo] = useState(detail);
|
||||
|
||||
useEffect(()=>{
|
||||
|
|
@ -27,21 +28,29 @@ export default ({ detail, projectId }) => {
|
|||
<div>项目简介: {info.projectIntro}</div>
|
||||
</div>
|
||||
{/* 课题列表 */}
|
||||
{info.registrationTaskList && info.registrationTaskList.length ? info.registrationTaskList.map((item, index)=>{
|
||||
return <div className='taskItem mt20' key={index}>
|
||||
<div className="left">
|
||||
<div className="taskTitle"><Tooltip title={item.taskName}>{item.taskName}</Tooltip></div>
|
||||
<div className='mt20 oneLine leftWidth'>导师姓名: {item.tutorName}</div>
|
||||
{item.tutorMail && <div className='mb20 email oneLine leftWidth'>邮箱地址: <span><Tooltip title={item.tutorMail}>{item.tutorMail}</Tooltip></span></div>}
|
||||
<div className={
|
||||
info.registrationTaskList &&
|
||||
info.registrationTaskList.length &&
|
||||
listLen == 2 &&
|
||||
info.registrationTaskList.length >= 2
|
||||
? 'lastLineScroll' : listLen == 3 &&
|
||||
info.registrationTaskList.length >= 3 ? 'lastTwoScroll' : '' }>
|
||||
{info.registrationTaskList && info.registrationTaskList.length ? info.registrationTaskList.map((item, index)=>{
|
||||
return <div className='taskItem mt20' key={index}>
|
||||
<div className="left">
|
||||
<div className="taskTitle"><Tooltip title={item.taskName}>{item.taskName}</Tooltip></div>
|
||||
<div className='mt20 oneLine leftWidth'>导师姓名: {item.tutorName}</div>
|
||||
{item.tutorMail && <div className='mb20 email oneLine leftWidth'>邮箱地址: <span><Tooltip title={item.tutorMail}>{item.tutorMail}</Tooltip></span></div>}
|
||||
</div>
|
||||
<div className="center">
|
||||
<div className="taskDesc"><Tooltip title={item.taskDesc}>{item.taskDesc}</Tooltip></div>
|
||||
{item.taskUrl && <div className="taskUrl oneLine">课题链接: <a href={item.taskUrl} target={"_blank"}>{item.taskUrl}</a></div>}
|
||||
<div></div>
|
||||
</div>
|
||||
<div className="right oneLine taskUrl"><span className='taskReward'>¥{item.taskReward}</span></div>
|
||||
</div>
|
||||
<div className="center">
|
||||
<div className="taskDesc"><Tooltip title={item.taskDesc}>{item.taskDesc}</Tooltip></div>
|
||||
{item.taskUrl && <div className="taskUrl oneLine">课题链接: <a href={item.taskUrl} target={"_blank"}>{item.taskUrl}</a></div>}
|
||||
<div></div>
|
||||
</div>
|
||||
<div className="right oneLine taskUrl"><span className='taskReward'>¥{item.taskReward}</span></div>
|
||||
</div>
|
||||
}) : <Nodata _html="课题暂无数据" small={true}/>}
|
||||
}) : <Nodata _html="课题暂无数据" small={true}/>}
|
||||
</div>
|
||||
</div>: <div className="projectDetailBox nodata"><Nodata _html="暂无数据" small={true}/></div>
|
||||
)
|
||||
}
|
||||
|
|
@ -14,6 +14,7 @@ const { Search } = Input;
|
|||
function ProjectList() {
|
||||
const [data, setData] = useState([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [listLen, setListLen] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
setLoading(true);
|
||||
|
|
@ -31,11 +32,26 @@ function ProjectList() {
|
|||
}, [])
|
||||
|
||||
// 修改taskList盒子的高度,防止弹框过高影响整体页面
|
||||
function changeVisible(visible, item) {
|
||||
function changeVisible(visible, item, index) {
|
||||
if (visible) {
|
||||
let height = document.documentElement.clientWidth / 1920 * 500 + 70 + document.querySelector(`.${item.gitlinkLastUrl}`).offsetTop + item.registrationTaskList.length * 320;
|
||||
document.querySelector('#taskList').style.height = height + 'px';
|
||||
// let height = document.documentElement.clientWidth / 1920 * 500 + 70 + document.querySelector(`.${item.gitlinkLastUrl}`).offsetTop + item.registrationTaskList.length * 320;
|
||||
// document.querySelector('#taskList').style.height = height + 'px';
|
||||
document.querySelector('#taskList').style.height = 'auto';
|
||||
// 判断当前行数是否为最后两行,并添加滚动条样式
|
||||
if(data && data.length && data.length > 0){
|
||||
const len = data.length;
|
||||
const num = len%3 == 0 ? 3 : len%3;
|
||||
// 最后一行
|
||||
if(len - index <= num){
|
||||
setListLen(2)
|
||||
}
|
||||
// 最后两行
|
||||
if(len - index <= num + 3 && len - index > num){
|
||||
setListLen(3)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
setListLen(null);
|
||||
document.querySelector('#taskList').style.height = 'auto';
|
||||
}
|
||||
}
|
||||
|
|
@ -46,10 +62,10 @@ function ProjectList() {
|
|||
<div className='projectListBox'>
|
||||
{data && data.map((item, index) => {
|
||||
return <Popover
|
||||
onVisibleChange={(visible) => { changeVisible(visible, item) }}
|
||||
onVisibleChange={(visible) => { changeVisible(visible, item, index) }}
|
||||
key={index}
|
||||
placement={(index + 1) % 3 === 0 ? 'bottomRight' : (index + 1) % 3 % 2 === 0 ? 'bottom' : 'bottomLeft'}
|
||||
content={<ProjectDetail detail={item}/>}
|
||||
content={<ProjectDetail detail={item} listLen = {listLen} />}
|
||||
trigger='click'
|
||||
overlayClassName='projectItemPopover'
|
||||
autoAdjustOverflow={false}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
.lastLineScroll {
|
||||
max-height: 220px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
.lastTwoScroll {
|
||||
max-height: 500px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
|
@ -3,8 +3,9 @@ import { Button, message, Tooltip } from 'antd';
|
|||
import Nodata from '../../../forge/Nodata';
|
||||
import { useEffect } from 'react';
|
||||
import { getProjectById } from '../../api';
|
||||
import './index.scss';
|
||||
|
||||
export default ({ detail, projectId, applyTaskId, period, showTask=true, applyTask, id, round }) => {
|
||||
export default ({ detail, projectId, applyTaskId, period, showTask=true, applyTask, id, round, listLen }) => {
|
||||
const [info, setInfo] = useState(detail);
|
||||
|
||||
useEffect(()=>{
|
||||
|
|
@ -27,33 +28,41 @@ export default ({ detail, projectId, applyTaskId, period, showTask=true, applyTa
|
|||
<div>项目简介: {info.projectIntro}</div>
|
||||
</div>
|
||||
{/* 从项目、课题列表展开的显示课题列表,结果公示页展开的不显示课题列表 */}
|
||||
{showTask && (info.registrationTaskList && info.registrationTaskList.length > 0 ? info.registrationTaskList.map((item, index)=>{
|
||||
return <div className='taskItem mt20' key={index}>
|
||||
<div className="left">
|
||||
<div className="taskTitle" onClick={()=>{window.location.href=`/glcc/${id}/subjects/detail/${item.id}`}}><Tooltip title={item.taskName}>{item.taskName}</Tooltip></div>
|
||||
<div className='mt20 oneLine leftWidth'>导师姓名: {item.tutorName}</div>
|
||||
{item.tutorMail && <div className='mb20 email oneLine leftWidth'>邮箱地址: <span><Tooltip title={item.tutorMail}>{item.tutorMail}</Tooltip></span></div>}
|
||||
</div>
|
||||
<div className="center">
|
||||
<div className="taskDesc">{item.taskDesc}</div>
|
||||
{item.taskUrl && <div className="taskUrl oneLine">课题链接: <a href={item.taskUrl} target={"_blank"}>{item.taskUrl}</a></div>}
|
||||
<div>
|
||||
{/* 报名详情按钮 */}
|
||||
{round === 2 && applyTaskId && Object.keys(applyTaskId).includes(item.id.toString()) && <Button onClick={()=>{window.location.href=`/glcc/student/apply/${item.id}`}} className='lookDetail mr10'>报名详情</Button>}
|
||||
|
||||
{/* 课题申请时间范围内: 申请课题 */}
|
||||
{/* 第一次报名 */}
|
||||
{round === 2 && period === "stuApply" && !(applyTaskId && Object.keys(applyTaskId).includes(item.id.toString())) && <Button type='primary' className='applyBut mr10' onClick={()=>{applyTask(item.id)}}>申请课题</Button>}
|
||||
{/* 第二次报名 锁定状态 */}
|
||||
{round === 2 && period === "stuApply1" && !(applyTaskId && Object.keys(applyTaskId).includes(item.id.toString())) && (item.locked ? <Tooltip title={"该课题已有学生入选"}><Button type='primary' className='mr10' disabled>申请课题</Button></Tooltip> : <Button type='primary' className='applyBut mr10' onClick={()=>{applyTask(item.id)}}>申请课题</Button>)}
|
||||
|
||||
{/* 查看课题详情按钮 */}
|
||||
<Button onClick={()=>{window.open(`/glcc/${id}/subjects/detail/${item.id}`)}} className='lookDetail'>课题详情</Button>
|
||||
<div className={
|
||||
showTask && info.registrationTaskList &&
|
||||
info.registrationTaskList.length &&
|
||||
listLen == 2 &&
|
||||
info.registrationTaskList.length >= 2
|
||||
? 'lastLineScroll' : listLen == 3 &&
|
||||
showTask && info.registrationTaskList.length >= 3 ? 'lastTwoScroll' : '' }>
|
||||
{showTask && (info.registrationTaskList && info.registrationTaskList.length > 0 ? info.registrationTaskList.map((item, index)=>{
|
||||
return <div className='taskItem mt20' key={index}>
|
||||
<div className="left">
|
||||
<div className="taskTitle" onClick={()=>{window.location.href=`/glcc/${id}/subjects/detail/${item.id}`}}><Tooltip title={item.taskName}>{item.taskName}</Tooltip></div>
|
||||
<div className='mt20 oneLine leftWidth'>导师姓名: {item.tutorName}</div>
|
||||
{item.tutorMail && <div className='mb20 email oneLine leftWidth'>邮箱地址: <span><Tooltip title={item.tutorMail}>{item.tutorMail}</Tooltip></span></div>}
|
||||
</div>
|
||||
<div className="center">
|
||||
<div className="taskDesc">{item.taskDesc}</div>
|
||||
{item.taskUrl && <div className="taskUrl oneLine">课题链接: <a href={item.taskUrl} target={"_blank"}>{item.taskUrl}</a></div>}
|
||||
<div>
|
||||
{/* 报名详情按钮 */}
|
||||
{round === 2 && applyTaskId && Object.keys(applyTaskId).includes(item.id.toString()) && <Button onClick={()=>{window.location.href=`/glcc/student/apply/${item.id}`}} className='lookDetail mr10'>报名详情</Button>}
|
||||
|
||||
{/* 课题申请时间范围内: 申请课题 */}
|
||||
{/* 第一次报名 */}
|
||||
{round === 2 && period === "stuApply" && !(applyTaskId && Object.keys(applyTaskId).includes(item.id.toString())) && <Button type='primary' className='applyBut mr10' onClick={()=>{applyTask(item.id)}}>申请课题</Button>}
|
||||
{/* 第二次报名 锁定状态 */}
|
||||
{round === 2 && period === "stuApply1" && !(applyTaskId && Object.keys(applyTaskId).includes(item.id.toString())) && (item.locked ? <Tooltip title={"该课题已有学生入选"}><Button type='primary' className='mr10' disabled>申请课题</Button></Tooltip> : <Button type='primary' className='applyBut mr10' onClick={()=>{applyTask(item.id)}}>申请课题</Button>)}
|
||||
|
||||
{/* 查看课题详情按钮 */}
|
||||
<Button onClick={()=>{window.open(`/glcc/${id}/subjects/detail/${item.id}`)}} className='lookDetail'>课题详情</Button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="right oneLine taskUrl"><span className='taskReward'>¥{item.taskReward}</span></div>
|
||||
</div>
|
||||
<div className="right oneLine taskUrl"><span className='taskReward'>¥{item.taskReward}</span></div>
|
||||
</div>
|
||||
}) : <Nodata _html="课题暂无数据" small={true}/>)}
|
||||
}) : <Nodata _html="课题暂无数据" small={true}/>)}
|
||||
</div>
|
||||
</div>: <div className="projectDetailBox nodata"><Nodata _html="暂无数据" small={true}/></div>
|
||||
)
|
||||
}
|
||||
|
|
@ -18,6 +18,7 @@ function ProjectList({ applyTaskId, location, match, applyTask, round, period, m
|
|||
const [keyword, setKeyword] = useState(openmmlab ? 'openmmlab' : undefined);
|
||||
const [data, setData] = useState([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [listLen, setListLen] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
setLoading(true);
|
||||
|
|
@ -67,11 +68,26 @@ function ProjectList({ applyTaskId, location, match, applyTask, round, period, m
|
|||
})
|
||||
}, [keyword, round])
|
||||
|
||||
function changeVisible(visible, item) {
|
||||
function changeVisible(visible, item, index) {
|
||||
if (visible) {
|
||||
let height = document.documentElement.clientWidth / 1920 * 500 + 70 + document.querySelector(`.${item.gitlinkLastUrl}`).offsetTop + item.registrationTaskList.length * 320;
|
||||
document.querySelector('#taskList').style.height = height + 'px';
|
||||
// let height = document.documentElement.clientWidth / 1920 * 500 + 70 + document.querySelector(`.${item.gitlinkLastUrl}`).offsetTop + item.registrationTaskList.length * 320;
|
||||
// document.querySelector('#taskList').style.height = height + 'px';
|
||||
document.querySelector('#taskList').style.height = 'auto';
|
||||
// 判断当前行数是否为最后两行,并添加滚动条样式
|
||||
if(data && data.length && data.length > 0){
|
||||
const len = data.length;
|
||||
const num = len%3 == 0 ? 3 : len%3;
|
||||
// 最后一行
|
||||
if(len - index <= num){
|
||||
setListLen(2)
|
||||
}
|
||||
// 最后两行
|
||||
if(len - index <= num + 3 && len - index > num){
|
||||
setListLen(3)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
setListLen(null)
|
||||
document.querySelector('#taskList').style.height = 'auto';
|
||||
}
|
||||
}
|
||||
|
|
@ -84,10 +100,10 @@ function ProjectList({ applyTaskId, location, match, applyTask, round, period, m
|
|||
<div className='projectListBox'>
|
||||
{data && data.map((item, index) => {
|
||||
return <Popover
|
||||
onVisibleChange={(visible) => { changeVisible(visible, item) }}
|
||||
onVisibleChange={(visible) => { changeVisible(visible, item, index) }}
|
||||
key={index}
|
||||
placement={(index + 1) % 3 === 0 ? 'bottomRight' : (index + 1) % 3 % 2 === 0 ? 'bottom' : 'bottomLeft'}
|
||||
content={<ProjectDetail id={id} detail={item} applyTaskId={applyTaskId} applyTask={applyTask} period={period} round={round}/>}
|
||||
content={<ProjectDetail id={id} detail={item} applyTaskId={applyTaskId} applyTask={applyTask} period={period} round={round} listLen={listLen} />}
|
||||
trigger='click'
|
||||
overlayClassName='projectItemPopover'
|
||||
autoAdjustOverflow={false}
|
||||
|
|
|
|||
Loading…
Reference in New Issue