diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/util/MerchantUtils.java b/jsowell-pile/src/main/java/com/jsowell/pile/util/MerchantUtils.java index 3a38970df..0677e6de7 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/util/MerchantUtils.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/util/MerchantUtils.java @@ -16,7 +16,7 @@ public class MerchantUtils { } /** - * + * 从统一社会信用代码中获取组织机构代码 * @param organizationCode * @return */ diff --git a/jsowell-ui/src/utils/common.js b/jsowell-ui/src/utils/common.js index 0c52b71cc..2a8681779 100644 --- a/jsowell-ui/src/utils/common.js +++ b/jsowell-ui/src/utils/common.js @@ -107,6 +107,25 @@ export function selectDictLabels(datas, value, separator) { return actions.join('').substring(0, actions.join('').length - 1); } +/* + * 验证字符串是否为空(也不能为纯空格) + * true--说明为空, false--说明不为空 + */ +export function isEmptyString(string) { + if ( + string == undefined || + typeof string == 'undefined' || + !string || + string == null || + string == '' || + /^\s+$/gi.test(string) + ) { + return true; + } else { + return false; + } +} + // 字符串格式化(%s ) export function sprintf(str) { var args = arguments, flag = true, i = 1; diff --git a/jsowell-ui/src/views/thirdparty/secret/detail.vue b/jsowell-ui/src/views/thirdparty/secret/detail.vue index c24523f2e..4ee852512 100644 --- a/jsowell-ui/src/views/thirdparty/secret/detail.vue +++ b/jsowell-ui/src/views/thirdparty/secret/detail.vue @@ -6,14 +6,14 @@ - + - + + style="width: 90%"/> @@ -21,21 +21,25 @@
对接平台密钥信息
+ style="margin-top: 20px;"> + placeholder="请输入对接平台生成的唯一识别密钥(OperatorSecret)" + style="width: 90%"/> - + - + - +
@@ -44,24 +48,29 @@
我方生成密钥信息 - 生成密钥 + 生成密钥 +
- + style="margin-top: 20px;"> + - + - + + style="width: 90%"/>
@@ -83,7 +92,7 @@ import {addSecret, getSecret, updateSecret} from "@/api/thirdParty/secret"; -import {generateRandomID} from "@/utils/common"; +import {generateRandomID, isEmptyString} from "@/utils/common"; export default { dicts: ["third_party_type"], @@ -96,8 +105,7 @@ export default { // 表单参数 form: {}, // 表单校验 - rules: { - } + rules: {} }; }, created() { @@ -106,8 +114,31 @@ export default { }, methods: { // 生成密钥 + clickGenerateSecret() { + // 是否有值,默认false + let hasValue = false; + if (!isEmptyString(this.form.ourOperatorSecret) || !isEmptyString(this.form.ourDataSecret) + || !isEmptyString(this.form.ourDataSecretIv) || !isEmptyString(this.form.ourSigSecret)) { + // 任一字段不为空,hasValue为true + hasValue = true; + } + if (hasValue) { + // 有值时弹出提示框 + this.$confirm('当前已经有值, 此操作将覆盖原值, 是否继续?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + // 点击确定生成密钥 + this.generateSecret(); + }); + } else { + // 没有值,直接生成密钥 + this.generateSecret(); + } + }, + // 生成密钥方法 generateSecret() { - console.log("生成密钥"); this.form.ourOperatorSecret = generateRandomID(16); this.form.ourDataSecret = generateRandomID(16); this.form.ourDataSecretIv = generateRandomID(16); @@ -128,7 +159,7 @@ export default { updateTitle() { const platformName = this.platformName; const title = "【" + platformName + "】平台配置"; - const route = Object.assign({}, this.$route, { title: `${title}` }); + const route = Object.assign({}, this.$route, {title: `${title}`}); this.$store.dispatch("tagsView/updateVisitedView", route); }, submitForm() { diff --git a/jsowell-ui/src/views/thirdparty/secret/index.vue b/jsowell-ui/src/views/thirdparty/secret/index.vue index 63aafa043..acd0ba174 100644 --- a/jsowell-ui/src/views/thirdparty/secret/index.vue +++ b/jsowell-ui/src/views/thirdparty/secret/index.vue @@ -356,6 +356,13 @@ export default { // 生成密钥 generateSecret() { console.log("生成密钥"); + if ((this.form.ourOperatorSecret != null && this.form.ourOperatorSecret.length !== 0) + || (this.form.ourDataSecret != null && this.form.ourDataSecret.length !== 0) + || (this.form.ourDataSecretIv != null && this.form.ourDataSecretIv.length !== 0) + || (this.form.ourSigSecret != null && this.form.ourSigSecret.length !== 0)) { + console.log("当前已经有值,是否重新生成覆盖原值?"); + return; + } this.form.ourOperatorSecret = generateRandomID(16); this.form.ourDataSecret = generateRandomID(16); this.form.ourDataSecretIv = generateRandomID(16);