king
2020-04-15 a45ebcabfb93f05d8c0550edb9659b50c227c5cc
src/tabviews/managetable/secretKeyTable/index.jsx
@@ -7,7 +7,7 @@
import zhCN from '@/locales/zh-CN/main.js'
import enUS from '@/locales/en-US/main.js'
import options from '@/store/options.js'
import { buttonConfig, tabConfig } from './config'
import { buttonConfig, tabConfig, refCodes } from './config'
import SubTable from '@/tabviews/zshare/normalTable'
import SubAction from './actionList'
@@ -150,32 +150,40 @@
    let result = await Api.getLocalConfig(param)
    if (result.status) {
      // let _data = result.secret_param
      let str = result.secret_param
      let _data = [
        {uuid: 'sso_system', public: 'a', private: 'apple', keyType: 'sso'},
        {uuid: 'local_system', public: 'b', private: 'banana', keyType: 'local'},
        {uuid: 'other_system1', public: 'c', private: 'cherry', keyType: 'other'},
        {uuid: 'other_system2', public: 'd', private: 'damson', keyType: 'other'}
      ]
      _data = _data.map((item, index) => {
        item.key = index
        return item
      })
      // Math.floor(Math.random()*10)
      try {
        if (str) {
          str = str.substring(1)
          str = window.atob(str)
          refCodes.forEach(item => {
            str = str.replace(new RegExp(item.md5str, 'g'), item.char)
          })
          str = JSON.parse(window.decodeURIComponent(window.atob(str)))
        }
      } catch {
        str = ''
      }
      if (!str) {
        this.setState({
          loading: false
          loading: false,
          pickup: false,
          data: []
        })
        notification.error({
          top: 92,
          message: '密钥组数据格式错误,请恢复默认设置后,重新添加!',
          message: '密钥组数据丢失或格式错误,请恢复默认设置,重新添加!',
          duration: 15
        })
        return
      }
      let _data = str.map((item, index) => {
        item.key = index
        return item
      })
      this.setState({
        data: _data,
        pickup: false,