feat: 登录配置中对未支持的登录方式增加提示

This commit is contained in:
lxy 2025-11-19 15:25:46 +08:00
parent 126d43a90b
commit 63dca8d683
5 changed files with 37 additions and 44 deletions

View File

@ -1,5 +1,5 @@
import React, { useState } from 'react';
import { Button, Space, Switch, Affix, Alert, Typography, Modal, Divider, Tag, Row, } from 'antd';
import { Button, Space, Switch, Affix, Alert, Typography, Modal, Divider, Tag, Row, Tooltip, } from 'antd';
import Styles from './web.pc.module.less';
import classNames from 'classnames';
import { ExclamationCircleFilled } from '@ant-design/icons';
@ -18,9 +18,11 @@ function AppView(props) {
const { id, type, config, enabled, stateColor } = passport;
return (<div className={classNames(Styles.item, Styles.title)}>
<Tag color={stateColor}>{t(`passport:v.type.${type}`)}</Tag>
<Switch checkedChildren="开启" unCheckedChildren="关闭" checked={enabled} onChange={(checked) => {
<Tooltip title="暂未支持该登录方式">
<Switch checkedChildren="开启" unCheckedChildren="关闭" checked={enabled} disabled={!enabled} onChange={(checked) => {
changeEnabled(checked);
}}/>
</Tooltip>
</div>);
}
export default function render(props) {

View File

@ -21,7 +21,7 @@ const triggers = [
}
},
{
name: 'web applicaiton清空微信网站配置时将相应的passport禁用',
name: 'web applicaiton清空微信网站配置时将相应的applicationPassport删除',
entity: 'application',
action: 'update',
when: 'before',
@ -43,8 +43,6 @@ const triggers = [
let count = 0;
for (const application of applications) {
if (application.type === 'web') {
// const { wechat } = application.config as WebConfig || {};
// const { appId, appSecret } = wechat || {};
const { appId: newAppId, appSecret: newAppSecret } = data?.config?.wechat || {};
if (!newAppId || !newAppSecret) {
const [passport] = await context.select('passport', {
@ -60,16 +58,14 @@ const triggers = [
indexFrom: 0,
}, { forUpdate: true });
if (passport) {
await context.operate('passport', {
await context.operate('applicationPassport', {
id: await generateNewIdAsync(),
action: 'update',
data: {
enabled: false,
config: {},
},
action: 'remove',
data: {},
filter: {
id: passport.id,
}
passportId: passport.id,
applicationId: application.id,
},
}, option);
count++;
}

View File

@ -23,7 +23,7 @@ const triggers = [
}
},
{
name: 'web applicaiton清空微信网站配置时将相应的passport禁用',
name: 'web applicaiton清空微信网站配置时将相应的applicationPassport删除',
entity: 'application',
action: 'update',
when: 'before',
@ -45,8 +45,6 @@ const triggers = [
let count = 0;
for (const application of applications) {
if (application.type === 'web') {
// const { wechat } = application.config as WebConfig || {};
// const { appId, appSecret } = wechat || {};
const { appId: newAppId, appSecret: newAppSecret } = data?.config?.wechat || {};
if (!newAppId || !newAppSecret) {
const [passport] = await context.select('passport', {
@ -62,16 +60,14 @@ const triggers = [
indexFrom: 0,
}, { forUpdate: true });
if (passport) {
await context.operate('passport', {
await context.operate('applicationPassport', {
id: await (0, uuid_1.generateNewIdAsync)(),
action: 'update',
data: {
enabled: false,
config: {},
},
action: 'remove',
data: {},
filter: {
id: passport.id,
}
passportId: passport.id,
applicationId: application.id,
},
}, option);
count++;
}

View File

@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react';
import { Button, Space, Switch, Affix, Alert, Typography, Modal, Divider, Tag, Row, } from 'antd';
import { Button, Space, Switch, Affix, Alert, Typography, Modal, Divider, Tag, Row, Tooltip, } from 'antd';
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../oak-app-domain';
import Styles from './web.pc.module.less';
@ -30,14 +30,17 @@ function AppView(props: {
return (
<div className={classNames(Styles.item, Styles.title)}>
<Tag color={stateColor}>{t(`passport:v.type.${type}`)}</Tag>
<Switch
checkedChildren="开启"
unCheckedChildren="关闭"
checked={enabled}
onChange={(checked) => {
changeEnabled(checked)
}}
/>
<Tooltip title="暂未支持该登录方式">
<Switch
checkedChildren="开启"
unCheckedChildren="关闭"
checked={enabled}
disabled={!enabled}
onChange={(checked) => {
changeEnabled(checked)
}}
/>
</Tooltip>
</div>
)
}

View File

@ -30,7 +30,7 @@ const triggers: Trigger<EntityDict, 'application', BRC<EntityDict>>[] = [
}
} as RemoveTrigger<EntityDict, 'application', BRC<EntityDict>>,
{
name: 'web applicaiton清空微信网站配置时将相应的passport禁用',
name: 'web applicaiton清空微信网站配置时将相应的applicationPassport删除',
entity: 'application',
action: 'update',
when: 'before',
@ -52,8 +52,6 @@ const triggers: Trigger<EntityDict, 'application', BRC<EntityDict>>[] = [
let count = 0;
for (const application of applications) {
if (application.type === 'web') {
// const { wechat } = application.config as WebConfig || {};
// const { appId, appSecret } = wechat || {};
const { appId: newAppId, appSecret: newAppSecret } = (data?.config as WebConfig)?.wechat || {};
if (!newAppId || !newAppSecret) {
const [passport] = await context.select('passport', {
@ -69,16 +67,14 @@ const triggers: Trigger<EntityDict, 'application', BRC<EntityDict>>[] = [
indexFrom: 0,
}, { forUpdate: true });
if (passport) {
await context.operate('passport', {
await context.operate('applicationPassport', {
id: await generateNewIdAsync(),
action: 'update',
data: {
enabled: false,
config: {},
},
action: 'remove',
data: {},
filter: {
id: passport.id,
}
passportId: passport.id,
applicationId: application.id,
},
}, option);
count++;
}