Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivManage
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
CivManage
Commits
c0c53508
Commit
c0c53508
authored
Oct 31, 2022
by
皮倩雯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: '修改加密方式'
parent
d3411171
Pipeline
#62770
waiting for manual action with stages
Changes
13
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
456 additions
and
61 deletions
+456
-61
InitDataBase.jsx
src/pages/database/InitDataBase/InitDataBase.jsx
+50
-14
AddModal.jsx
src/pages/database/databaseConfig/mysqltable/AddModal.jsx
+31
-3
AddModal.jsx
src/pages/database/databaseConfig/oracle/AddModal.jsx
+31
-3
AddModal.jsx
src/pages/database/databaseConfig/sqlServer/AddModal.jsx
+31
-3
AppendModal.jsx
src/pages/database/databaseInitialization/AppendModal.jsx
+29
-1
DatabaseInitialization.jsx
...atabase/databaseInitialization/DatabaseInitialization.jsx
+65
-14
AddModal.jsx
...s/platformCenter/gis/schemeConfig/VectorData/AddModal.jsx
+29
-1
BaseConfig.jsx
...ages/platformCenter/hostmanager/baseConfig/BaseConfig.jsx
+30
-1
messageConfig.jsx
...latformCenter/hostmanager/messageConfig/messageConfig.jsx
+31
-3
AddAllModal.jsx
src/pages/platformCenter/videoManager/AddAllModal.jsx
+31
-2
AddModal.jsx
src/pages/platformCenter/videoManager/AddModal.jsx
+34
-10
DHModal.jsx
src/pages/platformCenter/videoManager/DHModal.jsx
+32
-3
HKModal.jsx
src/pages/platformCenter/videoManager/HKModal.jsx
+32
-3
No files found.
src/pages/database/InitDataBase/InitDataBase.jsx
View file @
c0c53508
...
@@ -38,6 +38,7 @@ import {
...
@@ -38,6 +38,7 @@ import {
InitAddDataBase
,
// 数据库初始化
InitAddDataBase
,
// 数据库初始化
InitEditDataBase
,
// 二次初始化
InitEditDataBase
,
// 二次初始化
}
from
'@/services/database/api'
;
}
from
'@/services/database/api'
;
import
CryptoJS
from
'crypto-js'
;
import
styles
from
'./InitDataBase.less'
;
import
styles
from
'./InitDataBase.less'
;
import
InitModal
from
'./initModal'
;
import
InitModal
from
'./initModal'
;
...
@@ -85,6 +86,8 @@ const InitDataBase = props => {
...
@@ -85,6 +86,8 @@ const InitDataBase = props => {
const
[
keep
,
setKeep
]
=
useState
([]);
const
[
keep
,
setKeep
]
=
useState
([]);
const
[
flag
,
setFlag
]
=
useState
(
0
);
const
[
flag
,
setFlag
]
=
useState
(
0
);
const
[
keepData
,
setKeepData
]
=
useState
({});
const
[
keepData
,
setKeepData
]
=
useState
({});
const
key
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1p2a3n4d5a6o7m8s9a10n1e2t3c4o5re'
);
//十六位十六进制数作为密钥
const
iv
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1234567890000000'
);
// 获取数据库配置信息
// 获取数据库配置信息
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -102,8 +105,13 @@ const InitDataBase = props => {
...
@@ -102,8 +105,13 @@ const InitDataBase = props => {
obj
[
k
]
=
res
[
k
];
obj
[
k
]
=
res
[
k
];
});
});
console
.
log
(
obj
,
'objohjfaosdjf'
);
console
.
log
(
obj
,
'objohjfaosdjf'
);
form
.
setFieldsValue
({
...
obj
,
password
:
atob
(
obj
.
password
)
});
setDbForm
(
val
=>
({
...
val
,
...
obj
,
password
:
atob
(
obj
.
password
)
}));
console
.
log
(
Decrypt
(
obj
.
password
));
let
aa
=
Decrypt
(
obj
.
password
);
console
.
log
(
Encrypt
(
aa
));
form
.
setFieldsValue
({
...
obj
,
password
:
Decrypt
(
obj
.
password
)
});
setDbForm
(
val
=>
({
...
val
,
...
obj
,
password
:
Decrypt
(
obj
.
password
)
}));
setAllSqulDir
(
res
.
allSqlDir
);
setAllSqulDir
(
res
.
allSqlDir
);
if
(
res
.
allSqlDir
.
some
(
item
=>
item
===
inUse
))
{
if
(
res
.
allSqlDir
.
some
(
item
=>
item
===
inUse
))
{
setDefaultSqlDir
(
res
.
tableSQLDirName
);
setDefaultSqlDir
(
res
.
tableSQLDirName
);
...
@@ -121,6 +129,31 @@ const InitDataBase = props => {
...
@@ -121,6 +129,31 @@ const InitDataBase = props => {
}
}
};
};
},
[]);
},
[]);
// 解密
const
Decrypt
=
word
=>
{
let
encryptedHexStr
=
CryptoJS
.
enc
.
Hex
.
parse
(
word
);
let
srcs
=
CryptoJS
.
enc
.
Base64
.
stringify
(
encryptedHexStr
);
let
decrypt
=
CryptoJS
.
AES
.
decrypt
(
srcs
,
key
,
{
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
,
});
let
decryptedStr
=
decrypt
.
toString
(
CryptoJS
.
enc
.
Utf8
);
return
decryptedStr
.
toString
();
};
//加密
const
Encrypt
=
word
=>
{
let
srcs
=
CryptoJS
.
enc
.
Utf8
.
parse
(
word
);
let
encrypted
=
CryptoJS
.
AES
.
encrypt
(
srcs
,
key
,
{
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
,
});
return
encrypted
.
ciphertext
.
toString
().
toUpperCase
();
};
// 弹出模态框
// 弹出模态框
const
handleShowModal
=
(
key
,
value
)
=>
{
const
handleShowModal
=
(
key
,
value
)
=>
{
setModalVisible
({
...
modalVisible
,
[
key
]:
value
});
setModalVisible
({
...
modalVisible
,
[
key
]:
value
});
...
@@ -226,7 +259,7 @@ const InitDataBase = props => {
...
@@ -226,7 +259,7 @@ const InitDataBase = props => {
ip
:
obj
.
ip
,
ip
:
obj
.
ip
,
dbName
:
obj
.
dbName
,
dbName
:
obj
.
dbName
,
userName
:
obj
.
userName
,
userName
:
obj
.
userName
,
password
:
btoa
(
obj
.
password
),
password
:
Encrypt
(
obj
.
password
),
})
})
.
then
(
resnew
=>
{
.
then
(
resnew
=>
{
setCardLoading
(
false
);
setCardLoading
(
false
);
...
@@ -236,7 +269,7 @@ const InitDataBase = props => {
...
@@ -236,7 +269,7 @@ const InitDataBase = props => {
ip
:
obj
.
ip
,
ip
:
obj
.
ip
,
dbName
:
obj
.
dbName
,
dbName
:
obj
.
dbName
,
userName
:
obj
.
userName
,
userName
:
obj
.
userName
,
password
:
btoa
(
obj
.
password
),
password
:
Encrypt
(
obj
.
password
),
});
});
// setUpData(upData + 1);
// setUpData(upData + 1);
getConnRecordData
();
getConnRecordData
();
...
@@ -269,7 +302,7 @@ const InitDataBase = props => {
...
@@ -269,7 +302,7 @@ const InitDataBase = props => {
ip
:
obj
.
ip
,
ip
:
obj
.
ip
,
dbName
:
obj
.
dbName
,
dbName
:
obj
.
dbName
,
userName
:
obj
.
userName
,
userName
:
obj
.
userName
,
password
:
btoa
(
obj
.
password
),
password
:
Encrypt
(
obj
.
password
),
// Type:"SQLServer",
// Type:"SQLServer",
// name:obj.dbName,
// name:obj.dbName,
})
})
...
@@ -302,7 +335,7 @@ const InitDataBase = props => {
...
@@ -302,7 +335,7 @@ const InitDataBase = props => {
// _version: 9999,
// _version: 9999,
// _dc: Date.now(),
// _dc: Date.now(),
userName
:
params
.
userName
||
''
,
userName
:
params
.
userName
||
''
,
password
:
btoa
(
params
.
password
)
||
''
,
password
:
Encrypt
(
params
.
password
)
||
''
,
ip
:
params
.
ip
||
''
,
ip
:
params
.
ip
||
''
,
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
...
@@ -328,7 +361,7 @@ const InitDataBase = props => {
...
@@ -328,7 +361,7 @@ const InitDataBase = props => {
Object
.
keys
(
obj
).
forEach
(
k
=>
{
Object
.
keys
(
obj
).
forEach
(
k
=>
{
obj
[
k
]
=
item
[
k
];
obj
[
k
]
=
item
[
k
];
});
});
form
.
setFieldsValue
({
...
obj
,
password
:
atob
(
obj
.
password
)
});
form
.
setFieldsValue
({
...
obj
,
password
:
Decrypt
(
obj
.
password
)
});
};
};
// 产品方案选择框回调
// 产品方案选择框回调
const
handleSelect
=
value
=>
{
const
handleSelect
=
value
=>
{
...
@@ -385,7 +418,7 @@ const InitDataBase = props => {
...
@@ -385,7 +418,7 @@ const InitDataBase = props => {
ip
:
obj
.
ip
,
ip
:
obj
.
ip
,
dbName
:
obj
.
dbName
,
dbName
:
obj
.
dbName
,
userName
:
obj
.
userName
,
userName
:
obj
.
userName
,
password
:
btoa
(
obj
.
password
),
password
:
Encrypt
(
obj
.
password
),
desc
,
desc
,
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
...
@@ -431,7 +464,7 @@ const InitDataBase = props => {
...
@@ -431,7 +464,7 @@ const InitDataBase = props => {
const
GetDb
=
()
=>
{
const
GetDb
=
()
=>
{
let
obj
=
form
.
getFieldsValue
();
let
obj
=
form
.
getFieldsValue
();
GetDbProduct
({
...
obj
,
password
:
btoa
(
obj
.
password
)
}).
then
(
res
=>
{
GetDbProduct
({
...
obj
,
password
:
Encrypt
(
obj
.
password
)
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
console
.
log
(
res
.
data
);
console
.
log
(
res
.
data
);
if
(
res
.
data
.
Product
)
{
if
(
res
.
data
.
Product
)
{
...
@@ -473,7 +506,7 @@ const InitDataBase = props => {
...
@@ -473,7 +506,7 @@ const InitDataBase = props => {
setInitLoading
(
true
);
setInitLoading
(
true
);
let
obj
=
form
.
getFieldsValue
();
let
obj
=
form
.
getFieldsValue
();
let
req1
=
GetProductList
();
let
req1
=
GetProductList
();
let
req2
=
GetDbProduct
({
...
obj
,
password
:
btoa
(
obj
.
password
)
});
let
req2
=
GetDbProduct
({
...
obj
,
password
:
Encrypt
(
obj
.
password
)
});
Promise
.
all
([
req1
,
req2
])
Promise
.
all
([
req1
,
req2
])
.
then
(
res
=>
{
.
then
(
res
=>
{
if
(
res
[
1
].
code
!==
0
||
res
[
0
].
code
!==
0
)
{
if
(
res
[
1
].
code
!==
0
||
res
[
0
].
code
!==
0
)
{
...
@@ -620,8 +653,12 @@ const InitDataBase = props => {
...
@@ -620,8 +653,12 @@ const InitDataBase = props => {
setInitVisible
(
true
);
setInitVisible
(
true
);
doInitLog
();
doInitLog
();
if
(
dbExists
)
{
if
(
dbExists
)
{
InitEditDataBase
({
...
obj
,
productSetting
,
license
:
j
,
password
:
btoa
(
obj
.
password
)
}).
then
(
InitEditDataBase
({
res
=>
{
...
obj
,
productSetting
,
license
:
j
,
password
:
Encrypt
(
obj
.
password
),
}).
then
(
res
=>
{
setInitLoading
(
false
);
setInitLoading
(
false
);
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
notification
.
success
({
notification
.
success
({
...
@@ -636,8 +673,7 @@ const InitDataBase = props => {
...
@@ -636,8 +673,7 @@ const InitDataBase = props => {
description
:
res
.
msg
,
description
:
res
.
msg
,
});
});
}
}
},
});
);
return
;
return
;
}
}
InitAddDataBase
({
...
obj
,
productSetting
,
license
:
j
}).
then
(
res
=>
{
InitAddDataBase
({
...
obj
,
productSetting
,
license
:
j
}).
then
(
res
=>
{
...
...
src/pages/database/databaseConfig/mysqltable/AddModal.jsx
View file @
c0c53508
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Form
,
Modal
,
Input
,
Select
,
notification
}
from
'antd'
;
import
{
Form
,
Modal
,
Input
,
Select
,
notification
}
from
'antd'
;
import
{
AddConnString
,
EditConnString
}
from
'@/services/database/api'
;
import
{
AddConnString
,
EditConnString
}
from
'@/services/database/api'
;
import
CryptoJS
from
'crypto-js'
;
const
{
Item
}
=
Form
;
const
{
Item
}
=
Form
;
const
{
Option
}
=
Select
;
const
{
Option
}
=
Select
;
...
@@ -8,6 +9,33 @@ const AddModal = props => {
...
@@ -8,6 +9,33 @@ const AddModal = props => {
const
{
callBackSubmit
=
()
=>
{},
type
,
formObj
,
visible
}
=
props
;
const
{
callBackSubmit
=
()
=>
{},
type
,
formObj
,
visible
}
=
props
;
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
form
]
=
Form
.
useForm
();
const
[
form
]
=
Form
.
useForm
();
const
key
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1p2a3n4d5a6o7m8s9a10n1e2t3c4o5re'
);
// 十六位十六进制数作为密钥
const
iv
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1234567890000000'
);
// 解密
const
Decrypt
=
word
=>
{
let
encryptedHexStr
=
CryptoJS
.
enc
.
Hex
.
parse
(
word
);
let
srcs
=
CryptoJS
.
enc
.
Base64
.
stringify
(
encryptedHexStr
);
let
decrypt
=
CryptoJS
.
AES
.
decrypt
(
srcs
,
key
,
{
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
,
});
let
decryptedStr
=
decrypt
.
toString
(
CryptoJS
.
enc
.
Utf8
);
return
decryptedStr
.
toString
();
};
// 加密
const
Encrypt
=
word
=>
{
let
srcs
=
CryptoJS
.
enc
.
Utf8
.
parse
(
word
);
let
encrypted
=
CryptoJS
.
AES
.
encrypt
(
srcs
,
key
,
{
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
,
});
return
encrypted
.
ciphertext
.
toString
().
toUpperCase
();
};
// 提交
// 提交
const
onSubmit
=
()
=>
{
const
onSubmit
=
()
=>
{
form
.
validateFields
().
then
(
validate
=>
{
form
.
validateFields
().
then
(
validate
=>
{
...
@@ -18,7 +46,7 @@ const AddModal = props => {
...
@@ -18,7 +46,7 @@ const AddModal = props => {
AddConnString
({
AddConnString
({
type
:
'mysql'
,
type
:
'mysql'
,
...
obj
,
...
obj
,
password
:
btoa
(
obj
.
password
),
password
:
Encrypt
(
obj
.
password
),
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
setLoading
(
false
);
setLoading
(
false
);
...
@@ -54,7 +82,7 @@ const AddModal = props => {
...
@@ -54,7 +82,7 @@ const AddModal = props => {
type
:
'mysql'
,
type
:
'mysql'
,
...
obj
,
...
obj
,
oldName
:
formObj
.
name
,
oldName
:
formObj
.
name
,
password
:
btoa
(
obj
.
password
),
password
:
Encrypt
(
obj
.
password
),
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
setLoading
(
false
);
setLoading
(
false
);
...
@@ -84,7 +112,7 @@ const AddModal = props => {
...
@@ -84,7 +112,7 @@ const AddModal = props => {
form
.
setFieldsValue
({
port
:
3306
});
form
.
setFieldsValue
({
port
:
3306
});
break
;
break
;
case
'edit'
:
case
'edit'
:
form
.
setFieldsValue
({
...
formObj
,
password
:
atob
(
formObj
.
password
)
});
form
.
setFieldsValue
({
...
formObj
,
password
:
Decrypt
(
formObj
.
password
)
});
if
(
!
formObj
.
port
)
{
if
(
!
formObj
.
port
)
{
form
.
setFieldsValue
({
port
:
3306
});
form
.
setFieldsValue
({
port
:
3306
});
}
}
...
...
src/pages/database/databaseConfig/oracle/AddModal.jsx
View file @
c0c53508
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Form
,
Modal
,
Input
,
Select
,
notification
}
from
'antd'
;
import
{
Form
,
Modal
,
Input
,
Select
,
notification
}
from
'antd'
;
import
{
AddConnString
,
EditConnString
}
from
'@/services/database/api'
;
import
{
AddConnString
,
EditConnString
}
from
'@/services/database/api'
;
import
CryptoJS
from
'crypto-js'
;
const
{
Item
}
=
Form
;
const
{
Item
}
=
Form
;
const
{
Option
}
=
Select
;
const
{
Option
}
=
Select
;
...
@@ -8,6 +9,33 @@ const AddModal = props => {
...
@@ -8,6 +9,33 @@ const AddModal = props => {
const
{
callBackSubmit
=
()
=>
{},
type
,
formObj
,
visible
}
=
props
;
const
{
callBackSubmit
=
()
=>
{},
type
,
formObj
,
visible
}
=
props
;
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
form
]
=
Form
.
useForm
();
const
[
form
]
=
Form
.
useForm
();
const
key
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1p2a3n4d5a6o7m8s9a10n1e2t3c4o5re'
);
// 十六位十六进制数作为密钥
const
iv
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1234567890000000'
);
// 解密
const
Decrypt
=
word
=>
{
let
encryptedHexStr
=
CryptoJS
.
enc
.
Hex
.
parse
(
word
);
let
srcs
=
CryptoJS
.
enc
.
Base64
.
stringify
(
encryptedHexStr
);
let
decrypt
=
CryptoJS
.
AES
.
decrypt
(
srcs
,
key
,
{
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
,
});
let
decryptedStr
=
decrypt
.
toString
(
CryptoJS
.
enc
.
Utf8
);
return
decryptedStr
.
toString
();
};
// 加密
const
Encrypt
=
word
=>
{
let
srcs
=
CryptoJS
.
enc
.
Utf8
.
parse
(
word
);
let
encrypted
=
CryptoJS
.
AES
.
encrypt
(
srcs
,
key
,
{
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
,
});
return
encrypted
.
ciphertext
.
toString
().
toUpperCase
();
};
// 提交
// 提交
const
onSubmit
=
()
=>
{
const
onSubmit
=
()
=>
{
form
.
validateFields
().
then
(
validate
=>
{
form
.
validateFields
().
then
(
validate
=>
{
...
@@ -18,7 +46,7 @@ const AddModal = props => {
...
@@ -18,7 +46,7 @@ const AddModal = props => {
AddConnString
({
AddConnString
({
...
obj
,
...
obj
,
type
:
'oracle'
,
type
:
'oracle'
,
password
:
btoa
(
obj
.
password
),
password
:
Encrypt
(
obj
.
password
),
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
setLoading
(
false
);
setLoading
(
false
);
...
@@ -54,7 +82,7 @@ const AddModal = props => {
...
@@ -54,7 +82,7 @@ const AddModal = props => {
type
:
'oracle'
,
type
:
'oracle'
,
...
obj
,
...
obj
,
oldName
:
formObj
.
name
,
oldName
:
formObj
.
name
,
password
:
btoa
(
obj
.
password
),
password
:
Encrypt
(
obj
.
password
),
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
setLoading
(
false
);
setLoading
(
false
);
...
@@ -83,7 +111,7 @@ const AddModal = props => {
...
@@ -83,7 +111,7 @@ const AddModal = props => {
form
.
resetFields
();
form
.
resetFields
();
break
;
break
;
case
'edit'
:
case
'edit'
:
form
.
setFieldsValue
({
...
formObj
,
password
:
atob
(
formObj
.
password
)
});
form
.
setFieldsValue
({
...
formObj
,
password
:
Decrypt
(
formObj
.
password
)
});
break
;
break
;
default
:
default
:
break
;
break
;
...
...
src/pages/database/databaseConfig/sqlServer/AddModal.jsx
View file @
c0c53508
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Form
,
Modal
,
Input
,
Select
,
notification
}
from
'antd'
;
import
{
Form
,
Modal
,
Input
,
Select
,
notification
}
from
'antd'
;
import
{
AddConnString
,
EditConnString
}
from
'@/services/database/api'
;
import
{
AddConnString
,
EditConnString
}
from
'@/services/database/api'
;
import
CryptoJS
from
'crypto-js'
;
const
{
Item
}
=
Form
;
const
{
Item
}
=
Form
;
const
{
Option
}
=
Select
;
const
{
Option
}
=
Select
;
...
@@ -8,6 +9,33 @@ const AddModal = props => {
...
@@ -8,6 +9,33 @@ const AddModal = props => {
const
{
callBackSubmit
=
()
=>
{},
type
,
formObj
,
visible
}
=
props
;
const
{
callBackSubmit
=
()
=>
{},
type
,
formObj
,
visible
}
=
props
;
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
form
]
=
Form
.
useForm
();
const
[
form
]
=
Form
.
useForm
();
const
key
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1p2a3n4d5a6o7m8s9a10n1e2t3c4o5re'
);
// 十六位十六进制数作为密钥
const
iv
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1234567890000000'
);
// 解密
const
Decrypt
=
word
=>
{
let
encryptedHexStr
=
CryptoJS
.
enc
.
Hex
.
parse
(
word
);
let
srcs
=
CryptoJS
.
enc
.
Base64
.
stringify
(
encryptedHexStr
);
let
decrypt
=
CryptoJS
.
AES
.
decrypt
(
srcs
,
key
,
{
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
,
});
let
decryptedStr
=
decrypt
.
toString
(
CryptoJS
.
enc
.
Utf8
);
return
decryptedStr
.
toString
();
};
// 加密
const
Encrypt
=
word
=>
{
let
srcs
=
CryptoJS
.
enc
.
Utf8
.
parse
(
word
);
let
encrypted
=
CryptoJS
.
AES
.
encrypt
(
srcs
,
key
,
{
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
,
});
return
encrypted
.
ciphertext
.
toString
().
toUpperCase
();
};
// 提交
// 提交
const
onSubmit
=
()
=>
{
const
onSubmit
=
()
=>
{
form
.
validateFields
().
then
(
validate
=>
{
form
.
validateFields
().
then
(
validate
=>
{
...
@@ -18,7 +46,7 @@ const AddModal = props => {
...
@@ -18,7 +46,7 @@ const AddModal = props => {
AddConnString
({
AddConnString
({
...
obj
,
...
obj
,
type
:
'sqlserver'
,
type
:
'sqlserver'
,
password
:
btoa
(
obj
.
password
),
password
:
Encrypt
(
obj
.
password
),
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
setLoading
(
false
);
setLoading
(
false
);
...
@@ -54,7 +82,7 @@ const AddModal = props => {
...
@@ -54,7 +82,7 @@ const AddModal = props => {
...
obj
,
...
obj
,
oldName
:
formObj
.
name
,
oldName
:
formObj
.
name
,
type
:
'sqlserver'
,
type
:
'sqlserver'
,
password
:
btoa
(
obj
.
password
),
password
:
Encrypt
(
obj
.
password
),
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
setLoading
(
false
);
setLoading
(
false
);
...
@@ -83,7 +111,7 @@ const AddModal = props => {
...
@@ -83,7 +111,7 @@ const AddModal = props => {
form
.
resetFields
();
form
.
resetFields
();
break
;
break
;
case
'edit'
:
case
'edit'
:
form
.
setFieldsValue
({
...
formObj
,
password
:
atob
(
formObj
.
password
)
});
form
.
setFieldsValue
({
...
formObj
,
password
:
Decrypt
(
formObj
.
password
)
});
break
;
break
;
default
:
default
:
break
;
break
;
...
...
src/pages/database/databaseInitialization/AppendModal.jsx
View file @
c0c53508
...
@@ -10,6 +10,7 @@ import {
...
@@ -10,6 +10,7 @@ import {
CheckOutlined
,
CheckOutlined
,
}
from
'@ant-design/icons'
;
}
from
'@ant-design/icons'
;
import
styles
from
'./DatabaseInitialization.less'
;
import
styles
from
'./DatabaseInitialization.less'
;
import
CryptoJS
from
'crypto-js'
;
import
{
GetLicenseDifference
,
InitEditDataBase
,
GetProductList
}
from
'@/services/database/api'
;
import
{
GetLicenseDifference
,
InitEditDataBase
,
GetProductList
}
from
'@/services/database/api'
;
const
AppendModal
=
props
=>
{
const
AppendModal
=
props
=>
{
...
@@ -29,6 +30,9 @@ const AppendModal = props => {
...
@@ -29,6 +30,9 @@ const AppendModal = props => {
const
[
number1
,
setNumber1
]
=
useState
(
''
);
const
[
number1
,
setNumber1
]
=
useState
(
''
);
const
[
allValue
,
setAllValue
]
=
useState
([]);
const
[
allValue
,
setAllValue
]
=
useState
([]);
const
key
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1p2a3n4d5a6o7m8s9a10n1e2t3c4o5re'
);
// 十六位十六进制数作为密钥
const
iv
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1234567890000000'
);
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
visible
)
{
if
(
visible
)
{
getProduct
();
getProduct
();
...
@@ -65,9 +69,33 @@ const AppendModal = props => {
...
@@ -65,9 +69,33 @@ const AppendModal = props => {
}
}
},
[
visible
]);
},
[
visible
]);
// 解密
const
Decrypt
=
word
=>
{
let
encryptedHexStr
=
CryptoJS
.
enc
.
Hex
.
parse
(
word
);
let
srcs
=
CryptoJS
.
enc
.
Base64
.
stringify
(
encryptedHexStr
);
let
decrypt
=
CryptoJS
.
AES
.
decrypt
(
srcs
,
key
,
{
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
,
});
let
decryptedStr
=
decrypt
.
toString
(
CryptoJS
.
enc
.
Utf8
);
return
decryptedStr
.
toString
();
};
// 加密
const
Encrypt
=
word
=>
{
let
srcs
=
CryptoJS
.
enc
.
Utf8
.
parse
(
word
);
let
encrypted
=
CryptoJS
.
AES
.
encrypt
(
srcs
,
key
,
{
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
,
});
return
encrypted
.
ciphertext
.
toString
().
toUpperCase
();
};
const
getProduct
=
()
=>
{
const
getProduct
=
()
=>
{
setLoading
(
true
);
setLoading
(
true
);
GetLicenseDifference
({
...
value
,
password
:
btoa
(
value
.
password
)
}).
then
(
res
=>
{
GetLicenseDifference
({
...
value
,
password
:
Encrypt
(
value
.
password
)
}).
then
(
res
=>
{
setLoading
(
false
);
setLoading
(
false
);
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
let
aab
=
[];
let
aab
=
[];
...
...
src/pages/database/databaseInitialization/DatabaseInitialization.jsx
View file @
c0c53508
...
@@ -49,6 +49,7 @@ import {
...
@@ -49,6 +49,7 @@ import {
PlusOutlined
,
PlusOutlined
,
EyeOutlined
,
EyeOutlined
,
}
from
'@ant-design/icons'
;
}
from
'@ant-design/icons'
;
import
CryptoJS
from
'crypto-js'
;
import
styles
from
'./DatabaseInitialization.less'
;
import
styles
from
'./DatabaseInitialization.less'
;
import
styles1
from
'../InitDataBase/InitDataBase.less'
;
import
styles1
from
'../InitDataBase/InitDataBase.less'
;
import
AppendModal
from
'./AppendModal'
;
import
AppendModal
from
'./AppendModal'
;
...
@@ -122,6 +123,33 @@ const DatabaseInitialization = props => {
...
@@ -122,6 +123,33 @@ const DatabaseInitialization = props => {
const
[
historyVisible
,
setHistoryVisible
]
=
useState
(
false
);
const
[
historyVisible
,
setHistoryVisible
]
=
useState
(
false
);
const
[
keepInitDetailVisible
,
setKeepInitDetailVisible
]
=
useState
(
false
);
const
[
keepInitDetailVisible
,
setKeepInitDetailVisible
]
=
useState
(
false
);
const
key
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1p2a3n4d5a6o7m8s9a10n1e2t3c4o5re'
);
//十六位十六进制数作为密钥
const
iv
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1234567890000000'
);
// 解密
const
Decrypt
=
word
=>
{
let
encryptedHexStr
=
CryptoJS
.
enc
.
Hex
.
parse
(
word
);
let
srcs
=
CryptoJS
.
enc
.
Base64
.
stringify
(
encryptedHexStr
);
let
decrypt
=
CryptoJS
.
AES
.
decrypt
(
srcs
,
key
,
{
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
,
});
let
decryptedStr
=
decrypt
.
toString
(
CryptoJS
.
enc
.
Utf8
);
return
decryptedStr
.
toString
();
};
//加密
const
Encrypt
=
word
=>
{
let
srcs
=
CryptoJS
.
enc
.
Utf8
.
parse
(
word
);
let
encrypted
=
CryptoJS
.
AES
.
encrypt
(
srcs
,
key
,
{
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
,
});
return
encrypted
.
ciphertext
.
toString
().
toUpperCase
();
};
// 获取数据库配置信息
// 获取数据库配置信息
useEffect
(()
=>
{
useEffect
(()
=>
{
setCardLoading
(
true
);
setCardLoading
(
true
);
...
@@ -337,7 +365,7 @@ const DatabaseInitialization = props => {
...
@@ -337,7 +365,7 @@ const DatabaseInitialization = props => {
ip
:
resdata
.
data
.
ip
,
ip
:
resdata
.
data
.
ip
,
dbName
:
resdata
.
data
.
dbName
,
dbName
:
resdata
.
data
.
dbName
,
userName
:
resdata
.
data
.
userName
,
userName
:
resdata
.
data
.
userName
,
password
:
atob
(
resdata
.
data
.
password
),
password
:
Decrypt
(
resdata
.
data
.
password
),
});
});
GetDbChangeFirst
(
kk
);
GetDbChangeFirst
(
kk
);
// 有License的情况下首次进入展示数据
// 有License的情况下首次进入展示数据
...
@@ -411,7 +439,7 @@ const DatabaseInitialization = props => {
...
@@ -411,7 +439,7 @@ const DatabaseInitialization = props => {
const
GetDbChangeFirst
=
kk
=>
{
const
GetDbChangeFirst
=
kk
=>
{
let
obj
=
form
.
getFieldsValue
();
let
obj
=
form
.
getFieldsValue
();
GetDbProduct
({
...
obj
,
password
:
btoa
(
obj
.
password
)
}).
then
(
res
=>
{
GetDbProduct
({
...
obj
,
password
:
Encrypt
(
obj
.
password
)
}).
then
(
res
=>
{
setCardLoading
(
false
);
setCardLoading
(
false
);
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
if
(
res
.
data
.
IsAuthorize
)
{
if
(
res
.
data
.
IsAuthorize
)
{
...
@@ -461,7 +489,7 @@ const DatabaseInitialization = props => {
...
@@ -461,7 +489,7 @@ const DatabaseInitialization = props => {
const
GetDbChange
=
e
=>
{
const
GetDbChange
=
e
=>
{
let
obj
=
form
.
getFieldsValue
();
let
obj
=
form
.
getFieldsValue
();
GetDbProduct
({
...
obj
,
password
:
btoa
(
obj
.
password
)
}).
then
(
res
=>
{
GetDbProduct
({
...
obj
,
password
:
Encrypt
(
obj
.
password
)
}).
then
(
res
=>
{
setCardLoading
(
false
);
setCardLoading
(
false
);
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
if
(
res
.
data
.
IsAuthorize
)
{
if
(
res
.
data
.
IsAuthorize
)
{
...
@@ -472,10 +500,14 @@ const DatabaseInitialization = props => {
...
@@ -472,10 +500,14 @@ const DatabaseInitialization = props => {
onCheckLaster
(
res
.
data
.
IsAppend
);
onCheckLaster
(
res
.
data
.
IsAppend
);
}
}
}
else
{
}
else
{
let
obj1
=
form
.
getFieldsValue
();
CheckDatabaseIsExist
({
...
obj1
,
password
:
Encrypt
(
obj
.
password
)
}).
then
(
res1
=>
{
setCardLoading
(
false
);
if
(
res1
.
code
===
0
)
{
if
(
if
(
res
.
data
.
Project
&&
res1
.
data
.
Project
&&
res
.
data
.
Project
[
0
]
&&
res1
.
data
.
Project
[
0
]
&&
res
.
data
.
Project
[
res
.
data
.
Project
.
length
-
1
].
license
==
'已使用'
res1
.
data
.
Project
[
res1
.
data
.
Project
.
length
-
1
].
license
==
'已使用'
)
{
)
{
setbeforeColor
(
'red'
);
setbeforeColor
(
'red'
);
setResult
(
'未检测到可用License'
);
setResult
(
'未检测到可用License'
);
...
@@ -485,6 +517,12 @@ const DatabaseInitialization = props => {
...
@@ -485,6 +517,12 @@ const DatabaseInitialization = props => {
setResult
(
'未检测到License'
);
setResult
(
'未检测到License'
);
setMsg
(
'未检测到License'
);
setMsg
(
'未检测到License'
);
}
}
}
else
{
setbeforeColor
(
'red'
);
setResult
(
`
${
res1
.
msg
}
`
);
setMsg
(
res1
.
msg
);
}
});
}
}
if
(
res
.
data
.
Project
&&
res
.
data
.
Project
.
length
>
0
)
{
if
(
res
.
data
.
Project
&&
res
.
data
.
Project
.
length
>
0
)
{
setKeepHistroy
(
res
.
data
.
Project
);
setKeepHistroy
(
res
.
data
.
Project
);
...
@@ -563,7 +601,7 @@ const DatabaseInitialization = props => {
...
@@ -563,7 +601,7 @@ const DatabaseInitialization = props => {
const
GetDbChangeAppend
=
()
=>
{
const
GetDbChangeAppend
=
()
=>
{
let
obj
=
form
.
getFieldsValue
();
let
obj
=
form
.
getFieldsValue
();
GetDbProduct
({
...
obj
,
password
:
btoa
(
obj
.
password
)
}).
then
(
res
=>
{
GetDbProduct
({
...
obj
,
password
:
Encrypt
(
obj
.
password
)
}).
then
(
res
=>
{
setCardLoading
(
false
);
setCardLoading
(
false
);
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
if
(
res
.
data
.
Product
)
{
if
(
res
.
data
.
Product
)
{
...
@@ -643,7 +681,7 @@ const DatabaseInitialization = props => {
...
@@ -643,7 +681,7 @@ const DatabaseInitialization = props => {
handleShowModal
(
'initVisible'
,
false
);
handleShowModal
(
'initVisible'
,
false
);
setInitVisible
(
true
);
setInitVisible
(
true
);
doInitLog
();
doInitLog
();
NewInitAddDataBase
({
...
obj
,
productSetting
,
password
:
btoa
(
obj
.
password
)
}).
then
(
res
=>
{
NewInitAddDataBase
({
...
obj
,
productSetting
,
password
:
Encrypt
(
obj
.
password
)
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
GetDbChangeAppend
();
GetDbChangeAppend
();
setMsg
(
'未检测到可用License'
);
setMsg
(
'未检测到可用License'
);
...
@@ -697,7 +735,7 @@ const DatabaseInitialization = props => {
...
@@ -697,7 +735,7 @@ const DatabaseInitialization = props => {
setInitVisible
(
true
);
setInitVisible
(
true
);
doInitLog
();
doInitLog
();
let
obj
=
form
.
getFieldsValue
();
let
obj
=
form
.
getFieldsValue
();
InitEditDataBase
({
...
obj
,
password
:
btoa
(
obj
.
password
)
}).
then
(
res
=>
{
InitEditDataBase
({
...
obj
,
password
:
Encrypt
(
obj
.
password
)
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
GetDbChangeAppend
();
GetDbChangeAppend
();
setMsg
(
'未检测到可用License'
);
setMsg
(
'未检测到可用License'
);
...
@@ -798,7 +836,7 @@ const DatabaseInitialization = props => {
...
@@ -798,7 +836,7 @@ const DatabaseInitialization = props => {
// setKeepValue([]);
// setKeepValue([]);
setProduct
([]);
setProduct
([]);
setCardLoading
(
true
);
setCardLoading
(
true
);
GetProductList
({
...
obj
,
password
:
btoa
(
obj
.
password
)
}).
then
(
res
=>
{
GetProductList
({
...
obj
,
password
:
Encrypt
(
obj
.
password
)
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
console
.
log
(
res
.
data
);
console
.
log
(
res
.
data
);
GetDbChange
();
GetDbChange
();
...
@@ -827,10 +865,23 @@ const DatabaseInitialization = props => {
...
@@ -827,10 +865,23 @@ const DatabaseInitialization = props => {
setMsg
(
'请输入完整数据库信息'
);
setMsg
(
'请输入完整数据库信息'
);
}
}
};
};
// 非授权模式下环境检查
const
checkUnLicense
=
()
=>
{
let
obj
=
form
.
getFieldsValue
();
CheckDatabaseIsExist
({
...
obj
,
password
:
Encrypt
(
obj
.
password
)
}).
then
(
res
=>
{
setCardLoading
(
false
);
if
(
res
.
code
!==
0
)
{
setbeforeColor
(
'red'
);
setResult
(
`
${
res
.
msg
}
`
);
setMsg
(
res
.
msg
);
}
});
};
const
onCheckLaster
=
aa
=>
{
const
onCheckLaster
=
aa
=>
{
// 此时有授权码才能进入
// 此时有授权码才能进入
let
obj
=
form
.
getFieldsValue
();
let
obj
=
form
.
getFieldsValue
();
CheckDatabaseIsExist
({
...
obj
,
password
:
btoa
(
obj
.
password
)
}).
then
(
res
=>
{
CheckDatabaseIsExist
({
...
obj
,
password
:
Encrypt
(
obj
.
password
)
}).
then
(
res
=>
{
setCardLoading
(
false
);
setCardLoading
(
false
);
if
(
res
.
code
==
0
)
{
if
(
res
.
code
==
0
)
{
setDataValue
(
form
.
getFieldsValue
());
setDataValue
(
form
.
getFieldsValue
());
...
@@ -870,7 +921,7 @@ const DatabaseInitialization = props => {
...
@@ -870,7 +921,7 @@ const DatabaseInitialization = props => {
const
Submit
=
()
=>
{
const
Submit
=
()
=>
{
let
obj
=
form
.
getFieldsValue
();
let
obj
=
form
.
getFieldsValue
();
if
(
obj
.
ip
&&
obj
.
userName
&&
obj
.
password
&&
obj
.
dbName
)
{
if
(
obj
.
ip
&&
obj
.
userName
&&
obj
.
password
&&
obj
.
dbName
)
{
GetProductList
({
...
obj
,
password
:
btoa
(
obj
.
password
)
}).
then
(
res
=>
{
GetProductList
({
...
obj
,
password
:
Encrypt
(
obj
.
password
)
}).
then
(
res
=>
{
setCardLoading
(
false
);
setCardLoading
(
false
);
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
GetDbChange
(
1
);
GetDbChange
(
1
);
...
@@ -900,7 +951,7 @@ const DatabaseInitialization = props => {
...
@@ -900,7 +951,7 @@ const DatabaseInitialization = props => {
const
findCheck
=
aa
=>
{
const
findCheck
=
aa
=>
{
let
obj
=
form
.
getFieldsValue
();
let
obj
=
form
.
getFieldsValue
();
CheckDatabaseIsExist
({
...
obj
,
password
:
btoa
(
obj
.
password
)
}).
then
(
res
=>
{
CheckDatabaseIsExist
({
...
obj
,
password
:
Encrypt
(
obj
.
password
)
}).
then
(
res
=>
{
setCardLoading
(
false
);
setCardLoading
(
false
);
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
setDataValue
(
form
.
getFieldsValue
());
setDataValue
(
form
.
getFieldsValue
());
...
@@ -947,7 +998,7 @@ const DatabaseInitialization = props => {
...
@@ -947,7 +998,7 @@ const DatabaseInitialization = props => {
const
findCheck1
=
aa
=>
{
const
findCheck1
=
aa
=>
{
let
obj
=
form
.
getFieldsValue
();
let
obj
=
form
.
getFieldsValue
();
CheckDatabaseIsExist
({
...
obj
,
password
:
btoa
(
obj
.
password
)
}).
then
(
res
=>
{
CheckDatabaseIsExist
({
...
obj
,
password
:
Encrypt
(
obj
.
password
)
}).
then
(
res
=>
{
setCardLoading
(
false
);
setCardLoading
(
false
);
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
setDataValue
(
form
.
getFieldsValue
());
setDataValue
(
form
.
getFieldsValue
());
...
...
src/pages/platformCenter/gis/schemeConfig/VectorData/AddModal.jsx
View file @
c0c53508
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Form
,
Modal
,
Input
,
Select
,
AutoComplete
,
Button
,
notification
}
from
'antd'
;
import
{
Form
,
Modal
,
Input
,
Select
,
AutoComplete
,
Button
,
notification
}
from
'antd'
;
import
CryptoJS
from
'crypto-js'
;
import
styles
from
'../SchemeConfig.less'
;
import
styles
from
'../SchemeConfig.less'
;
import
{
GetGISServerMapList
,
publisService
}
from
'@/services/webConfig/api'
;
import
{
GetGISServerMapList
,
publisService
}
from
'@/services/webConfig/api'
;
...
@@ -19,6 +20,33 @@ const AddModal = props => {
...
@@ -19,6 +20,33 @@ const AddModal = props => {
const
[
gsIp
,
setGsIp
]
=
useState
([]);
const
[
gsIp
,
setGsIp
]
=
useState
([]);
const
[
form
]
=
Form
.
useForm
();
const
[
form
]
=
Form
.
useForm
();
const
{
Item
}
=
Form
;
const
{
Item
}
=
Form
;
const
key
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1p2a3n4d5a6o7m8s9a10n1e2t3c4o5re'
);
// 十六位十六进制数作为密钥
const
iv
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1234567890000000'
);
// 解密
const
Decrypt
=
word
=>
{
let
encryptedHexStr
=
CryptoJS
.
enc
.
Hex
.
parse
(
word
);
let
srcs
=
CryptoJS
.
enc
.
Base64
.
stringify
(
encryptedHexStr
);
let
decrypt
=
CryptoJS
.
AES
.
decrypt
(
srcs
,
key
,
{
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
,
});
let
decryptedStr
=
decrypt
.
toString
(
CryptoJS
.
enc
.
Utf8
);
return
decryptedStr
.
toString
();
};
// 加密
const
Encrypt
=
word
=>
{
let
srcs
=
CryptoJS
.
enc
.
Utf8
.
parse
(
word
);
let
encrypted
=
CryptoJS
.
AES
.
encrypt
(
srcs
,
key
,
{
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
,
});
return
encrypted
.
ciphertext
.
toString
().
toUpperCase
();
};
// 提交
// 提交
const
onSubmit
=
()
=>
{
const
onSubmit
=
()
=>
{
form
.
validateFields
().
then
(
validate
=>
{
form
.
validateFields
().
then
(
validate
=>
{
...
@@ -33,7 +61,7 @@ const AddModal = props => {
...
@@ -33,7 +61,7 @@ const AddModal = props => {
gsAppName
:
obj
.
servicename
,
gsAppName
:
obj
.
servicename
,
gsUser
:
obj
.
user
,
gsUser
:
obj
.
user
,
gsWorkspaceName
:
obj
.
workname
,
gsWorkspaceName
:
obj
.
workname
,
gsPwd
:
btoa
(
obj
.
password
),
gsPwd
:
Encrypt
(
obj
.
password
),
mapServerName
:
obj
.
name
,
mapServerName
:
obj
.
name
,
solution
:
solutionNames
,
solution
:
solutionNames
,
};
};
...
...
src/pages/platformCenter/hostmanager/baseConfig/BaseConfig.jsx
View file @
c0c53508
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Button
,
Descriptions
,
Input
,
Card
,
Divider
,
Row
,
Col
}
from
'antd'
;
import
{
Button
,
Descriptions
,
Input
,
Card
,
Divider
,
Row
,
Col
}
from
'antd'
;
import
CryptoJS
from
'crypto-js'
;
import
styles
from
'./BaseConfig.less'
;
import
styles
from
'./BaseConfig.less'
;
import
{
GetDataBaseConfig
,
GetBasicInfo
}
from
'@/services/hostmanager/hostmanager'
;
import
{
GetDataBaseConfig
,
GetBasicInfo
}
from
'@/services/hostmanager/hostmanager'
;
import
servie
from
'../../../../assets/images/icons/服务器管理.svg'
;
import
servie
from
'../../../../assets/images/icons/服务器管理.svg'
;
...
@@ -14,6 +15,33 @@ const BaseConfig = () => {
...
@@ -14,6 +15,33 @@ const BaseConfig = () => {
});
});
const
[
currentSiteInfo
,
setcurrentSiteInfo
]
=
useState
(
''
);
const
[
currentSiteInfo
,
setcurrentSiteInfo
]
=
useState
(
''
);
const
key
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1p2a3n4d5a6o7m8s9a10n1e2t3c4o5re'
);
// 十六位十六进制数作为密钥
const
iv
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1234567890000000'
);
// 解密
const
Decrypt
=
word
=>
{
let
encryptedHexStr
=
CryptoJS
.
enc
.
Hex
.
parse
(
word
);
let
srcs
=
CryptoJS
.
enc
.
Base64
.
stringify
(
encryptedHexStr
);
let
decrypt
=
CryptoJS
.
AES
.
decrypt
(
srcs
,
key
,
{
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
,
});
let
decryptedStr
=
decrypt
.
toString
(
CryptoJS
.
enc
.
Utf8
);
return
decryptedStr
.
toString
();
};
// 加密
const
Encrypt
=
word
=>
{
let
srcs
=
CryptoJS
.
enc
.
Utf8
.
parse
(
word
);
let
encrypted
=
CryptoJS
.
AES
.
encrypt
(
srcs
,
key
,
{
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
,
});
return
encrypted
.
ciphertext
.
toString
().
toUpperCase
();
};
useEffect
(()
=>
{
useEffect
(()
=>
{
getCurrentConfig
();
getCurrentConfig
();
getSiteCode
();
getSiteCode
();
...
@@ -35,8 +63,9 @@ const BaseConfig = () => {
...
@@ -35,8 +63,9 @@ const BaseConfig = () => {
};
};
const
encrypt
=
word
=>
{
const
encrypt
=
word
=>
{
let
aa
=
Decrypt
(
word
);
let
encryptStr
=
''
;
let
encryptStr
=
''
;
for
(
let
i
=
0
;
i
<
word
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
aa
.
length
;
i
++
)
{
encryptStr
+=
'*'
;
encryptStr
+=
'*'
;
}
}
return
encryptStr
;
return
encryptStr
;
...
...
src/pages/platformCenter/hostmanager/messageConfig/messageConfig.jsx
View file @
c0c53508
...
@@ -9,6 +9,7 @@ import {
...
@@ -9,6 +9,7 @@ import {
}
from
'@/services/hostmanager/hostmanager'
;
}
from
'@/services/hostmanager/hostmanager'
;
import
{
GetMessageVersion
}
from
'@/services/messagemanage/messagemanage'
;
import
{
GetMessageVersion
}
from
'@/services/messagemanage/messagemanage'
;
import
{
CloseCircleFilled
}
from
'@ant-design/icons'
;
import
{
CloseCircleFilled
}
from
'@ant-design/icons'
;
import
CryptoJS
from
'crypto-js'
;
import
message11
from
'../../../../assets/images/icons/消息.svg'
;
import
message11
from
'../../../../assets/images/icons/消息.svg'
;
import
Yes
from
'../../../../assets/images/icons/正确.svg'
;
import
Yes
from
'../../../../assets/images/icons/正确.svg'
;
import
styles
from
'./messageConfig.less'
;
import
styles
from
'./messageConfig.less'
;
...
@@ -31,6 +32,33 @@ const MessageConfig = () => {
...
@@ -31,6 +32,33 @@ const MessageConfig = () => {
const
[
flag
,
setFlag
]
=
useState
(
0
);
const
[
flag
,
setFlag
]
=
useState
(
0
);
const
[
form
]
=
Form
.
useForm
();
const
[
form
]
=
Form
.
useForm
();
const
key
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1p2a3n4d5a6o7m8s9a10n1e2t3c4o5re'
);
// 十六位十六进制数作为密钥
const
iv
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1234567890000000'
);
// 解密
const
Decrypt
=
word
=>
{
let
encryptedHexStr
=
CryptoJS
.
enc
.
Hex
.
parse
(
word
);
let
srcs
=
CryptoJS
.
enc
.
Base64
.
stringify
(
encryptedHexStr
);
let
decrypt
=
CryptoJS
.
AES
.
decrypt
(
srcs
,
key
,
{
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
,
});
let
decryptedStr
=
decrypt
.
toString
(
CryptoJS
.
enc
.
Utf8
);
return
decryptedStr
.
toString
();
};
// 加密
const
Encrypt
=
word
=>
{
let
srcs
=
CryptoJS
.
enc
.
Utf8
.
parse
(
word
);
let
encrypted
=
CryptoJS
.
AES
.
encrypt
(
srcs
,
key
,
{
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
,
});
return
encrypted
.
ciphertext
.
toString
().
toUpperCase
();
};
const
onFinish
=
values
=>
{
const
onFinish
=
values
=>
{
// 先测试连接再保存
// 先测试连接再保存
// 1.测试链接
// 1.测试链接
...
@@ -39,7 +67,7 @@ const MessageConfig = () => {
...
@@ -39,7 +67,7 @@ const MessageConfig = () => {
messAddress
:
values
.
messageAddress
,
messAddress
:
values
.
messageAddress
,
sqlServerIP
:
currentDataBase
.
ip
,
sqlServerIP
:
currentDataBase
.
ip
,
loginName
:
currentDataBase
.
userName
,
loginName
:
currentDataBase
.
userName
,
password
:
btoa
(
currentDataBase
.
password
),
password
:
Encrypt
(
currentDataBase
.
password
),
sqlName
:
currentDataBase
.
dbName
,
sqlName
:
currentDataBase
.
dbName
,
siteCode
:
currentSiteInfo
,
siteCode
:
currentSiteInfo
,
}).
then
(
res
=>
{
}).
then
(
res
=>
{
...
@@ -72,7 +100,7 @@ const MessageConfig = () => {
...
@@ -72,7 +100,7 @@ const MessageConfig = () => {
messAddress
:
CurrentAddress
,
messAddress
:
CurrentAddress
,
sqlServerIP
:
CurrentDataBase
.
ip
,
sqlServerIP
:
CurrentDataBase
.
ip
,
loginName
:
CurrentDataBase
.
userName
,
loginName
:
CurrentDataBase
.
userName
,
password
:
btoa
(
CurrentDataBase
.
password
),
password
:
Encrypt
(
CurrentDataBase
.
password
),
sqlName
:
CurrentDataBase
.
dbName
,
sqlName
:
CurrentDataBase
.
dbName
,
siteCode
:
currentSiteInfo
,
siteCode
:
currentSiteInfo
,
}).
then
(
res
=>
{
}).
then
(
res
=>
{
...
@@ -105,7 +133,7 @@ const MessageConfig = () => {
...
@@ -105,7 +133,7 @@ const MessageConfig = () => {
GetDataBaseConfig
().
then
(
resdata
=>
{
GetDataBaseConfig
().
then
(
resdata
=>
{
if
(
resdata
.
code
===
0
)
{
if
(
resdata
.
code
===
0
)
{
setCurrentDataBase
({
...
resdata
.
data
,
password
:
atob
(
resdata
.
data
.
password
)
});
setCurrentDataBase
({
...
resdata
.
data
,
password
:
Decrypt
(
resdata
.
data
.
password
)
});
GetBasicInfo
().
then
(
reslist
=>
{
GetBasicInfo
().
then
(
reslist
=>
{
if
(
reslist
.
code
===
0
)
{
if
(
reslist
.
code
===
0
)
{
setcurrentSiteInfo
(
reslist
.
data
);
setcurrentSiteInfo
(
reslist
.
data
);
...
...
src/pages/platformCenter/videoManager/AddAllModal.jsx
View file @
c0c53508
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
/* eslint-disable react/jsx-no-undef */
/* eslint-disable react/jsx-no-undef */
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Form
,
Modal
,
Row
,
Col
,
Input
,
Select
,
notification
}
from
'antd'
;
import
{
Form
,
Modal
,
Row
,
Col
,
Input
,
Select
,
notification
}
from
'antd'
;
import
CryptoJS
from
'crypto-js'
;
import
{
addInsertVideoConfig
,
editInsertVideoConfig
}
from
'@/services/videoManger/videoManger'
;
import
{
addInsertVideoConfig
,
editInsertVideoConfig
}
from
'@/services/videoManger/videoManger'
;
const
AddModal
=
props
=>
{
const
AddModal
=
props
=>
{
...
@@ -20,8 +21,36 @@ const AddModal = props => {
...
@@ -20,8 +21,36 @@ const AddModal = props => {
const
[
selectChange2
,
setSelectChange2
]
=
useState
(
'主码流'
);
const
[
selectChange2
,
setSelectChange2
]
=
useState
(
'主码流'
);
const
[
load
,
setLoad
]
=
useState
(
false
);
// 提交加载
const
[
load
,
setLoad
]
=
useState
(
false
);
// 提交加载
const
key
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1p2a3n4d5a6o7m8s9a10n1e2t3c4o5re'
);
// 十六位十六进制数作为密钥
const
iv
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1234567890000000'
);
const
[
configurationType
,
setConfigurationType
]
=
useState
(
'1'
);
const
[
configurationType
,
setConfigurationType
]
=
useState
(
'1'
);
// 解密
const
Decrypt
=
word
=>
{
let
encryptedHexStr
=
CryptoJS
.
enc
.
Hex
.
parse
(
word
);
let
srcs
=
CryptoJS
.
enc
.
Base64
.
stringify
(
encryptedHexStr
);
let
decrypt
=
CryptoJS
.
AES
.
decrypt
(
srcs
,
key
,
{
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
,
});
let
decryptedStr
=
decrypt
.
toString
(
CryptoJS
.
enc
.
Utf8
);
return
decryptedStr
.
toString
();
};
// 加密
const
Encrypt
=
word
=>
{
let
srcs
=
CryptoJS
.
enc
.
Utf8
.
parse
(
word
);
let
encrypted
=
CryptoJS
.
AES
.
encrypt
(
srcs
,
key
,
{
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
,
});
return
encrypted
.
ciphertext
.
toString
().
toUpperCase
();
};
const
onChange
=
value
=>
{
const
onChange
=
value
=>
{
setSelectChange
(
value
);
setSelectChange
(
value
);
};
};
...
@@ -55,8 +84,8 @@ const AddModal = props => {
...
@@ -55,8 +84,8 @@ const AddModal = props => {
getValue
.
StreamType
=
'主码流'
;
getValue
.
StreamType
=
'主码流'
;
}
}
getValue
.
VideoManufacturer
=
Type
;
getValue
.
VideoManufacturer
=
Type
;
console
.
log
(
getValue
.
LoginPwd
)
addInsertVideoConfig
({
...
getValue
,
LoginPwd
:
btoa
(
getValue
.
LoginPwd
)
}).
then
(
res
=>
{
addInsertVideoConfig
({
...
getValue
,
LoginPwd
:
Encrypt
(
getValue
.
LoginPwd
)
}).
then
(
res
=>
{
if
(
res
.
msg
===
'Ok'
)
{
if
(
res
.
msg
===
'Ok'
)
{
onCancel
();
onCancel
();
setLoad
(
false
);
setLoad
(
false
);
...
...
src/pages/platformCenter/videoManager/AddModal.jsx
View file @
c0c53508
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Form
,
Modal
,
Row
,
Col
,
Input
,
Select
,
notification
}
from
'antd'
;
import
{
Form
,
Modal
,
Row
,
Col
,
Input
,
Select
,
notification
}
from
'antd'
;
import
{
addInsertVideoConfig
,
editInsertVideoConfig
}
from
'@/services/videoManger/videoManger'
;
import
{
addInsertVideoConfig
,
editInsertVideoConfig
}
from
'@/services/videoManger/videoManger'
;
import
CryptoJS
from
'crypto-js'
;
const
AddModal
=
props
=>
{
const
AddModal
=
props
=>
{
const
{
callBackSubmit
=
()
=>
{},
visible
,
onCancel
,
type
,
type1
,
kind
,
obj
}
=
props
;
const
{
callBackSubmit
=
()
=>
{},
visible
,
onCancel
,
type
,
type1
,
kind
,
obj
}
=
props
;
...
@@ -15,6 +16,33 @@ const AddModal = props => {
...
@@ -15,6 +16,33 @@ const AddModal = props => {
const
[
selectChange2
,
setSelectChange2
]
=
useState
(
'主码流'
);
const
[
selectChange2
,
setSelectChange2
]
=
useState
(
'主码流'
);
const
[
load
,
setLoad
]
=
useState
(
false
);
// 提交加载
const
[
load
,
setLoad
]
=
useState
(
false
);
// 提交加载
const
key
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1p2a3n4d5a6o7m8s9a10n1e2t3c4o5re'
);
// 十六位十六进制数作为密钥
const
iv
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1234567890000000'
);
// 解密
const
Decrypt
=
word
=>
{
let
encryptedHexStr
=
CryptoJS
.
enc
.
Hex
.
parse
(
word
);
let
srcs
=
CryptoJS
.
enc
.
Base64
.
stringify
(
encryptedHexStr
);
let
decrypt
=
CryptoJS
.
AES
.
decrypt
(
srcs
,
key
,
{
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
,
});
let
decryptedStr
=
decrypt
.
toString
(
CryptoJS
.
enc
.
Utf8
);
return
decryptedStr
.
toString
();
};
// 加密
const
Encrypt
=
word
=>
{
let
srcs
=
CryptoJS
.
enc
.
Utf8
.
parse
(
word
);
let
encrypted
=
CryptoJS
.
AES
.
encrypt
(
srcs
,
key
,
{
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
,
});
return
encrypted
.
ciphertext
.
toString
().
toUpperCase
();
};
const
onChange
=
value
=>
{
const
onChange
=
value
=>
{
setSelectChange
(
value
);
setSelectChange
(
value
);
};
};
...
@@ -28,11 +56,12 @@ const AddModal = props => {
...
@@ -28,11 +56,12 @@ const AddModal = props => {
};
};
useEffect
(()
=>
{
useEffect
(()
=>
{
console
.
log
(
obj
.
LoginPwd
);
setLoad
(
false
);
setLoad
(
false
);
if
(
kind
===
'add'
)
{
if
(
kind
===
'add'
)
{
form
.
resetFields
();
form
.
resetFields
();
}
else
{
}
else
{
form
.
setFieldsValue
({
...
obj
,
LoginPwd
:
obj
.
LoginPwd
?
atob
(
obj
.
LoginPwd
)
:
''
});
form
.
setFieldsValue
({
...
obj
,
LoginPwd
:
obj
.
LoginPwd
?
Decrypt
(
obj
.
LoginPwd
)
:
''
});
}
}
},
[
visible
]);
},
[
visible
]);
const
onSubmit
=
()
=>
{
const
onSubmit
=
()
=>
{
...
@@ -52,7 +81,7 @@ const AddModal = props => {
...
@@ -52,7 +81,7 @@ const AddModal = props => {
}
}
getValue
.
VideoManufacturer
=
type
;
getValue
.
VideoManufacturer
=
type
;
if
(
kind
===
'add'
)
{
if
(
kind
===
'add'
)
{
addInsertVideoConfig
({
...
getValue
,
LoginPwd
:
btoa
(
getValue
.
LoginPwd
)
}).
then
(
res
=>
{
addInsertVideoConfig
({
...
getValue
,
LoginPwd
:
Encrypt
(
getValue
.
LoginPwd
)
}).
then
(
res
=>
{
if
(
res
.
msg
===
'Ok'
)
{
if
(
res
.
msg
===
'Ok'
)
{
onCancel
();
onCancel
();
setLoad
(
false
);
setLoad
(
false
);
...
@@ -77,7 +106,7 @@ const AddModal = props => {
...
@@ -77,7 +106,7 @@ const AddModal = props => {
editInsertVideoConfig
({
editInsertVideoConfig
({
...
getValue
,
...
getValue
,
Id
:
obj
.
Id
,
Id
:
obj
.
Id
,
LoginPwd
:
btoa
(
getValue
.
LoginPwd
),
LoginPwd
:
Encrypt
(
getValue
.
LoginPwd
),
}).
then
(
res
=>
{
}).
then
(
res
=>
{
if
(
res
.
msg
===
'Ok'
)
{
if
(
res
.
msg
===
'Ok'
)
{
onCancel
();
onCancel
();
...
@@ -305,7 +334,7 @@ const AddModal = props => {
...
@@ -305,7 +334,7 @@ const AddModal = props => {
</
Form
>
</
Form
>
</
Modal
>
</
Modal
>
);
);
}
else
{
}
return
(
return
(
<
Modal
<
Modal
visible=
{
visible
}
visible=
{
visible
}
...
@@ -638,11 +667,7 @@ const AddModal = props => {
...
@@ -638,11 +667,7 @@ const AddModal = props => {
},
},
]
}
]
}
>
>
<
Select
<
Select
defaultValue=
"主码流"
value=
{
selectChange2
}
onChange=
{
onChange2
}
>
defaultValue=
"主码流"
value=
{
selectChange2
}
onChange=
{
onChange2
}
>
<
Option
value=
"主码流"
>
主码流
</
Option
>
<
Option
value=
"主码流"
>
主码流
</
Option
>
<
Option
value=
"子码流"
>
子码流
</
Option
>
<
Option
value=
"子码流"
>
子码流
</
Option
>
</
Select
>
</
Select
>
...
@@ -681,6 +706,5 @@ const AddModal = props => {
...
@@ -681,6 +706,5 @@ const AddModal = props => {
</
Form
>
</
Form
>
</
Modal
>
</
Modal
>
);
);
}
};
};
export
default
AddModal
;
export
default
AddModal
;
src/pages/platformCenter/videoManager/DHModal.jsx
View file @
c0c53508
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Form
,
Modal
,
Row
,
Col
,
Input
,
Select
,
notification
}
from
'antd'
;
import
{
Form
,
Modal
,
Row
,
Col
,
Input
,
Select
,
notification
}
from
'antd'
;
import
{
addInsertVideoConfig
,
editInsertVideoConfig
}
from
'@/services/videoManger/videoManger'
;
import
{
addInsertVideoConfig
,
editInsertVideoConfig
}
from
'@/services/videoManger/videoManger'
;
import
CryptoJS
from
'crypto-js'
;
const
AddDHModal
=
props
=>
{
const
AddDHModal
=
props
=>
{
const
{
callBackSubmit
=
()
=>
{},
visible
,
onCancel
,
type
,
kind
,
obj
}
=
props
;
const
{
callBackSubmit
=
()
=>
{},
visible
,
onCancel
,
type
,
kind
,
obj
}
=
props
;
...
@@ -15,6 +16,33 @@ const AddDHModal = props => {
...
@@ -15,6 +16,33 @@ const AddDHModal = props => {
const
[
selectChange2
,
setSelectChange2
]
=
useState
(
'主码流'
);
const
[
selectChange2
,
setSelectChange2
]
=
useState
(
'主码流'
);
const
[
load
,
setLoad
]
=
useState
(
false
);
// 提交加载
const
[
load
,
setLoad
]
=
useState
(
false
);
// 提交加载
const
key
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1p2a3n4d5a6o7m8s9a10n1e2t3c4o5re'
);
// 十六位十六进制数作为密钥
const
iv
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1234567890000000'
);
// 解密
const
Decrypt
=
word
=>
{
let
encryptedHexStr
=
CryptoJS
.
enc
.
Hex
.
parse
(
word
);
let
srcs
=
CryptoJS
.
enc
.
Base64
.
stringify
(
encryptedHexStr
);
let
decrypt
=
CryptoJS
.
AES
.
decrypt
(
srcs
,
key
,
{
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
,
});
let
decryptedStr
=
decrypt
.
toString
(
CryptoJS
.
enc
.
Utf8
);
return
decryptedStr
.
toString
();
};
// 加密
const
Encrypt
=
word
=>
{
let
srcs
=
CryptoJS
.
enc
.
Utf8
.
parse
(
word
);
let
encrypted
=
CryptoJS
.
AES
.
encrypt
(
srcs
,
key
,
{
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
,
});
return
encrypted
.
ciphertext
.
toString
().
toUpperCase
();
};
const
onChange
=
value
=>
{
const
onChange
=
value
=>
{
setSelectChange
(
value
);
setSelectChange
(
value
);
};
};
...
@@ -28,11 +56,12 @@ const AddDHModal = props => {
...
@@ -28,11 +56,12 @@ const AddDHModal = props => {
};
};
useEffect
(()
=>
{
useEffect
(()
=>
{
console
.
log
(
obj
.
LoginPwd
);
setLoad
(
false
);
setLoad
(
false
);
if
(
kind
===
'add'
)
{
if
(
kind
===
'add'
)
{
form
.
resetFields
();
form
.
resetFields
();
}
else
{
}
else
{
form
.
setFieldsValue
({
...
obj
,
LoginPwd
:
obj
.
LoginPwd
?
atob
(
obj
.
LoginPwd
)
:
''
});
form
.
setFieldsValue
({
...
obj
,
LoginPwd
:
obj
.
LoginPwd
?
Decrypt
(
obj
.
LoginPwd
)
:
''
});
}
}
},
[
visible
]);
},
[
visible
]);
const
onSubmit
=
()
=>
{
const
onSubmit
=
()
=>
{
...
@@ -52,7 +81,7 @@ const AddDHModal = props => {
...
@@ -52,7 +81,7 @@ const AddDHModal = props => {
}
}
getValue
.
VideoManufacturer
=
type
;
getValue
.
VideoManufacturer
=
type
;
if
(
kind
===
'add'
)
{
if
(
kind
===
'add'
)
{
addInsertVideoConfig
({
...
getValue
,
LoginPwd
:
btoa
(
getValue
.
LoginPwd
)
}).
then
(
res
=>
{
addInsertVideoConfig
({
...
getValue
,
LoginPwd
:
Encrypt
(
getValue
.
LoginPwd
)
}).
then
(
res
=>
{
if
(
res
.
msg
===
'Ok'
)
{
if
(
res
.
msg
===
'Ok'
)
{
onCancel
();
onCancel
();
setLoad
(
false
);
setLoad
(
false
);
...
@@ -77,7 +106,7 @@ const AddDHModal = props => {
...
@@ -77,7 +106,7 @@ const AddDHModal = props => {
editInsertVideoConfig
({
editInsertVideoConfig
({
...
getValue
,
...
getValue
,
Id
:
obj
.
Id
,
Id
:
obj
.
Id
,
LoginPwd
:
btoa
(
getValue
.
LoginPwd
),
LoginPwd
:
Encrypt
(
getValue
.
LoginPwd
),
}).
then
(
res
=>
{
}).
then
(
res
=>
{
if
(
res
.
msg
===
'Ok'
)
{
if
(
res
.
msg
===
'Ok'
)
{
onCancel
();
onCancel
();
...
...
src/pages/platformCenter/videoManager/HKModal.jsx
View file @
c0c53508
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Form
,
Modal
,
Row
,
Col
,
Input
,
Select
,
notification
}
from
'antd'
;
import
{
Form
,
Modal
,
Row
,
Col
,
Input
,
Select
,
notification
}
from
'antd'
;
import
{
addInsertVideoConfig
,
editInsertVideoConfig
}
from
'@/services/videoManger/videoManger'
;
import
{
addInsertVideoConfig
,
editInsertVideoConfig
}
from
'@/services/videoManger/videoManger'
;
import
CryptoJS
from
'crypto-js'
;
const
AddHKModal
=
props
=>
{
const
AddHKModal
=
props
=>
{
const
{
callBackSubmit
=
()
=>
{},
visible
,
onCancel
,
type
,
kind
,
obj
}
=
props
;
const
{
callBackSubmit
=
()
=>
{},
visible
,
onCancel
,
type
,
kind
,
obj
}
=
props
;
...
@@ -14,6 +15,33 @@ const AddHKModal = props => {
...
@@ -14,6 +15,33 @@ const AddHKModal = props => {
const
[
selectChange2
,
setSelectChange2
]
=
useState
(
'主码流'
);
const
[
selectChange2
,
setSelectChange2
]
=
useState
(
'主码流'
);
const
[
load
,
setLoad
]
=
useState
(
false
);
// 提交加载
const
[
load
,
setLoad
]
=
useState
(
false
);
// 提交加载
const
key
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1p2a3n4d5a6o7m8s9a10n1e2t3c4o5re'
);
// 十六位十六进制数作为密钥
const
iv
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1234567890000000'
);
// 解密
const
Decrypt
=
word
=>
{
let
encryptedHexStr
=
CryptoJS
.
enc
.
Hex
.
parse
(
word
);
let
srcs
=
CryptoJS
.
enc
.
Base64
.
stringify
(
encryptedHexStr
);
let
decrypt
=
CryptoJS
.
AES
.
decrypt
(
srcs
,
key
,
{
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
,
});
let
decryptedStr
=
decrypt
.
toString
(
CryptoJS
.
enc
.
Utf8
);
return
decryptedStr
.
toString
();
};
// 加密
const
Encrypt
=
word
=>
{
let
srcs
=
CryptoJS
.
enc
.
Utf8
.
parse
(
word
);
let
encrypted
=
CryptoJS
.
AES
.
encrypt
(
srcs
,
key
,
{
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
,
});
return
encrypted
.
ciphertext
.
toString
().
toUpperCase
();
};
const
onChange
=
value
=>
{
const
onChange
=
value
=>
{
setSelectChange
(
value
);
setSelectChange
(
value
);
};
};
...
@@ -27,11 +55,12 @@ const AddHKModal = props => {
...
@@ -27,11 +55,12 @@ const AddHKModal = props => {
};
};
useEffect
(()
=>
{
useEffect
(()
=>
{
console
.
log
(
obj
.
LoginPwd
);
setLoad
(
false
);
setLoad
(
false
);
if
(
kind
===
'add'
)
{
if
(
kind
===
'add'
)
{
form
.
resetFields
();
form
.
resetFields
();
}
else
{
}
else
{
form
.
setFieldsValue
({
...
obj
,
LoginPwd
:
obj
.
LoginPwd
?
atob
(
obj
.
LoginPwd
)
:
''
});
form
.
setFieldsValue
({
...
obj
,
LoginPwd
:
obj
.
LoginPwd
?
Decrypt
(
obj
.
LoginPwd
)
:
''
});
}
}
},
[
visible
]);
},
[
visible
]);
const
onSubmit
=
()
=>
{
const
onSubmit
=
()
=>
{
...
@@ -51,7 +80,7 @@ const AddHKModal = props => {
...
@@ -51,7 +80,7 @@ const AddHKModal = props => {
}
}
getValue
.
VideoManufacturer
=
type
;
getValue
.
VideoManufacturer
=
type
;
if
(
kind
===
'add'
)
{
if
(
kind
===
'add'
)
{
addInsertVideoConfig
({
...
getValue
,
LoginPwd
:
btoa
(
getValue
.
LoginPwd
)
}).
then
(
res
=>
{
addInsertVideoConfig
({
...
getValue
,
LoginPwd
:
Encrypt
(
getValue
.
LoginPwd
)
}).
then
(
res
=>
{
if
(
res
.
msg
===
'Ok'
)
{
if
(
res
.
msg
===
'Ok'
)
{
onCancel
();
onCancel
();
setLoad
(
false
);
setLoad
(
false
);
...
@@ -76,7 +105,7 @@ const AddHKModal = props => {
...
@@ -76,7 +105,7 @@ const AddHKModal = props => {
editInsertVideoConfig
({
editInsertVideoConfig
({
...
getValue
,
...
getValue
,
Id
:
obj
.
Id
,
Id
:
obj
.
Id
,
LoginPwd
:
btoa
(
getValue
.
LoginPwd
),
LoginPwd
:
Encrypt
(
getValue
.
LoginPwd
),
}).
then
(
res
=>
{
}).
then
(
res
=>
{
if
(
res
.
msg
===
'Ok'
)
{
if
(
res
.
msg
===
'Ok'
)
{
onCancel
();
onCancel
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment