登录接口参数加密
This commit is contained in:
@@ -2,7 +2,23 @@
|
||||
<div class="content">{{ content }}</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { useRouter } from 'vue-router';
|
||||
import {ref,inject} from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
const key = ref(0);
|
||||
const router = useRouter();//获取路由实例
|
||||
const route = useRoute();//获取当前路由
|
||||
const getIsshowRefresh = sessionStorage.getItem("isRefrech");
|
||||
console.log(typeof getIsshowRefresh)
|
||||
if(getIsshowRefresh && getIsshowRefresh == "1"){
|
||||
const { fullPath } = route;
|
||||
console.log(fullPath)
|
||||
// location.reload()
|
||||
// router.replace({ path: '/empty' }).then(() => {
|
||||
// router.replace({ path: fullPath });
|
||||
// });
|
||||
sessionStorage.removeItem("isRefrech")
|
||||
}
|
||||
console.log(useRouter().currentRoute.value.meta);
|
||||
|
||||
const content = useRouter().currentRoute.value.meta.title + 'developing';
|
||||
|
@@ -2,7 +2,6 @@ import { http } from '/nerv-lib/util';
|
||||
import { ref } from 'vue';
|
||||
import { menuS } from '/@/api/menuSystem';
|
||||
import { NsMessage } from '/nerv-lib/component';
|
||||
import { resetRouter } from '/nerv-lib/saas/router';
|
||||
export const tableConfig = (orgId:any,SystemAddEdit:any,mainRef:any) => {
|
||||
return ref({
|
||||
title: '系统菜单',
|
||||
@@ -15,7 +14,6 @@ export const tableConfig = (orgId:any,SystemAddEdit:any,mainRef:any) => {
|
||||
name: 'systemMenuAdd',
|
||||
type: 'primary',
|
||||
handle: () => {
|
||||
console.log("12345")
|
||||
SystemAddEdit.value.getMenuList();//请求列表的菜单数据
|
||||
SystemAddEdit.value.toggle(1);
|
||||
// editConfigureDeviceAlarms.value.toggle(null, configureDeviceAlarmsData.value);
|
||||
@@ -79,8 +77,6 @@ export const tableConfig = (orgId:any,SystemAddEdit:any,mainRef:any) => {
|
||||
label: '新增',
|
||||
name: 'userAdd',
|
||||
handle: (record: any) => {
|
||||
console.log("我是编辑区域11111")
|
||||
console.log(record)
|
||||
SystemAddEdit.value.getMenuList();//请求列表的菜单数据
|
||||
SystemAddEdit.value.toggle(1,record);
|
||||
}
|
||||
|
@@ -80,6 +80,7 @@
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { NsMessage } from '/nerv-lib/component';
|
||||
import { replyDynamRoutesPath } from '/nerv-lib/util/dynamicRoutesss';
|
||||
import { Enobscure, Deobscure } from '/nerv-lib/util/crypto';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'UserLogin',
|
||||
@@ -124,11 +125,9 @@
|
||||
}
|
||||
});
|
||||
const submit = (value): void => {
|
||||
console.log(value);
|
||||
|
||||
let data = JSON.stringify({
|
||||
accountNo: userName.value.trim(),
|
||||
password: password.value.trim(),
|
||||
password: Enobscure(password.value.trim()),
|
||||
});
|
||||
validator(null, value?.code)
|
||||
.then(() => {
|
||||
|
24
lib/util/crypto.ts
Normal file
24
lib/util/crypto.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import * as CryptoJS from 'crypto-js';
|
||||
const key = CryptoJS.enc.Utf8.parse("1234567890123456");
|
||||
const iv = CryptoJS.enc.Utf8.parse("1234567890123456");
|
||||
//加密方法,key:秘钥,iv:id
|
||||
export const Enobscure = (word:any) => {
|
||||
const srcs = CryptoJS.enc.Utf8.parse(word);
|
||||
const encrypted = CryptoJS.AES.encrypt(srcs, key, {
|
||||
iv: iv,
|
||||
mode: CryptoJS.mode.CBC,
|
||||
padding: CryptoJS.pad.Pkcs7,
|
||||
});
|
||||
return CryptoJS.enc.Base64.stringify(encrypted.ciphertext);
|
||||
}
|
||||
//解密方法
|
||||
export const Deobscure = (word:any) => {
|
||||
const base64 = CryptoJS.enc.Base64.parse(word);
|
||||
const src = CryptoJS.enc.Base64.stringify(base64);
|
||||
const decrypt = CryptoJS.AES.decrypt(src, key, {
|
||||
iv: iv,
|
||||
mode: CryptoJS.mode.CBC,
|
||||
padding: CryptoJS.pad.Pkcs7,
|
||||
});
|
||||
return CryptoJS.enc.Utf8.stringify(decrypt);
|
||||
}
|
@@ -32,6 +32,7 @@
|
||||
"axios": "^0.27.2",
|
||||
"clamp": "^1.0.1",
|
||||
"codemirror": "^6.0.1",
|
||||
"crypto-js": "^4.2.0",
|
||||
"dagre": "latest",
|
||||
"dayjs": "^1.11.2",
|
||||
"echarts": "^5.3.2",
|
||||
@@ -102,6 +103,7 @@
|
||||
"devDependencies": {
|
||||
"@amap/amap-jsapi-loader": "^1.0.1",
|
||||
"@ant-design/colors": "^7.0.0",
|
||||
"@types/crypto-js": "^4.2.2",
|
||||
"@types/js-cookie": "^3.0.2",
|
||||
"@types/js-yaml": "^4.0.5",
|
||||
"@types/lodash-es": "^4.17.6",
|
||||
|
Reference in New Issue
Block a user