diff --git a/src/components/Header/components/Join/JoinProjectModal.tsx b/src/components/Header/components/Join/JoinProjectModal.tsx index b161c210..581b608c 100644 --- a/src/components/Header/components/Join/JoinProjectModal.tsx +++ b/src/components/Header/components/Join/JoinProjectModal.tsx @@ -22,7 +22,7 @@ const JoinProjectModal: FC = ({ onCancel = () => { }, }) => { const [inputValue, setInputValue] = useState(); - const [radioValue, setRadioValue] = useState(); + const [radioValue, setRadioValue] = useState("developer"); const [isLoading, setIsLoading] = useState(false); const handleOk = async () => { @@ -41,36 +41,40 @@ const JoinProjectModal: FC = ({ setIsLoading(true); const res = await projectApplies({ - code: inputValue, - role: radioValue + applied_project:{ + code: inputValue, + role: radioValue + } }); setIsLoading(false); handleCancel(); - const mapping: any = { - 1: "您输入的邀请码错误", - 2: "您已经是该项目成员", - 3: "请选择一个角色", - 4: "您的申请已提交,请等待项目管理员审批", - 5: "您已经申请加入该项目了,请耐心等待", - 6: "您已成功加入项目", - } + // const mapping: any = { + // 1: "您输入的邀请码错误", + // 2: "您已经是该项目成员", + // 3: "请选择一个角色", + // 4: "您的申请已提交,请等待项目管理员审批", + // 5: "您已经申请加入该项目了,请耐心等待", + // 6: "您已成功加入项目", + // } - if (mapping[res.status]) { - message.info(mapping[res.status]); - return; - } + // if (res.status !== 0 ) { + // message.info(res.message); + // return; + // } - if (res.status === 0) { - if (radioValue === "reporter") { - message.success('您加入项目成功!'); - trackEvent(['开发项目', '加入项目成功']) - history.push(`/projects/${res?.project_id}`); - } else { - trackEvent(['开发项目', '加入项目等待审批']) - message.success('您的申请已提交,请等待项目管理员审批!'); - } - return; - } + // if (res.status === 0) { + // if (radioValue === "reporter") { + // message.success('您加入项目成功!'); + // trackEvent(['开发项目', '加入项目成功']) + // history.push(`/projects/${res?.project_id}`); + // } else { + // trackEvent(['开发项目', '加入项目等待审批']) + // message.success('您的申请已提交,请等待项目管理员审批!'); + // } + // return; + // } + message.info(res.message); + return; }; const handleCancel = async () => { @@ -82,16 +86,17 @@ const JoinProjectModal: FC = ({
- 课堂邀请码: + 项目邀请码: = ({ }} />
-
- 身份: +
+ 选择角色: setRadioValue(e.target.value)}> - 管理人员 - 开发人员 - 报告人员 + 管理者 + 开发者 + 报告者
diff --git a/src/components/Header/components/Join/index.less b/src/components/Header/components/Join/index.less index 29840e23..d8d0d3f9 100644 --- a/src/components/Header/components/Join/index.less +++ b/src/components/Header/components/Join/index.less @@ -1,5 +1,29 @@ @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 { width: 120px; text-align: center; diff --git a/src/components/Header/components/Join/index.tsx b/src/components/Header/components/Join/index.tsx index 209425b6..da1b0f4b 100644 --- a/src/components/Header/components/Join/index.tsx +++ b/src/components/Header/components/Join/index.tsx @@ -55,20 +55,21 @@ const Join: FC = ({ const [visibleJoinProject, setVisibleJoinProject] = useState(); const handleJoinVerify = (type: VerifyType) => { - if (!handleVerify(dispatch)) { - return; - } + // if (!handleVerify(dispatch)) { + // return; + // } - if (type === VerifyType.Projects && !user.userInfo?.email) { - message.info('请先绑定邮箱,谢谢'); - return; - } + // if (type === VerifyType.Projects && !user.userInfo?.email) { + // message.info('请先绑定邮箱,谢谢'); + // return; + // } - if (type === VerifyType.Classrooms) { - setVisibleJoinClassroom(true); - } else if (type === VerifyType.Projects) { - setVisibleJoinProject(true); - } + // if (type === VerifyType.Classrooms) { + // setVisibleJoinClassroom(true); + // } else if (type === VerifyType.Projects) { + // setVisibleJoinProject(true); + // } + setVisibleJoinProject(true); } const handleAddVerify = (url: string, type?: VerifyType) => { @@ -170,14 +171,31 @@ const Join: FC = ({ // // // } - const JoinOverlay = (joinProps: any) => { + const JoinOverlay = (list: any) => { return <> - +
+ + { + list.map(function(item:any,key:number){ + return( + (item.name !=="加入课堂" && item.name !=="加入开发项目") && + + {window.location.href=item.url}}>{item.name} + + ) + }) + } + + handleJoinVerify(VerifyType.Projects)}>加入项目 + + +
} - return
- } placement="bottomRight"> + return ( +
+ JoinOverlay(globalSetting?.setting?.add) } placement="bottomRight"> = ({ visible={visibleJoinProject} onCancel={() => setVisibleJoinProject(false)} /> -
+
) } export default connect( ({ diff --git a/src/components/Header/components/User/index.tsx b/src/components/Header/components/User/index.tsx index 296d1b45..c2cfac71 100644 --- a/src/components/Header/components/User/index.tsx +++ b/src/components/Header/components/User/index.tsx @@ -308,7 +308,7 @@ const User: FC = ({ if (isLogin()) { return ( diff --git a/src/components/Header/index.less b/src/components/Header/index.less index cfb2f598..f6316797 100755 --- a/src/components/Header/index.less +++ b/src/components/Header/index.less @@ -4,6 +4,7 @@ min-width: 1200px; [class~='ant-layout-header'] { padding: 0; + height: 60px; } .logo { diff --git a/src/components/Header/index.tsx b/src/components/Header/index.tsx index 8d58ea0b..f47c3470 100755 --- a/src/components/Header/index.tsx +++ b/src/components/Header/index.tsx @@ -308,7 +308,7 @@ const HeaderComponents: FC = ({ { !checkIsClientExam() && <> - {!isLogin && } + {!isLogin && !!user?.userInfo?.login && } { !!user?.userInfo?.login && {user?.userInfo?.message_unread_total && {user?.userInfo?.message_unread_total}} } diff --git a/src/models/user/index.ts b/src/models/user/index.ts index f95da7ac..f5d92b99 100755 --- a/src/models/user/index.ts +++ b/src/models/user/index.ts @@ -76,7 +76,7 @@ const UserModel: UserModelType = { }, *getUserInfo({ payload }, { call, put }) { // location.search - const response = yield call(getUserInfo, { ...payload,debug:"admin" }) + const response = yield call(getUserInfo, { ...payload}) localStorage.userInfo = JSON.stringify(response); yield put({ diff --git a/src/service/home.ts b/src/service/home.ts index 59346b8e..24ecfd1e 100755 --- a/src/service/home.ts +++ b/src/service/home.ts @@ -1,4 +1,5 @@ import Fetch from '@/utils/fetch'; +import ENV from '@/utils/env'; export async function HomeIndex() { return Fetch('/api/home/index.json', { @@ -13,7 +14,7 @@ export async function applyToJoinCourse(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', body: params });