king
2022-03-23 fc32b691967b530f949f62cc3758a9d70dbd5a91
2022-03-23
5个文件已修改
224 ■■■■■ 已修改文件
src/components/header/index.jsx 56 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/mob/components/topbar/normal-navbar/index.jsx 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/mob/components/topbar/normal-navbar/options.jsx 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/login/index.jsx 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sso/index.jsx 118 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/header/index.jsx
@@ -189,10 +189,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 +455,6 @@
            message: result.message,
            duration: 10
          })
          return
        } else if (result.func_detail && result.func_detail.length > 0) {
          this.writeFuncs(result.func_detail)
        }
@@ -551,18 +559,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) => {
src/mob/components/topbar/normal-navbar/index.jsx
@@ -37,7 +37,8 @@
        subtype: card.subtype,
        wrap: { type: 'navbar', height: 50, title: 'NavBar', back: 'true', logout: 'false' },
        style: {boxShadow: '0 0 3px #D9D9D9', shadowColor: '#D9D9D9', shadowBlur: '3px', paddingLeft: '10px', paddingRight: '10px', lineHeight: '2.8', fontSize: '18px' },
        searchStyle: {}
        searchStyle: {},
        titleStyle: {}
      }
      if (card.config) {
@@ -102,6 +103,8 @@
    if (comIds[1] === 'search') {
      _card.searchStyle = style
    } else if (comIds[1] === 'title') {
      _card.titleStyle = style
    } else {
      _card.style = style
    }
@@ -117,6 +120,12 @@
    const { card } = this.state
    MKEmitter.emit('changeStyle', [card.uuid], ['font', 'background', 'border', 'padding', 'shadow'], card.style)
  }
  changeTitleStyle = () => {
    const { card } = this.state
    MKEmitter.emit('changeStyle', [card.uuid, 'title'], ['font'], card.titleStyle || {})
  }
  changeSearchStyle = () => {
@@ -216,7 +225,13 @@
            {card.wrap.menuPosition === 'left' ? <div className="img" style={{backgroundImage: `url(${avatar})`}}></div> : null}
          </div>
          {card.wrap.type !== 'search' ?
            <div className="am-navbar-title">{card.wrap.title || ''}</div> :
            <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
              <div className="mk-popover-control">
                <FontColorsOutlined className="style" title="调整样式" onClick={this.changeTitleStyle}/>
              </div>
            } trigger="hover">
              <div className="am-navbar-title" style={card.titleStyle}>{card.wrap.title || ''}</div>
            </Popover> :
            <div className="am-navbar-search" onDoubleClick={this.setSearch}>
              <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
                <div className="mk-popover-control">
src/mob/components/topbar/normal-navbar/options.jsx
@@ -138,6 +138,17 @@
      }]
    },
    {
      type: 'radio',
      field: 'mode',
      label: '弹框背景',
      initval: wrap.mode || 'dark',
      required: false,
      options: [
        {value: 'light', label: '白色'},
        {value: 'dark', label: '黑色'},
      ]
    },
    {
      type: 'select',
      field: 'linkmenu',
      label: '关联菜单',
src/views/login/index.jsx
@@ -74,13 +74,6 @@
   * @param {Object} param 用户名密码等信息
   */
  async loginsubmit (param) {
    if (options.sysType === 'local' && !window.GLOB.mainSystemApi) { // 业务系统必须设置单点地址
      Modal.warning({
        title: '未设置单点服务器地址,请联系管理员!'
      })
      return
    }
    let city = sessionStorage.getItem('city') || ''
    let ipAddress = sessionStorage.getItem('ipAddress') || ''
@@ -176,13 +169,6 @@
  }
  async phoneloginsubmit (param) {
    if (options.sysType === 'local' && !window.GLOB.mainSystemApi) { // 业务系统必须设置单点地址
      Modal.warning({
        title: '未设置单点服务器地址,请联系管理员!'
      })
      return
    }
    let city = sessionStorage.getItem('city') || ''
    let ipAddress = sessionStorage.getItem('ipAddress') || ''
@@ -232,12 +218,6 @@
  }
  authLogin = (appid, openid, memberid, scanId) => {
    if (options.sysType === 'local' && !window.GLOB.mainSystemApi) { // 业务系统必须设置单点地址
      Modal.warning({
        title: '未设置单点服务器地址,请联系管理员!'
      })
      return
    }
    Api.getTouristMsg(appid, openid, memberid, scanId).then(res => {
      if (res.status) {
        sessionStorage.setItem('UserID', res.UserID)
src/views/sso/index.jsx
@@ -1,5 +1,5 @@
import React, {Component} from 'react'
import { Spin } from 'antd'
import { Spin, notification } from 'antd'
import { connect } from 'react-redux'
import md5 from 'md5'
import moment from 'moment'
@@ -16,23 +16,41 @@
      let _param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param)))
      if (typeof(_param) === 'object') {
        _param.UserID && sessionStorage.setItem('UserID', _param.UserID)
        _param.LoginUID && sessionStorage.setItem('LoginUID', _param.LoginUID)
        _param.User_Name && sessionStorage.setItem('User_Name', _param.User_Name)
        _param.Full_Name && sessionStorage.setItem('Full_Name', _param.Full_Name)
        _param.debug && sessionStorage.setItem('debug', _param.debug)
        _param.dataM && sessionStorage.setItem('dataM', _param.dataM)
        _param.dataM && sessionStorage.setItem('localDataM', _param.dataM)
        _param.avatar && sessionStorage.setItem('avatar', _param.avatar)
        _param.role_id && sessionStorage.setItem('role_id', _param.role_id)
        _param.role_id && sessionStorage.setItem('localRole_id', _param.role_id)
        this.authLogin(_param.appid, _param.openid, _param.memberId, _param.key)
      } else {
        this.props.history.replace('/login')
      }
      this.getMessage()
    } catch (e) {
      this.props.history.replace('/login')
    }
  }
  authLogin = (appid, openid, memberid, scanId) => {
    Api.getTouristMsg(appid, openid, memberid, scanId).then(res => {
      if (res.status) {
        sessionStorage.setItem('UserID', res.UserID)
        sessionStorage.setItem('LoginUID', res.LoginUID)
        sessionStorage.setItem('User_Name', res.UserName)
        sessionStorage.setItem('Full_Name', res.FullName)
        sessionStorage.setItem('avatar', res.icon || '')
        sessionStorage.setItem('dataM', res.dataM ? 'true' : '')
        sessionStorage.setItem('localDataM', res.dataM ? 'true' : '')
        sessionStorage.setItem('debug', res.debug || '')
        sessionStorage.setItem('role_id', res.role_id || '')
        sessionStorage.setItem('departmentcode', res.departmentcode || '')
        sessionStorage.setItem('organization', res.organization || '')
        sessionStorage.setItem('localRole_id', res.role_id || '')
        this.getMessage()
      } else {
        notification.warning({
          top: 92,
          message: res.message,
          duration: 5
        })
        this.props.history.replace('/login')
      }
    })
  }
  getMessage = () => {
@@ -47,7 +65,16 @@
    Api.getSystemConfig(_param).then(res => {
      if (res.status) {
        let _url = window.location.href.split('#')[0] + 'system'
        if (/^https/.test(window.location.protocol)) { // https转换
          res.Banner = res.Banner ? res.Banner.replace(/^http:/ig, 'https:') : ''
          res.doclogo = res.doclogo ? res.doclogo.replace(/^http:/ig, 'https:') : ''
          res.indexlogo = res.indexlogo ? res.indexlogo.replace(/^http:/ig, 'https:') : ''
          res.loginlogo = res.loginlogo ? res.loginlogo.replace(/^http:/ig, 'https:') : ''
          res.titlelogo = res.titlelogo ? res.titlelogo.replace(/^http:/ig, 'https:') : ''
        }
        const _href = window.location.href.split('#')[0]
        let _url = _href + 'system'
        let systemMsg = {
          favicon: res.titlelogo || '',
          platTitle: res.titleName || '',
@@ -59,7 +86,30 @@
          mainlogo: res.indexlogo || '',
          doclogo: res.doclogo || '',
          style: res.CSS || '',
          webSite: res.WebSite || ''
          showline: res.split_line_show || 'true',
          webSite: res.WebSite || '',
          navBar: res.menu_type,
          app_version: res.app_version
        }
        let level = res.pwd_level || ''
        if (level && !['letter_num', 'char_num', 'char_num_90'].includes(level)) {
          level = ''
        }
        localStorage.setItem(_href + 'pwdlevel', level)
        if (res.srcid) {
          localStorage.setItem(_href + 'srcId', res.srcid)
        } else {
          localStorage.removeItem(_href + 'srcId')
        }
        sessionStorage.setItem('home_background', res.index_background_color || '')
        if (res.sys_datetime) {
          sessionStorage.setItem('sys_datetime', res.sys_datetime)
          sessionStorage.setItem('app_datetime', new Date().getTime())
        }
        // url标题
@@ -71,42 +121,13 @@
          localStorage.removeItem(_url)
        }
        let _loginurl = window.location.href.split('#')[0] + 'loginways'
        let login_ways = []
        let login_types = []
        if (res.login_ways && res.login_ways.length > 0) {
          res.login_ways.forEach(item => {
            // 短信验证码登录,必须设置短信Id
            if (item.way_no === 'sms_vcode' && !item.sms_id) return
            if (login_types.includes(item.way_no)) return
            login_types.push(item.way_no)
            login_ways.push({
              label: item.way_name,
              type: item.way_no,
              smsId: item.sms_id
            })
          })
        } else {
          login_ways.push({
            label: '账号密码登录',
            type: 'uname_pwd',
            smsId: ''
          })
        }
        try {
          localStorage.setItem(_loginurl, window.btoa(window.encodeURIComponent(JSON.stringify(login_ways))))
        } catch (e) {
          localStorage.removeItem(_loginurl)
        }
        window.GLOB.mainlogo = systemMsg.mainlogo
        window.GLOB.style = systemMsg.style
        window.GLOB.navBar = systemMsg.navBar
        window.GLOB.appVersion = systemMsg.app_version
    
        if (window.GLOB.style && styles[window.GLOB.style]) {
          document.body.className = styles[window.GLOB.style]
          document.body.className = styles[window.GLOB.style] + ' ' + (res.split_line_show === 'false' ? 'hidden-split-line' : '')
        }
        if (res.titlelogo && window.GLOB.favicon !== res.titlelogo) {
@@ -125,6 +146,11 @@
        }
        this.props.history.replace('/main')
      } else {
        notification.warning({
          top: 92,
          message: res.message,
          duration: 5
        })
        this.props.history.replace('/login')
      }
    }, () => {