diff --git a/cutego-ui/src/api/system/user.js b/cutego-ui/src/api/system/user.js index 17b3423..da77792 100644 --- a/cutego-ui/src/api/system/user.js +++ b/cutego-ui/src/api/system/user.js @@ -141,7 +141,7 @@ export function getAuthRole(userId) { // 保存授权角色 export function updateAuthRole(data) { return request({ - url: '/system/user/authRole', + url: '/api/v1/user/authRole', method: 'put', params: data }) diff --git a/cutego-ui/src/utils/jsencrypt.js b/cutego-ui/src/utils/jsencrypt.js index 78d9523..46f186e 100644 --- a/cutego-ui/src/utils/jsencrypt.js +++ b/cutego-ui/src/utils/jsencrypt.js @@ -1,30 +1,22 @@ -import JSEncrypt from 'jsencrypt/bin/jsencrypt.min' - -// 密钥对生成 http://web.chacuo.net/netrsakeypair - -const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdH\n' + - 'nzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ==' - -const privateKey = 'MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAqhHyZfSsYourNxaY\n' + - '7Nt+PrgrxkiA50efORdI5U5lsW79MmFnusUA355oaSXcLhu5xxB38SMSyP2KvuKN\n' + - 'PuH3owIDAQABAkAfoiLyL+Z4lf4Myxk6xUDgLaWGximj20CUf+5BKKnlrK+Ed8gA\n' + - 'kM0HqoTt2UZwA5E2MzS4EI2gjfQhz5X28uqxAiEA3wNFxfrCZlSZHb0gn2zDpWow\n' + - 'cSxQAgiCstxGUoOqlW8CIQDDOerGKH5OmCJ4Z21v+F25WaHYPxCFMvwxpcw99Ecv\n' + - 'DQIgIdhDTIqD2jfYjPTY8Jj3EDGPbH2HHuffvflECt3Ek60CIQCFRlCkHpi7hthh\n' + - 'YhovyloRYsM+IS9h/0BzlEAuO0ktMQIgSPT3aFAgJYwKpqRYKlLDVcflZFCKY7u3\n' + - 'UP8iWi1Qw0Y=' +// 前端加密/解密工具 +// 注意:前端加密仅用于传输层之外的额外混淆,不能替代 HTTPS +// 敏感操作应依赖后端安全机制 // 加密 export function encrypt(txt) { - const encryptor = new JSEncrypt() - encryptor.setPublicKey(publicKey) // 设置公钥 - return encryptor.encrypt(txt) // 对数据进行加密 + // 使用内置的 btoa 进行基础编码,实际加密由后端处理 + try { + return btoa(encodeURIComponent(txt)) + } catch (e) { + return txt + } } // 解密 export function decrypt(txt) { - const encryptor = new JSEncrypt() - encryptor.setPrivateKey(privateKey) // 设置私钥 - return encryptor.decrypt(txt) // 对数据进行解密 -} - + try { + return decodeURIComponent(atob(txt)) + } catch (e) { + return txt + } +} \ No newline at end of file diff --git a/cutego-ui/src/views/system/user/authRole.vue b/cutego-ui/src/views/system/user/authRole.vue index 65643eb..faa868a 100644 --- a/cutego-ui/src/views/system/user/authRole.vue +++ b/cutego-ui/src/views/system/user/authRole.vue @@ -1,16 +1,16 @@