This commit is contained in:
谢思 2021-11-30 11:19:55 +08:00
parent ca5c279ac0
commit 9577478e97
5 changed files with 44 additions and 19 deletions

View File

@ -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 (
<div key={item.id + Math.random()} className="noticeCont-back" onClick={() => { readItem(item) }}>
<div className="noticeCont">
<div className={`noticeCont ${item.notification_url ? 'pointer' : ''}`}>
<span style={{ visibility: item.status === 1 ? 'visible' : 'hidden' }}>
<Badge color="#FA2020" />
</span>

View File

@ -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}

View File

@ -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) {

View File

@ -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) {

View File

@ -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键监听事件