Browse Source

登录接口参数加密

temp
duyufeng 3 weeks ago
parent
commit
e8253be8ca
  1. 18
      hx-ai-intelligent/src/view/developing.vue
  2. 4
      hx-op/src/view/systemManage/systemMenu/config.ts
  3. 5
      lib/saas/view/system/login.vue
  4. 24
      lib/util/crypto.ts
  5. 2
      package.json

18
hx-ai-intelligent/src/view/developing.vue

@ -2,7 +2,23 @@
<div class="content">{{ content }}</div> <div class="content">{{ content }}</div>
</template> </template>
<script lang="ts" setup> <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); console.log(useRouter().currentRoute.value.meta);
const content = useRouter().currentRoute.value.meta.title + 'developing'; const content = useRouter().currentRoute.value.meta.title + 'developing';

4
hx-op/src/view/systemManage/systemMenu/config.ts

@ -2,7 +2,6 @@ import { http } from '/nerv-lib/util';
import { ref } from 'vue'; import { ref } from 'vue';
import { menuS } from '/@/api/menuSystem'; import { menuS } from '/@/api/menuSystem';
import { NsMessage } from '/nerv-lib/component'; import { NsMessage } from '/nerv-lib/component';
import { resetRouter } from '/nerv-lib/saas/router';
export const tableConfig = (orgId:any,SystemAddEdit:any,mainRef:any) => { export const tableConfig = (orgId:any,SystemAddEdit:any,mainRef:any) => {
return ref({ return ref({
title: '系统菜单', title: '系统菜单',
@ -15,7 +14,6 @@ export const tableConfig = (orgId:any,SystemAddEdit:any,mainRef:any) => {
name: 'systemMenuAdd', name: 'systemMenuAdd',
type: 'primary', type: 'primary',
handle: () => { handle: () => {
console.log("12345")
SystemAddEdit.value.getMenuList();//请求列表的菜单数据 SystemAddEdit.value.getMenuList();//请求列表的菜单数据
SystemAddEdit.value.toggle(1); SystemAddEdit.value.toggle(1);
// editConfigureDeviceAlarms.value.toggle(null, configureDeviceAlarmsData.value); // editConfigureDeviceAlarms.value.toggle(null, configureDeviceAlarmsData.value);
@ -79,8 +77,6 @@ export const tableConfig = (orgId:any,SystemAddEdit:any,mainRef:any) => {
label: '新增', label: '新增',
name: 'userAdd', name: 'userAdd',
handle: (record: any) => { handle: (record: any) => {
console.log("我是编辑区域11111")
console.log(record)
SystemAddEdit.value.getMenuList();//请求列表的菜单数据 SystemAddEdit.value.getMenuList();//请求列表的菜单数据
SystemAddEdit.value.toggle(1,record); SystemAddEdit.value.toggle(1,record);
} }

5
lib/saas/view/system/login.vue

@ -80,6 +80,7 @@
import { storeToRefs } from 'pinia'; import { storeToRefs } from 'pinia';
import { NsMessage } from '/nerv-lib/component'; import { NsMessage } from '/nerv-lib/component';
import { replyDynamRoutesPath } from '/nerv-lib/util/dynamicRoutesss'; import { replyDynamRoutesPath } from '/nerv-lib/util/dynamicRoutesss';
import { Enobscure, Deobscure } from '/nerv-lib/util/crypto';
export default defineComponent({ export default defineComponent({
name: 'UserLogin', name: 'UserLogin',
@ -124,11 +125,9 @@
} }
}); });
const submit = (value): void => { const submit = (value): void => {
console.log(value);
let data = JSON.stringify({ let data = JSON.stringify({
accountNo: userName.value.trim(), accountNo: userName.value.trim(),
password: password.value.trim(), password: Enobscure(password.value.trim()),
}); });
validator(null, value?.code) validator(null, value?.code)
.then(() => { .then(() => {

24
lib/util/crypto.ts

@ -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);
}

2
package.json

@ -32,6 +32,7 @@
"axios": "^0.27.2", "axios": "^0.27.2",
"clamp": "^1.0.1", "clamp": "^1.0.1",
"codemirror": "^6.0.1", "codemirror": "^6.0.1",
"crypto-js": "^4.2.0",
"dagre": "latest", "dagre": "latest",
"dayjs": "^1.11.2", "dayjs": "^1.11.2",
"echarts": "^5.3.2", "echarts": "^5.3.2",
@ -102,6 +103,7 @@
"devDependencies": { "devDependencies": {
"@amap/amap-jsapi-loader": "^1.0.1", "@amap/amap-jsapi-loader": "^1.0.1",
"@ant-design/colors": "^7.0.0", "@ant-design/colors": "^7.0.0",
"@types/crypto-js": "^4.2.2",
"@types/js-cookie": "^3.0.2", "@types/js-cookie": "^3.0.2",
"@types/js-yaml": "^4.0.5", "@types/js-yaml": "^4.0.5",
"@types/lodash-es": "^4.17.6", "@types/lodash-es": "^4.17.6",

Loading…
Cancel
Save