From 1e4a2c74f6782a1f1e3d745830948f3255871f61 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 30 十一月 2021 21:08:49 +0800 Subject: [PATCH] 2021-11-30 --- src/views/login/index.jsx | 75 ++++++++++++++++++++++++++++++++++++- 1 files changed, 72 insertions(+), 3 deletions(-) diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx index ee716bc..fe62be2 100644 --- a/src/views/login/index.jsx +++ b/src/views/login/index.jsx @@ -328,16 +328,85 @@ 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 -- Gitblit v1.8.0