king
2022-04-26 5046d0d13dc6a8563b8e54e31913bc44cfa1072f
src/components/header/index.jsx
@@ -38,7 +38,8 @@
    visible: false, // 修改密码模态框
    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    confirmLoading: false,
    userName: sessionStorage.getItem('User_Name'),
    userName: '',
    fullName: '',
    logourl: window.GLOB.mainlogo,
    appVersion: window.GLOB.appVersion,
    loginVisible: false,
@@ -189,10 +190,19 @@
        const { menulist, thdMenuList } = this.getMenulist(result)
        let systems = []
        if ((options.sysType === 'local' || options.sysType === 'SSO') && result.sys_list) {
          systems = result.sys_list
          if (options.sysType === 'local' && window.GLOB.systemType !== 'production' && systems.length > 10) {
            systems.length = 10
          }
        }
        this.setState({
          menulist,
          thdMenuList,
          systems: window.GLOB.systemType === 'production' || options.sysType === 'SSO' ? (result.sys_list || []) : []
          systems: systems
        })
        
        let mainMenu = menulist[0] || ''
@@ -446,7 +456,6 @@
            message: result.message,
            duration: 10
          })
          return
        } else if (result.func_detail && result.func_detail.length > 0) {
          this.writeFuncs(result.func_detail)
        }
@@ -551,18 +560,40 @@
      url = url + '/'
    }
    let href = url + 'index.html#/ssologin/' + window.btoa(window.encodeURIComponent(JSON.stringify({
      UserID: sessionStorage.getItem('UserID'),
      LoginUID: sessionStorage.getItem('LoginUID'),
      User_Name: sessionStorage.getItem('User_Name'),
      Full_Name: sessionStorage.getItem('Full_Name'),
      avatar: sessionStorage.getItem('avatar'),
      dataM: system.dataM ? 'true' : '',
      debug: system.debug || '',
      role_id: system.role_id || ''
    })))
    let key = Utils.getuuid()
    window.open(href)
    let _param = {
      func: 'webapi_scan_binding_key',
      binding_type: 'mk',
      scan_type: 'toggle',
      scan_appkey: system.scan_appkey,
      id: key
    }
    Api.getSystemConfig(_param).then(res => {
      if (!res.status) {
        notification.warning({
          top: 92,
          message: res.message,
          duration: 5
        })
      } else if (res.thd_party_appid && res.thd_party_member_id && res.thd_party_openid) {
        let href = url + 'admin/index.html#/ssologin/' + window.btoa(window.encodeURIComponent(JSON.stringify({
          appid: res.thd_party_appid,
          memberId: res.thd_party_member_id,
          openid: res.thd_party_openid,
          key: key
        })))
        window.open(href)
      } else {
        notification.warning({
          top: 92,
          message: '信息缺失,请联系管理员!',
          duration: 5
        })
      }
    })
  }
  dropdownMenuChange = (visible) => {
@@ -579,6 +610,15 @@
  UNSAFE_componentWillMount () {
    // 组件加载时,获取菜单数据
    this.getRolesMenu()
    let fullName = sessionStorage.getItem('Full_Name') || ''
    let userName = sessionStorage.getItem('User_Name') || ''
    if (fullName.toLowerCase() === userName.toLowerCase()) {
      userName = ''
    }
    this.setState({fullName, userName})
  }
  componentDidMount () {
@@ -586,6 +626,12 @@
    setTimeout(() => {
      Api.getAppVersion().then(() => {}, () => {})
    }, 1000)
    // Api.genericInterface({
    //   func: 's_get_fcc_account_data',
    //   fcc_date: '2022-03-01',
    //   search_type: ''
    // }).then(res => {
    // })
  }
  shouldComponentUpdate (nextProps, nextState) {
@@ -802,7 +848,7 @@
          <div>
            <img src={this.state.avatar || avatar} alt=""/>
            <span>
              <span className="username">{this.state.userName}</span> <DownOutlined />
              <span className="username"><span>{this.state.fullName}</span>{this.state.userName ? <span>{this.state.userName}</span> : null}</span> <DownOutlined />
            </span>
          </div>
        </Dropdown>