forked from Gitlink/forgeplus-react
head
This commit is contained in:
parent
ba56a106b4
commit
eb6f54496f
|
@ -22,7 +22,7 @@ const JoinProjectModal: FC<PageProps> = ({
|
||||||
onCancel = () => { },
|
onCancel = () => { },
|
||||||
}) => {
|
}) => {
|
||||||
const [inputValue, setInputValue] = useState<string>();
|
const [inputValue, setInputValue] = useState<string>();
|
||||||
const [radioValue, setRadioValue] = useState<string>();
|
const [radioValue, setRadioValue] = useState<string>("developer");
|
||||||
const [isLoading, setIsLoading] = useState<boolean>(false);
|
const [isLoading, setIsLoading] = useState<boolean>(false);
|
||||||
|
|
||||||
const handleOk = async () => {
|
const handleOk = async () => {
|
||||||
|
@ -41,36 +41,40 @@ const JoinProjectModal: FC<PageProps> = ({
|
||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
const res = await projectApplies({
|
const res = await projectApplies({
|
||||||
code: inputValue,
|
applied_project:{
|
||||||
role: radioValue
|
code: inputValue,
|
||||||
|
role: radioValue
|
||||||
|
}
|
||||||
});
|
});
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
handleCancel();
|
handleCancel();
|
||||||
const mapping: any = {
|
// const mapping: any = {
|
||||||
1: "您输入的邀请码错误",
|
// 1: "您输入的邀请码错误",
|
||||||
2: "您已经是该项目成员",
|
// 2: "您已经是该项目成员",
|
||||||
3: "请选择一个角色",
|
// 3: "请选择一个角色",
|
||||||
4: "您的申请已提交,请等待项目管理员审批",
|
// 4: "您的申请已提交,请等待项目管理员审批",
|
||||||
5: "您已经申请加入该项目了,请耐心等待",
|
// 5: "您已经申请加入该项目了,请耐心等待",
|
||||||
6: "您已成功加入项目",
|
// 6: "您已成功加入项目",
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (mapping[res.status]) {
|
// if (res.status !== 0 ) {
|
||||||
message.info(mapping[res.status]);
|
// message.info(res.message);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (res.status === 0) {
|
// if (res.status === 0) {
|
||||||
if (radioValue === "reporter") {
|
// if (radioValue === "reporter") {
|
||||||
message.success('您加入项目成功!');
|
// message.success('您加入项目成功!');
|
||||||
trackEvent(['开发项目', '加入项目成功'])
|
// trackEvent(['开发项目', '加入项目成功'])
|
||||||
history.push(`/projects/${res?.project_id}`);
|
// history.push(`/projects/${res?.project_id}`);
|
||||||
} else {
|
// } else {
|
||||||
trackEvent(['开发项目', '加入项目等待审批'])
|
// trackEvent(['开发项目', '加入项目等待审批'])
|
||||||
message.success('您的申请已提交,请等待项目管理员审批!');
|
// message.success('您的申请已提交,请等待项目管理员审批!');
|
||||||
}
|
// }
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
message.info(res.message);
|
||||||
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCancel = async () => {
|
const handleCancel = async () => {
|
||||||
|
@ -82,16 +86,17 @@ const JoinProjectModal: FC<PageProps> = ({
|
||||||
<Modal
|
<Modal
|
||||||
centered
|
centered
|
||||||
keyboard={false}
|
keyboard={false}
|
||||||
closable={false}
|
closable={true}
|
||||||
title="加入项目"
|
title="加入项目"
|
||||||
visible={visible}
|
visible={visible}
|
||||||
confirmLoading={isLoading}
|
confirmLoading={isLoading}
|
||||||
onOk={handleOk}
|
onOk={handleOk}
|
||||||
onCancel={handleCancel}
|
onCancel={handleCancel}
|
||||||
|
wrapClassName={styles.joinModal}
|
||||||
>
|
>
|
||||||
<div className="tc">
|
<div className="tc">
|
||||||
<div>
|
<div>
|
||||||
<span>课堂邀请码:</span>
|
<span>项目邀请码:</span>
|
||||||
<Input
|
<Input
|
||||||
placeholder="请输入6位开发项目邀请码"
|
placeholder="请输入6位开发项目邀请码"
|
||||||
style={{ width: 270 }}
|
style={{ width: 270 }}
|
||||||
|
@ -105,12 +110,12 @@ const JoinProjectModal: FC<PageProps> = ({
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="mt10 font14">
|
<div className="mt30 font14">
|
||||||
<span>身份:</span>
|
<span className="mr5">选择角色:</span>
|
||||||
<Radio.Group value={radioValue} onChange={e => setRadioValue(e.target.value)}>
|
<Radio.Group value={radioValue} onChange={e => setRadioValue(e.target.value)}>
|
||||||
<Radio value={Type.Manager}>管理人员</Radio>
|
<Radio value={Type.Manager}>管理者</Radio>
|
||||||
<Radio value={Type.Developer}>开发人员</Radio>
|
<Radio value={Type.Developer}>开发者</Radio>
|
||||||
<Radio value={Type.Reporter}>报告人员</Radio>
|
<Radio value={Type.Reporter}>报告者</Radio>
|
||||||
</Radio.Group>
|
</Radio.Group>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,5 +1,29 @@
|
||||||
@import '../../../../global.less';
|
@import '../../../../global.less';
|
||||||
|
.dropdownFlex{
|
||||||
|
a{
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.joinModal{
|
||||||
|
[class=~'ant-modal-title']{
|
||||||
|
text-align: center;
|
||||||
|
height: 50px;
|
||||||
|
line-height: 50px;
|
||||||
|
}
|
||||||
|
[class~='ant-modal-close-x']{
|
||||||
|
height: 70px;
|
||||||
|
line-height: 70px;
|
||||||
|
svg{
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[class=~'tc']{
|
||||||
|
padding:22px 0px;
|
||||||
|
}
|
||||||
|
[class~='ant-btn']{
|
||||||
|
height: 32px;
|
||||||
|
}
|
||||||
|
}
|
||||||
.rightMenu {
|
.rightMenu {
|
||||||
width: 120px;
|
width: 120px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
|
@ -55,20 +55,21 @@ const Join: FC<PageProps> = ({
|
||||||
const [visibleJoinProject, setVisibleJoinProject] = useState<boolean>();
|
const [visibleJoinProject, setVisibleJoinProject] = useState<boolean>();
|
||||||
|
|
||||||
const handleJoinVerify = (type: VerifyType) => {
|
const handleJoinVerify = (type: VerifyType) => {
|
||||||
if (!handleVerify(dispatch)) {
|
// if (!handleVerify(dispatch)) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (type === VerifyType.Projects && !user.userInfo?.email) {
|
// if (type === VerifyType.Projects && !user.userInfo?.email) {
|
||||||
message.info('请先绑定邮箱,谢谢');
|
// message.info('请先绑定邮箱,谢谢');
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (type === VerifyType.Classrooms) {
|
// if (type === VerifyType.Classrooms) {
|
||||||
setVisibleJoinClassroom(true);
|
// setVisibleJoinClassroom(true);
|
||||||
} else if (type === VerifyType.Projects) {
|
// } else if (type === VerifyType.Projects) {
|
||||||
setVisibleJoinProject(true);
|
// setVisibleJoinProject(true);
|
||||||
}
|
// }
|
||||||
|
setVisibleJoinProject(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleAddVerify = (url: string, type?: VerifyType) => {
|
const handleAddVerify = (url: string, type?: VerifyType) => {
|
||||||
|
@ -170,14 +171,31 @@ const Join: FC<PageProps> = ({
|
||||||
// </Row>
|
// </Row>
|
||||||
// </>
|
// </>
|
||||||
// }
|
// }
|
||||||
const JoinOverlay = (joinProps: any) => {
|
const JoinOverlay = (list: any) => {
|
||||||
return <>
|
return <>
|
||||||
|
<div className={styles.dropdownFlex}>
|
||||||
|
<Menu>
|
||||||
|
{
|
||||||
|
list.map(function(item:any,key:number){
|
||||||
|
return(
|
||||||
|
(item.name !=="加入课堂" && item.name !=="加入开发项目") &&
|
||||||
|
<Menu.Item key={item.name+key}>
|
||||||
|
<a onClick={()=>{window.location.href=item.url}}>{item.name}</a>
|
||||||
|
</Menu.Item>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
<Menu.Item>
|
||||||
|
<a onClick={() => handleJoinVerify(VerifyType.Projects)}>加入项目</a>
|
||||||
|
</Menu.Item>
|
||||||
|
</Menu>
|
||||||
|
</div>
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
|
|
||||||
return <section>
|
return (
|
||||||
<Dropdown overlay={<Menu className={`${styles.rightMenu} ${styles.joinMenu} mt10`}><JoinOverlay /></Menu>} placement="bottomRight">
|
<section>
|
||||||
|
<Dropdown overlay={()=>JoinOverlay(globalSetting?.setting?.add) } placement="bottomRight">
|
||||||
<span style={{ lineHeight: 'inherit' }} className="iconfont icon-tianjiafangda c-white font18 current ml15 mr15"></span>
|
<span style={{ lineHeight: 'inherit' }} className="iconfont icon-tianjiafangda c-white font18 current ml15 mr15"></span>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
<JoinClassroomModal
|
<JoinClassroomModal
|
||||||
|
@ -188,7 +206,7 @@ const Join: FC<PageProps> = ({
|
||||||
visible={visibleJoinProject}
|
visible={visibleJoinProject}
|
||||||
onCancel={() => setVisibleJoinProject(false)}
|
onCancel={() => setVisibleJoinProject(false)}
|
||||||
/>
|
/>
|
||||||
</section>
|
</section>)
|
||||||
}
|
}
|
||||||
export default connect(
|
export default connect(
|
||||||
({
|
({
|
||||||
|
|
|
@ -308,7 +308,7 @@ const User: FC<PageProps> = ({
|
||||||
if (isLogin()) {
|
if (isLogin()) {
|
||||||
return (
|
return (
|
||||||
<Dropdown
|
<Dropdown
|
||||||
className={`mr25`}
|
className={`${styles.height67} mr25`}
|
||||||
overlay={OwnerDownMenu}
|
overlay={OwnerDownMenu}
|
||||||
placement="bottomLeft"
|
placement="bottomLeft"
|
||||||
>
|
>
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
min-width: 1200px;
|
min-width: 1200px;
|
||||||
[class~='ant-layout-header'] {
|
[class~='ant-layout-header'] {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
height: 60px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo {
|
.logo {
|
||||||
|
|
|
@ -308,7 +308,7 @@ const HeaderComponents: FC<PageProps> = ({
|
||||||
{
|
{
|
||||||
!checkIsClientExam() && <>
|
!checkIsClientExam() && <>
|
||||||
<SearchInput />
|
<SearchInput />
|
||||||
{!isLogin && <Join />}
|
{!isLogin && !!user?.userInfo?.login && <Join />}
|
||||||
{
|
{
|
||||||
!!user?.userInfo?.login && <a className="iconfont icon-xiaoxilingdang c-white ml15 mr15 font18 relative" href ={`${globalSetting?.setting?.common?.main_site_url}/settings/notice`}>{user?.userInfo?.message_unread_total && <span className={styles.newslight}>{user?.userInfo?.message_unread_total}</span>}</a>
|
!!user?.userInfo?.login && <a className="iconfont icon-xiaoxilingdang c-white ml15 mr15 font18 relative" href ={`${globalSetting?.setting?.common?.main_site_url}/settings/notice`}>{user?.userInfo?.message_unread_total && <span className={styles.newslight}>{user?.userInfo?.message_unread_total}</span>}</a>
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ const UserModel: UserModelType = {
|
||||||
},
|
},
|
||||||
*getUserInfo({ payload }, { call, put }) {
|
*getUserInfo({ payload }, { call, put }) {
|
||||||
// location.search
|
// location.search
|
||||||
const response = yield call(getUserInfo, { ...payload,debug:"admin" })
|
const response = yield call(getUserInfo, { ...payload})
|
||||||
localStorage.userInfo = JSON.stringify(response);
|
localStorage.userInfo = JSON.stringify(response);
|
||||||
|
|
||||||
yield put({
|
yield put({
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import Fetch from '@/utils/fetch';
|
import Fetch from '@/utils/fetch';
|
||||||
|
import ENV from '@/utils/env';
|
||||||
|
|
||||||
export async function HomeIndex() {
|
export async function HomeIndex() {
|
||||||
return Fetch('/api/home/index.json', {
|
return Fetch('/api/home/index.json', {
|
||||||
|
@ -13,7 +14,7 @@ export async function applyToJoinCourse(params: any) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
export async function projectApplies(params: any) {
|
export async function projectApplies(params: any) {
|
||||||
return Fetch('/api/project_applies.json', {
|
return Fetch(`${ENV.FORGE_SERVER}/api/applied_projects.json`, {
|
||||||
method: 'post',
|
method: 'post',
|
||||||
body: params
|
body: params
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue