Commit 7a48cc3d authored by 皮倩雯's avatar 皮倩雯

fix: '修复数据库链接失败bug‘

parent e3a5d5a9
Pipeline #81866 passed with stages
......@@ -253,8 +253,10 @@ const InitDataBase = props => {
const onFinish = values => {
setCardLoading(true);
const obj = values;
console.log(chooseDb.current, 'obj');
let pwd = Decrypt(obj.password) === '' ? Encrypt(obj.password) : obj.password;
let pwd =
Decrypt(obj.password) === '' || Decrypt(obj.password).indexOf('\u0004') !== -1
? Encrypt(obj.password)
: obj.password;
saveConnectionNew({
ip: obj.ip,
dbName: obj.dbName,
......@@ -296,7 +298,10 @@ const InitDataBase = props => {
const onCheck = e => {
setCardLoading(true);
const obj = form.getFieldsValue();
let pwd = Decrypt(obj.password) === '' ? Encrypt(obj.password) : obj.password;
let pwd =
Decrypt(obj.password) === '' || Decrypt(obj.password).indexOf('\u0004') !== -1
? Encrypt(obj.password)
: obj.password;
connectionTest({
ip: obj.ip,
dbName: obj.dbName,
......@@ -327,7 +332,10 @@ const InitDataBase = props => {
// 获取数据库列表
const selectFocus = e => {
let params = form.getFieldsValue();
let pwd = Decrypt(params.password) === '' ? Encrypt(params.password) : params.password;
let pwd =
Decrypt(params.password) === '' || Decrypt(params.password).indexOf('\u0004') !== -1
? Encrypt(params.password)
: params.password;
getDataBaseList({
userName: params.userName || '',
password: pwd || '',
......
......@@ -96,7 +96,10 @@ const AppendModal = props => {
const getProduct = () => {
setLoading(true);
let pwd = Decrypt(value.password) === '' ? Encrypt(value.password) : value.password;
let pwd =
Decrypt(value.password) === '' || Decrypt(value.password).indexOf('\u0004') !== -1
? Encrypt(value.password)
: value.password;
GetLicenseDifference({ ...value, password: pwd }).then(res => {
setLoading(false);
if (res.code === 0) {
......
......@@ -452,7 +452,10 @@ const DatabaseInitialization = props => {
const GetDbChangeFirst = kk => {
let obj = form.getFieldsValue();
let pwd = Decrypt(obj.password) === '' ? Encrypt(obj.password) : obj.password;
let pwd =
Decrypt(obj.password) === '' || Decrypt(obj.password).indexOf('\u0004') !== -1
? Encrypt(obj.password)
: obj.password;
GetDbProduct({ ...obj, password: pwd }).then(res => {
setCardLoading(false);
if (res.code === 0) {
......@@ -503,7 +506,10 @@ const DatabaseInitialization = props => {
const GetDbChange = e => {
let obj = form.getFieldsValue();
let pwd = Decrypt(obj.password) === '' ? Encrypt(obj.password) : obj.password;
let pwd =
Decrypt(obj.password) === '' || Decrypt(obj.password).indexOf('\u0004') !== -1
? Encrypt(obj.password)
: obj.password;
GetDbProduct({ ...obj, password: pwd }).then(res => {
setCardLoading(false);
if (res.code === 0) {
......@@ -619,7 +625,10 @@ const DatabaseInitialization = props => {
const GetDbChangeAppend = () => {
let obj = form.getFieldsValue();
let pwd = Decrypt(obj.password) === '' ? Encrypt(obj.password) : obj.password;
let pwd =
Decrypt(obj.password) === '' || Decrypt(obj.password).indexOf('\u0004') !== -1
? Encrypt(obj.password)
: obj.password;
GetDbProduct({ ...obj, password: pwd }).then(res => {
setCardLoading(false);
if (res.code === 0) {
......@@ -704,7 +713,10 @@ const DatabaseInitialization = props => {
handleShowModal('initVisible', false);
setInitVisible(true);
doInitLog();
let pwd = Decrypt(obj.password) === '' ? Encrypt(obj.password) : obj.password;
let pwd =
Decrypt(obj.password) === '' || Decrypt(obj.password).indexOf('\u0004') !== -1
? Encrypt(obj.password)
: obj.password;
NewInitAddDataBase({ ...obj, productSetting, password: pwd }).then(res => {
if (res.code === 0) {
GetDbChangeAppend(); // 刷星已初始化的产品勾选
......@@ -760,7 +772,10 @@ const DatabaseInitialization = props => {
setInitVisible(true);
doInitLog();
let obj = form.getFieldsValue();
let pwd = Decrypt(obj.password) === '' ? Encrypt(obj.password) : obj.password;
let pwd =
Decrypt(obj.password) === '' || Decrypt(obj.password).indexOf('\u0004') !== -1
? Encrypt(obj.password)
: obj.password;
InitEditDataBase({
...obj,
password: pwd,
......@@ -857,7 +872,10 @@ const DatabaseInitialization = props => {
// setKeepValue([]);
setProduct([]);
setCardLoading(true);
let pwd = Decrypt(obj.password) === '' ? Encrypt(obj.password) : obj.password;
let pwd =
Decrypt(obj.password) === '' || Decrypt(obj.password).indexOf('\u0004') !== -1
? Encrypt(obj.password)
: obj.password;
GetProductList({ ...obj, password: pwd }).then(res => {
if (res.code === 0) {
console.log(res.data);
......@@ -890,7 +908,10 @@ const DatabaseInitialization = props => {
// 非授权模式下环境检查
const checkUnLicense = () => {
let obj = form.getFieldsValue();
let pwd = Decrypt(obj.password) === '' ? Encrypt(obj.password) : obj.password;
let pwd =
Decrypt(obj.password) === '' || Decrypt(obj.password).indexOf('\u0004') !== -1
? Encrypt(obj.password)
: obj.password;
CheckDatabaseIsExist({ ...obj, password: pwd }).then(res => {
setCardLoading(false);
if (res.code !== 0) {
......@@ -904,7 +925,10 @@ const DatabaseInitialization = props => {
const onCheckLaster = aa => {
// 此时有授权码才能进入
let obj = form.getFieldsValue();
let pwd = Decrypt(obj.password) === '' ? Encrypt(obj.password) : obj.password;
let pwd =
Decrypt(obj.password) === '' || Decrypt(obj.password).indexOf('\u0004') !== -1
? Encrypt(obj.password)
: obj.password;
CheckDatabaseIsExist({ ...obj, password: pwd }).then(res => {
setCardLoading(false);
if (res.code == 0) {
......@@ -953,7 +977,10 @@ const DatabaseInitialization = props => {
setAppendType('no');
let obj = form.getFieldsValue();
if (obj.ip && obj.userName && obj.password && obj.dbName) {
let pwd = Decrypt(obj.password) === '' ? Encrypt(obj.password) : obj.password;
let pwd =
Decrypt(obj.password) === '' || Decrypt(obj.password).indexOf('\u0004') !== -1
? Encrypt(obj.password)
: obj.password;
GetProductList({ ...obj, password: pwd }).then(res => {
setCardLoading(false);
if (res.code === 0) {
......@@ -983,7 +1010,10 @@ const DatabaseInitialization = props => {
const findCheck = aa => {
let obj = form.getFieldsValue();
let pwd = Decrypt(obj.password) === '' ? Encrypt(obj.password) : obj.password;
let pwd =
Decrypt(obj.password) === '' || Decrypt(obj.password).indexOf('\u0004') !== -1
? Encrypt(obj.password)
: obj.password;
CheckDatabaseIsExist({ ...obj, password: pwd }).then(res => {
setCardLoading(false);
if (res.code === 0) {
......@@ -1039,7 +1069,10 @@ const DatabaseInitialization = props => {
const findCheck1 = aa => {
let obj = form.getFieldsValue();
let pwd = Decrypt(obj.password) === '' ? Encrypt(obj.password) : obj.password;
let pwd =
Decrypt(obj.password) === '' || Decrypt(obj.password).indexOf('\u0004') !== -1
? Encrypt(obj.password)
: obj.password;
CheckDatabaseIsExist({ ...obj, password: pwd }).then(res => {
setCardLoading(false);
if (res.code === 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment