king
2025-05-08 400fee62fb40006a9839f1c3a8244b82566b5057
src/components/header/index.jsx
@@ -11,6 +11,7 @@
import Utils from '@/utils/utils.js'
import avatar from '@/assets/img/avatar.jpg'
import wxicon from '@/assets/img/wx-icon.png'
import mkpublic from '@/assets/img/mkpublic.jpg'
import './index.scss'
const { confirm } = Modal
@@ -18,6 +19,7 @@
const Resetpwd = asyncComponent(() => import('@/components/resetPassword'))
const QrCode = asyncComponent(() => import('@/components/qrcode'))
const LoginForm = asyncSpinComponent(() => import('./loginform'))
const SysIcon = asyncComponent(() => import('./sysmessage/icon'))
class Header extends Component {
  state = {
@@ -26,6 +28,7 @@
    fullName: '',
    logourl: window.GLOB.mainlogo,
    wxVisible: false,
    wxStep: 1,
    loginVisible: false,
    loginLoading: false,
    avatar: Utils.getrealurl(sessionStorage.getItem('avatar')),
@@ -56,7 +59,9 @@
  componentDidMount () {
    // 获取系统的版本信息,延时查询
    setTimeout(() => {
      Api.getAppVersion()
      if (!window.GLOB.$error) {
        Api.getAppVersion()
      }
    }, 1000)
    // sessionStorage 跨页面共享
@@ -78,6 +83,24 @@
        }
      }
    })
    if (sessionStorage.getItem('local_error')) {
      try {
        let param = JSON.parse(sessionStorage.getItem('local_error'))
        setTimeout(() => {
          Api.genericInterface({
            func: 's_special_error_note_log',
            ...param
          }).then(res => {
            if (res.status) {
              sessionStorage.removeItem('local_error')
            }
          })
        }, 3000)
      } catch (e) {
        sessionStorage.removeItem('local_error')
      }
    }
  }
  shouldComponentUpdate (nextProps, nextState) {
@@ -125,8 +148,10 @@
      cancelText: dict['cancel'] || '取消',
      onOk() {
        sessionStorage.clear()
        that.props.history.replace('/login')
        window.location.reload()
        setTimeout(() => {
          that.props.history.replace('/login')
          window.location.reload()
        }, 100)
      },
      onCancel() {}
    })
@@ -290,9 +315,10 @@
          if (PageParam.OpenType === 'outpage' && PageParam.linkUrl) {
            fstItem.OpenType = 'newpage'
            fstItem.src = PageParam.linkUrl
            fstItem.src = window.GLOB.systemType === 'production' && PageParam.linkProUrl ? PageParam.linkProUrl : PageParam.linkUrl
            fstItem.src = fstItem.src.replace(/@loginuid@/ig, sessionStorage.getItem('LoginUID'))
            fstItem.src = fstItem.src.replace(/@userid@/ig, sessionStorage.getItem('UserID'))
            if (/#\/iframe\//.test(fstItem.src)) {
              fstItem.src = fstItem.src.replace(/@loginuid@/ig, sessionStorage.getItem('LoginUID'))
              fstItem.type = 'iframe'
              fstItem.OpenType = 'newtab'
            }
@@ -329,7 +355,7 @@
                ParentNames: [fst.MenuName, snd.MenuName],
                MenuNo: trd.MenuNo,
                EasyCode: trd.EasyCode,
                type: 'CommonTable',
                type: 'CustomPage',
                OpenType: 'newtab',
                hidden: 'false'
              }
@@ -338,7 +364,7 @@
                try {
                  let PageParam = JSON.parse(trd.PageParam)
                  trdItem.type = PageParam.Template || 'CommonTable'
                  trdItem.type = PageParam.Template || 'CustomPage'
                  trdItem.OpenType = PageParam.OpenType || 'newtab'
                  trdItem.hidden = PageParam.hidden || 'false'
                  trdItem.menuColor = PageParam.menuColor || ''
@@ -346,9 +372,10 @@
                  if (trdItem.type === 'NewPage') {
                    trdItem.OpenType = 'newpage'
                    trdItem.src = PageParam.url || ''
                    trdItem.src = window.GLOB.systemType === 'production' && PageParam.proUrl ? PageParam.proUrl : PageParam.url || ''
                    trdItem.src = trdItem.src.replace(/@loginuid@/ig, sessionStorage.getItem('LoginUID'))
                    trdItem.src = trdItem.src.replace(/@userid@/ig, sessionStorage.getItem('UserID'))
                    if (/#\/iframe\//.test(trdItem.src)) {
                      trdItem.src = trdItem.src.replace(/@loginuid@/ig, sessionStorage.getItem('LoginUID'))
                      trdItem.type = 'iframe'
                      trdItem.OpenType = 'newtab'
                    }
@@ -635,7 +662,7 @@
        <Menu.Item key="verup" onClick={this.verup}>
          {dict['page_upd'] || '页面更新'}
        </Menu.Item>
        {window.GLOB.WXNotice ? <Menu.Item key="wxnotice" onClick={() => this.setState({wxVisible: true})}>
        {window.GLOB.WXNotice ? <Menu.Item key="wxnotice" onClick={() => this.setState({wxVisible: true, wxStep: 1})}>
          微信消息
        </Menu.Item> : null}
        {window.GLOB.appVersion ? <Menu.Item key="version" onClick={this.about}>
@@ -785,6 +812,7 @@
            <SearchOutlined className="search-menu" />
          </Dropdown> : null
        }
        {window.GLOB.SysNotice ? <SysIcon /> : null}
        {/* 头像、用户名 */}
        <Dropdown className="header-setting" overlay={menu}>
          <div>
@@ -819,14 +847,22 @@
          footer={null}
          destroyOnClose
        >
          <div className="wx-sms-wrap">
          {this.state.wxStep !== 2 ? <div className="wx-sms-wrap">
            <img className="mk-img" src={mkpublic} alt=""/>
            <div className="mk-tip">
              <span>微信扫码</span>
              <span>关注公众号</span>
              <span>关注公众号且授权后方可接收消息。</span>
              <span onClick={() => this.setState({wxStep: 2})}>下一步</span>
            </div>
          </div> : <div className="wx-sms-wrap">
            <QrCode card={{qrWidth: 200, color: '#000000'}} value={window.GLOB.baseurl + 'mob/wxnotice.html?userid=' + sessionStorage.getItem('UserID') + '&loginuid=' + sessionStorage.getItem('LoginUID')}/>
            <div className="tip">
              <img src={wxicon} alt=""/>
              <span>微信扫码</span>
              <span>关注公众号</span>
              <span>获取用户授权</span>
            </div>
          </div>
          </div>}
        </Modal>
      </header>
    )