mirror of
https://github.com/chillzhuang/Sword
synced 2024-11-22 02:09:26 +08:00
🎉 2.6.0发布 升级Hoxton.SR1 适配最新架构
This commit is contained in:
parent
9921323463
commit
79d58cd5c0
@ -1,9 +1,9 @@
|
||||
<p align="center">
|
||||
<img src="https://img.shields.io/badge/Release-V2.5.1-green.svg" alt="Downloads">
|
||||
<img src="https://img.shields.io/badge/Release-V2.6.0-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/license-Apache%202-blue.svg" alt="Build Status">
|
||||
<img src="https://img.shields.io/badge/Spring%20Cloud-Greenwich.SR3-blue.svg" alt="Coverage Status">
|
||||
<img src="https://img.shields.io/badge/Spring%20Boot-2.1.8.RELEASE-blue.svg" alt="Downloads">
|
||||
<img src="https://img.shields.io/badge/Spring%20Cloud-Hoxton.SR1-blue.svg" alt="Coverage Status">
|
||||
<img src="https://img.shields.io/badge/Spring%20Boot-2.2.2.RELEASE-blue.svg" alt="Downloads">
|
||||
<a target="_blank" href="https://bladex.vip">
|
||||
<img src="https://img.shields.io/badge/Author-Small%20Chill-ff69b4.svg" alt="Downloads">
|
||||
</a>
|
||||
|
@ -64,7 +64,7 @@ export default [
|
||||
component: './Account/Settings/NotificationView',
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sword",
|
||||
"version": "2.5.4",
|
||||
"version": "2.6.0",
|
||||
"description": "An out-of-box UI solution for enterprise applications",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
@ -60,7 +60,8 @@
|
||||
"react-media": "^1.9.2",
|
||||
"react-router-dom": "^4.3.1",
|
||||
"roadhog-api-doc": "^1.1.2",
|
||||
"js-base64": "^2.5.1"
|
||||
"js-base64": "^2.5.1",
|
||||
"umi": "^2.4.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^16.8.1",
|
||||
|
@ -1,12 +1,11 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
import { Card, Col, Collapse, Row } from 'antd';
|
||||
import { Card, Col, Collapse, Row, Divider, Tag } from 'antd';
|
||||
import styles from '../../layouts/Sword.less';
|
||||
|
||||
import PageHeaderWrapper from '@/components/PageHeaderWrapper';
|
||||
|
||||
const { Panel } = Collapse;
|
||||
|
||||
|
||||
class Workplace extends PureComponent {
|
||||
render() {
|
||||
return (
|
||||
@ -15,14 +14,14 @@ class Workplace extends PureComponent {
|
||||
<Row gutter={24}>
|
||||
<Col span={24}>
|
||||
<div style={{ textAlign: 'center' }}>
|
||||
<img src="https://img.shields.io/badge/Release-V2.5.4-green.svg" alt="Downloads" />
|
||||
<img src="https://img.shields.io/badge/Release-V2.6.0-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/Spring%20Cloud-Greenwich.SR3-blue.svg"
|
||||
src="https://img.shields.io/badge/Spring%20Cloud-Hoxton.SR1-blue.svg"
|
||||
alt="Coverage Status"
|
||||
/>
|
||||
<img
|
||||
src="https://img.shields.io/badge/Spring%20Boot-2.1.9.RELEASE-blue.svg"
|
||||
src="https://img.shields.io/badge/Spring%20Boot-2.2.2.RELEASE-blue.svg"
|
||||
alt="Downloads"
|
||||
/>
|
||||
<a href="https://bladex.vip">
|
||||
@ -40,8 +39,10 @@ class Workplace extends PureComponent {
|
||||
</div>
|
||||
</Col>
|
||||
</Row>
|
||||
</Card>
|
||||
<Row gutter={24}>
|
||||
<Col span={16}>
|
||||
<Card className={styles.card} bordered={false}>
|
||||
<Collapse bordered={false} defaultActiveKey={['1', '2', '3', '5']}>
|
||||
<Panel header="欢迎使用Sword" key="1">
|
||||
<div>1.Sword是SpringBlade前端UI系统</div>
|
||||
@ -56,54 +57,167 @@ class Workplace extends PureComponent {
|
||||
<div>3.基于稳定生产的商业项目升级优化而来,更加贴近企业级的需求</div>
|
||||
<div>4.追求企业开发更加高效,部署更加方便,生产更加稳定</div>
|
||||
<div>5.GVP-码云最有价值开源项目</div>
|
||||
<div>6.BladeX授权地址:<a href="https://bladex.vip/#/vip">点击授权</a></div>
|
||||
<div>
|
||||
6.BladeX授权地址:<a href="https://bladex.vip/#/vip">点击授权</a>
|
||||
</div>
|
||||
</Panel>
|
||||
<Panel header="为何需要BladeX" key="3">
|
||||
<div>1.经历过较长的线上生产,积累了很多企业痛点的解决方案。</div>
|
||||
<div>2.一套代码兼容MySql、Oracle、PostgreSQL,适应企业各种不同场景的需求。</div>
|
||||
<div>3.集成了很多企业急切所需的例如多租户、Oauth2授权认证、工作流、分布式事务等等功能。</div>
|
||||
<div>4.深度定制了Flowable工作流,完美支持SpringCloud分布式服务的场景,以远程调用的方式进行操作。</div>
|
||||
<div>5.升级了核心驱动,新功能完全可以开箱即用,而开源版需要自己再花时间进行集成,需要花掉更多的时间成本。</div>
|
||||
<div>6.拥抱微服务时代,很多企业由于项目转型或升级,传统的技术已然不能满足,反而会花更多成本,而BladeX就是为此而生。</div>
|
||||
<div>7.同时提供SpringCloud版本和SpringBoot版本,两个版本的api可以与Sword和Saber无缝对接,为小型项目至大型项目保驾护航。</div>
|
||||
<div>8.授权购买即永久,源码没有混淆,后续升级完全免费。企业只需花很少的钱即可获得一整套成熟的解决方案,你还在等什么?</div>
|
||||
<div>
|
||||
3.集成了很多企业急切所需的例如多租户、Oauth2授权认证、工作流、分布式事务等等功能。
|
||||
</div>
|
||||
<div>
|
||||
4.深度定制了Flowable工作流,完美支持SpringCloud分布式服务的场景,以远程调用的方式进行操作。
|
||||
</div>
|
||||
<div>
|
||||
5.升级了核心驱动,新功能完全可以开箱即用,而开源版需要自己再花时间进行集成,需要花掉更多的时间成本。
|
||||
</div>
|
||||
<div>
|
||||
6.拥抱微服务时代,很多企业由于项目转型或升级,传统的技术已然不能满足,反而会花更多成本,而BladeX就是为此而生。
|
||||
</div>
|
||||
<div>
|
||||
7.同时提供SpringCloud版本和SpringBoot版本,两个版本的api可以与Sword和Saber无缝对接,为小型项目至大型项目保驾护航。
|
||||
</div>
|
||||
<div>
|
||||
8.授权购买即永久,源码没有混淆,后续升级完全免费。企业只需花很少的钱即可获得一整套成熟的解决方案,你还在等什么?
|
||||
</div>
|
||||
</Panel>
|
||||
<Panel header="拥有的核心功能" key="4">
|
||||
<div>1.前后端分离-采用前后端分离模式,前端提供两套架构,Sword基于React,Saber基于Vue</div>
|
||||
<div>2. 分布式单体式后端架构-提供两套后端架构,基于SpringCloud的分布式架构以及基于SpringBoot的单体式架构</div>
|
||||
<div>3.API完全兼容-两套后端架构与两套前端架构,共四套架构可以任意组合,所有API完全兼容</div>
|
||||
<div>4.前后端代码生成-定制针对两套前端与后端的代码生成模板,轻松生成整个模块的前后端代码,减少重复工作量</div>
|
||||
<div>5.组件化、插件化架构-针对功能深度定制各个starter,引入开箱即用,为整个架构解耦,提升效率</div>
|
||||
<div>
|
||||
1.前后端分离-采用前后端分离模式,前端提供两套架构,Sword基于React,Saber基于Vue
|
||||
</div>
|
||||
<div>
|
||||
2.
|
||||
分布式单体式后端架构-提供两套后端架构,基于SpringCloud的分布式架构以及基于SpringBoot的单体式架构
|
||||
</div>
|
||||
<div>
|
||||
3.API完全兼容-两套后端架构与两套前端架构,共四套架构可以任意组合,所有API完全兼容
|
||||
</div>
|
||||
<div>
|
||||
4.前后端代码生成-定制针对两套前端与后端的代码生成模板,轻松生成整个模块的前后端代码,减少重复工作量
|
||||
</div>
|
||||
<div>
|
||||
5.组件化、插件化架构-针对功能深度定制各个starter,引入开箱即用,为整个架构解耦,提升效率
|
||||
</div>
|
||||
<div>6.Nacos-集成阿里巴巴的Nacos完成统一的服务注册与配置</div>
|
||||
<div>7.Sentinel-集成Sentinel从流量控制、熔断降级、系统负载等多个维度保护服务的稳定性</div>
|
||||
<div>
|
||||
7.Sentinel-集成Sentinel从流量控制、熔断降级、系统负载等多个维度保护服务的稳定性
|
||||
</div>
|
||||
<div>8.Dubbo-完美集成Dubbo最新版,支持远程RPC调用</div>
|
||||
<div>9.多租户系统-完整的SaaS多租户架构</div>
|
||||
<div>10.Oauth2-集成Oauth2协议,完美支持多终端的接入与认证授权</div>
|
||||
<div>11.工作流-深度定制SpringCloud分布式场景的Flowable工作流,为复杂流程保驾护航。同时提供SpringBoot集成版本</div>
|
||||
<div>
|
||||
11.工作流-深度定制SpringCloud分布式场景的Flowable工作流,为复杂流程保驾护航。同时提供SpringBoot集成版本
|
||||
</div>
|
||||
<div>12.独立流程设计器-提供独立的完全汉化的流程设计器,轻松定制流程模型</div>
|
||||
<div>13.动态网关-集成基于Nacos的轻量级、高拓展性动态网关</div>
|
||||
<div>14.动态聚合文档-实现基于Nacos的Swagger SpringCloud聚合文档</div>
|
||||
<div>15.分布式文件服务-集成minio、qiniu、alioss等优秀的第三方,提供便捷的文件上传与管理</div>
|
||||
<div>16.多租户对象存储系统-在SaaS系统中,各租户可自行配置文件上传至自己的私有OSS</div>
|
||||
<div>
|
||||
15.分布式文件服务-集成minio、qiniu、alioss等优秀的第三方,提供便捷的文件上传与管理
|
||||
</div>
|
||||
<div>
|
||||
16.多租户对象存储系统-在SaaS系统中,各租户可自行配置文件上传至自己的私有OSS
|
||||
</div>
|
||||
<div>17.权限管理-精心设计的权限管理方案,角色权限精确到按钮</div>
|
||||
<div>18.动态数据权限-高度灵活的动态数据权限,提供注解+Web可视化两种配置方式,Web配置无需重启直接生效</div>
|
||||
<div>19.动态接口权限-高度灵活的动态接口权限,提供注解+Web可视化两种配置方式,Web配置无需重启直接生效</div>
|
||||
<div>20.多租户顶部菜单配置-提供给每个租户独立的顶部菜单配置模块,可以自定义顶部菜单切换</div>
|
||||
<div>21.主流数据库兼容-一套代码完全兼容Mysql、Postgresql、Oracle三大主流数据库</div>
|
||||
<div>
|
||||
18.动态数据权限-高度灵活的动态数据权限,提供注解+Web可视化两种配置方式,Web配置无需重启直接生效
|
||||
</div>
|
||||
<div>
|
||||
19.动态接口权限-高度灵活的动态接口权限,提供注解+Web可视化两种配置方式,Web配置无需重启直接生效
|
||||
</div>
|
||||
<div>
|
||||
20.多租户顶部菜单配置-提供给每个租户独立的顶部菜单配置模块,可以自定义顶部菜单切换
|
||||
</div>
|
||||
<div>
|
||||
21.主流数据库兼容-一套代码完全兼容Mysql、Postgresql、Oracle三大主流数据库
|
||||
</div>
|
||||
<div>22.动态网关鉴权-基于Nacos的动态网关鉴权,可在线配置,实时生效</div>
|
||||
<div>23.全能代码生成器-支持自定义模型、模版 、业务建模,支持多种模板引擎,在线配置。大幅度提升开发效率,不再为重复工作发愁。</div>
|
||||
<div>24.Seata分布式事务-定制集成Seata,支持分布式事务,无代码侵入,不失灵活与简洁</div>
|
||||
<div>
|
||||
23.全能代码生成器-支持自定义模型、模版
|
||||
、业务建模,支持多种模板引擎,在线配置。大幅度提升开发效率,不再为重复工作发愁。
|
||||
</div>
|
||||
<div>
|
||||
24.Seata分布式事务-定制集成Seata,支持分布式事务,无代码侵入,不失灵活与简洁
|
||||
</div>
|
||||
<div>25.未完待续...</div>
|
||||
</Panel>
|
||||
<Panel header="软件定制开发合作" key="5">
|
||||
<div>1.接BladeX系列架构的定制服务</div>
|
||||
<div>2.接3个月以内工期的react、vue、springboot、springcloud、app、小程序等软件定制服务</div>
|
||||
<div>
|
||||
2.接3个月以内工期的react、vue、springboot、springcloud、app、小程序等软件定制服务
|
||||
</div>
|
||||
<div>3.有意向请联系唯一指定QQ:85088620</div>
|
||||
</Panel>
|
||||
</Collapse>
|
||||
</Card>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<Collapse bordered={false} defaultActiveKey={['13']}>
|
||||
<Row gutter={24}>
|
||||
<Card className={styles.card} bordered={false}>
|
||||
<span>产品名称</span>
|
||||
<Divider type="vertical" />
|
||||
<Tag color="#108ee9">SpringBlade企业级微服务开发平台</Tag>
|
||||
<Divider style={{ margin: '12px 0' }} />
|
||||
<span>账号密码</span>
|
||||
<Divider type="vertical" />
|
||||
<Tag color="magenta">管理员(admin)</Tag>
|
||||
<Divider style={{ margin: '12px 0' }} />
|
||||
<span>官网地址</span>
|
||||
<Divider type="vertical" />
|
||||
<a href="https://bladex.vip" target="_blank">
|
||||
https://bladex.vip
|
||||
</a>
|
||||
<Divider style={{ margin: '12px 0' }} />
|
||||
<span>社区地址</span>
|
||||
<Divider type="vertical" />
|
||||
<a href="https://sns.bladex.vip" target="_blank">
|
||||
https://sns.bladex.vip
|
||||
</a>
|
||||
<Divider style={{ margin: '12px 0' }} />
|
||||
<span>获取文档</span>
|
||||
<Divider type="vertical" />
|
||||
<Tag color="#91e253" style={{ cursor: 'pointer' }}>
|
||||
<a href="https://sns.bladex.vip/note/view/1.html" target="_blank">
|
||||
免费版
|
||||
</a>
|
||||
</Tag>
|
||||
<Divider type="vertical" />
|
||||
<Tag color="#f5827b" style={{ cursor: 'pointer' }}>
|
||||
<a href="https://www.kancloud.cn/@smallchill" target="_blank">
|
||||
收费版
|
||||
</a>
|
||||
</Tag>
|
||||
<Divider style={{ margin: '12px 0' }} />
|
||||
<span>获取源码</span>
|
||||
<Divider type="vertical" />
|
||||
<Tag color="#87d068" style={{ cursor: 'pointer' }}>
|
||||
<a href="https://gitee.com/smallc/SpringBlade" target="_blank">
|
||||
开源版
|
||||
</a>
|
||||
</Tag>
|
||||
<Divider type="vertical" />
|
||||
<Tag color="#f50" style={{ cursor: 'pointer' }}>
|
||||
<a href="https://bladex.vip/#/vip" target="_blank">
|
||||
商业版
|
||||
</a>
|
||||
</Tag>
|
||||
</Card>
|
||||
</Row>
|
||||
<Row gutter={24}>
|
||||
<Card className={styles.card} bordered={false}>
|
||||
<Collapse bordered={false} defaultActiveKey={['14']}>
|
||||
<Panel header="2.6.0发布 升级Hoxton.SR1 适配最新架构" key="14">
|
||||
<div>1.升级SpringCloud Hoxton.SR1</div>
|
||||
<div>2.升级SpringBoot 2.2.2.RELEASE</div>
|
||||
<div>3.升级Alibaba Cloud 2.1.1.RELEASE</div>
|
||||
<div>4.升级Seata 1.0.0</div>
|
||||
<div>5.升级Swagger-Bootstrap-UI为最新的Knife4j 2.0.1</div>
|
||||
<div>6.升级Xss过滤机制以适配最新架构</div>
|
||||
<div>7.升级前端请求机制以适配最新架构</div>
|
||||
<div>8.修复blade-resource无法进行docker打包的问题</div>
|
||||
<div>9.修复blade-demo没有配置LauncherService导致启动失败的问题</div>
|
||||
</Panel>
|
||||
<Panel header="2.5.4发布 增加多数据源示例工程" key="13">
|
||||
<div>1.增加示例工程,增加多种常见场景的解决方案</div>
|
||||
<div>2.增加不同包名运行的示例</div>
|
||||
@ -185,7 +299,10 @@ class Workplace extends PureComponent {
|
||||
</Panel>
|
||||
<Panel header="2.3.0发布 升级SpringCloud Greenwich与SpringBoot" key="3">
|
||||
<div>1.升级 SpringCloud Greenwich</div>
|
||||
<div>2.升级 SpringCloud Alibaba 组件版本为0.9.0.RELEASE,支持最新版本的nacos与sentinel</div>
|
||||
<div>
|
||||
2.升级 SpringCloud Alibaba
|
||||
组件版本为0.9.0.RELEASE,支持最新版本的nacos与sentinel
|
||||
</div>
|
||||
<div>3.升级 SpringBoot 2.1.4</div>
|
||||
<div>4.升级 mysql 驱动版本</div>
|
||||
<div>5.优化 LauncherService 关于环境的判断逻辑</div>
|
||||
@ -210,14 +327,25 @@ class Workplace extends PureComponent {
|
||||
<div>6.增加父子角色过滤,使得角色无法越权配置</div>
|
||||
</Panel>
|
||||
<Panel header="2.0.0发布 全面升级为SpringCloud微服务架构" key="0">
|
||||
<div>1.SpringBlade 2.0 是由一个商业级项目升级优化而来的SpringCloud微服务架构,采用Java8 API重构了业务代码,完全遵循阿里巴巴编码规范</div>
|
||||
<div>2.采用Spring Boot 2 、Spring Cloud Greenwich 、Mybatis 等核心技术,用于快速搭建企业级的微服务系统平台</div>
|
||||
<div>3.SpringBlade 致力于创造新颖的开发模式,将开发中遇到的痛点、生产中所踩的坑整理归纳,并将解决方案都融合到框架中</div>
|
||||
<div>
|
||||
1.SpringBlade 2.0
|
||||
是由一个商业级项目升级优化而来的SpringCloud微服务架构,采用Java8
|
||||
API重构了业务代码,完全遵循阿里巴巴编码规范
|
||||
</div>
|
||||
<div>
|
||||
2.采用Spring Boot 2 、Spring Cloud Greenwich 、Mybatis
|
||||
等核心技术,用于快速搭建企业级的微服务系统平台
|
||||
</div>
|
||||
<div>
|
||||
3.SpringBlade
|
||||
致力于创造新颖的开发模式,将开发中遇到的痛点、生产中所踩的坑整理归纳,并将解决方案都融合到框架中
|
||||
</div>
|
||||
</Panel>
|
||||
</Collapse>
|
||||
</Card>
|
||||
</Row>
|
||||
</Col>
|
||||
</Row>
|
||||
</Card>
|
||||
</PageHeaderWrapper>
|
||||
);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import React, { Component } from 'react';
|
||||
import { connect } from 'dva';
|
||||
import { formatMessage, FormattedMessage } from 'umi/locale';
|
||||
import { Checkbox, Alert, notification, Icon } from 'antd';
|
||||
import { Checkbox, Alert } from 'antd';
|
||||
import Login from '../../components/Login';
|
||||
import styles from './Login.less';
|
||||
import { tenantMode } from '../../defaultSettings';
|
||||
@ -18,44 +18,6 @@ class LoginPage extends Component {
|
||||
autoLogin: true,
|
||||
};
|
||||
|
||||
componentWillMount() {
|
||||
notification.config({
|
||||
placement: 'bottomRight',
|
||||
});
|
||||
notification.destroy();
|
||||
notification.open({
|
||||
message: '手册信息',
|
||||
description: (
|
||||
<div>
|
||||
<p>Sword开发手册:<a target="_blank" href="https://www.kancloud.cn/smallchill/sword">点击查看</a></p>
|
||||
<p>SpringBlade开发手册:<a target="_blank" href="https://www.kancloud.cn/smallchill/blade">点击查看</a></p>
|
||||
</div>
|
||||
),
|
||||
icon: <Icon type="smile" style={{ color: '#108ee9' }} />,
|
||||
duration: 0,
|
||||
});
|
||||
setTimeout(() => {
|
||||
notification.open({
|
||||
message: '授权信息',
|
||||
description: (
|
||||
<div>
|
||||
<p>欢迎使用Sword!</p>
|
||||
<p>该系统可用BladeX增强开发,</p>
|
||||
<p>若要商用强烈推荐高度定制的商业化框架,具体授权信息请访问如下地址。</p>
|
||||
<p>
|
||||
BladeX 授权地址:
|
||||
<a target="_blank" href="https://bladex.vip/#/vip">
|
||||
点击授权
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
),
|
||||
icon: <Icon type="smile" style={{ color: '#108ee9' }} />,
|
||||
duration: 0,
|
||||
});
|
||||
}, 500);
|
||||
}
|
||||
|
||||
onTabChange = type => {
|
||||
this.setState({ type });
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React, { Fragment, PureComponent } from 'react';
|
||||
import { connect } from 'dva';
|
||||
import { Button, Col, Divider, Form, Input, message, Modal, Row } from "antd";
|
||||
import { Button, Col, Divider, Form, Input, message, Modal, Row } from 'antd';
|
||||
import Panel from '../../../components/Panel';
|
||||
import Grid from '../../../components/Sword/Grid';
|
||||
import { CODE_LIST } from '../../../actions/code';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
import { Form, Input, Card, Row, Col, Button, InputNumber, TreeSelect, message } from "antd";
|
||||
import { Form, Input, Card, Row, Col, Button, InputNumber, TreeSelect, message } from 'antd';
|
||||
import { connect } from 'dva';
|
||||
import Panel from '../../../components/Panel';
|
||||
import styles from '../../../layouts/Sword.less';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
import { Form, Input, Card, Row, Col, Button, InputNumber, TreeSelect, message } from "antd";
|
||||
import { Form, Input, Card, Row, Col, Button, InputNumber, TreeSelect, message } from 'antd';
|
||||
import { connect } from 'dva';
|
||||
import Panel from '../../../components/Panel';
|
||||
import styles from '../../../layouts/Sword.less';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
import { Form, Input, Card, Row, Col, Button, InputNumber, TreeSelect, message } from "antd";
|
||||
import { Form, Input, Card, Row, Col, Button, InputNumber, TreeSelect, message } from 'antd';
|
||||
import { connect } from 'dva';
|
||||
import Panel from '../../../components/Panel';
|
||||
import styles from '../../../layouts/Sword.less';
|
||||
|
@ -1,4 +1,5 @@
|
||||
import moment from 'moment';
|
||||
import RequestForm from '@/utils/RequestForm';
|
||||
|
||||
/**
|
||||
* 通用工具类
|
||||
@ -46,14 +47,10 @@ export default class Func {
|
||||
/**
|
||||
* Json强转为Form类型
|
||||
* @param obj
|
||||
* @returns {FormData}
|
||||
* @returns {RequestForm}
|
||||
*/
|
||||
static toFormData(obj) {
|
||||
const data = new FormData();
|
||||
Object.keys(obj).forEach(key => {
|
||||
data.append(key, Array.isArray(obj[key]) ? obj[key].join(',') : obj[key]);
|
||||
});
|
||||
return data;
|
||||
return new RequestForm(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
|
17
src/utils/RequestForm.js
Normal file
17
src/utils/RequestForm.js
Normal file
@ -0,0 +1,17 @@
|
||||
import { stringify } from 'qs';
|
||||
|
||||
export default class RequestForm {
|
||||
constructor(params) {
|
||||
const values = params;
|
||||
Object.keys(params).forEach(key => {
|
||||
if (Array.isArray(params[key])) {
|
||||
values[key] = params[key].join(',');
|
||||
}
|
||||
});
|
||||
this.params = values;
|
||||
}
|
||||
|
||||
parse() {
|
||||
return stringify(this.params);
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ import hash from 'hash.js';
|
||||
import { Base64 } from 'js-base64';
|
||||
import { clientId, clientSecret } from '../defaultSettings';
|
||||
import { getToken, removeAll } from './authority';
|
||||
import RequestForm from '@/utils/RequestForm';
|
||||
|
||||
const codeMessage = {
|
||||
200: '服务器成功返回请求的数据。',
|
||||
@ -135,13 +136,20 @@ export default function request(url, option) {
|
||||
newOptions.method === 'PUT' ||
|
||||
newOptions.method === 'DELETE'
|
||||
) {
|
||||
if (!(newOptions.body instanceof FormData)) {
|
||||
if (!(newOptions.body instanceof FormData) && !(newOptions.body instanceof RequestForm)) {
|
||||
newOptions.headers = {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json;charset=utf-8',
|
||||
...newOptions.headers,
|
||||
};
|
||||
newOptions.body = JSON.stringify(newOptions.body);
|
||||
} else if (newOptions.body instanceof RequestForm) {
|
||||
newOptions.headers = {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
...newOptions.headers,
|
||||
};
|
||||
newOptions.body = newOptions.body.parse();
|
||||
} else {
|
||||
// newOptions.body is FormData
|
||||
newOptions.headers = {
|
||||
|
Loading…
Reference in New Issue
Block a user