增加登录旁待办条数提醒,及1分钟自动隐藏

master
孙亮 9 months ago
parent 16b7829e13
commit d115e68420

@ -1,6 +1,8 @@
import { AutoComplete, Divider, Form, Input, message, Popover, Tabs, Tag } from 'antd'
import { Route } from 'dva/router'
import lodash from "lodash"
import requestaxios from 'axios';
import utils from "@/microhost/common"
import React, { useContext, useEffect, useLayoutEffect, useRef, useState } from 'react'
import { history, useModel, } from 'umi'
import {Dropdown, Menu, Modal} from "antd"
@ -10,6 +12,7 @@ import {Runtime} from "../../system"
import UserEditor from "../userEdit"
import MicroApps from '@/microhost/system/apps'
import { SystemData } from '@/microhost/models/system'
import { string } from 'prop-types';
/**
*
@ -27,9 +30,14 @@ const RightInfo = () => {
const [isLoading, setIsLoading] = useState<boolean>(false)
const [activeThemeName, setActiveThemeName] = useState<any>("")
const [searchList, setSearchList] = useState<any[]>([])
const [msgnum,setmsgnum]=useState<any>("");
//const [isHidden, setIsHidden] = useState(true); // 初始化状态变量为 false
useEffect(() => {
msglog();
}, [])
useLayoutEffect(() => {
window.addEventListener("click", () => {
//setShowFuncs(false)
})
@ -39,6 +47,40 @@ const RightInfo = () => {
}
}, [])
const msglog=()=>
{
setmsgnum("0");
// console.log("开始请求");
// const date={
// mid: "41f852c5-dfa3-3057-c62d-197d82f71b58" ,//指定模块id可在导航管理获得用户需有权限
// app: "", //预留
// title: "待办提醒", //推送标题
// msg: "您有代办信息请及时处理", //推送内容
// showtype: 0 ,//0-仅通知 1-通知且提供跳转 2-通知且直接跳转
// filter: { //可选参数,推送过滤
// // loginId: string //可选参数,指定接收人
// },
// param: { //可选参数给模块传递get参数
// //参数名:参数值
// }
// }
const loginName = utils.loadCookie("loginName")
//const loginName='chengzhigang';
requestaxios
.post("http://172.15.89.222:8081/WF/API/EmpWorksNums?UserNo="+loginName)
.then(({ data }) => {
setmsgnum(data.replace("EmpWorksNums:",""));
setTimeout(() => {
document.getElementById('MSGNUM').style.display = 'none';
// setIsVisible(false); // 2000ms后将isVisible设置为不可见状态
}, 60000);
})
.catch((reason) => {
message.error('推送代办信息报错' + reason);
});
}
const changePassword = async () => {
await thisForm.validateFields()
let vals: any = thisForm.getFieldsValue()
@ -231,8 +273,9 @@ const RightInfo = () => {
<img src="/statics/home/ustb-logo.jpg" width={128} height={32} className="ibk-menu-img" style={{marginTop: 4, borderLeft: "2px solid #ccc", paddingLeft: 4}} />
</div> */}
<div className={styles.info_content} style={{}}>
<span><UserOutlined /></span>
<div style={{marginLeft: 8, whiteSpace: "nowrap"}}>{!nickname ? "-" : `${nickname},您好!`}</div>
<div style={{marginLeft: 8, whiteSpace: "nowrap"}}>{!nickname ? "-" : `${nickname},您好!`}<span id='MSGNUM' style={{fontSize:'16PX',color:'rgb(225 70 70)'}}>{`您有${msgnum}条待办`}</span></div>
</div>
</Dropdown>
{/* </Popover> */}

Loading…
Cancel
Save