king
2021-04-02 69d182c8cee63fb850a001b0edf4b613e8aa01c2
src/views/login/index.jsx
@@ -40,7 +40,9 @@
    syncApp: false,
    loginWays: null,
    touristLogin: false,
    syncing: false
    syncing: false,
    ipAddress: '',
    city: ''
  }
  changelang (item) {
@@ -75,6 +77,7 @@
   * @param {Object} param 用户名密码等信息
   */
  async loginsubmit (param) {
    const { ipAddress, city } = this.state
    if (options.sysType === 'local' && !window.GLOB.mainSystemApi) { // 业务系统必须设置单点地址
      Modal.warning({
        title: '未设置单点服务器地址,请联系管理员!'
@@ -83,7 +86,7 @@
    }
    // 登录提交
    let res = await Api.getusermsg(param.username, param.password)
    let res = await Api.getusermsg(param.username, param.password, false, ipAddress, city)
    if (res.status) {
      sessionStorage.setItem('UserID', res.UserID)
      sessionStorage.setItem('LoginUID', res.LoginUID)
@@ -145,6 +148,7 @@
  }
  async phoneloginsubmit (param) {
    const { ipAddress, city } = this.state
    if (options.sysType === 'local' && !window.GLOB.mainSystemApi) { // 业务系统必须设置单点地址
      Modal.warning({
        title: '未设置单点服务器地址,请联系管理员!'
@@ -153,7 +157,7 @@
    }
    // 登录提交
    let res = await Api.getphoneusermsg(param.phone, param.vercode)
    let res = await Api.getphoneusermsg(param.phone, param.vercode, false, ipAddress, city)
    if (res.status) {
      sessionStorage.setItem('UserID', res.UserID)
      sessionStorage.setItem('LoginUID', res.LoginUID)
@@ -198,6 +202,15 @@
  }
  componentDidMount () {
    // 获取ip及城市信息
    Api.directRequest('http://epc.mk9h.cn/webapi/iploc', 'get', null, 'true').then(res => {
      if (!res || !res.location) return
      sessionStorage.setItem('city', res.location)
      this.setState({
        ipAddress: res.ip || '',
        city: res.location
      })
    })
    const timeStamp = new Date().getTime()
    const _authUrl = window.location.href.split('#')[0] + 'AuthCode'