fix: 树样式错乱bug修改
* fix: 登录加密 * fix: 登录加密功能 * fix: 树样式错乱bug修改
This commit is contained in:
parent
d28fb618a2
commit
f41a209cd5
|
@ -15,8 +15,6 @@
|
|||
checkable
|
||||
@check="onCheck"
|
||||
:height="600"
|
||||
:showLine="{ showLeafIcon: false }"
|
||||
:show-icon="true"
|
||||
>
|
||||
<template #title="{ name, key }">
|
||||
<span
|
||||
|
|
|
@ -129,8 +129,9 @@ import { TOKEN_KEY } from '@/utils/variable'
|
|||
import { Form } from 'ant-design-vue'
|
||||
|
||||
import { applicationInfo, bindAccount } from '@/api/bind'
|
||||
import { code, authLogin, userDetail } from '@/api/login'
|
||||
import { code, authLogin, userDetail , authLoginConfig} from '@/api/login'
|
||||
import { useSystem } from '@/store/system'
|
||||
import {encrypt} from '@/utils/encrypt'
|
||||
|
||||
const useForm = Form.useForm;
|
||||
const systemStore = useSystem();
|
||||
|
@ -175,15 +176,17 @@ const getUrlCode = () => {
|
|||
const bindUser = ref<any>({ appName: '' })
|
||||
const getAppInfo = async () => {
|
||||
const code = getUrlCode()
|
||||
const { result } = await applicationInfo(code)
|
||||
bindUser.value = result
|
||||
const { result,success } = await applicationInfo(code)
|
||||
bindUser.value = result || {}
|
||||
|
||||
if (result.applicationProvider === 'dingtalk-ent-app') {
|
||||
bindUser.value.appName = '钉钉'
|
||||
} else if (result.applicationProvider === 'wechat-webapp') {
|
||||
bindUser.value.appName = '微信'
|
||||
} else {
|
||||
bindUser.value.appName = result.applicationName
|
||||
if(success){
|
||||
if (result?.applicationProvider === 'dingtalk-ent-app') {
|
||||
bindUser.value.appName = '钉钉'
|
||||
} else if (result?.applicationProvider === 'wechat-webapp') {
|
||||
bindUser.value.appName = '微信'
|
||||
} else {
|
||||
bindUser.value.appName = result?.applicationName
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -239,7 +242,11 @@ const getCode = async () => {
|
|||
captcha.value.key = res.result?.key
|
||||
}
|
||||
|
||||
|
||||
const RsaConfig = reactive<any>({
|
||||
enabled:false, //是否加密
|
||||
publicKey:'', //rsa公钥,使用此公钥对密码进行加密
|
||||
id:'' //密钥ID
|
||||
})
|
||||
/**
|
||||
* 登录并绑定账户
|
||||
*/
|
||||
|
@ -252,14 +259,25 @@ const handleLoginBind = () => {
|
|||
bindCode: code,
|
||||
expires: 3600000
|
||||
}
|
||||
|
||||
const resq:any = await authLoginConfig()
|
||||
if(resq.status === 200){
|
||||
if(resq.result?.encrypt){
|
||||
RsaConfig.enabled = resq.result?.encrypt.enabled
|
||||
RsaConfig.publicKey = resq.result?.encrypt.publicKey
|
||||
RsaConfig.id = resq.result?.encrypt.id
|
||||
}
|
||||
}
|
||||
if (captcha.value.base64) {
|
||||
params.verifyKey = captcha.value.key
|
||||
} else {
|
||||
delete params.verifyCode
|
||||
}
|
||||
|
||||
const res = await authLogin(params)
|
||||
const data = {
|
||||
...params,
|
||||
password:RsaConfig.enabled?encrypt(params.password,RsaConfig.publicKey):params.password,
|
||||
encryptId:RsaConfig.enabled?RsaConfig.id:undefined
|
||||
}
|
||||
const res = await authLogin(data)
|
||||
console.log('res: ', res)
|
||||
if (res.success) {
|
||||
onlyMessage('登录成功')
|
||||
|
@ -273,11 +291,26 @@ const handleLoginBind = () => {
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
const getQueryVariable = (): Map<string, string> => {
|
||||
const index = window.location.href.indexOf('?')
|
||||
const paramsUrl = window.location.href.substr(index + 1)
|
||||
const paramsArr = paramsUrl.split('#')?.[0] || ''
|
||||
|
||||
const vars = paramsArr.split('&');
|
||||
const maps = new Map()
|
||||
for (let i = 0; i < vars.length; i++) {
|
||||
const pair = vars[i].split('=');
|
||||
const [key, value] = pair
|
||||
maps.set(key, value)
|
||||
}
|
||||
return maps;
|
||||
}
|
||||
/**
|
||||
* 绑定成功跳转至页面url的: redirect
|
||||
*/
|
||||
const goRedirect = () => {
|
||||
const urlParams = new URLSearchParams(window.location.hash)
|
||||
const urlParams = getQueryVariable();
|
||||
const redirectUrl =
|
||||
urlParams.get('redirect') ||
|
||||
window.location.href.split('redirect=')?.[1]
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
:load-data="onLoadData"
|
||||
@check="onCheck"
|
||||
v-model:expandedKeys="expandedKeys"
|
||||
:showLine="{ showLeafIcon: false }"
|
||||
:show-icon="true"
|
||||
/>
|
||||
</j-card>
|
||||
<div style="width: 100px">
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
:load-data="onLoadData"
|
||||
@check="onCheck"
|
||||
v-model:expandedKeys="expandedKeys"
|
||||
:showLine="{ showLeafIcon: false }"
|
||||
:show-icon="true"
|
||||
/>
|
||||
</j-card>
|
||||
<div style="width: 100px">
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
:tree-data="dataSource"
|
||||
:checkedKeys="checkedKeys"
|
||||
@check="onCheck"
|
||||
:showLine="{ showLeafIcon: false }"
|
||||
:show-icon="true"
|
||||
/>
|
||||
</j-card>
|
||||
<div style="width: 100px">
|
||||
|
|
|
@ -74,10 +74,11 @@
|
|||
|
||||
<script setup lang='ts' name='Oauth'>
|
||||
import { TOKEN_KEY } from '@/utils/variable'
|
||||
import { config, code, getOAuth2, initApplication, authLogin, settingDetail } from '@/api/login'
|
||||
import { config, code, getOAuth2, initApplication, authLogin, settingDetail,authLoginConfig } from '@/api/login'
|
||||
import { getMe_api } from '@/api/home'
|
||||
import { getImage, getToken } from '@/utils/comm'
|
||||
import Config from '../../../config/config'
|
||||
import {encrypt} from '@/utils/encrypt'
|
||||
|
||||
const spinning = ref(true)
|
||||
const isLogin = ref(false)
|
||||
|
@ -193,11 +194,27 @@ const getQueryVariable = (): Map<string, string> => {
|
|||
return maps;
|
||||
}
|
||||
|
||||
const RsaConfig = reactive<any>({
|
||||
enabled:false, //是否加密
|
||||
publicKey:'', //rsa公钥,使用此公钥对密码进行加密
|
||||
id:'' //密钥ID
|
||||
})
|
||||
|
||||
const doLogin = () => {
|
||||
formRef.value.validate().then( async data => {
|
||||
const res = await authLogin({
|
||||
const resq:any = await authLoginConfig()
|
||||
if(resq.status === 200){
|
||||
if(resq.result?.encrypt){
|
||||
RsaConfig.enabled = resq.result?.encrypt.enabled
|
||||
RsaConfig.publicKey = resq.result?.encrypt.publicKey
|
||||
RsaConfig.id = resq.result?.encrypt.id
|
||||
}
|
||||
}
|
||||
const res:any = await authLogin({
|
||||
verifyKey: captcha.key,
|
||||
...formModel
|
||||
...formModel,
|
||||
password:RsaConfig.enabled?encrypt(formModel.password,RsaConfig.publicKey):formModel.password,
|
||||
encryptId:RsaConfig.enabled?RsaConfig.id:undefined
|
||||
})
|
||||
if (res.success) {
|
||||
const token = res.result.token
|
||||
|
|
|
@ -38,8 +38,6 @@
|
|||
:height='450'
|
||||
:virtual='true'
|
||||
@select='treeSelect'
|
||||
:showLine="{ showLeafIcon: false }"
|
||||
:show-icon="true"
|
||||
>
|
||||
<template #title="{ name, description }">
|
||||
<j-space>
|
||||
|
|
|
@ -55,8 +55,6 @@
|
|||
:height='450'
|
||||
:virtual='true'
|
||||
@select='treeSelect'
|
||||
:showLine="{ showLeafIcon: false }"
|
||||
:show-icon="true"
|
||||
>
|
||||
<template #title="{ name, description }">
|
||||
<j-space>
|
||||
|
|
|
@ -33,8 +33,6 @@
|
|||
:fieldNames="{ key: 'code', title: 'name' }"
|
||||
@check="treeCheck"
|
||||
:height="300"
|
||||
:showLine="{ showLeafIcon: false }"
|
||||
:show-icon="true"
|
||||
>
|
||||
<template #title="{ name }">
|
||||
<span>{{ name }}</span>
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
:selectedKeys="selectedKeys"
|
||||
@drop="onDrop"
|
||||
@dragend="onDragend"
|
||||
:showLine="{ showLeafIcon: false }"
|
||||
:show-icon="true"
|
||||
>
|
||||
<template #title="row">
|
||||
<div class="tree-content">
|
||||
|
|
Loading…
Reference in New Issue