|
|
@@ -40,30 +40,30 @@
|
|
|
</div>
|
|
|
<div v-else-if="steps[current].contentTemplate === 'Second'">
|
|
|
<a-form
|
|
|
+ ref="formRef2"
|
|
|
:model="identityInfo"
|
|
|
:label-col="{ style: { width: '120px' } }"
|
|
|
:wrapper-col="{
|
|
|
span: 8,
|
|
|
}"
|
|
|
+ :rules="rulesForStep2"
|
|
|
autocomplete="off"
|
|
|
>
|
|
|
- <a-form-item
|
|
|
- has-feedback
|
|
|
- label="认证源名称"
|
|
|
- name="name"
|
|
|
- :rules="[{ required: true, message: '请输入认证源名称!' }]"
|
|
|
- >
|
|
|
+ <a-form-item has-feedback label="认证源名称" name="name">
|
|
|
<a-input
|
|
|
v-model:value="identityInfo.name"
|
|
|
placeholder="必填,请输入认证源名称"
|
|
|
/>
|
|
|
</a-form-item>
|
|
|
|
|
|
- <a-form-item
|
|
|
- label="认证源LOGO"
|
|
|
- name="logo"
|
|
|
- :rules="[{ required: true, message: '请选择LOGO!' }]"
|
|
|
- >
|
|
|
+ <a-form-item has-feedback label="认证源标识" name="no">
|
|
|
+ <a-input
|
|
|
+ v-model:value="identityInfo.no"
|
|
|
+ placeholder="必填,请输入认证源标识"
|
|
|
+ />
|
|
|
+ </a-form-item>
|
|
|
+
|
|
|
+ <a-form-item label="认证源LOGO" name="logo">
|
|
|
<div v-tooltip.top="'点击查看大图'">
|
|
|
<a-image :width="48" :src="logoUrl" />
|
|
|
</div>
|
|
|
@@ -122,12 +122,7 @@
|
|
|
v-if="current === 1"
|
|
|
type="primary"
|
|
|
style="margin-left: 8px"
|
|
|
- :disabled="
|
|
|
- !identityInfo.name ||
|
|
|
- logoUrl === '/static/assets/client-base-v4/image/logo.png'
|
|
|
- ? true
|
|
|
- : false
|
|
|
- "
|
|
|
+
|
|
|
@click="next"
|
|
|
>
|
|
|
下一步
|
|
|
@@ -149,8 +144,11 @@ import {
|
|
|
imageToBase64,
|
|
|
base64toFile,
|
|
|
queryById,
|
|
|
+ isNoExist,
|
|
|
} from './configData.js';
|
|
|
|
|
|
+
|
|
|
+const formRef2 = ref();
|
|
|
const route = useRoute();
|
|
|
const current = ref(0); // 当前步骤
|
|
|
const logoName = ref(''); // logo 名称
|
|
|
@@ -185,7 +183,7 @@ const identitySetting = ref({
|
|
|
roleTemplateNo: '003',
|
|
|
clientId: '',
|
|
|
spEntityID: 'com.leanwo.prodog.sp',
|
|
|
- spAssertionConsumeService: 'http://xxxx:xx/api/saml/sso/${id}',
|
|
|
+ spAssertionConsumeService: 'http://xxxx:xx/api/saml/sso/${no}',
|
|
|
spAssertionConsumeSuccessRedirectService:
|
|
|
'http://xxxx:xx/index.html#/samlLogin',
|
|
|
});
|
|
|
@@ -200,7 +198,7 @@ onMounted(() => {
|
|
|
const { identityId } = route.query;
|
|
|
if (identityId) {
|
|
|
isEdit.value = true;
|
|
|
- identityInfo.id = identityId;
|
|
|
+ identityInfo.id = Number(identityId);
|
|
|
queryAuthById(identityId);
|
|
|
} else {
|
|
|
isEdit.value = false;
|
|
|
@@ -222,11 +220,13 @@ const queryAuthById = id => {
|
|
|
description,
|
|
|
logo,
|
|
|
name,
|
|
|
+ no,
|
|
|
} = success.data;
|
|
|
logoUrl.value = getImageSrc(className, logo);
|
|
|
imgToBase64();
|
|
|
logoName.value = logo;
|
|
|
identityInfo.name = name;
|
|
|
+ identityInfo.no = no;
|
|
|
identityInfo.active = active;
|
|
|
logoClassName.value = className;
|
|
|
identityInfo.description = description;
|
|
|
@@ -248,6 +248,33 @@ const queryAuthById = id => {
|
|
|
},
|
|
|
);
|
|
|
};
|
|
|
+
|
|
|
+// check is no exist
|
|
|
+const validateIsNoExist = (no, excludeId) => {
|
|
|
+ const params = new FormData();
|
|
|
+ params.append('no', no);
|
|
|
+ params.append('excludeId', excludeId);
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ isNoExist(params).then(
|
|
|
+ success => {
|
|
|
+ if (success.errorCode === 0) {
|
|
|
+ if(success.data === false){
|
|
|
+ resolve();
|
|
|
+ }else{
|
|
|
+ reject('认证源标识已经存在');
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ reject(success.errorMessage);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error => {
|
|
|
+ reject(error);
|
|
|
+ },
|
|
|
+ );
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
// 图片转file
|
|
|
const imgToBase64 = () => {
|
|
|
var image = new Image();
|
|
|
@@ -261,7 +288,7 @@ const imgToBase64 = () => {
|
|
|
|
|
|
// 获取logo文件
|
|
|
const logoFileChange = async e => {
|
|
|
- if(!isImage.value){
|
|
|
+ if (!isImage.value) {
|
|
|
message.warning('请上传图片类型的logo!');
|
|
|
return;
|
|
|
}
|
|
|
@@ -308,6 +335,42 @@ const steps = ref([
|
|
|
},
|
|
|
]);
|
|
|
|
|
|
+const noValidator = async (_rule, value) => {
|
|
|
+ if (value === '') {
|
|
|
+ return Promise.reject('请输入认证源标识!');
|
|
|
+ } else {
|
|
|
+ return validateIsNoExist(value, identityInfo.id);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+const rulesForStep2 = {
|
|
|
+ name: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请输入认证源名称!',
|
|
|
+ trigger: 'change',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ no: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请输入认证源标识!',
|
|
|
+ trigger: 'change',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ validator: noValidator,
|
|
|
+ trigger: 'change',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ logo: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请选择LOGO!',
|
|
|
+ trigger: 'change',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+};
|
|
|
+
|
|
|
// 选择认证源数据
|
|
|
const selectedItem = ref([
|
|
|
{
|
|
|
@@ -324,8 +387,18 @@ const selectedItem = ref([
|
|
|
|
|
|
// 下一步
|
|
|
const next = () => {
|
|
|
- current.value++;
|
|
|
+ if (current.value === 1) {
|
|
|
+ // TODO
|
|
|
+ formRef2.value.validate().then(success => {
|
|
|
+ current.value++;
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ current.value++;
|
|
|
+ }
|
|
|
};
|
|
|
+
|
|
|
+const validateNo = () => {};
|
|
|
+
|
|
|
// 上一步
|
|
|
const prev = () => {
|
|
|
current.value--;
|