diff --git a/src/forge/Head/NoticeContent.jsx b/src/forge/Head/NoticeContent.jsx index 39546707..d29dfb72 100644 --- a/src/forge/Head/NoticeContent.jsx +++ b/src/forge/Head/NoticeContent.jsx @@ -23,6 +23,9 @@ function NoticeContent({ visible, showNotification, resetUserInfo, current_user: const [atPage, setAtPage] = useState(0); const [atUnreadList, setAtUnreadList] = useState([]);//未读@我列表 + //记录用户点击的消息 + const [clickItem, setClickItem] = useState(undefined); + useEffect(() => { resetUserInfo(); }, [noticeUnreadCount,atUnreadCount]); @@ -150,23 +153,26 @@ function NoticeContent({ visible, showNotification, resetUserInfo, current_user: function changeReadMark(item) { - if (item.type === "notification") { - let list = noticeUnreadList.slice(); - let index = noticeUnreadList.indexOf(item); - list[index].status = 2; - setNoticeUnreadList(list); - if (noticeUnreadCount > 0) { - setNoticeUnreadCount(noticeUnreadCount - 1); - } - } else if (item.type === "atme") { - let list = atUnreadList.slice(); - let index = atUnreadList.indexOf(item); - list[index].status = 2; - setAtUnreadList(list); - if (atUnreadCount > 0) { - setAtUnreadCount(atUnreadCount - 1); + if (!clickItem || clickItem.id !== item.id){ + if (item.type === "notification") { + let list = noticeUnreadList.slice(); + let index = noticeUnreadList.indexOf(item); + if (list[index].status === 1 && noticeUnreadCount > 0) { + setNoticeUnreadCount(noticeUnreadCount - 1); + } + list[index].status = 2; + setNoticeUnreadList(list); + } else if (item.type === "atme") { + let list = atUnreadList.slice(); + let index = atUnreadList.indexOf(item); + if (list[index].status === 1 && atUnreadCount > 0) { + setAtUnreadCount(atUnreadCount - 1); + } + list[index].status = 2; + setAtUnreadList(list); } } + setClickItem(item); } return ( @@ -219,7 +225,7 @@ function NoticeContent({ visible, showNotification, resetUserInfo, current_user: {atUnreadList.map(item => { return (
{ readItem(item) }}> -
+
diff --git a/src/forge/Order/order_form.js b/src/forge/Order/order_form.js index 7e5edfcc..2b6ba2d7 100644 --- a/src/forge/Order/order_form.js +++ b/src/forge/Order/order_form.js @@ -355,7 +355,7 @@ class order_form extends Component { mdID={"order-new-description"} initValue={description} onChange={this.onContentChange} - isCanAtme = {true} + isCanAtme = {form_type} changeAtWhoLoginList = {this.changeAtWhoLoginList} owner = {owner} projectsId = {projectsId} diff --git a/src/modules/loginRegister/Register.jsx b/src/modules/loginRegister/Register.jsx index 441ad46e..1ff6d9e1 100644 --- a/src/modules/loginRegister/Register.jsx +++ b/src/modules/loginRegister/Register.jsx @@ -38,11 +38,14 @@ function Register(props){ }).then((response)=>{ if(response.data && response.data.status === -6){ //验证码不正确 - form.setFields({captcha: {value:values.captcha,errors:[new Error('验证码错误,请重新输入')]}}) + form.setFields({captcha: {value:values.captcha,errors:[new Error('验证码错误,请重新输入')]}}); + //设置邮箱内容-》不设置会被恢复成undefined,从而点击验证码失败 + setEmailStr(values.email); }else if(response.data && response.data.status === 0){ //注册成功,页面跳转即可,注册后登录流程forge处理了 window.location.href = "/"+values.register_username; - }else{ + } else { + setEmailStr(values.email); setMess(response.data.message); } }) @@ -134,6 +137,7 @@ function Register(props){ setCountDown(true); setGetCaptchaBut(false); seconds.current = 60; + setSecondsStr(60); !interval && clearInterval(interval); interval = setInterval(() => { if (seconds.current > 1) { diff --git a/src/modules/loginRegister/ResetPassword.jsx b/src/modules/loginRegister/ResetPassword.jsx index d1226995..fa7ec72a 100644 --- a/src/modules/loginRegister/ResetPassword.jsx +++ b/src/modules/loginRegister/ResetPassword.jsx @@ -46,6 +46,8 @@ function ResetPassword(props) { console.log('error',error); }) } else { + //设置邮箱内容-》不设置会被恢复成undefined,从而点击验证码失败 + setEmailStr(values.email); const message = response.data.message; message === "验证码不正确" ? form.setFields({captcha: {value:values.captcha,errors:[new Error('验证码错误,请重新输入')]}}) : setMess(message); } @@ -112,6 +114,7 @@ function ResetPassword(props) { setCountDown(true); setGetCaptchaBut(false); seconds.current = 60; + setSecondsStr(60); !interval && clearInterval(interval); interval = setInterval(() => { if (seconds.current > 1) { diff --git a/src/modules/tpm/challengesnew/tpm-md-editor.js b/src/modules/tpm/challengesnew/tpm-md-editor.js index 46c01ec3..030a05e0 100644 --- a/src/modules/tpm/challengesnew/tpm-md-editor.js +++ b/src/modules/tpm/challengesnew/tpm-md-editor.js @@ -90,6 +90,7 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla const containerId = `mdEditor_${mdID}`; const editorBodyId = `mdEditors_${mdID}`; const tipId = `e_tips_mdEditor_${mdID}`; + const [init, setInit] = useState(true); useEffect(()=>{ //请求members接口获取全部可@列表 @@ -295,6 +296,17 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla const cmEl = editorInstance && editorInstance.cm + useEffect(() => { + //如果是复制issue则需要将原内容中的@谁录入 @列表中 + if (init && cmEl && initValue && isCanAtme === "copy" && initValue.indexOf("@") !== -1) { + allUsers.map(item => { + initValue.indexOf(`[@${item.username}](/${item.login})`) !== -1 && selectAtWho(item.username); + }) + setInit(false); + console.log('复制issue atWhoLoginList.current', atWhoLoginList.current, 'atWhoLoginListState', atWhoLoginListState); + } + }, [initValue]) + useEffect(()=>{ if(atWhoVisibleRef.current){ // 添加上下键、enter键监听事件