From 27821f7b598e9e87de8fb179bdcbfdc5e2cb31fa Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 25 九月 2019 00:17:55 +0800
Subject: [PATCH] 2019-09-25update

---
 src/locales/zh-CN/main.js           |    4 
 src/components/header/index.jsx     |   17 +-
 src/components/mainAction/index.jsx |   49 ++++-
 src/router/index.js                 |   12 +
 src/locales/zh-CN/login.js          |    3 
 src/store/options.js                |    4 
 src/api/index.js                    |   67 +++++++-
 src/components/mainTable/index.jsx  |   58 ++++++
 package.json                        |    3 
 src/components/mainTable/index.scss |   17 ++
 src/locales/en-US/main.js           |    4 
 src/components/sidemenu/index.jsx   |   28 +++
 src/tabviews/commontable/index.jsx  |   63 +++++++
 src/locales/en-US/login.js          |    3 
 src/views/login/index.jsx           |   95 +++++++++--
 15 files changed, 365 insertions(+), 62 deletions(-)

diff --git a/package.json b/package.json
index c3d8529..1b8cbdc 100644
--- a/package.json
+++ b/package.json
@@ -142,5 +142,6 @@
     "presets": [
       "react-app"
     ]
-  }
+  },
+  "homepage": "."
 }
diff --git a/src/api/index.js b/src/api/index.js
index cdd6846..a8d4518 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -1,18 +1,20 @@
 import axios from 'axios'
+import qs from 'qs'
 
 axios.defaults.crossDomain = true
