| | |
| | | let _s = md5('mksoft' + moment().format('YYYYMMDD')) |
| | | authCode = authCode ? authCode.split(',') : [] |
| | | let index = authCode.findIndex(key => key === _s) |
| | | let license = false |
| | | |
| | | let key = md5(window.GLOB.appId + 'minke_software' + window.GLOB.appkey).toUpperCase().substr(-6) |
| | | if (window.GLOB.licenseKey) { |
| | | if (window.GLOB.licenseKey.length !== 20) { |
| | | Modal.warning({ |
| | | title: `本地授权码已失效,请联系管理员。`, |
| | | okText: '知道了' |
| | | }) |
| | | } else { |
| | | let key = md5(window.GLOB.appId + 'minke_software' + window.GLOB.appkey).toUpperCase().substr(-6) |
| | | |
| | | let key1 = window.GLOB.licenseKey.substring(0, 6) |
| | | let key2 = window.GLOB.licenseKey.substring(6, 14) |
| | | let key3 = window.GLOB.licenseKey.substring(14) |
| | | let key4 = md5(key1 + key2).toUpperCase().substr(-6) |
| | | |
| | | if (key === key1 && key3 === key4) { |
| | | let last = window.GLOB.appkey[window.GLOB.appkey.length - 1] |
| | | let offset = 0 |
| | | let keys = {} |
| | | |
| | | if (!isNaN(+last)) { |
| | | offset = (10 - last) % 10 |
| | | } else { |
| | | last = last.charCodeAt() - 65 |
| | | offset = (30 - last) % 10 |
| | | } |
| | | |
| | | for (let i = 0; i < 26; i++) { |
| | | let char = String.fromCharCode(65 + i) |
| | | keys[char] = (offset + i) % 10 |
| | | } |
| | | |
| | | let lictime = +key2.replace(/[A-Z]/ig, (s) => { |
| | | return keys[s] |
| | | }) |
| | | let curtime = +moment().format('YYYYMMDD') |
| | | let licday = lictime - curtime |
| | | let _mindUrl = window.location.href.split('#')[0] + 'notMind' |
| | | |
| | | if (index > -1 || window.GLOB.licenseKey === key) { |
| | | if (licday < 0 || isNaN(licday)) { |
| | | Modal.warning({ |
| | | title: '本地授权码已失效,请联系管理员。', |
| | | okText: '知道了' |
| | | }) |
| | | } else if (licday > 20) { |
| | | license = true |
| | | localStorage.removeItem(_mindUrl) |
| | | } else { |
| | | license = true |
| | | |
| | | if (localStorage.getItem(_mindUrl) !== 'false') { |
| | | Modal.confirm({ |
| | | title: `距离授权到期还剩${licday}天,请联系管理员。`, |
| | | okText: '不在提醒', |
| | | cancelText: '关闭', |
| | | onOk() { |
| | | localStorage.setItem(_mindUrl, 'false') |
| | | }, |
| | | onCancel() {}, |
| | | }) |
| | | } |
| | | } |
| | | } else { |
| | | Modal.warning({ |
| | | title: '本地授权码已失效,请联系管理员。', |
| | | okText: '知道了' |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | | if ((!window.GLOB.licenseKey && index > -1) || license) { |
| | | this.setState({ |
| | | auth: true |
| | | }) |
| | | } |
| | | |
| | | if (window.GLOB.licenseKey !== key && (index === -1 || index > 5)) { |
| | | if (!window.GLOB.licenseKey && (index === -1 || index > 5)) { |
| | | let _appId = window.GLOB.appId |
| | | |
| | | if (options.sysType === 'cloud') { // 云端使用系统配置appid |