diff --git a/src/main/java/net/mingsoft/cms/action/GeneraterAction.java b/src/main/java/net/mingsoft/cms/action/GeneraterAction.java index 492d2a2b..66d48f9e 100644 --- a/src/main/java/net/mingsoft/cms/action/GeneraterAction.java +++ b/src/main/java/net/mingsoft/cms/action/GeneraterAction.java @@ -114,13 +114,6 @@ public class GeneraterAction extends BaseAction { */ @RequestMapping("/index") public String index(HttpServletRequest request, ModelMap model) { - // 该站点ID有session提供 - int websiteId = BasicUtil.getAppId(); - Integer modelId = modelBiz.getEntityByModelCode(ModelCode.CMS_COLUMN).getModelId(); // 查询当前模块编号 - // 获取所有的内容管理栏目 - List list = columnBiz.queryAll(websiteId, modelId); - model.addAttribute("list", JSONArray.toJSONString(list)); - model.addAttribute("now", new Date()); return "/cms/generate/index"; } diff --git a/src/main/webapp/WEB-INF/manager/cms/generate/index.ftl b/src/main/webapp/WEB-INF/manager/cms/generate/index.ftl index 43189a24..0aa1d40e 100644 --- a/src/main/webapp/WEB-INF/manager/cms/generate/index.ftl +++ b/src/main/webapp/WEB-INF/manager/cms/generate/index.ftl @@ -21,7 +21,7 @@ 根据时间与栏目类型生成文章 - +
@@ -30,10 +30,10 @@ :style="{width: '100%'}" :filterable="false" :disabled="false" - :multiple="true" :clearable="true" + :clearable="true" placeholder="请选择主题模板"> - +
@@ -54,23 +54,19 @@
- 生成主页 - 预览主页 + 生成主页 + 预览主页
- - - +
@@ -98,28 +94,24 @@
- 生成文章 + 生成文章
- - - + +
- 生成栏目 + 生成栏目
@@ -135,18 +127,106 @@ }, data: { + loading:false, template:'',//主题模板 templateOptions:[], position:'', //位置 contentSection:'', //文章栏目 section:'', //栏目 - time:'', + time:ms.util.date.fmt(new Date(),"yyyy-MM-dd"), + treeList:[], }, methods: { + //更新主页 + updataIndex(){ + var that = this; + if(!that.position || that.position == ''){ + this.$notify({ title: '请输入主页位置!', type: 'warning' }); + return; + } + that.loading = true; + ms.http.get(ms.manager+'/cms/generate//generateIndex.do', {url:that.template,position:that.position}).then(function (data) { + if(data.result){ + that.$notify({ title: '更新成功!', type: 'success' }); + } + }).catch(function (err) { + that.$notify({ title: '更新失败!',message: err, type: 'error' }); + console.log(err); + }).finally(()=>{ + that.loading = false; + }); + }, + //预览主页 + viewIndex(){ + if(!this.position || this.position == ''){ + this.$notify({ title: '请输入主页位置!', type: 'warning' }); + return; + } + window.open(ms.manager+"/cms/generate/"+this.position+"/viewIndex.do"); + }, + //更新栏目 + updateColumn(){ + var that = this; + if(!that.section || that.section == ''){ + that.$notify({ title: '请选择栏目!', type: 'warning' }); + return; + } + that.loading = true; + ms.http.get(ms.manager+'/cms/generate/'+that.section+'/genernateColumn.do', {section:that.section}).then(function (data) { + if(data.result){ + that.$notify({ title: '更新成功!', type: 'success' }); + } + }).catch(function (err) { + that.$notify({ title: '更新失败!',message: err, type: 'error' }); + console.log(err); + }).finally(()=>{ + that.loading = false; + }); + }, + //生成文章栏目 + updateArticle(){ + var that = this; + if(!that.contentSection || that.contentSection == ''){ + that.$notify({ title: '请选择栏目!', type: 'warning' }); + return; + } + that.loading = true; + ms.http.get(ms.manager+'/cms/generate/'+that.contentSection+'/generateArticle.do', {contentSection:that.contentSection,data:that.time}).then(function (data) { + if(data.result){ + that.$notify({ title: '更新成功!', type: 'success' }); + } + }).catch(function (err) { + that.$notify({ title: '更新失败!',message: err, type: 'error' }); + console.log(err); + }).finally(()=>{ + that.loading = false; + }); + }, + //获取主题模板数据源 + templateOptionsGet() { + var that = this; + ms.http.get(ms.manager+'/template/queryTemplateFileForColumn.do', {pageSize:99999}).then(function (data) { + that.templateOptions = data; + }).catch(function (err) { + console.log(err); + }); + }, + getTree(){ + var that = this; + ms.http.get(ms.manager+"/cms/category/list.do",{pageSize:9999}).then(function(res){ + if(res.result){ + //res.data.rows.push({id:0,categoryId: null,categoryTitle:'顶级栏目管理'}); + that.treeList = ms.util.treeData(res.data.rows,'id','categoryId','children'); + } + }).catch(function(err){ + console.log(err); + }); + }, }, created(){ - + this.getTree(); + this.templateOptionsGet(); } })