king
2025-05-13 1779677cece5864b62a65df4b01a4a69496e149a
src/views/login/index.jsx
@@ -28,6 +28,8 @@
    ICP: window.GLOB.ICP || '',
    lineColor: window.GLOB.lineColor || '',
    webSite: window.GLOB.webSite || '',
    prolType: window.GLOB.prolType || '',
    prolCont: window.GLOB.prolCont || '',
    langList: [],
    syncApp: false,
    loginWays: null,
@@ -159,12 +161,31 @@
        }
      }
      let iframe = sessionStorage.getItem('iframe')
      if (iframe) {
        sessionStorage.removeItem('iframe')
        this.props.history.replace(iframe.replace(/@loginuid@/, res.LoginUID))
      if (['20210626201522493D7AD7591D7A547278685', '20210626201956190740F1DF384914A3CA9EF'].includes(window.GLOB.appkey) && process.env.NODE_ENV === 'production' && param.username !== 'IF_DMS_APP') {
        let _param = {
          UserName: param.username,
          Password: param.password,
          BasePath: '/'
        }
        Api.loginAndRedirect(_param).then(result => {
          if (result.IsError) {
            this.setState({
              isDisabled: false
            })
            message.warning('登录失败,用户名或密码错误!')
          } else {
            let lang = sessionStorage.getItem('lang') !== 'en-US' ? '/zh-CN' : '/en-US'
            window.location.replace(document.location.origin + lang + '/Home/Index')
          }
        })
      } else {
        this.props.history.replace('/main')
        let iframe = sessionStorage.getItem('iframe')
        if (iframe) {
          sessionStorage.removeItem('iframe')
          this.props.history.replace(iframe.replace(/@loginuid@/, res.LoginUID))
        } else {
          this.props.history.replace('/main')
        }
      }
    } else if (res.ErrCode === 'Need_Get_Appkey' && window.GLOB.sysType === 'SSO') {
      message.warning('应用尚未创建,请向云端同步应用!')
@@ -307,7 +328,6 @@
    // md5("/ws/location/v1/ip?callback=callbackFunction&key=key&output=jsonp secret key")
    // md5("/ws/location/v1/ip?callback=callbackFunction&key=BA7BZ-4QB65-LFCIA-QPDA6-4G6O7-MJB4Q&output=jsonpuThL4ZM3XOj642ksEQh76tyHFjh4")
    sessionStorage.removeItem('subLangList')
    sessionStorage.removeItem('langList')
    setTimeout(() => {
@@ -639,12 +659,27 @@
              style: res.CSS || '',
              showline: res.split_line_show || 'true',
              webSite: res.WebSite || '',
              prolType: '',
              prolCont: '',
              navBar: res.menu_type, // shutter 百叶窗、linkage_navigation 联动菜单、linkage 联动菜单_无导航栏、menu_board 菜单面板、menu_board_navigation 菜单面板_标签页
              app_version: res.app_version,
              Member_Level: 0,
              appname: res.appname || '',
              loginOtop: loginOtop,
              loginOleft: loginOleft
            }
            if (['every_time', 'once', 'not_required'].includes(res.require_legal_consent) && res.legal_documents) {
              systemMsg.prolCont = res.legal_documents
              try {
                systemMsg.prolCont = window.decodeURIComponent(window.atob(systemMsg.prolCont))
                if (res.require_legal_consent !== 'not_required') {
                  systemMsg.prolType = res.require_legal_consent
                }
              } catch(e) {
                systemMsg.prolType = ''
                systemMsg.prolCont = ''
              }
            }
            if ([10, 20, 30, 40, 50, 60, 70, 80, 90, 100].includes(res.member_level)) {
@@ -736,20 +771,8 @@
            }
            if (res.lang_data && res.lang_data.length > 1 && window.GLOB.systemType !== 'production') {
              let list = res.lang_data.map(item => item.Lang)
              let lang = 'zh-CN'
              if (window.GLOB.defLang && list.includes(window.GLOB.defLang)) {
                lang = window.GLOB.defLang
              }
              if (list.includes(lang)) {
                list = [lang, ...list.filter(item => item !== lang)]
                if (lang === sessionStorage.getItem('lang')) {
                  sessionStorage.setItem('langList', JSON.stringify(list))
                } else {
                  sessionStorage.setItem('subLangList', JSON.stringify(list))
                }
              }
              let list = res.lang_data.map(item => item.Lang).filter(n => n !== 'zh-CN')
              sessionStorage.setItem('langList', JSON.stringify(list))
            }
            if (res.lang_data.length === 1 && res.lang_data[0].Lang !== sessionStorage.getItem('lang')) {
@@ -759,12 +782,16 @@
              return
            }
            let langList = res.lang_data.map(item => ({Lang: item.Lang, LangName: item.LangName}))
            localStorage.setItem(window.GLOB.sysSign + 'langList', JSON.stringify(langList))
            window.GLOB.loginOtop = systemMsg.loginOtop
            window.GLOB.loginOleft = systemMsg.loginOleft
            
            this.setState({
              loginWays: login_ways,
              langList: res.lang_data || [],
              langList: langList,
              ...systemMsg
            })
@@ -787,32 +814,32 @@
            }
            // positecgroup
            // if (res.users_upt === 'true' && window.GLOB.systemType === 'production') {
            //   Api.genericInterface({
            //     func: 's_Get_local_u_deleted',
            //     users_upt_date: res.users_upt_date,
            //     userid: result.UserID,
            //     LoginUID: result.LoginUID
            //   }).then(localres => {
            //     if (!localres.status) return
            //     Api.getSystemConfig({
            //       func: 's_get_sso_u_create',
            //       user_ids: localres.user_ids,
            //       user_ids_local: localres.user_ids_local,
            //       users_upt_date: localres.users_upt_date,
            //       userid: result.UserID,
            //       LoginUID: result.LoginUID
            //     }).then(ssores => {
            //       if (!ssores.status) return
            //       Api.genericInterface({
            //         func: 's_get_local_u_create',
            //         user_ids_local: ssores.user_ids_local,
            //         userid: result.UserID,
            //         LoginUID: result.LoginUID
            //       })
            //     })
            //   })
            // }
            if (['20210626201522493D7AD7591D7A547278685', '20210626201956190740F1DF384914A3CA9EF'].includes(window.GLOB.appkey) && res.users_upt === 'true' && window.GLOB.systemType === 'production') {
              Api.genericInterface({
                func: 's_Get_local_u_deleted',
                users_upt_date: res.users_upt_date,
                userid: result.UserID,
                LoginUID: result.LoginUID
              }).then(localres => {
                if (!localres.status) return
                Api.getSystemConfig({
                  func: 's_get_sso_u_create',
                  user_ids: localres.user_ids,
                  user_ids_local: localres.user_ids_local,
                  users_upt_date: localres.users_upt_date,
                  userid: result.UserID,
                  LoginUID: result.LoginUID
                }).then(ssores => {
                  if (!ssores.status) return
                  Api.genericInterface({
                    func: 's_get_local_u_create',
                    user_ids_local: ssores.user_ids_local,
                    userid: result.UserID,
                    LoginUID: result.LoginUID
                  })
                })
              })
            }
          } else {
            message.warning(res.message)
          }
