mirror of
https://github.com/chillzhuang/Sword
synced 2024-11-22 02:09:26 +08:00
🎉 2.7.3.RELEASE 增强多租户功能
This commit is contained in:
parent
197ec94a63
commit
2aa10f7930
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sword",
|
"name": "sword",
|
||||||
"version": "2.7.2",
|
"version": "2.7.3",
|
||||||
"description": "An out-of-box UI solution for enterprise applications",
|
"description": "An out-of-box UI solution for enterprise applications",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React, { PureComponent } from 'react';
|
||||||
import { connect } from 'dva';
|
import { connect } from 'dva';
|
||||||
|
import router from 'umi/router';
|
||||||
import { Card, Col, Form, Input, Modal, Button, Row, message } from 'antd';
|
import { Card, Col, Form, Input, Modal, Button, Row, message } from 'antd';
|
||||||
import styles from '@/layouts/Sword.less';
|
import styles from '@/layouts/Sword.less';
|
||||||
import { getCurrentUser, removeAll } from '@/utils/authority';
|
import { getCurrentUser, removeAll } from '@/utils/authority';
|
||||||
import { validateNull } from '@/utils/utils';
|
import { validateNull } from '@/utils/utils';
|
||||||
import { tenantMode } from '@/defaultSettings';
|
import { tenantMode } from '@/defaultSettings';
|
||||||
import { getUserInfo, registerGuest } from '@/services/user';
|
import { getUserInfo, registerGuest } from '@/services/user';
|
||||||
import router from 'umi/router';
|
|
||||||
|
|
||||||
const FormItem = Form.Item;
|
const FormItem = Form.Item;
|
||||||
|
|
||||||
@ -23,7 +23,10 @@ class ThirdRegister extends PureComponent {
|
|||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const user = getCurrentUser();
|
const user = getCurrentUser();
|
||||||
if (validateNull(user) || validateNull(user.userId) || user.userId < 0) {
|
if (validateNull(user)) {
|
||||||
|
removeAll();
|
||||||
|
router.push('/user/login');
|
||||||
|
} else if (validateNull(user.userId) || user.userId < 0) {
|
||||||
// 第三方注册用户,弹出注册框
|
// 第三方注册用户,弹出注册框
|
||||||
this.setState({ visible: true, user });
|
this.setState({ visible: true, user });
|
||||||
} else {
|
} else {
|
||||||
@ -60,9 +63,7 @@ class ThirdRegister extends PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const { form } = this.props;
|
||||||
form,
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
const { loading, visible, user } = this.state;
|
const { loading, visible, user } = this.state;
|
||||||
|
|
||||||
@ -178,4 +179,5 @@ class ThirdRegister extends PureComponent {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ThirdRegister;
|
export default ThirdRegister;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { message } from 'antd';
|
import { message } from 'antd';
|
||||||
import router from 'umi/router';
|
import router from 'umi/router';
|
||||||
import { TENANT_NAMESPACE } from '../actions/tenant';
|
import { TENANT_NAMESPACE } from '../actions/tenant';
|
||||||
import { list, submit, detail, remove } from '../services/tenant';
|
import { list, submit, detail, remove, info } from '../services/tenant';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
namespace: TENANT_NAMESPACE,
|
namespace: TENANT_NAMESPACE,
|
||||||
@ -11,6 +11,9 @@ export default {
|
|||||||
pagination: false,
|
pagination: false,
|
||||||
},
|
},
|
||||||
detail: {},
|
detail: {},
|
||||||
|
info: {
|
||||||
|
tenantId: '000000',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
effects: {
|
effects: {
|
||||||
*fetchList({ payload }, { call, put }) {
|
*fetchList({ payload }, { call, put }) {
|
||||||
@ -40,6 +43,17 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
*fetchInfo({ payload }, { call, put }) {
|
||||||
|
const response = yield call(info, payload);
|
||||||
|
if (response.success && response.data.tenantId) {
|
||||||
|
yield put({
|
||||||
|
type: 'saveInfo',
|
||||||
|
payload: {
|
||||||
|
info: response.data,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
*clearDetail({ payload }, { put }) {
|
*clearDetail({ payload }, { put }) {
|
||||||
yield put({
|
yield put({
|
||||||
type: 'removeDetail',
|
type: 'removeDetail',
|
||||||
@ -77,6 +91,12 @@ export default {
|
|||||||
detail: action.payload.detail,
|
detail: action.payload.detail,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
saveInfo(state, action) {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
info: action.payload.info,
|
||||||
|
};
|
||||||
|
},
|
||||||
removeDetail(state) {
|
removeDetail(state) {
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
|
@ -20,14 +20,14 @@ class Workplace extends PureComponent {
|
|||||||
<Row gutter={24}>
|
<Row gutter={24}>
|
||||||
<Col span={24}>
|
<Col span={24}>
|
||||||
<div style={{ textAlign: 'center' }}>
|
<div style={{ textAlign: 'center' }}>
|
||||||
<img src="https://img.shields.io/badge/Release-V2.7.1-green.svg" alt="Downloads" />
|
<img src="https://img.shields.io/badge/Release-V2.7.3-green.svg" alt="Downloads" />
|
||||||
<img src="https://img.shields.io/badge/JDK-1.8+-green.svg" alt="Build Status" />
|
<img src="https://img.shields.io/badge/JDK-1.8+-green.svg" alt="Build Status" />
|
||||||
<img
|
<img
|
||||||
src="https://img.shields.io/badge/Spring%20Cloud-Hoxton.SR5-blue.svg"
|
src="https://img.shields.io/badge/Spring%20Cloud-Hoxton.SR8-blue.svg"
|
||||||
alt="Coverage Status"
|
alt="Coverage Status"
|
||||||
/>
|
/>
|
||||||
<img
|
<img
|
||||||
src="https://img.shields.io/badge/Spring%20Boot-2.2.7.RELEASE-blue.svg"
|
src="https://img.shields.io/badge/Spring%20Boot-2.2.9.RELEASE-blue.svg"
|
||||||
alt="Downloads"
|
alt="Downloads"
|
||||||
/>
|
/>
|
||||||
<a href="https://bladex.vip">
|
<a href="https://bladex.vip">
|
||||||
@ -212,7 +212,16 @@ class Workplace extends PureComponent {
|
|||||||
</Row>
|
</Row>
|
||||||
<Row gutter={24}>
|
<Row gutter={24}>
|
||||||
<Card className={styles.card} bordered={false}>
|
<Card className={styles.card} bordered={false}>
|
||||||
<Collapse bordered={false} defaultActiveKey={['19']}>
|
<Collapse bordered={false} defaultActiveKey={['20']}>
|
||||||
|
<Panel header="2.7.3发布 增强多租户功能" key="20">
|
||||||
|
<div>1.升级至 SpringCloud Hoxton.SR8</div>
|
||||||
|
<div>2.升级至 Mybatis-Plus 3.4.0</div>
|
||||||
|
<div>3.重构Mybatis-Plus封装适配最新版</div>
|
||||||
|
<div>4.多租户增加域名绑定功能</div>
|
||||||
|
<div>5.创建多租户的同时创建对应的管理用户</div>
|
||||||
|
<div>6.优化日志模块分页排序</div>
|
||||||
|
<div>7.关闭日志模块外置api放行</div>
|
||||||
|
</Panel>
|
||||||
<Panel header="2.7.2发布 集成JustAuth支持第三方登录" key="19">
|
<Panel header="2.7.2发布 集成JustAuth支持第三方登录" key="19">
|
||||||
<div>1.升级至 SpringCloud Hoxton.SR7</div>
|
<div>1.升级至 SpringCloud Hoxton.SR7</div>
|
||||||
<div>2.升级至 SpringBoot 2.2.9.RELEASE</div>
|
<div>2.升级至 SpringBoot 2.2.9.RELEASE</div>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { connect } from 'dva';
|
import { connect } from 'dva';
|
||||||
import { formatMessage, FormattedMessage } from 'umi/locale';
|
import { formatMessage, FormattedMessage } from 'umi/locale';
|
||||||
import { Checkbox, Alert, Icon, Row, Col, Card, Spin } from 'antd';
|
import { Checkbox, Alert, Icon, Row, Col, Card } from 'antd';
|
||||||
import Login from '../../components/Login';
|
import Login from '../../components/Login';
|
||||||
import styles from './Login.less';
|
import styles from './Login.less';
|
||||||
import { tenantMode, captchaMode, authUrl } from '../../defaultSettings';
|
import { tenantMode, captchaMode, authUrl } from '../../defaultSettings';
|
||||||
@ -9,8 +9,9 @@ import { getQueryString, getTopUrl, validateNull } from '@/utils/utils';
|
|||||||
|
|
||||||
const { Tab, TenantId, UserName, Password, Captcha, Submit } = Login;
|
const { Tab, TenantId, UserName, Password, Captcha, Submit } = Login;
|
||||||
|
|
||||||
@connect(({ login, loading }) => ({
|
@connect(({ login, tenant, loading }) => ({
|
||||||
login,
|
login,
|
||||||
|
tenant,
|
||||||
submitting: loading.effects['login/login'],
|
submitting: loading.effects['login/login'],
|
||||||
}))
|
}))
|
||||||
class LoginPage extends Component {
|
class LoginPage extends Component {
|
||||||
@ -46,6 +47,10 @@ class LoginPage extends Component {
|
|||||||
type: 'menu/fetchMenuData',
|
type: 'menu/fetchMenuData',
|
||||||
payload: { routes, authority },
|
payload: { routes, authority },
|
||||||
});
|
});
|
||||||
|
dispatch({
|
||||||
|
type: 'tenant/fetchInfo',
|
||||||
|
payload: { domain },
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,10 +78,13 @@ class LoginPage extends Component {
|
|||||||
handleSubmit = (err, values) => {
|
handleSubmit = (err, values) => {
|
||||||
const { type } = this.state;
|
const { type } = this.state;
|
||||||
if (!err) {
|
if (!err) {
|
||||||
const { dispatch } = this.props;
|
const { dispatch,
|
||||||
|
tenant: { info } } = this.props;
|
||||||
|
const { tenantId } = info;
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'login/login',
|
type: 'login/login',
|
||||||
payload: {
|
payload: {
|
||||||
|
tenantId,
|
||||||
...values,
|
...values,
|
||||||
type,
|
type,
|
||||||
},
|
},
|
||||||
@ -99,8 +107,14 @@ class LoginPage extends Component {
|
|||||||
);
|
);
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { login, submitting } = this.props;
|
const {
|
||||||
const { type, autoLogin, loading } = this.state;
|
login,
|
||||||
|
submitting,
|
||||||
|
tenant: { info },
|
||||||
|
} = this.props;
|
||||||
|
const { type, autoLogin } = this.state;
|
||||||
|
const { tenantId } = info;
|
||||||
|
const tenantVisible = tenantMode && tenantId === '000000';
|
||||||
return (
|
return (
|
||||||
<div className={styles.main}>
|
<div className={styles.main}>
|
||||||
<Login
|
<Login
|
||||||
@ -116,10 +130,10 @@ class LoginPage extends Component {
|
|||||||
login.type === 'account' &&
|
login.type === 'account' &&
|
||||||
!submitting &&
|
!submitting &&
|
||||||
this.renderMessage(formatMessage({ id: 'app.login.message-invalid-credentials' }))}
|
this.renderMessage(formatMessage({ id: 'app.login.message-invalid-credentials' }))}
|
||||||
{tenantMode ? (
|
{tenantVisible ? (
|
||||||
<TenantId
|
<TenantId
|
||||||
name="tenantId"
|
name="tenantId"
|
||||||
defaultValue="000000"
|
defaultValue={`${tenantId}`}
|
||||||
placeholder={`${formatMessage({ id: 'app.login.tenantId' })}: 000000`}
|
placeholder={`${formatMessage({ id: 'app.login.tenantId' })}: 000000`}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
|
@ -69,7 +69,7 @@ class Role extends PureComponent {
|
|||||||
|
|
||||||
const { dispatch } = this.props;
|
const { dispatch } = this.props;
|
||||||
dispatch(
|
dispatch(
|
||||||
ROLE_GRANT({ roleIds: keys[0], menuIds: roleCheckedTreeKeys }, () => {
|
ROLE_GRANT({ roleIds: keys, menuIds: roleCheckedTreeKeys }, () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
visible: false,
|
visible: false,
|
||||||
confirmLoading: false,
|
confirmLoading: false,
|
||||||
|
@ -86,6 +86,9 @@ class TenantAdd extends PureComponent {
|
|||||||
<TextArea style={{ minHeight: 32 }} rows={3} placeholder="请输入联系地址" />
|
<TextArea style={{ minHeight: 32 }} rows={3} placeholder="请输入联系地址" />
|
||||||
)}
|
)}
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
<FormItem {...formItemLayout} label="绑定域名">
|
||||||
|
{getFieldDecorator('domain')(<Input placeholder="请输入绑定域名" />)}
|
||||||
|
</FormItem>
|
||||||
</Card>
|
</Card>
|
||||||
</Form>
|
</Form>
|
||||||
</Panel>
|
</Panel>
|
||||||
|
@ -112,6 +112,11 @@ class TenantEdit extends PureComponent {
|
|||||||
initialValue: detail.address,
|
initialValue: detail.address,
|
||||||
})(<TextArea style={{ minHeight: 32 }} rows={3} placeholder="请输入联系地址" />)}
|
})(<TextArea style={{ minHeight: 32 }} rows={3} placeholder="请输入联系地址" />)}
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
<FormItem {...formItemLayout} label="绑定域名">
|
||||||
|
{getFieldDecorator('domain', {
|
||||||
|
initialValue: detail.domain,
|
||||||
|
})(<Input placeholder="请输入绑定域名" />)}
|
||||||
|
</FormItem>
|
||||||
</Card>
|
</Card>
|
||||||
</Form>
|
</Form>
|
||||||
</Panel>
|
</Panel>
|
||||||
|
@ -74,6 +74,9 @@ class TenantView extends PureComponent {
|
|||||||
<FormItem {...formItemLayout} label="联系地址">
|
<FormItem {...formItemLayout} label="联系地址">
|
||||||
<span>{detail.address}</span>
|
<span>{detail.address}</span>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
<FormItem {...formItemLayout} label="绑定域名">
|
||||||
|
<span>{detail.domain}</span>
|
||||||
|
</FormItem>
|
||||||
</Card>
|
</Card>
|
||||||
</Form>
|
</Form>
|
||||||
</Panel>
|
</Panel>
|
||||||
|
@ -15,7 +15,7 @@ export async function tree(params) {
|
|||||||
export async function grant(params) {
|
export async function grant(params) {
|
||||||
return request('/api/blade-system/role/grant', {
|
return request('/api/blade-system/role/grant', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: func.toFormData(params),
|
body: params,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,3 +27,7 @@ export async function remove(params) {
|
|||||||
body: func.toFormData(params),
|
body: func.toFormData(params),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function info(params) {
|
||||||
|
return request(`/api/blade-system/tenant/info?${stringify(params)}`);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user