-axios.defaults.headers.common['token'] = 'token'
+// axios.defaults.headers.common['token'] = 'token'
 axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'
 axios.defaults.withCredentials = true
 
 axios.interceptors.request.use((config) => {
-  config.url = config.url || '/dostar'
   config.method = 'post'
-  config.data = config.data || {}
-  if (config.url !== '/login') {
-    config.data.userid = sessionStorage.getItem('UserID') || ''
+  config.headers.token = sessionStorage.getItem('TOKEN') || ''
+  if (config.url.includes('LoginAndRedirect')) {
+    config.data = qs.stringify(config.data)
+  } else {
+    config.data = JSON.stringify(config.data)
   }
-  config.data = JSON.stringify(config.data)
+
   return config
 }, (error) => {
   return Promise.reject(error)
@@ -27,11 +29,40 @@
 class Api {
   constructor() {
     if (process.env.NODE_ENV === 'production') {
-      axios.defaults.baseURL = document.location.origin + '/' + window.Glob.Service
+      axios.defaults.baseURL = document.location.origin + '/MKWMS'
     } else {
       axios.defaults.baseURL = 'http://127.0.0.1:8888'
     }
   }
+
+  /**
+   * @description 绯荤粺鎺堟潈
+   */
+  systemauth (appId, timestamp) {
+    return axios({
+      // url: 'http://minkesoft.com/mksepc/webapi/dostar',
+      url: '/mksepc',
+      data: {
+        func: 'sEmpowerCloud_Get_LinkUrl',
+        userid: '',
+        AppID: appId,
+        TimeStamp: timestamp
+      }
+    })
+  }
+  
+  // /**
+  //  * @description 鐧诲綍绯荤粺
+  //  */
+  // loginsystem (username, password) {
+  //   return axios({
+  //     url: 'http://qingqiumarket.cn/MKWMS/zh-CN/Home/LoginAndRedirect',
+  //     data: {
+  //       Username: username,
+  //       Password: password
+  //     }
+  //   })
+  // }
 
   /**
    * @description 鐧诲綍绯荤粺
@@ -53,7 +84,8 @@
     return axios({
       url: '/dostar',
       data: {
-        func: 'logout'
+        func: 'logout',
+        userid: sessionStorage.getItem('UserID')
       }
     })
   }
@@ -66,6 +98,7 @@
       url: '/dostar',
       data: {
         func: 'ResetPassword',
+        userid: sessionStorage.getItem('UserID'),
         OriginPwd: originpwd,
         NewPwd: newpwd
       }
@@ -79,7 +112,8 @@
     return axios({
       url: '/dostar',
       data: {
-        func: 'GetTopMenus'
+        func: 'GetTopMenus',
+        userid: sessionStorage.getItem('UserID')
       }
     })
   }
@@ -93,6 +127,7 @@
       url: '/dostar',
       data: {
         func: 'GetSubMenus',
+        userid: sessionStorage.getItem('UserID'),
         ParentID: menuId
       }
     })
@@ -107,6 +142,7 @@
       url: '/dostar',
       data: {
         func: 'GetMainConfigs',
+        userid: sessionStorage.getItem('UserID'),
         MenuNo: MenuNo
       }
     })
@@ -121,6 +157,7 @@
       url: '/dostar',
       data: {
         func: 'GetMainData',
+        userid: sessionStorage.getItem('UserID'),
         MenuNo: MenuNo,
         PageIndex: pageIndex,
         PageSize: pageSize,
@@ -130,6 +167,18 @@
       }
     })
   }
+
+  /**
+   * @description 鑾峰彇椤甸潰鍒楄〃鏁版嵁
+   * @param {String} param 鎻愪氦鍙傛暟
+   */
+  setActionSubmit (param) {
+    param.userid = sessionStorage.getItem('UserID')
+    return axios({
+      url: '/dostar',
+      data: param
+    })
+  }
 }
 
 export default new Api()
\ No newline at end of file
diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx
index d4204be..993a191 100644
--- a/src/components/header/index.jsx
+++ b/src/components/header/index.jsx
@@ -27,7 +27,7 @@
   state = {
     menulist: null,
     visible: false,
-    dict: (!sessionStorage.getItem('lang') || sessionStorage.getItem('lang') === 'zh-CN') ? zhCN : enUS,
+    dict: (!localStorage.getItem('lang') || localStorage.getItem('lang') === 'zh-CN') ? zhCN : enUS,
     confirmLoading: false
   }
 
@@ -98,7 +98,6 @@
         return Api.logoutsystem().then(res => {
           if (res.status) {
             sessionStorage.removeItem('UserID')
-            sessionStorage.removeItem('lang')
             _this.props.resetState()
             _this.props.history.replace('/login')
           } else {
@@ -120,15 +119,17 @@
     let result = await Api.getMainMenuData()
     if (result.status) {
       this.setState({
-        menulist: result.data.map((menu, index) => { // 澧炲姞绱㈠紩锛岀敤浜庢墦寮�鏂伴〉闈㈡椂鏌ヨ鑿滃崟
-          menu.index = index
-          return menu
-        })
+        menulist: result.data
       })
       let param = sessionStorage.getItem('view_param') // 鏄惁涓烘墦寮�鏂伴〉闈�
       if (param) {
-        let i = parseInt(param.split('&')[0])
-        this.props.modifyMainMenu(result.data[i] || result.data[0])
+        // 閫氳繃url涓璵enuid绛涢�夊嚭閫変腑鐨勪富鑿滃崟
+        let id = param.split('&')[0]
+        let _menu = result.data.filter(item => item.MenuID === id)[0]
+        if (!_menu) {
+          sessionStorage.removeItem('view_param')
+        }
+        this.props.modifyMainMenu(_menu || result.data[0])
       } else {
         this.props.modifyMainMenu(result.data[0])
       }
diff --git a/src/components/mainAction/index.jsx b/src/components/mainAction/index.jsx
index 95df621..f99b8fb 100644
--- a/src/components/mainAction/index.jsx
+++ b/src/components/mainAction/index.jsx
@@ -1,13 +1,15 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 // import { is, fromJS } from 'immutable'
-import { Button, Affix, Modal } from 'antd'
+import { Button, Affix, Modal, notification } from 'antd'
+import Api from '@/api'
 import './index.scss'
 
 const { confirm } = Modal
 
 class MainAction extends Component {
   static propTpyes = {
+    MenuNo: PropTypes.string,
     actions: PropTypes.array, // 鎼滅储鏉′欢鍒楄〃
     dict: PropTypes.object, // 瀛楀吀椤�
     fixed: PropTypes.any
@@ -16,20 +18,47 @@
   state = {
 
   }
-
+  
+  refreshdata = () => {
+    this.props.refreshdata()
+  }
   actionTrigger = (item) => {
+    let _this = this
+    let data = this.props.gettableselected()
+    if (item.Ot === 'required' && (!data || data.length === 0)) {
+      // 闇�瑕侀�夋嫨琛屾椂锛屾牎楠屾暟鎹�
+      notification.warning({
+        top: 92,
+        message: this.props.dict['main.action.confirm.selectline']
+      })
+      return
+    }
+
     if (item.Action === 'Prompt' || item.Action === 'Delete') {
       confirm({
         title: this.props.dict['main.action.confirm.tip'],
-        // content: 'Some descriptions',
         onOk() {
-          return new Promise((resolve, reject) => {
-            setTimeout(Math.random() > 0.5 ? resolve : reject, 1000)
-          }).catch(() => console.log('Oops errors!'))
+          return Api.setActionSubmit({
+            func: 'SetActionSubmitSuccess'
+            // func: 'SetActionSubmitError'
+          }).then((res) => {
+            if (res.status) {
+              notification.success({
+                top: 92,
+                message: _this.props.dict['main.action.confirm.success']
+                // duration: 0
+                // description:
+              })
+              _this.refreshdata()
+            } else {
+              notification.error({
+                top: 92,
+                message: res.message
+              })
+            }
+          })
         },
-        onCancel() {
-          console.log('Cancel')
-        }
+        onCancel() {}
       })
     }
   }
@@ -47,7 +76,7 @@
     if (this.props.fixed) { // 鎸夐挳鏄惁鍥哄畾鍦ㄥご閮�
       return (
         <Affix offsetTop={48}>
-          <div className="button-list">
+          <div className="button-list" id={this.props.MenuNo + 'mainaction'}>
             {this.props.actions.map((item, index) => {
               return (
                 <Button
diff --git a/src/components/mainTable/index.jsx b/src/components/mainTable/index.jsx
index b742eda..2289e12 100644
--- a/src/components/mainTable/index.jsx
+++ b/src/components/mainTable/index.jsx
@@ -1,10 +1,13 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { Table, Icon, message } from 'antd'
+// import { is, fromJS } from 'immutable'
+import { Table, Icon, message, Affix } from 'antd'
 import './index.scss'
 
 export default class MainTable extends Component {
   static propTpyes = {
+    MenuNo: PropTypes.string, // 鑿滃崟鍙傛暟
+    fixed: PropTypes.object, // 琛ㄦ牸澶撮儴鏄惁鍥哄畾浜庨〉闈笂鏂�
     loading: PropTypes.bool,
     total: PropTypes.number,
     select: PropTypes.object,
@@ -59,15 +62,22 @@
   }
 
   changeRow = (record, index) => {
-    // 鐐瑰嚮鏁磋锛岃Е鍙戝垏鎹�
+    // 鐐瑰嚮鏁磋锛岃Е鍙戝垏鎹紝鍒ゆ柇鏄惁鍙�夛紝鍗曢�夋垨澶氶�夛紝杩涜瀵瑰簲鎿嶄綔
+    if (!this.props.select || !this.props.select.selectable) return
+
     let newkeys = JSON.parse(JSON.stringify(this.state.selectedRowKeys))
     let _re = newkeys.includes(index)
-    if (_re) {
-      newkeys = newkeys.filter(item => item !== index)
+
+    if (this.props.select.selectType === 'radio') {
+      this.setState({ selectedRowKeys: [index] })
     } else {
-      newkeys.push(index)
+      if (_re) {
+        newkeys = newkeys.filter(item => item !== index)
+      } else {
+        newkeys.push(index)
+      }
+      this.setState({ selectedRowKeys: newkeys })
     }
-    this.setState({ selectedRowKeys: newkeys })
   }
 
   changeTable = (pagination, filters, sorter) => {
@@ -77,6 +87,13 @@
       selectedRowKeys: []
     })
     this.props.refreshdata(pagination, filters, sorter)
+  }
+
+  resetTable = () => {
+    this.setState({
+      pageIndex: 1,
+      selectedRowKeys: []
+    })
   }
 
   render() {
@@ -89,8 +106,37 @@
         onChange: this.onSelectChange
       }
     }
+    let offset = null
+    if (this.props.fixed.fixtable) {
+      // 琛ㄦ牸澶撮儴鍥哄畾浜庨《閮ㄦ椂锛屽垽鏂窛椤堕儴楂樺害
+      if (!this.props.fixed.fixaction) {
+        offset = 48
+      } else {
+        let box = document.getElementById(this.props.MenuNo + 'mainaction')
+        if (box) {
+          offset = 48 + box.offsetHeight
+        } else {
+          offset = 105
+        }
+      }
+    }
     return (
       <div className="main-table">
+        {this.props.fixed.fixtable && <Affix offsetTop={offset} className="fix-header">
+          <Table
+            bordered={true}
+            rowSelection={rowSelection}
+            size="middle"
+            columns={this.state.columns.map(column => {
+              return {
+                align: column.align,
+                dataIndex: column.dataIndex,
+                title: column.title,
+                width: column.width
+              }
+            })}
+          />
+        </Affix>}
         <Table
           bordered={true}
           rowSelection={rowSelection}
diff --git a/src/components/mainTable/index.scss b/src/components/mainTable/index.scss
index 5b42d38..12469f9 100644
--- a/src/components/mainTable/index.scss
+++ b/src/components/mainTable/index.scss
@@ -47,4 +47,21 @@
     border: 1px solid rgba(0, 0, 0, 0.07);
     background: rgba(0, 0, 0, 0);
   }
+  .fix-header {
+    .ant-table-body {
+      min-height: unset
+    }
+    .ant-table-placeholder {
+      display: none;
+    }
+    .ant-table-wrapper {
+      display: none;
+    }
+    .ant-affix .ant-table-wrapper {
+      display: block;
+    }
+    // .ant-table-column-sorter, .anticon-filter {
+    //   display: none;
+    // }
+  }
 }
\ No newline at end of file
diff --git a/src/components/sidemenu/index.jsx b/src/components/sidemenu/index.jsx
index 54ace05..f1dfe5a 100644
--- a/src/components/sidemenu/index.jsx
+++ b/src/components/sidemenu/index.jsx
@@ -29,7 +29,7 @@
     let result = await Api.getSubMenuData(menu.MenuID)
     if (result.status) {
       let param = sessionStorage.getItem('view_param') // 鏄惁涓烘墦寮�鏂伴〉闈�
-      let msg = sessionStorage.getItem('UserID') + '&' + sessionStorage.getItem('lang')
+      let msg = sessionStorage.getItem('UserID')
       let submenuindex = 0 // 灞曞紑浜岀骇鑿滃崟绱㈠紩
       let tabindex = null // 鎵撳紑鐨則ab椤�
       if (param) {
@@ -43,7 +43,7 @@
         subMenulist: result.data.map((item, i) => {
           if (item.children) {
             item.children = item.children.map((child, n) => {
-              let _msg = window.btoa(menu.index + '&' + i + '&' + n + '&' + msg)
+              let _msg = window.btoa(menu.MenuID + '&' + i + '&' + n + '&' + msg)
               child.src = '#/main/' + _msg
               return child
             })
@@ -96,6 +96,30 @@
     }
   }
 
+  // componentDidMount () {
+  //   this.props.modifyTabview([{
+  //     Action: "Index",
+  //     Deleted: "0",
+  //     IsButton: "0",
+  //     LinkUrl: "Main/Index?MenuNo=SRMPurchaseOrderM",
+  //     MenuID: "MM02130020118001000170",
+  //     MenuName: "閲囪喘鍗曠鐞�",
+  //     MenuNo: "SRMPurchaseOrderM",
+  //     Ot: "",
+  //     ParentID: "MM021300201180010",
+  //     Remark: "",
+  //     Sort: "100",
+  //     icon: "Content/Upload/2018-07-02/2018070216084721656911_199046432321408044.png",
+  //     id: "MM02130020118001000170",
+  //     pid: "MM021300201180010",
+  //     sIcon: "Content/Upload/2018-07-02/2018070216084721656911_199046432321408044.png",
+  //     selected: true,
+  //     src: "#/main/MCYwJjAmVTAwMDAwMDAwMSZudWxs",
+  //     text: "閲囪喘鍗曠鐞�",
+  //     url: null
+  //   }])
+  // }
+
   onOpenChange = openKeys => {
     const latestOpenKey = openKeys.find(key => this.state.openKeys.indexOf(key) === -1)
     if (this.state.rootSubmenuKeys.indexOf(latestOpenKey) === -1) {
diff --git a/src/locales/en-US/login.js b/src/locales/en-US/login.js
index d46de10..66c78e1 100644
--- a/src/locales/en-US/login.js
+++ b/src/locales/en-US/login.js
@@ -1,4 +1,7 @@
 export default {
+  'login.auth.tip': 'The system is not authorized, please contact the administrator.',
+  'login.auth.ok': 'OK',
+  'login.auth.cancel': 'Cancel',
   'login.username': 'Username',
   'login.username.empty': 'Please input your username!',
   'login.password': 'Password',
diff --git a/src/locales/en-US/main.js b/src/locales/en-US/main.js
index 6e94caf..4d230f9 100644
--- a/src/locales/en-US/main.js
+++ b/src/locales/en-US/main.js
@@ -4,5 +4,7 @@
   'main.copy.success': 'Copy success',
   'main.pagination.of': 'of',
   'main.pagination.items': 'items',
-  'main.action.confirm.tip': 'Do you want to execute?'
+  'main.action.confirm.tip': 'Do you want to execute?',
+  'main.action.confirm.success': 'Execute successfully!',
+  'main.action.confirm.selectline': 'Please select a line!'
 }
\ No newline at end of file
diff --git a/src/locales/zh-CN/login.js b/src/locales/zh-CN/login.js
index 586f70a..5b6f0d0 100644
--- a/src/locales/zh-CN/login.js
+++ b/src/locales/zh-CN/login.js
@@ -1,4 +1,7 @@
 export default {
+  'login.auth.tip': '绯荤粺鏈巿鏉冿紝璇疯仈绯荤鐞嗗憳銆�',
+  'login.auth.ok': '纭畾',
+  'login.auth.cancel': '鍙栨秷',
   'login.username': '鐢ㄦ埛鍚�',
   'login.username.empty': '璇疯緭鍏ョ敤鎴峰悕!',
   'login.password': '瀵嗙爜',
diff --git a/src/locales/zh-CN/main.js b/src/locales/zh-CN/main.js
index e50cc85..d519a99 100644
--- a/src/locales/zh-CN/main.js
+++ b/src/locales/zh-CN/main.js
@@ -4,5 +4,7 @@
   'main.copy.success': '澶嶅埗鎴愬姛',
   'main.pagination.of': '鍏�',
   'main.pagination.items': '鏉�',
-  'main.action.confirm.tip': '纭畾瑕佹墽琛屽悧?'
+  'main.action.confirm.tip': '纭畾瑕佹墽琛屽悧?',
+  'main.action.confirm.success': '鎵ц鎴愬姛锛�',
+  'main.action.confirm.selectline': '璇烽�夋嫨琛�!'
 }
\ No newline at end of file
diff --git a/src/router/index.js b/src/router/index.js
index c904a39..d24638a 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -1,5 +1,7 @@
 import React, {Component} from 'react'
 import {HashRouter, Switch, Route, Redirect} from 'react-router-dom'
+import moment from 'moment'
+import md5 from 'md5'
 import asyncComponent from '@/utils/asyncComponent'
 const main = asyncComponent(() => import('@/views/main'))
 const login = asyncComponent(() => import('@/views/login'))
@@ -23,15 +25,19 @@
       return (<Redirect to={{ pathname: '/main'}}/>)
     }
     
-    let userId = sessionStorage.getItem('UserID')
-    if (userId) {
+    let userId = sessionStorage.getItem('UserID') // 鍒ゆ柇鏄惁瀛樺湪userid
+
+    let authCode = localStorage.getItem('AuthCode') // 鍒ゆ柇绯荤粺鏄惁鍦ㄦ巿鏉冩湡闄愬唴
+    let _s = md5('mksoft' + moment().format('YYYYMMDD'))
+    let isauth = authCode && authCode.includes(_s)
+
+    if (userId && isauth) {
       return (<item.component {...props}/>)
     } else {
       let param = sessionStorage.getItem('view_param')
       if (param) {
         param = param.split('&')
         sessionStorage.setItem('UserID', param[3])
-        sessionStorage.setItem('lang', param[4])
         return (<item.component {...props}/>)
       } else {
         return (<Redirect to={{ pathname: '/login', state: {from: props.location}}}/>)
diff --git a/src/store/options.js b/src/store/options.js
new file mode 100644
index 0000000..bb3cfcd
--- /dev/null
+++ b/src/store/options.js
@@ -0,0 +1,4 @@
+// 绯荤粺閰嶇疆
+export default {
+  AppId: '2019092321511819778303670F4A640128471'
+}
\ No newline at end of file
diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx
index 6e4aa5d..2bccedc 100644
--- a/src/tabviews/commontable/index.jsx
+++ b/src/tabviews/commontable/index.jsx
@@ -31,7 +31,8 @@
       orderColumn: '',
       orderType: '',
       search: ''
-    }
+    },
+    fixed: {}
   }
 
   async loadconfig () {
@@ -54,7 +55,11 @@
         newconfig.columns = result.columns.map(column => {
           return column
         })
-        newconfig.columns.length = 4
+        newconfig.columns.length = 5
+      }
+      newconfig.fixed = {
+        fixaction: true,
+        fixtable: true
       }
       newconfig.select = result.select
       this.setState(newconfig)
@@ -78,6 +83,7 @@
   }
 
   refreshbysearch = (searches) => {
+    // 鎼滅储鏉′欢鍙樺寲
     this.loadmaindata(this.state.param.pageIndex, this.state.param.pageSize, this.state.param.orderColumn, this.state.param.orderType, searches)
     let param = Object.assign({}, this.state.param, {
       search: searches
@@ -89,6 +95,7 @@
   }
 
   refreshbytable = (pagination, filters, sorter) => {
+    // 琛ㄦ牸鏌ヨ鏉′欢淇敼
     console.log(filters)
     if (sorter.order) {
       let _chg = {
@@ -108,6 +115,24 @@
       loading: true,
       param: param
     })
+  }
+
+  refreshbyaction = () => {
+    // 鎸夐挳鎿嶄綔鍚庡埛鏂拌〃鏍�,閲嶇疆椤电爜鍙婇�夋嫨椤�
+    this.refs.mainTable.resetTable()
+    this.loadmaindata(1, this.state.param.pageSize, this.state.param.orderColumn, this.state.param.orderType, this.state.param.search)
+    this.setState({
+      loading: true
+    })
+  }
+
+  gettableselected = () => {
+    // 鑾峰彇琛ㄦ牸閫夋嫨椤�
+    let data = []
+    this.refs.mainTable.state.selectedRowKeys.forEach(item => {
+      data.push(this.refs.mainTable.props.data[item])
+    })
+    return data
   }
 
   copyMenuNo = (e) => {
@@ -136,9 +161,37 @@
     return (
       <div className="commontable">
         {!this.state.searchlist && <Loading />}
-        {this.state.searchlist && <MainSearch refreshdata={this.refreshbysearch} searchlist={this.state.searchlist} dict={this.state.dict} />}
-        {this.state.actions && <MainAction fixed={true} actions={this.state.actions} dict={this.state.dict} />}
-        {this.state.columns && <MainTable refreshdata={this.refreshbytable} columns={this.state.columns} data={this.state.data} select={this.state.select} total={this.state.total} loading={this.state.loading} dict={this.state.dict} />}
+        {this.state.searchlist &&
+          <MainSearch
+            refreshdata={this.refreshbysearch}
+            searchlist={this.state.searchlist}
+            dict={this.state.dict}
+          />
+        }
+        {this.state.actions &&
+          <MainAction
+            MenuNo={this.props.MenuNo}
+            fixed={this.state.fixed.fixaction}
+            refreshdata={this.refreshbyaction}
+            gettableselected={this.gettableselected}
+            actions={this.state.actions}
+            dict={this.state.dict}
+          />
+        }
+        {this.state.columns &&
+          <MainTable
+            ref="mainTable"
+            MenuNo={this.props.MenuNo}
+            fixed={this.state.fixed}
+            refreshdata={this.refreshbytable}
+            columns={this.state.columns}
+            data={this.state.data}
+            select={this.state.select}
+            total={this.state.total}
+            loading={this.state.loading}
+            dict={this.state.dict}
+          />
+        }
         <Button className="main-copy" icon="copy" onClick={this.copyMenuNo} shape="circle" />
         <BackTop>
           <div className="ant-back-top">
diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx
index 18b6ecf..ef1511d 100644
--- a/src/views/login/index.jsx
+++ b/src/views/login/index.jsx
@@ -1,27 +1,43 @@
 import React, {Component} from 'react'
-import { Form, Icon, Input, Button, Checkbox, Dropdown, Menu, message } from 'antd'
+import { Form, Icon, Input, Button, Checkbox, Dropdown, Menu, message, Modal } from 'antd'
 import md5 from 'md5'
+import moment from 'moment'
 import Api from '@/api'
 import zhCN from '@/locales/zh-CN/login.js'
 import enUS from '@/locales/en-US/login.js'
+import options from '@/store/options.js'
 import logourl from '../../assets/img/login-logo.png'
 import './index.scss'
 
+const { confirm } = Modal
+
 class Login extends Component {
-  state = {
-    langs: [{
-      name: '涓枃绠�浣�',
-      value: 'zh-CN'
-    }, {
-      name: 'English',
-      value: 'en-US'
-    }],
-    selectedlang: {
-      name: '涓枃绠�浣�',
-      value: 'zh-CN'
-    },
-    dict: zhCN,
-    isDisabled: false
+  constructor (props) {
+    super(props)
+
+    const iszhCN = !localStorage.getItem('lang') || localStorage.getItem('lang') === 'zh-CN'
+
+    this.state = {
+      langs: [{
+        name: '涓枃绠�浣�',
+        value: 'zh-CN'
+      }, {
+        name: 'English',
+        value: 'en-US'
+      }],
+      selectedlang: iszhCN ?
+        {
+          name: '涓枃绠�浣�',
+          value: 'zh-CN'
+        } :
+        {
+          name: 'English',
+          value: 'en-US'
+        },
+      dict: iszhCN ? zhCN : enUS,
+      isDisabled: false,
+      auth: false
+    }
   }
 
   changelang (item) {
@@ -36,11 +52,22 @@
     // md5瀵嗙爜鍔犲瘑
     const salt = 'minkesoft'
     return md5(md5(pwd + salt))
+    // return pwd
   }
 
   handleSubmit = e => {
     // 鐧诲綍鍙傛暟妫�楠�
     e.preventDefault()
+    if (!this.state.auth) {
+      confirm({
+        title: this.state.dict['login.auth.tip'],
+        okText: this.state.dict['login.auth.ok'],
+        cancelText: this.state.dict['login.auth.cancel'],
+        onOk() {},
+        onCancel() {}
+      })
+      return
+    }
     this.props.form.validateFields((err, values) => {
       if (err) return
       this.setState({
@@ -55,8 +82,9 @@
     let password = this.md5Password(param.password)
     let result = await Api.loginsystem(param.username, password)
     if (result.status) {
+    // if (!result.IsError) {
       sessionStorage.setItem('UserID', result.userid)
-      sessionStorage.setItem('lang', this.state.selectedlang.value)
+      localStorage.setItem('lang', this.state.selectedlang.value)
 
       if (param.remember) { // 璁颁綇瀵嗙爜鏃惰处鍙峰瘑鐮佸瓨鍏ocalStorage
         localStorage.setItem('username', param.username)
@@ -74,12 +102,47 @@
       }
     } else {
       message.warning(result.message)
+      // message.warning(result.Message)
       this.setState({
         isDisabled: false
       })
     }
   }
 
+  UNSAFE_componentWillMount () {
+    let timeStamp = new Date().getTime()
+    // let str = md5('MK19' + options.AppId + timeStamp)
+    Api.systemauth(options.AppId, timeStamp).then(res => {
+      if (res.status) {
+        let box = []
+        for (let i = 0; i < 15; i++) {
+          let s = 'mksoft' + moment().add(i, 'days').format('YYYYMMDD')
+          box.push(md5(s))
+        }
+        box = box.join(',')
+        localStorage.setItem('AuthCode', box)
+
+        this.setState({
+          auth: true
+        })
+      } else {
+        localStorage.removeItem('AuthCode')
+        this.setState({
+          auth: false
+        })
+      }
+      // console.log(str)
+    })
+
+    let authCode = localStorage.getItem('AuthCode')
+    let _s = md5('mksoft' + moment().format('YYYYMMDD'))
+    if (authCode && authCode.includes(_s)) {
+      this.setState({
+        auth: true
+      })
+    }
+  }
+
   render () {
     const { getFieldDecorator } = this.props.form
     const menu = (

--
Gitblit v1.8.0