Ver Fonte

5.2.1发布

msgroup há 4 anos atrás
pai
commit
2d3b0160bb

+ 1 - 1
README.md

@@ -35,7 +35,7 @@
 
 很多人说铭飞是大天朝国唯一完整开源的J2EE系统!团队希望看到更多的优秀好用的开源系统,我们一直会努力下去!<br/>
 
-QQ交流群号:[![加入QQ群](https://img.shields.io/badge/一群-231212174-blue.svg)](https://jq.qq.com/?_wv=1027&k=5zykX7V)  [![加入QQ群](https://img.shields.io/badge/二群-221335098-blue.svg)](https://jq.qq.com/?_wv=1027&k=56BqFKu) [![加入QQ群](https://img.shields.io/badge/三群-242805203-blue.svg)](https://jq.qq.com/?_wv=1027&k=5oF19sl)
+QQ交流群号: [![加入QQ群](https://img.shields.io/badge/五群-231211521-blue.svg)](https://jq.qq.com/?_wv=1027&k=5oF19sl) [![加入QQ群](https://img.shields.io/badge/四群-881894877-blue.svg)](https://jq.qq.com/?_wv=1027&k=5oF19sl) [![加入QQ群](https://img.shields.io/badge/一群-231212174-blue.svg)](https://jq.qq.com/?_wv=1027&k=5zykX7V)  [![加入QQ群](https://img.shields.io/badge/二群-221335098-blue.svg)](https://jq.qq.com/?_wv=1027&k=56BqFKu) [![加入QQ群](https://img.shields.io/badge/三群-242805203-blue.svg)](https://jq.qq.com/?_wv=1027&k=5oF19sl)
 
 
 # 开源说明

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 191
doc/5.1-up-5.2.sql


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 128
doc/mcms-5.2.sql


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 48
doc/历史/5.0.0-to-5.1-mysql.sql


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
doc/历史/5.1-patch.sql


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 97
doc/历史/mcms-5.1.sql


+ 6 - 12
pom.xml

@@ -10,10 +10,10 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>net.mingsoft</groupId>
     <artifactId>ms-mcms</artifactId>
-    <version>5.2.0.RELEASE</version>
+    <version>5.2.1</version>
     <name>ms-mcms</name>
     <!-- 打包war包 -->
-<!--    <packaging>war</packaging>-->
+    <!--    <packaging>war</packaging>-->
     <properties>
         <java.version>1.8</java.version>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -49,23 +49,17 @@
         <dependency>
             <groupId>net.mingsoft</groupId>
             <artifactId>ms-basic</artifactId>
-            <version>1.0.37</version>
+            <version>2.1.0</version>
         </dependency>
         <dependency>
             <groupId>net.mingsoft</groupId>
             <artifactId>ms-mdiy</artifactId>
-            <version>1.0.28</version>
-        </dependency>
-        <dependency>
-            <groupId>net.mingsoft</groupId>
-            <artifactId>ms-mpeople</artifactId>
-            <version>1.0.33</version>
-
+            <version>2.1.0</version>
         </dependency>
         <dependency>
             <groupId>net.mingsoft</groupId>
             <artifactId>store-client</artifactId>
-            <version>5.2</version>
+            <version>2.1.0</version>
         </dependency>
 
     </dependencies>
@@ -129,4 +123,4 @@
         </plugins>
         <defaultGoal>compile</defaultGoal>
     </build>
-</project>
+</project>

+ 2 - 4
src/main/java/net/mingsoft/MSApplication.java

@@ -32,14 +32,12 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
 import java.util.Locale;
 
 
-@SpringBootApplication
-@ComponentScan(basePackages = {"net.mingsoft"})
+@SpringBootApplication(scanBasePackages = {"net.mingsoft"})
 @MapperScan(basePackages={"**.dao","com.baomidou.**.mapper"})
 @ServletComponentScan(basePackages = {"net.mingsoft"})
-@EnableCaching
 public class MSApplication {
 	public static void main(String[] args) {
 		SpringApplication.run(MSApplication.class, args);
 	}
 
-}
+}

+ 2 - 1
src/main/java/net/mingsoft/cms/action/CategoryAction.java

@@ -295,7 +295,8 @@ public class CategoryAction extends BaseAction {
 				 return ResultData.build().error(getResString("cannot.select.child"));
 			 }
 		 }
-		categoryBiz.updateEntity(category);
+		 // 这里不能使用mybitsplus 存在业务
+		 categoryBiz.updateEntity(category);
 		return ResultData.build().success(category);
 	}
 

+ 1 - 1
src/main/java/net/mingsoft/cms/action/ContentAction.java

@@ -285,7 +285,7 @@ public class ContentAction extends BaseAction {
 		if(!StringUtil.checkLength(content.getContentUrl()+"", 0, 200)){
 			return ResultData.build().error(getResString("err.length", this.getResString("content.url"), "0", "200"));
 		}
-		contentBiz.updateEntity(content);
+		contentBiz.saveOrUpdate(content);
 		return ResultData.build().success(content);
 	}
 

+ 3 - 3
src/main/java/net/mingsoft/cms/action/GeneraterAction.java

@@ -133,7 +133,7 @@ public class GeneraterAction extends BaseAction {
         String generateFileName = request.getParameter("position");
 
         // 获取文件所在路径 首先判断用户输入的模版文件是否存在
-        if (!FileUtil.exist(ParserUtil.buildTempletPath())) {
+        if (!FileUtil.exist(ParserUtil.buildTemplatePath())) {
             return ResultData.build().error(getResString("templet.file"));
         } else {
 
@@ -186,7 +186,7 @@ public class GeneraterAction extends BaseAction {
                 case LIST: // 列表
 
                     // 判断模板文件是否存在
-                    if (!FileUtil.exist(ParserUtil.buildTempletPath(column.getCategoryListUrl()))) {
+                    if (!FileUtil.exist(ParserUtil.buildTemplatePath(column.getCategoryListUrl()))) {
                         LOG.error("模板不存在:{}", column.getCategoryUrl());
                         continue;
                     }
@@ -244,7 +244,7 @@ public class GeneraterAction extends BaseAction {
             // 分类是列表
             if (category.getCategoryType().equals(CategoryTypeEnum.LIST.toString())) {
                 // 判断模板文件是否存在
-                if (!FileUtil.exist(ParserUtil.buildTempletPath(category.getCategoryListUrl())) || StringUtils.isEmpty(category.getCategoryListUrl())) {
+                if (!FileUtil.exist(ParserUtil.buildTemplatePath(category.getCategoryListUrl())) || StringUtils.isEmpty(category.getCategoryListUrl())) {
                     LOG.error("模板不存在:{}", category.getCategoryUrl());
                     continue;
                 }

+ 1 - 1
src/main/java/net/mingsoft/cms/action/web/CategoryAction.java

@@ -129,7 +129,7 @@ public class CategoryAction extends net.mingsoft.cms.action.BaseAction{
 		if(category.getId()==null) {
 			return ResultData.build().error();
 		}
-		CategoryEntity _category = (CategoryEntity)categoryBiz.getEntity(Integer.parseInt(category.getId()));
+		CategoryEntity _category = (CategoryEntity)categoryBiz.getById(category.getId());
 		return ResultData.build().success(_category);
 	}
 

+ 1 - 1
src/main/java/net/mingsoft/cms/action/web/ContentAction.java

@@ -118,7 +118,7 @@ public class ContentAction extends net.mingsoft.cms.action.BaseAction{
 		if(content.getId()==null) {
 			return ResultData.build().error();
 		}
-		ContentEntity _content = (ContentEntity)contentBiz.getEntity(Integer.parseInt(content.getId()));
+		ContentEntity _content = (ContentEntity)contentBiz.getById(content.getId());;
 		return ResultData.build().success(_content);
 	}
 

+ 21 - 18
src/main/java/net/mingsoft/cms/action/web/MCmsAction.java

@@ -347,30 +347,33 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
         //获取栏目信息
         String typeId = null;
         String categoryIds = BasicUtil.getString("categoryIds");
-        List categoryIdList = CollectionUtil.newArrayList();
+
+        //List categoryIdList = CollectionUtil.newArrayList();
+
         //当传递了栏目编号,但不是栏目集合
         if (StringUtils.isNotBlank(categoryIds) && !categoryIds.contains(",")) {
             typeId = categoryIds;
-        } else {
-            //取出所有的子栏目
-            String[] ids = categoryIds.split(",");
-            List<CategoryEntity> categoryList = categoryBiz.list(Wrappers.<CategoryEntity>lambdaQuery().ne(CategoryEntity::getCategoryType, CategoryTypeEnum.LINK.toString()));
-
-            categoryIdList = CollectionUtil.newArrayList(ids);
-            for(CategoryEntity c:categoryList) {
-                if(StringUtils.isNotEmpty(c.getParentids())) {
-                    for(String id:ids) {
-                        if(c.getParentids().indexOf(id)>-1) {
-                            categoryIdList.add(c.getId());
-                            break;
-                        }
-                    }
-                }
-            }
         }
+//        else {
+//            //取出所有的子栏目
+//            String[] ids = categoryIds.split(",");
+//            List<CategoryEntity> categoryList = categoryBiz.list(Wrappers.<CategoryEntity>lambdaQuery().ne(CategoryEntity::getCategoryType, CategoryTypeEnum.LINK.toString()));
+//
+//            categoryIdList = CollectionUtil.newArrayList(ids);
+//            for(CategoryEntity c:categoryList) {
+//                if(StringUtils.isNotEmpty(c.getParentids())) {
+//                    for(String id:ids) {
+//                        if(c.getParentids().indexOf(id)>-1) {
+//                            categoryIdList.add(c.getId());
+//                            break;
+//                        }
+//                    }
+//                }
+//            }
+//        }
 
         //重新组织 ID
-        categoryIds = StringUtils.join(categoryIdList, ",");
+        //categoryIds = StringUtils.join(categoryIdList, ",");
 
 
         //根据栏目确定自定义模型

+ 1 - 1
src/main/java/net/mingsoft/cms/aop/ContentAop.java

@@ -71,7 +71,7 @@ public class ContentAop extends BaseAop {
         if(content.getId()==null) {
             return pjp.proceed();
         }
-        content = (ContentEntity)contentBiz.getEntity(Integer.parseInt(content.getId()));
+        content = contentBiz.getById(content.getId());
         //如果文章不存在则直接发行
         if(content == null){
             return pjp.proceed();

+ 7 - 0
src/main/java/net/mingsoft/cms/entity/CategoryEntity.java

@@ -440,6 +440,13 @@ public class CategoryEntity extends BaseEntity {
     }
 
     /**
+     * 获取栏目Id(标签使用)
+     */
+    public Boolean getTypeleaf() {
+        return this.leaf; }
+
+
+    /**
      * 获取栏目图片 (标签使用)
      */
     public String getTypelitpic() {

+ 1 - 1
src/main/java/net/mingsoft/cms/util/CmsParserUtil.java

@@ -239,7 +239,7 @@ public class CmsParserUtil {
             }
 
             // 判断文件是否存在,若不存在弹出返回信息
-            if (!FileUtil.exist(ParserUtil.buildTempletPath(columnUrl)) || categoryBean.getId() == null || categoryBean.getCategoryType() == null) {
+            if (!FileUtil.exist(ParserUtil.buildTemplatePath(columnUrl)) || categoryBean.getId() == null || categoryBean.getCategoryType() == null) {
                 artId++;
                 continue;
             }

+ 7 - 1
src/main/java/net/mingsoft/config/WebConfig.java

@@ -65,6 +65,11 @@ public class WebConfig implements WebMvcConfigurer {
 	 */
 	@Value("${ms.upload.mapping}")
 	private String uploadMapping;
+	/**
+	 * 上传路径映射
+	 */
+	@Value("${ms.diy.html-dir}")
+	private String htmlDir;
 	@Bean
 	public ActionInterceptor actionInterceptor() {
 		return new ActionInterceptor();
@@ -88,7 +93,8 @@ public class WebConfig implements WebMvcConfigurer {
 	public void addResourceHandlers(ResourceHandlerRegistry registry) {
 		registry.addResourceHandler(uploadMapping).addResourceLocations(File.separator+uploadFloderPath+File.separator,"file:"+uploadFloderPath+File.separator,"classpath:/template/");
 		registry.addResourceHandler("/template/**").addResourceLocations(File.separator+template+File.separator,"file:"+template+File.separator,"classpath:/html/");
-		registry.addResourceHandler("/html/**").addResourceLocations("/html/","file:html/");
+		//注意这里的htmlDir资源不能使用File.separator替代"/",会导致Windows一键版访问失效
+		registry.addResourceHandler("/".concat(htmlDir).concat("/**")).addResourceLocations("/".concat(htmlDir).concat("/"),"file:".concat(htmlDir).concat("/"));
 		//三种映射方式 webapp下、当前目录下、jar内
 		registry.addResourceHandler("/app/**").addResourceLocations("/app/","file:app/", "classpath:/app/");
 		registry.addResourceHandler("/static/**").addResourceLocations("/static/","file:static/","classpath:/static/","classpath:/META-INF/resources/");

+ 1 - 1
src/main/resources/application-dev.yml

@@ -4,4 +4,4 @@ spring:
     username: root
     password: root
     filters: wall,mergeStat
-    type: com.alibaba.druid.pool.DruidDataSource
+    type: com.alibaba.druid.pool.DruidDataSource

+ 2 - 2
src/main/resources/application.yml

@@ -20,7 +20,7 @@ ms:
   manager:
     path: /ms #后台访问的路径,如:http://项目/ms/login.do,生产的时候建议修改
     view-path: /WEB-INF/manager #后台视图层路径配置
-    check-code: true #默认开启验证码验证,false验证码不验证
+    check-code: false #默认开启验证码验证,false验证码不验证
 
   upload:
     enable-web: true  #启用web层的上传
@@ -91,4 +91,4 @@ mybatis-plus:
     db-config:
       id-type: auto
   configuration:
-    database-id: mysql
+    database-id: mysql

+ 4 - 2
src/main/webapp/WEB-INF/manager/cms/category/form.ftl

@@ -589,7 +589,8 @@
                     });
                 }else {
                     this.$notify({
-                        title: response.msg,
+                        title: '失败',
+                        message: response.msg,
                         type: 'warning'
                     });
                 }
@@ -598,7 +599,8 @@
             //上传超过限制
             categoryImghandleExceed: function (files, fileList) {
                 this.$notify({
-                    title: '当前最多上传1个文件',
+                    title: '失败',
+                    message: '当前最多上传1个文件',
                     type: 'warning'
                 });
             },

+ 14 - 37
src/main/webapp/WEB-INF/manager/cms/content/form.ftl

@@ -1,8 +1,9 @@
 <!DOCTYPE html>
 <html>
 <head>
-    <title>文章</title>
+    <title>文章1</title>
     <#include "../../include/head-file.ftl">
+    <script src="${base}/static/mdiy/index.js"></script>
 </head>
 <body>
 <div id="form" v-cloak>
@@ -272,7 +273,7 @@
                     scaleEnabled: true,
                     compressSide: 0,
                     maxImageSideLength: 1000,
-                    maximumWords: 2000,
+                    maximumWords: 100000,
                     initialFrameWidth: '100%',
                     initialFrameHeight: 400,
                     serverUrl: ms.base + "/static/plugins/ueditor/1.4.3.1/jsp/editor.do?jsonConfig=%7BvideoUrlPrefix:\'" + ms.base + "\',fileUrlPrefix:\'" + ms.base + "\',imageUrlPrefix:\'" + ms.base + "\',imagePathFormat:\'/upload/${appId}/cms/content/editor/%7Btime%7D\',filePathFormat:\'/upload/${appId}/cms/content/editor/%7Btime%7D\',videoPathFormat:\'/upload/${appId}/cms/content/editor/%7Btime%7D\'%7D",
@@ -440,50 +441,24 @@
             changeModel: function () {
                 var that = this;
                 that.editableTabs = [that.editableTabs[0]];
-                this.removeModel();
 
                 if (this.currCategory) {
                     if (this.currCategory.mdiyModelId) {
-                        ms.http.get(ms.manager + "/mdiy/model/get.do", {
-                            id: this.currCategory.mdiyModelId
-                        }).then(function (data) {
-                            if (data.data && data.data.id) {
-                                that.rederModel(data.data, JSON.parse(data.data.modelJson));
-                            }
-                        });
+                        that.rederModel(this.currCategory.mdiyModelId)
                     }
                 }
             },
-            rederModel: function (modelEntity, data) {
+            rederModel: function (modelId) {
                 var that = this;
                 that.editableTabs.push({
-                    title: modelEntity.modelName,
+                    title: '',
                     name: 'custom-name'
                 });
-                this.removeModel();
-                that.$nextTick(function () {
-                    var div = document.createElement('div');
-                    div.id = 'c_model';
-                    var model = document.getElementById('model1');
-                    model.appendChild(div);
-                    var s = document.createElement('script');
-                    s.innerHTML = data.script;
-                    var con = document.createElement('div');
-                    con.id = 'custom-model';
-                    con.innerHTML = data.html;
-                    div.appendChild(s);
-                    div.appendChild(con); //初始化自定义模型并传入关联参数
-
-                    that.model = new custom_model({
-                        data: {
-                            title: modelEntity.modelName,
-                            modelId: modelEntity.id,
-                            form: {
-                                linkId: that.form.id
-                            }
-                        }
-                    });
+                ms.mdiy.model.extend("model1", {id:modelId},{ linkId: that.form.id }).then(function(obj) {
+                    that.model = obj;
+                    that.editableTabs[1].title = obj.modelName
                 });
+
             },
             getValue: function (data) {
                 this.form.categoryId = data.id;
@@ -620,7 +595,8 @@
                     });
                 }else {
                     this.$notify({
-                        title: response.msg,
+                        title: '失败',
+                        message: response.msg,
                         type: 'warning'
                     });
                 }
@@ -639,7 +615,8 @@
             //上传超过限制
             contentImghandleExceed: function (files, fileList) {
                 this.$notify({
-                    title: '当前最多上传1个文件',
+                    title: '失败',
+                    message: '当前最多上传1个文件',
                     type: 'warning'
                 });
             },

+ 1 - 1
src/main/webapp/WEB-INF/manager/cms/content/main.ftl

@@ -302,7 +302,7 @@
                 ms.http.post(ms.manager + "/cms/content/list.do", form.sqlWhere ? Object.assign({}, {
                     categoryType: '1',
                     sqlWhere: form.sqlWhere
-                }, page) : Object.assign({}, that.form, page)).then(function (res) {
+                }, page) : Object.assign({}, form, page)).then(function (res) {
                     if (that.loadState) {
                         that.loading = false;
                     } else {

+ 12 - 7
src/main/webapp/WEB-INF/manager/cms/generate/index.ftl

@@ -166,7 +166,8 @@
                 var that = this;
                 if (!that.position || that.position == '') {
                     this.$notify({
-                        title: '请输入主页位置!',
+                        title: '失败',
+                        message: '请输入主页位置!',
                         type: 'warning'
                     });
                     return;
@@ -178,13 +179,14 @@
                 }).then(function (data) {
                     if (data.result) {
                         that.$notify({
-                            title: '更新成功!',
+                            title: '成功',
+                            message: '更新成功!',
                             type: 'success'
                         });
                     } else {
                         that.$notify({
-                            title: '更新失败',
-                            message: "错误",
+                            title: '失败',
+                            message: "更新失败!",
                             type: 'error'
                         });
                     }
@@ -203,7 +205,8 @@
             viewIndex: function () {
                 if (!this.position || this.position == '') {
                     this.$notify({
-                        title: '请输入主页位置!',
+                        title: '失败',
+                        message: '请输入主页位置!',
                         type: 'warning'
                     });
                     return;
@@ -217,7 +220,8 @@
                 ms.http.get(ms.manager + '/cms/generate/' + (that.section ? that.section : 0) + '/genernateColumn.do').then(function (data) {
                     if (data.result) {
                         that.$notify({
-                            title: '更新成功!',
+                            title: '成功',
+                            message: '更新成功!',
                             type: 'success'
                         });
                     }else {
@@ -247,7 +251,8 @@
                 }).then(function (data) {
                     if (data.result) {
                         that.$notify({
-                            title: '更新成功!',
+                            title: '成功',
+                            message:'更新成功!',
                             type: 'success'
                         });
                     }else {

+ 109 - 29
src/main/webapp/static/plugins/ms/1.0.0/ms.http.js

@@ -1,15 +1,14 @@
 /**
  * 封装http请求
  */
-(function() {
+(function () {
 
     axios.defaults.timeout = 1000 * 60;
     axios.defaults.baseURL = '';
 
     //http request 拦截器
     axios.interceptors.request.use(
-
-        function(config) {
+        function (config) {
             config.headers = {
                 'Content-Type': 'application/x-www-form-urlencoded',
                 'Cache-Control': 'no-cache',
@@ -23,23 +22,58 @@
             }
             return config;
         },
-        function(error) {
-            return Promise.reject(err);
+        function (error) {
+            return Promise.reject(error);
         }
     );
 
 
     //http response 拦截器
     axios.interceptors.response.use(
-        function(response) {
-            //登录失效
-            if (response.data.bizCode == "401" && ms.isLoginRedirect) {
-                window.parent.location.href = ms.base + "/" + ms.login + "?backurl=" + encodeURIComponent(window.parent.location.href);
-                return;
-            }
+        function (response) {
             return response;
         },
-        function(error) {
+        function (error) {
+            if (error.response) {
+                let msg;
+                if (error.response.status == 401) {
+                    msg = "登录失败";
+                } else if (error.response.status == 400) {
+                    msg = "客户端错误";
+                } else if (error.response.status == 403) {
+                    msg = "您的权限不足";
+                } else if (error.response.status == 404) {
+                    msg = "请求不存在";
+                } else if (error.response.status == 423) {
+                    msg = "账号被锁定!";
+                } else if (error.response.status == 500) {
+                    msg = "服务器异常";
+
+                } else if (error.response.status == 501) {
+                    msg = "您的操作被取消或不允许提交";
+                } else if (error.response.status == 423) {
+                    msg = "服务器正在开小差....";
+                }
+                if(error.response.data && error.response.data.msg) {
+                    msg = error.response.data.msg;
+                }
+                if (msg) {
+                    var tempVue = document.createElement('div');
+                    tempVue.id = "tempVue";
+                    document.body.appendChild(tempVue)
+                    new Vue({el: '#tempVue',}).$notify.error({
+                        title: '错误',
+                        message: msg,
+                        type: 'warning'
+                    });
+                    if (error.response.status == 401) {
+                        window.location.reload();
+                    }
+                    document.body.removeChild(tempVue);
+                }
+
+            }
+
             return Promise.reject(error)
         }
     )
@@ -52,7 +86,7 @@
                 headers: conf.headers == undefined ? null : conf.headers,
             });
             _axios.interceptors.request.use(
-                function(config) {
+                function (config) {
                     if (config.method === 'post' && config.headers["Content-Type"] === "application/x-www-form-urlencoded") {
                         config.data = Qs.stringify(config.data, {
                             allowDots: true
@@ -60,8 +94,8 @@
                     }
                     return config;
                 },
-                function(error) {
-                    return Promise.reject(err);
+                function (error) {
+                    return Promise.reject(error);
                 }
             );
             return _axios;
@@ -70,7 +104,6 @@
     }
 
 
-
     /**
      * 封装get方法
      * @param url
@@ -82,14 +115,14 @@
         if (params == undefined) {
             params = {}
         }
-        return new Promise(function(resolve, reject) {
+        return new Promise(function (resolve, reject) {
             ajax().get(url, {
                 params: params
             })
-                .then(function(response) {
+                .then(function (response) {
                     resolve(response.data);
                 })
-                .catch(function(err) {
+                .catch(function (err) {
                     reject(err)
                 })
         })
@@ -109,11 +142,11 @@
             data = {}
         }
 
-        return new Promise(function(resolve, reject) {
+        return new Promise(function (resolve, reject) {
             ajax(conf).post(url, data, conf)
-                .then(function(response) {
+                .then(function (response) {
                     resolve(response.data);
-                }, function(err) {
+                }, function (err) {
                     reject(err)
                 })
         })
@@ -131,11 +164,11 @@
         if (data == undefined) {
             data = {}
         }
-        return new Promise(function(resolve, reject) {
+        return new Promise(function (resolve, reject) {
             ajax(conf).patch(url, data, conf)
-                .then(function(response) {
+                .then(function (response) {
                     resolve(response);
-                }, function(err) {
+                }, function (err) {
                     reject(err)
                 })
         })
@@ -152,22 +185,69 @@
         if (data == undefined) {
             data = {}
         }
-        return new Promise(function(resolve, reject) {
+        return new Promise(function (resolve, reject) {
             ajax(conf).put(url, data, conf)
-                .then(function(response) {
+                .then(function (response) {
                     resolve(response.data);
-                }, function(err) {
+                }, function (err) {
                     reject(err)
                 })
         })
     }
 
+    /**
+     * 下载资源
+     * @param url
+     * @param data
+     * @returns {Promise}
+     */
+    function download(url, data) {
+
+        if (data == undefined) {
+            data = {}
+        }
+
+        return new Promise(function (resolve, reject) {
+            axios({
+                method: 'post',
+                // 请求地址
+                url: url,
+                // 参数
+                data: data,
+                // 表明返回服务器返回的数据类型
+                responseType: 'blob',
+                headers: {Accept: 'application/vnd.openxmlformats-officedocument'}
+            }).then((res) => { // 处理返回的文件流
+                const content = res.data
+                const blob = new Blob([content])
+                const fileName = res.headers["filename"];
+                if ('download' in document.createElement('a')) { // 非IE下载
+                    const elink = document.createElement('a')
+                    elink.download = fileName
+                    elink.style.display = 'none'
+                    elink.href = URL.createObjectURL(blob)
+                    document.body.appendChild(elink)
+                    elink.click()
+                    URL.revokeObjectURL(elink.href) // 释放URL 对象
+                    document.body.removeChild(elink)
+                } else { // IE10+下载
+                    navigator.msSaveBlob(blob, fileName)
+                }
+                resolve(res);
+            }, function (err) {
+                reject(err)
+            })
+
+        })
+    }
+
 
     var http = {
         get: get,
         post: post,
         put: put,
-        patch: patch
+        patch: patch,
+        download: download
 
     }
 

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff