oak-general-business/es/components/userRelation/upsert/web.pc.js

59 lines
2.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React from 'react';
import { Tabs } from 'antd';
import Style from './web.module.less';
import ByMobile from './byMobile/index';
import ByUserEntityGrant from './byUserEntityGrant';
import { assert } from 'oak-domain/lib/utils/assert';
export default function Render(props) {
const { entity, entityId, relations, grantByUserEntityGrant, grantByEmail, grantByMobile, grantMethodCount, oakFullpath, redirectToAfterConfirm, qrCodeType, claimUrl, rule, ruleOnRow, passwordRequire, } = props.data;
let SubPart = <></>;
if (grantMethodCount === 0) {
SubPart = (<div className={Style.container}>
应用没有定义授权方式请管理员在控制台中定义
</div>);
}
else if (grantMethodCount === 1) {
if (grantByEmail) {
SubPart = <div className={Style.container}>尚未实现</div>;
}
else if (grantByMobile) {
SubPart = (<ByMobile passwordRequire={passwordRequire} entity={entity} entityId={entityId} relations={relations} oakPath="$userRelation-upsert-by-mobile" oakAutoUnmount={true}/>);
}
else {
assert(grantByUserEntityGrant === true);
SubPart = (<ByUserEntityGrant qrCodeType={qrCodeType} entity={entity} entityId={entityId} relations={relations} claimUrl={claimUrl} oakPath="$userRelation-upsert-by-userEntityGrant" oakAutoUnmount={true} redirectToAfterConfirm={redirectToAfterConfirm}/>);
}
}
else {
const items = [
{
label: 'Email',
key: 'item-1',
children: <div className={Style.container}>尚未实现</div>,
},
{
label: '手机号',
key: 'item-2',
children: (<ByMobile entity={entity} entityId={entityId} relations={relations} oakPath="$userRelation-upsert-by-mobile" oakAutoUnmount={true}/>),
},
{
label: '二维码',
key: 'item-3',
children: (<ByUserEntityGrant entity={entity} entityId={entityId} relations={relations} qrCodeType={qrCodeType} oakPath="$userRelation-upsert-by-userEntityGrant" oakAutoUnmount={true} redirectToAfterConfirm={redirectToAfterConfirm} claimUrl={claimUrl} rule={rule} ruleOnRow={ruleOnRow}/>),
},
];
const items2 = [];
if (grantByEmail) {
items2.push(items[0]);
}
if (grantByMobile) {
items2.push(items[1]);
}
if (grantByUserEntityGrant) {
items2.push(items[2]);
}
SubPart = <Tabs items={items2}/>;
}
return SubPart;
}