parent
3ff87e2ff4
commit
5bd178f909
|
@ -27,6 +27,7 @@
|
|||
"jetlinks-store": "^0.0.3",
|
||||
"jetlinks-ui-components": "^1.0.21",
|
||||
"js-cookie": "^3.0.1",
|
||||
"jsencrypt": "^3.3.2",
|
||||
"less": "^4.1.3",
|
||||
"less-loader": "^11.1.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
|
|
|
@ -61,3 +61,10 @@ export const loginout_api = () => server.get<any>('/user-token/reset')
|
|||
export const getOAuth2 = (params: any) => server.get<any>('/oauth2/authorize', params)
|
||||
|
||||
export const initApplication = (clientId: string | number) => server.get<{name: string}>(`/application/${clientId}/info`)
|
||||
|
||||
|
||||
/**
|
||||
* 登录加密信息
|
||||
* @returns
|
||||
*/
|
||||
export const authLoginConfig = () => server.get(`/authorize/login/configs`)
|
|
@ -8,18 +8,32 @@
|
|||
</template>
|
||||
<template #content>
|
||||
<div style="max-width: 400px;" class="ant-form-vertical">
|
||||
<j-form-item v-for="item in config.properties" :name="name.concat([item.property])" :label="item.name">
|
||||
<template v-if='item.type?.type === "string"'>
|
||||
<j-form-item v-for="item in config.properties" :key="item.property" :name="name.concat([item.property])" :label="item.name">
|
||||
<!-- <template v-if='item.type?.type === "string"'>
|
||||
<j-input v-model:value='value[item.property]' size="small" :placeholder="`请输入${item.name}`"/>
|
||||
</template>
|
||||
<j-select v-else v-model:value="value[item.property]" :options="item.type?.elements?.map((e: { 'text': string, 'value': string }) => ({
|
||||
<template v-else-if='item.type?.type === "int"'>
|
||||
<j-input-number style="width: 100%;" v-model:value='value[item.property]' size="small" :placeholder="`请输入${item.name}`"/>
|
||||
</template>
|
||||
<j-select v-else :mode="item.type?.multi ? 'multiple' : ''" v-model:value="value[item.property]" :options="item.type?.elements?.map((e: { 'text': string, 'value': string }) => ({
|
||||
label: e.text,
|
||||
value: e.value,
|
||||
}))" size="small" :placeholder="`请输入${item.name}`"></j-select>
|
||||
}))" size="small" :placeholder="`请输入${item.name}`"></j-select> -->
|
||||
<ValueItem
|
||||
v-model:modelValue="value[item.property]"
|
||||
:itemType="item.type?.type"
|
||||
:mode="item?.type?.multi ? 'multiple' : ''"
|
||||
:options="
|
||||
item.type?.elements?.map(e => ({
|
||||
label: e.text,
|
||||
value: e.value,
|
||||
}))
|
||||
"
|
||||
/>
|
||||
</j-form-item>
|
||||
</div>
|
||||
</template>
|
||||
{{ config.name || 存储配置 }}
|
||||
{{ config.name || '存储配置' }}
|
||||
<AIcon type="EditOutlined" class="item-icon" />
|
||||
</j-popover>
|
||||
</j-button>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<div class="value-item-warp">
|
||||
<j-select
|
||||
v-if="typeMap.get(itemType) === 'select'"
|
||||
:mode="mode"
|
||||
v-model:value="myValue"
|
||||
:options="options"
|
||||
allowClear
|
||||
|
@ -139,6 +140,11 @@ const props = defineProps({
|
|||
type: Array as PropType<DefaultOptionType[]>,
|
||||
default: () => [],
|
||||
},
|
||||
// 多选框
|
||||
mode: {
|
||||
type: String as PropType<'multiple' | 'tags' | 'combobox' | ''>,
|
||||
default: ''
|
||||
}
|
||||
});
|
||||
// type Props = {
|
||||
// itemData?: Object;
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
import JSEncrypt from "jsencrypt";
|
||||
|
||||
export const encrypt =(txt:string,publicKey:string)=>{
|
||||
const encryptor = new JSEncrypt()
|
||||
encryptor.setPublicKey(publicKey)
|
||||
return encryptor.encrypt(txt)
|
||||
}
|
|
@ -169,13 +169,15 @@ import {
|
|||
getInitSet,
|
||||
systemVersion,
|
||||
bindInfo,
|
||||
settingDetail, userDetail
|
||||
settingDetail, userDetail,
|
||||
authLoginConfig
|
||||
} from '@/api/login'
|
||||
import { useUserInfo } from '@/store/userInfo';
|
||||
import { useSystem } from '@/store/system'
|
||||
import { LocalStore } from '@/utils/comm';
|
||||
import { BASE_API_PATH, TOKEN_KEY, Version_Code } from '@/utils/variable';
|
||||
import { SystemConst } from '@/utils/consts';
|
||||
import {encrypt} from '@/utils/encrypt'
|
||||
|
||||
const store = useUserInfo();
|
||||
const systemStore = useSystem();
|
||||
|
@ -199,6 +201,12 @@ const form = reactive({
|
|||
verifyKey: '',
|
||||
});
|
||||
|
||||
const RsaConfig = reactive<any>({
|
||||
enabled:false, //是否加密
|
||||
publicKey:'', //rsa公钥,使用此公钥对密码进行加密
|
||||
id:'' //密钥ID
|
||||
})
|
||||
|
||||
const rules = {
|
||||
username: [
|
||||
{
|
||||
|
@ -249,7 +257,14 @@ iconMap.set('third-party', getImage('/apply/provider5.png'));
|
|||
const onFinish = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const res: any = await authLogin(form);
|
||||
|
||||
const data = {
|
||||
...form,
|
||||
password:RsaConfig.enabled?encrypt(form.password,RsaConfig.publicKey):form.password,
|
||||
encryptId:RsaConfig.enabled?RsaConfig.id:undefined
|
||||
}
|
||||
|
||||
const res: any = await authLogin(data);
|
||||
loading.value = false;
|
||||
if (res.success) {
|
||||
LocalStore.set(TOKEN_KEY, res?.result.token);
|
||||
|
@ -283,6 +298,7 @@ const onFinish = async () => {
|
|||
form.verifyCode = '';
|
||||
getCode();
|
||||
loading.value = false;
|
||||
getRsa()
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -317,6 +333,18 @@ const getOpen = () => {
|
|||
systemStore.getFront()
|
||||
};
|
||||
|
||||
//获取加密信息
|
||||
const getRsa =async () =>{
|
||||
const res:any = await authLoginConfig()
|
||||
if(res.status === 200){
|
||||
if(res.result?.encrypt){
|
||||
RsaConfig.enabled = res.result?.encrypt.enabled
|
||||
RsaConfig.publicKey = res.result?.encrypt.publicKey
|
||||
RsaConfig.id = res.result?.encrypt.id
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const basis = computed(() => {
|
||||
return systemStore.configInfo['front'] || {}
|
||||
})
|
||||
|
@ -352,6 +380,11 @@ watch(
|
|||
getOpen();
|
||||
getCode();
|
||||
screenRotation(screenWidth.value, screenHeight.value);
|
||||
|
||||
onMounted(()=>{
|
||||
getRsa()
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
|
|
|
@ -94,7 +94,8 @@ export default defineConfig(({ mode}) => {
|
|||
[env.VITE_APP_BASE_API]: {
|
||||
// target: 'http://192.168.32.226:8844',
|
||||
// target: 'http://192.168.32.244:8881',
|
||||
target: 'http://120.77.179.54:8844', // 120测试
|
||||
target: 'http://192.168.32.163:8844', //张季本地
|
||||
// target: 'http://120.77.179.54:8844', // 120测试
|
||||
// target: 'http://192.168.33.46:8844', // 本地开发环境
|
||||
ws: 'ws://192.168.33.46:8844',
|
||||
changeOrigin: true,
|
||||
|
|
|
@ -3862,6 +3862,11 @@ jsbn@~0.1.0:
|
|||
resolved "https://registry.jetlinks.cn/jsbn/-/jsbn-0.1.1.tgz"
|
||||
integrity sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==
|
||||
|
||||
jsencrypt@^3.3.2:
|
||||
version "3.3.2"
|
||||
resolved "http://registry.jetlinks.cn/jsencrypt/-/jsencrypt-3.3.2.tgz#b0f1a2278810c7ba1cb8957af11195354622df7c"
|
||||
integrity sha512-arQR1R1ESGdAxY7ZheWr12wCaF2yF47v5qpB76TtV64H1pyGudk9Hvw8Y9tb/FiTIaaTRUyaSnm5T/Y53Ghm/A==
|
||||
|
||||
jsesc@^2.5.1:
|
||||
version "2.5.2"
|
||||
resolved "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz"
|
||||
|
|
Loading…
Reference in New Issue