Ver código fonte

修复主页生成问题

huise 5 anos atrás
pai
commit
17f5ad42a1

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

@@ -24,7 +24,6 @@ package net.mingsoft.cms.action;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.bean.copier.CopyOptions;
 import cn.hutool.core.io.FileUtil;
-import net.mingsoft.basic.action.BaseAction;
 import net.mingsoft.basic.biz.IModelBiz;
 import net.mingsoft.basic.entity.AppEntity;
 import net.mingsoft.basic.util.BasicUtil;
@@ -52,12 +51,12 @@ import java.util.ArrayList;
 import java.util.List;
 
 /**
- * 
+ *
  * @ClassName: GeneraterAction
  * @Description:TODO 生成器
  * @author: 铭飞开发团队
  * @date: 2018年1月31日 下午2:52:07
- * 
+ *
  * @Copyright: 2018 www.mingsoft.net Inc. All rights reserved.
  */
 @Controller("cmsGenerater")
@@ -92,7 +91,7 @@ public class GeneraterAction extends BaseAction {
 
 	/**
 	 * 更新主页
-	 * 
+	 *
 	 * @return
 	 */
 	@RequestMapping("/index")
@@ -102,7 +101,7 @@ public class GeneraterAction extends BaseAction {
 
 	/**
 	 * 生成主页
-	 * 
+	 *
 	 * @param request
 	 * @param response
 	 */
@@ -114,7 +113,7 @@ public class GeneraterAction extends BaseAction {
 		String tmpFileName = request.getParameter("url");
 		// 生成后的文件名称
 		String generateFileName = request.getParameter("position");
-		
+
 		// 获取文件所在路径 首先判断用户输入的模版文件是否存在
 		if (!FileUtil.exist(ParserUtil.buildTempletPath())) {
 			this.outJson(response, false, getResString("templet.file"));
@@ -128,12 +127,12 @@ public class GeneraterAction extends BaseAction {
 			}
 		}
 	}
-	
+
 
 
 	/**
 	 * 生成列表的静态页面
-	 * 
+	 *
 	 * @param request
 	 * @param response
 	 * @param CategoryId
@@ -194,7 +193,7 @@ public class GeneraterAction extends BaseAction {
 
 	/**
 	 * 根据栏目id更新所有的文章
-	 * 
+	 *
 	 * @param request
 	 * @param response
 	 * @param columnId
@@ -219,12 +218,12 @@ public class GeneraterAction extends BaseAction {
 			this.outJson(response, false);
 		}
 	}
-	
+
 
 
 	/**
 	 * 用户预览主页
-	 * 
+	 *
 	 * @param request
 	 * @return
 	 */
@@ -236,4 +235,4 @@ public class GeneraterAction extends BaseAction {
 				+ File.separator + position + ParserUtil.HTML_SUFFIX;
 		return "redirect:" + indexPosition;
 	}
-}
+}

+ 1 - 0
src/main/java/net/mingsoft/cms/resources/resources.properties

@@ -33,3 +33,4 @@ category.id=\u6240\u5C5E\u680F\u76EE
 content.sort=\u81EA\u5B9A\u4E49\u987A\u5E8F
 category.diy.url=\u81EA\u5B9A\u4E49\u94FE\u63A5
 content.keyword=\u5173\u952E\u5B57
+templet.file=\u672A\u627E\u5230\u6A21\u677F\u6587\u4EF6

+ 1 - 0
src/main/java/net/mingsoft/cms/resources/resources_zh_CN.properties

@@ -33,3 +33,4 @@ category.id=\u6240\u5C5E\u680F\u76EE
 content.sort=\u81EA\u5B9A\u4E49\u987A\u5E8F
 category.diy.url=\u81EA\u5B9A\u4E49\u94FE\u63A5
 content.keyword=\u5173\u952E\u5B57
+templet.file=\u672A\u627E\u5230\u6A21\u677F\u6587\u4EF6

+ 8 - 2
src/main/webapp/WEB-INF/manager/cms/generate/index.ftl

@@ -128,7 +128,7 @@
 			homeLoading:false,
 			articleLoading:false,
 			columnLoading:false,
-			template:'index.htm',//主题模板
+			template:'',//主题模板
 			templateOptions:[],
 			position:'index', //位置
 			contentSection:'0', //文章栏目
@@ -205,6 +205,12 @@
 				var that = this;
 				ms.http.get(ms.manager+'/template/queryTemplateFileForColumn.do', {pageSize:99999}).then(function (data) {
 					that.templateOptions = data.data;
+					//寻找主页
+					var template = that.templateOptions.find(function (x) {
+						return x.indexOf("index")!=-1||x.indexOf("default")!=-1;
+					})
+					//没有就找其他的
+					that.template = template||(that.templateOptions.length>0?that.templateOptions[0]:"");
 				}).catch(function (err) {
 					console.log(err);
 				});
@@ -702,4 +708,4 @@
 	.el-date-editor{
 		width: 100%;
 	}
-</style>
+</style>