@@ -832,6 +859,19 @@
      this.setState({
        loginWays: loginWays
      })
    }
    let langs = localStorage.getItem(window.GLOB.sysSign + 'langList')
    if (langs) {
      try {
        langs = JSON.parse(langs)
      } catch (e) {
        langs = []
      }
      this.setState({
        langList: langs
      })
    }
  }
@@ -985,7 +1025,7 @@
  }
  render () {
    const { lineColor, bgImage, loginlogo, copyRight, webSite, ICP, loginWays } = this.state
    const { lineColor, bgImage, loginlogo, copyRight, webSite, ICP, loginWays, prolType, prolCont } = this.state
    let wrapStyle = {}
@@ -1010,6 +1050,8 @@
            auth={this.state.auth}
            authError={this.state.authError}
            loginWays={loginWays}
            prolType={prolType}
            prolCont={prolCont}
            langList={this.state.langList}
            isDisabled={this.state.isDisabled}
            handleSubmit={() => this.handleSubmit()}
@@ -1018,11 +1060,13 @@
          /> : null}
        </div>
        <div className="login-bottom">
          {webSite && copyRight ?
            <a target="_blank" rel="noopener noreferrer" href={webSite} dangerouslySetInnerHTML={{ __html: copyRight.replace(/\s/ig, '&nbsp;') }}></a> :
            <p dangerouslySetInnerHTML={{ __html: copyRight ? copyRight.replace(/\s/ig, '&nbsp;') : '' }}></p>
          }
          <br/>
          <p>
            {webSite && copyRight ?
              <a target="_blank" rel="noopener noreferrer" href={webSite} dangerouslySetInnerHTML={{ __html: copyRight.replace(/\s/ig, '&nbsp;') }}></a> :
              <span dangerouslySetInnerHTML={{ __html: copyRight ? copyRight.replace(/\s/ig, '&nbsp;') : '' }}></span>
            }
            {prolCont && !prolType ? <span style={{marginLeft: '15px'}} dangerouslySetInnerHTML={{ __html: prolCont }}></span> : null}
          </p>
          {ICP ? <a target="_blank" rel="noopener noreferrer" href="https://beian.miit.gov.cn/#/Integrated/index" dangerouslySetInnerHTML={{ __html: ICP.replace(/\s/ig, '&nbsp;') }}></a> : null}
        </div>
        {/* 编辑状态登录 */}