Commit 0a2f344b authored by 信 赵's avatar 信 赵

Merge branch '5.0.1' of https://gitee.com/mingSoft/MCMS into 5.0.1

 Conflicts:
	pom.xml
	src/main/webapp/static/plugins/ms/1.0.0/compatible.js
parents ef542c34 db98d5aa
......@@ -24,9 +24,12 @@
</p>
<p align="center">
铭飞平台:<a href="https://ms.mingsoft.net">https://ms.mingsoft.net/</a> <br/>
演示:<a href="http://demo.cms.mingsoft.net/ms/login.do">http://demo.cms.mingsoft.net/ms/login.do</a><br/>
<a href="http://file.mingsoft.net/ms-runner-4.7.2.zip">一键运行版本</a>
<a href="https://ms.mingsoft.net" target="_blank">铭飞平台</a>
<a href="http://demo.cms.mingsoft.net/ms/login.do" target="_blank">在线演示</a>
<a href="http://doc.ms.mingsoft.net/plugs-cms/" target="_blank">在线使用手册</a>
<a href="https://mingsoft.ke.qq.com/?tuin=383187f3#tab=1&category=-1" target="_blank">腾讯课堂在线视频</a><br/>
<a href="https://ke.qq.com/course/478498" target="_blank">代码生成器视频教程</a><br/>
<a href="http://file.mingsoft.net/ms-runner-5.0.0.zip" target="_blank">Windows一键运行版本\Linux一键运行版本</a>
</p>
-------------------------------------------------------------------------------
......
......@@ -5,13 +5,13 @@
Source Server Type : MySQL
Source Server Version : 50725
Source Host : imingsoft.cn:3307
Source Schema : db-mcms-5.0
Source Schema : db-mcms-5.0-test
Target Server Type : MySQL
Target Server Version : 50725
File Encoding : 65001
Date: 10/01/2020 11:33:43
Date: 24/03/2020 20:46:19
*/
SET NAMES utf8mb4;
......@@ -66,7 +66,7 @@ CREATE TABLE `cms_category` (
`category_manager_id` int(11) NULL DEFAULT NULL COMMENT '发布用户id',
`category_datetime` datetime(0) NULL DEFAULT NULL COMMENT '类别发布时间',
`mdiy_model_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '栏目管理的内容模型id',
`category_diy_url` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '自定义链接',
`category_diy_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '自定义链接',
`category_url` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '内容模板',
`category_list_url` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '列表模板',
`category_sort` int(11) NULL DEFAULT NULL COMMENT '自定义顺序',
......@@ -281,6 +281,28 @@ INSERT INTO `cms_history_log` VALUES (3, '0', NULL, '127.0.0.1', '2', 0, NULL, N
INSERT INTO `cms_history_log` VALUES (4, '0', NULL, '127.0.0.1', '8', 0, NULL, NULL, NULL, NULL);
INSERT INTO `cms_history_log` VALUES (5, '0', NULL, '127.0.0.1', '7', 0, NULL, NULL, NULL, NULL);
-- ----------------------------
-- Table structure for file
-- ----------------------------
DROP TABLE IF EXISTS `file`;
CREATE TABLE `file` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '文件编号',
`category_id` int(11) NULL DEFAULT NULL COMMENT '文件分类编号',
`app_id` int(11) NULL DEFAULT NULL COMMENT 'APP编号',
`file_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件名称',
`file_url` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件链接',
`file_size` int(11) NULL DEFAULT NULL COMMENT '文件大小',
`file_json` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件详情Json数据',
`file_type` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件类型:图片、音频、视频等',
`is_child` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '子业务',
`update_date` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
`update_by` int(11) NULL DEFAULT NULL COMMENT '更新者',
`create_by` int(11) NULL DEFAULT NULL COMMENT '创建者',
`create_date` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`del` int(1) NULL DEFAULT NULL COMMENT '删除标记',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 67 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '基础文件表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for manager
-- ----------------------------
......@@ -477,7 +499,7 @@ CREATE TABLE `mdiy_tag_sql` (
INSERT INTO `mdiy_tag_sql` VALUES (5, 3, '<#assign _typeid=\"\"/>\r\n<#assign _size=\"20\"/>\r\n<#if column?? && column.id?? && column.id?number gt 0>\r\n <#assign _typeid=\"${column.id}\">\r\n</#if>\r\n<#if typeid??>\r\n <#assign _typeid=\"${typeid}\">\r\n</#if>\r\n<#if size??>\r\n <#assign _size=\"${size}\">\r\n</#if>\r\n<#if orderby?? >\r\n <#if orderby==\"date\"> \r\n <#assign _orderby=\"content_datetime\">\r\n <#elseif orderby==\"updatedate\">\r\n <#assign _orderby=\"content_updatetime\">\r\n <#elseif orderby==\"hit\"> \r\n <#assign _orderby=\"content_hit\">\r\n <#elseif orderby==\"sort\">\r\n <#assign _orderby=\"content_sort\">\r\n <#else><#assign _orderby=\"cms_content.id\"></#if>\r\n <#else>\r\n <#assign _orderby=\"cms_content.id\">\r\n </#if>\r\nSELECT\r\n cms_content.id AS id,\r\n @rownum := @rownum + 1 AS `index`,\r\n LEFT (content_title, ${titlelen ?default(40)}) AS title,\r\n content_title AS fulltitle,\r\n content_author AS author,\r\n content_source AS source,\r\n content_details AS content,\r\n category.category_title AS typename,\r\n category.category_id AS typeid,\r\n ( CASE category.category_img WHEN \'\' THEN category.category_img ELSE CONVERT ( JSON_UNQUOTE( JSON_EXTRACT( category.category_img -> \'$[0]\', \'$.path\' ) ) USING utf8 ) END ) AS typelitpic,\r\n <#--列表页动态链接-->\r\n <#if isDo?? && isDo>\r\n CONCAT(\"/${modelName}/list.do?typeid=\", category.category_id) as typelink,\r\n <#else>\r\n (SELECT \"index.html\") AS typelink,\r\n </#if>\r\n ( CASE content_img WHEN \'\' THEN content_img ELSE CONVERT ( JSON_UNQUOTE( JSON_EXTRACT( content_img -> \'$[0]\', \'$.path\' ) ) USING utf8 ) END ) AS litpic,\r\n <#--内容页动态链接-->\r\n <#if isDo?? && isDo>\r\n CONCAT(\"/${modelName}/view.do?id=\", cms_content.id,\"&orderby=${_orderby}\",\"&order=${order!\'ASC\'}\") as link,\r\n <#else>\r\n\r\n CONCAT(category.category_path,\"/\",cms_content.id,\".html\") AS link,\r\n </#if>\r\n content_datetime AS date,<#if tableName??>${tableName}.*,</#if>\r\n content_description AS descrip,\r\n content_hit AS hit,\r\n content_type AS flag,\r\n category_title AS typetitle,\r\n cms_content.content_keyword AS keyword \r\nFROM\r\n (SELECT @rownum := 0) r,\r\n cms_content\r\n LEFT JOIN cms_category as category ON content_category_id = category.id\r\n <#--判断是否有自定义模型表-->\r\n <#if tableName??>LEFT JOIN ${tableName} ON ${tableName}.link_id=cms_content.id </#if>\r\nWHERE \r\n content_display=0 \r\n <#--根据站点编号查询-->\r\n <#if appId?? >\r\n and cms_content.app_id=${appId}\r\n and cms_content.id>0\r\n </#if>\r\n <#--判断是否有搜索分类集合-->\r\n <#if search??>\r\n <#if search.categoryIds??>and FIND_IN_SET(category.id,\'${search.categoryIds}\')</#if>\r\n <#--标题-->\r\n <#if search.content_title??> and content_title like CONCAT(\"%\",\'${search.content_title}\',\"%\")</#if>\r\n <#--作者-->\r\n <#if search.content_author??> and content_author like CONCAT(\"%\",\'${search.content_author}\',\"%\")</#if>\r\n <#--来源-->\r\n <#if search.content_source??> and content_source like CONCAT(\"%\",\'${search.content_source}\',\"%\")</#if>\r\n <#--属性-->\r\n <#if search.content_type??> and content_type like CONCAT(\"%\",\'${search.content_type}\',\"%\")</#if>\r\n <#--描述-->\r\n <#if search.content_description??> and content_description like CONCAT(\"%\",\'${search.content_description}\',\"%\")</#if>\r\n <#--关键字-->\r\n <#if search.content_keyword??> and content_keyword like CONCAT(\"%\",\'${search.content_keyword}\',\"%\")</#if>\r\n <#--内容-->\r\n <#if search.content_details??> and content_details like CONCAT(\"%\",\'${search.content_details}\',\"%\")</#if>\r\n <#--自定义顺序-->\r\n <#if search.content_sort??> and content_sort=${search.content_sort}</#if>\r\n <#else><#--查询栏目-->\r\n <#if _typeid?has_content> and (content_category_id=${_typeid} or content_category_id in \r\n (select id FROM cms_category where cms_category.del=0 and find_in_set(${_typeid},CATEGORY_PARENT_ID))) </#if>\r\n </#if>\r\n <#--标题-->\r\n <#if content_title??> and content_title like CONCAT(\"%\",\'${content_title}\',\"%\")</#if>\r\n <#--作者-->\r\n <#if content_author??> and content_author like CONCAT(\"%\",\'${content_author}\',\"%\")</#if>\r\n <#--来源-->\r\n <#if content_source??> and content_source like CONCAT(\"%\",\'${content_source}\',\"%\")</#if>\r\n <#--属性-->\r\n <#if content_type??> and content_type like CONCAT(\"%\",\'${content_type}\',\"%\")</#if>\r\n <#--描述-->\r\n <#if content_description??> and content_description like CONCAT(\"%\",\'${content_description}\',\"%\")</#if>\r\n <#--关键字-->\r\n <#if content_keyword??> and content_keyword like CONCAT(\"%\",\'${content_keyword}\',\"%\")</#if>\r\n <#--内容-->\r\n <#if content_details??> and content_details like CONCAT(\"%\",\'${content_details}\',\"%\")</#if>\r\n <#--自定义顺序-->\r\n <#if content_sort??> and content_sort=${content_sort}</#if>\r\n <#--自定义模型-->\r\n <#if diyModel??> \r\n <#list diyModel as dm>\r\n and ${tableName}.${dm.key} like CONCAT(\"%\",\'${dm.value}\',\"%\") \r\n </#list>\r\n </#if>\r\n <#--文章属性-->\r\n <#if flag?? >\r\n and cms_content.content_type like CONCAT(\'%\',\'${flag}\',\'%\') \r\n </#if>\r\n <#if noflag?? >\r\n and cms_content.content_type not like CONCAT(\'%\',\'${noflag}\',\'%\') \r\n </#if>\r\n <#--字段排序-->\r\n <#if orderby?? >\r\n ORDER BY \r\n <#if orderby==\"date\"> content_datetime\r\n <#elseif orderby==\"updatedate\"> content_updatetime\r\n <#elseif orderby==\"hit\"> content_hit\r\n <#elseif orderby==\"sort\"> content_sort\r\n <#else>cms_content.id</#if>\r\n <#else>\r\n ORDER BY cms_content.id\r\n </#if>\r\n <#if order?? >\r\n <#if order==\"desc\"> desc</#if>\r\n <#if order==\"asc\"> asc</#if>\r\n </#if>\r\n LIMIT \r\n <#--判断是否分页-->\r\n <#if ispaging?? && (pageTag.pageNo)??>${((pageTag.pageNo-1)*_size?eval)?c},${_size?default(20)}\r\n <#else>${_size?default(20)}</#if>', 1);
INSERT INTO `mdiy_tag_sql` VALUES (6, 4, '<#assign _typeid=\"\"/>\r\n<#if column?? && column.id?? && column.id?number gt 0>\r\n <#assign _typeid=\"${column.id}\">\r\n <#assign selfid=\"${column.id}\">\r\n</#if>\r\n<#if typeid??>\r\n <#assign _typeid=\"${typeid}\">\r\n</#if>\r\nselect \r\n @rownum := @rownum + 1 AS typeindex,\r\n id,\r\n id as typeid,\r\n category_title as typetitle,\r\n <#--返回父id集合-->\r\n category_parent_id as pids,\r\n <#--栏目选中的样式-->\r\n IF(<#if selfid?has_content>${selfid}<#else>${_typeid}</#if> = id ,\"${class!\'\'}\",\"\") as class,\r\n <#--动态链接-->\r\n <#if isDo?? && isDo>\r\n CONCAT(\"/${modelName}/list.do?typeid=\", id) as typelink,\r\n <#else>\r\n CONCAT(category_path,\"/index.html\") as typelink,\r\n </#if>\r\n category_keyword as typekeyword,\r\n category_diy_url as typeurl,\r\n category_flag as flag,\r\n category_descrip as typedescrip,\r\n ( CASE category_img WHEN \'\' THEN category_img ELSE CONVERT ( JSON_UNQUOTE( JSON_EXTRACT( category_img -> \'$[0]\', \'$.path\' ) ) USING utf8 ) END ) as typelitpic ,\r\n(select count(*) from cms_category c where c.category_id=typeid and c.del=0) as childsize\r\n from (SELECT @rownum := 0) r,cms_category \r\n where \r\n cms_category.del=0 \r\n <#--根据站点编号查询-->\r\n <#if appId?? >\r\n and cms_category.app_id=${appId}\r\n </#if>\r\n <#--栏目属性-->\r\n <#if flag?? >\r\n and category_flag like CONCAT(\'%\',\'${flag}\',\'%\') \r\n </#if>\r\n <#if noflag?? >\r\n and category_flag not like CONCAT(\'%\',\'${noflag}\',\'%\') \r\n </#if>\r\n<#if type?has_content>\r\n <#--顶级栏目(单个)-->\r\n <#if type==\"top\">\r\n and id=(select left(category_parent_id,LOCATE(\",\",category_parent_id)-1) from cms_category where category_id = ${_typeid})\r\n <#elseif type==\"nav\">\r\n and(category_id=0 or category_id is null)\r\n <#--同级栏目(多个)-->\r\n <#elseif type==\"level\">\r\n and\r\n <#if _typeid?has_content>\r\n category_id=(select category_id from cms_category where id=${_typeid})\r\n <#else>\r\n 1=1\r\n </#if>\r\n <#--当前栏目(单个)-->\r\n <#elseif type==\"self\">\r\n and \r\n <#if _typeid?has_content>\r\n id=${_typeid}\r\n <#else>\r\n 1=1\r\n </#if>\r\n <#--当前栏目的所属栏目(多个)-->\r\n <#elseif type==\"path\">\r\n and \r\n <#if _typeid?has_content>\r\n id in (<#if column?? && column.categoryParentId??>${column.categoryParentId},</#if>${_typeid})\r\n <#else>\r\n 1=1\r\n </#if>\r\n <#--子栏目(多个)-->\r\n <#elseif type==\"son\">\r\n and \r\n <#if _typeid?has_content>\r\n category_id=${_typeid}\r\n <#else>\r\n 1=1\r\n </#if>\r\n <#--上一级栏目没有则取当前栏目(单个)-->\r\n <#elseif type==\"parent\">\r\n and \r\n <#if _typeid?has_content>\r\n <#if column?? && column.categoryId??>\r\n id=${column.categoryId}\r\n <#else>\r\n id=${_typeid}\r\n </#if>\r\n <#else>\r\n 1=1\r\n </#if>\r\n <#--子栏目或同级栏目(多个)-->\r\n <#elseif type==\"sonOrLevel\">\r\n and \r\n <#if _typeid?has_content>\r\n category_id= if((SELECT count(*) FROM cms_category\r\n WHERE id=${_typeid})>0,${_typeid},(select id from cms_category where id=${_typeid}))\r\n <#else>\r\n 1=1\r\n </#if>\r\n </#if>\r\n<#else> <#--默认son-->\r\n and\r\n <#if _typeid?has_content>\r\n category_id=${_typeid}\r\n <#else>\r\n (category_id=0 or category_id is null)\r\n </#if>\r\n</#if>\r\n<#--字段排序-->\r\n <#if orderby?? >\r\n ORDER BY \r\n <#if orderby==\"date\"> category_datetime\r\n <#elseif orderby==\"sort\"> category_sort\r\n <#else>cms_content.id</#if>\r\n <#else>\r\n ORDER BY id\r\n </#if>\r\n <#if order?? >\r\n <#if order==\"desc\"> desc</#if>\r\n <#if order==\"asc\"> asc</#if>\r\n </#if>', 1);
INSERT INTO `mdiy_tag_sql` VALUES (7, 5, 'select \r\nAPP_NAME as name,\r\napp_logo as logo,\r\napp_keyword as keyword,\r\napp_description as descrip,\r\napp_copyright as copyright,\r\n<#--动态解析 -->\r\n<#if isDo?? && isDo>\r\n\"${url}\" as url,\r\n\"${url}\" as host,\r\n<#--使用地址栏的域名 -->\r\n<#elseif url??>\r\nCONCAT(\"${url}\",\"/${html}/\",app_id,\"/<#if m??>${m}</#if>\") as url,\r\n\"${url}\" as host,\r\n<#else>\r\nCONCAT(REPLACE(REPLACE(TRIM(substring_index(app_url,\"\\n\",1)), CHAR(10),\'\'), CHAR(13),\'\'),\"/html/\",app_id,\"/<#if m??>${m}</#if>\") as url,\r\nREPLACE(REPLACE(TRIM(substring_index(app_url,\"\\n\",1)), CHAR(10),\'\'), CHAR(13),\'\') as host,\r\n</#if>\r\nCONCAT(\"templets/\",app_id,\"/\",<#if m??>CONCAT(app_style,\"/${m}\")<#else>app_style</#if>) as style <#-- 判断是否为手机端 -->\r\nfrom app where app_id = ${appId} limit 1', 1);
INSERT INTO `mdiy_tag_sql` VALUES (8, 7, 'SELECT \r\ncms_content.id as id,\r\nleft(content_title,${titlelen?default(40)}) as title,\r\ncontent_title as fulltitle,\r\ncontent_author as author, \r\ncontent_source as source, \r\ncontent_details as content,\r\ncategory_title as typetitle,\r\ncms_category.id as typeid,\r\ncategory_img AS typelitpic,\r\n<#--动态链接-->\r\n<#if isDo?? && isDo>\r\nCONCAT(\"/${modelName}/list.do?typeid=\", category.id) as typelink,\r\n<#else>\r\n(SELECT \"index.html\") as typelink,\r\n</#if>\r\ncontent_img as litpic,\r\n<#--内容页动态链接-->\r\n<#if isDo?? && isDo>\r\nCONCAT(\"/mcms/view.do?id=\", cms_content.id) as link,\r\n<#else>\r\ncontent_url AS link,\r\n</#if>\r\ncontent_datetime as date,\r\ncontent_description as descrip,\r\nCONCAT(\"<script type=\'text/javascript\' src=\'${url}/basic/\",cms_content.id,\"/hit.do\'></script>\") as hit,\r\ncontent_type as flag,\r\ncategory_title as typetitle,\r\n<#if tableName??>${tableName}.*,</#if>\r\ncontent_keyword as keyword\r\nFROM cms_content\r\nLEFT JOIN cms_category ON content_category_id=cms_category.id \r\n<#--判断是否有自定义模型表-->\r\n<#if tableName??>left join ${tableName} on ${tableName}.link_id=cms_content.id</#if>\r\nWHERE \r\n1=1\r\n<#if id??> and cms_content.id=${id}</#if>', 1);
INSERT INTO `mdiy_tag_sql` VALUES (8, 7, 'SELECT \r\ncms_content.id as id,\r\nleft(content_title,${titlelen?default(40)}) as title,\r\ncontent_title as fulltitle,\r\ncontent_author as author, \r\ncontent_source as source, \r\ncontent_details as content,\r\ncategory_title as typetitle,\r\ncms_category.id as typeid,\r\n ( CASE cms_category.category_img WHEN \'\' THEN cms_category.category_img ELSE CONVERT ( JSON_UNQUOTE( JSON_EXTRACT( cms_category.category_img -> \'$[0]\', \'$.path\' ) ) USING utf8 ) END ) AS typelitpic,\r\n<#--动态链接-->\r\n<#if isDo?? && isDo>\r\nCONCAT(\"/${modelName}/list.do?typeid=\", category.id) as typelink,\r\n<#else>\r\n(SELECT \"index.html\") as typelink,\r\n</#if>\r\n( CASE cms_content.content_img WHEN \'\' THEN cms_content.content_img ELSE CONVERT ( JSON_UNQUOTE( JSON_EXTRACT( cms_content.content_img -> \'$[0]\', \'$.path\' ) ) USING utf8 ) END ) AS litpic,\r\n<#--内容页动态链接-->\r\n<#if isDo?? && isDo>\r\nCONCAT(\"/mcms/view.do?id=\", cms_content.id) as link,\r\n<#else>\r\ncontent_url AS link,\r\n</#if>\r\ncontent_datetime as date,\r\ncontent_description as descrip,\r\nCONCAT(\"<script type=\'text/javascript\' src=\'${url}/basic/\",cms_content.id,\"/hit.do\'></script>\") as hit,\r\ncontent_type as flag,\r\ncategory_title as typetitle,\r\n<#if tableName??>${tableName}.*,</#if>\r\ncontent_keyword as keyword\r\nFROM cms_content\r\nLEFT JOIN cms_category ON content_category_id=cms_category.id \r\n<#--判断是否有自定义模型表-->\r\n<#if tableName??>left join ${tableName} on ${tableName}.link_id=cms_content.id</#if>\r\nWHERE \r\n1=1\r\n<#if id??> and cms_content.id=${id}</#if>', 1);
INSERT INTO `mdiy_tag_sql` VALUES (9, 8, '<#assign select=\"(SELECT \'\')\"/>\r\n<#if orderby?? >\r\n <#if orderby==\"date\"> \r\n <#assign _orderby=\"content_datetime\">\r\n <#elseif orderby==\"updatedate\">\r\n <#assign _orderby=\"content_updatetime\">\r\n <#elseif orderby==\"hit\"> \r\n <#assign _orderby=\"content_hit\">\r\n <#elseif orderby==\"sort\">\r\n <#assign _orderby=\"content_sort\">\r\n <#else><#assign _orderby=\"cms_content.id\"></#if>\r\n <#else>\r\n <#assign _orderby=\"cms_content.id\">\r\n </#if>\r\n<#if (pageTag.preId) gt 0>\r\nSELECT \r\ncms_content.id as id,\r\nleft(content_title,${titlelen?default(40)}) as title,\r\ncontent_title as fulltitle,\r\ncontent_author as author, \r\ncontent_source as source, \r\ncontent_details as content,\r\ncategory.category_title as typename,\r\ncategory.category_id as typeid,\r\n(SELECT \"index.html\") as typelink,\r\ncontent_img as litpic,\r\n<#--内容页动态链接-->\r\n <#if isDo?? && isDo>\r\n CONCAT(\"/${modelName}/view.do?id=\", cms_content.id,\"&orderby=${_orderby}\",\"&order=${order!\'ASC\'}\") as link,\r\n <#else>\r\n CONCAT(category_path,\"/\",cms_content.id,\".html\") AS link,\r\n </#if>\r\ncontent_datetime as date,\r\ncontent_description as descrip,\r\ncontent_hit as hit,\r\ncontent_type as flag,\r\ncontent_keyword as keyword \r\nFROM cms_content \r\nLEFT JOIN cms_category as category ON content_category_id=category.id \r\nWHERE cms_content.id=${pageTag.preId}\r\n<#else>\r\nSELECT \r\n${select} as id,\r\n${select} as title,\r\n${select} as fulltitle,\r\n${select} as author, \r\n${select} as source, \r\n${select} as content,\r\n${select} as typename,\r\n${select} as typeid,\r\n${select} as typelink,\r\n${select} as litpic,\r\n${select} as link,\r\n${select} as date,\r\n${select} as descrip,\r\n${select} as hit,\r\n${select} as flag,\r\n${select} as keyword FROM cms_content\r\n</#if>', NULL);
INSERT INTO `mdiy_tag_sql` VALUES (10, 9, ' select\r\n <#if !(pageTag.indexUrl??)>\r\n <#--判断是否有栏目对象,用于搜索不传栏目-->\r\n <#if column??>\r\n <#assign path=column.categoryPath/>\r\n <#else>\r\n <#assign path=\"\"/>\r\n </#if>\r\n <#--总记录数、总页数-->\r\n (SELECT ${pageTag.total}) as total,\r\n <#--记录总数-->\r\n (SELECT ${pageTag.size}) as rcount,\r\n <#--当前页码-->\r\n (SELECT ${pageTag.pageNo}) as cur,\r\n <#--首页-->\r\n CONCAT(\"${path}\", \"/index.html\") as `index`,\r\n <#--上一页-->\r\n <#if (pageTag.pageNo?eval-1) gt 1>\r\n CONCAT(\"${path}\",\"/list-${pageTag.pageNo?eval-1}.html\") as pre,\r\n <#else>\r\n CONCAT(\"${path}\",\"/index.html\") as pre,\r\n </#if>\r\n <#--下一页-->\r\n <#if pageTag.total==1>\r\n CONCAT(\"${path}\", \"/index.html\") as `next`,\r\n CONCAT(\"${path}\", \"/index.html\") as `last`\r\n <#else>\r\n <#if pageTag.pageNo?eval gte pageTag.total>\r\n CONCAT(\"${path}\",\"/list-${pageTag.total}.html\") as next,\r\n <#else>\r\n CONCAT(\"${path}\",\"/list-${pageTag.pageNo?eval+1}.html\") as next,\r\n </#if>\r\n <#--最后一页-->\r\n CONCAT(\"${path}\",\"/list-${pageTag.total}.html\") as last\r\n </#if>\r\n<#else><#--判断是否是搜索页面-->\r\n \"${pageTag.indexUrl}\" as `index`,\"${pageTag.lastUrl}\" as `last`,\"${pageTag.preUrl}\" as `pre`,\"${pageTag.nextUrl}\" as `next`,\'${pageTag.total}\' as total,\'${pageTag.size}\' as rcount,\'${pageTag.pageNo}\' as cur\r\n</#if>', NULL);
INSERT INTO `mdiy_tag_sql` VALUES (11, 10, '<#assign select=\"(SELECT \'\')\"/>\r\n<#if orderby?? >\r\n <#if orderby==\"date\"> \r\n <#assign _orderby=\"content_datetime\">\r\n <#elseif orderby==\"updatedate\">\r\n <#assign _orderby=\"content_updatetime\">\r\n <#elseif orderby==\"hit\"> \r\n <#assign _orderby=\"content_hit\">\r\n <#elseif orderby==\"sort\">\r\n <#assign _orderby=\"content_sort\">\r\n <#else><#assign _orderby=\"cms_content.id\"></#if>\r\n <#else>\r\n <#assign _orderby=\"cms_content.id\">\r\n </#if>\r\n<#if (pageTag.nextId) gt 0>\r\nSELECT \r\ncms_content.id as id,\r\nleft(content_title,${titlelen?default(40)}) as title,\r\ncontent_title as fulltitle,\r\ncontent_author as author, \r\ncontent_source as source, \r\ncontent_details as content,\r\ncategory.category_title as typename,\r\ncategory.category_id as typeid,\r\n(SELECT \"index.html\") as typelink,\r\ncontent_img as litpic,\r\n<#--内容页动态链接-->\r\n <#if isDo?? && isDo>\r\n CONCAT(\"/${modelName}/view.do?id=\", cms_content.id,\"&orderby=${_orderby}\",\"&order=${order!\'ASC\'}\") as link,\r\n <#else>\r\n CONCAT(category_path,\"/\",cms_content.id,\".html\") AS link,\r\n </#if>\r\ncontent_datetime as date,\r\ncontent_description as descrip,\r\ncontent_hit as hit,\r\ncontent_type as flag,\r\ncontent_keyword as keyword \r\nFROM cms_content \r\nLEFT JOIN cms_category as category ON content_category_id=category.id \r\nWHERE cms_content.id=${pageTag.nextId}\r\n<#else>\r\nSELECT \r\n${select} as id,\r\n${select} as title,\r\n${select} as fulltitle,\r\n${select} as author, \r\n${select} as source, \r\n${select} as content,\r\n${select} as typename,\r\n${select} as typeid,\r\n${select} as typelink,\r\n${select} as litpic,\r\n${select} as link,\r\n${select} as date,\r\n${select} as descrip,\r\n${select} as hit,\r\n${select} as flag,\r\n${select} as keyword FROM cms_content\r\n</#if>', NULL);
......@@ -535,7 +557,7 @@ INSERT INTO `model` VALUES (265, '自定义页面', '20010000', 264, 'mdiy/page/
INSERT INTO `model` VALUES (266, '修改', '20010004', 269, 'mdiy:form:update', '2018-09-06 09:38:51', NULL, 0, 0, 0, '264,269', NULL);
INSERT INTO `model` VALUES (267, '新增', '20010002', 269, 'mdiy:form:save', '2018-09-06 09:38:51', NULL, 0, 0, 0, '264,269', NULL);
INSERT INTO `model` VALUES (268, '查看', '20010001', 269, 'mdiy:form:view', '2018-09-06 09:38:51', NULL, 0, 0, 0, '264,269', NULL);
INSERT INTO `model` VALUES (269, '自定义表单', '20020000', 264, 'mdiy/form/index.do', '2018-09-06 09:38:51', NULL, 0, 0, 1, '264', NULL);
INSERT INTO `model` VALUES (269, '自定义表单', '20020000', 264, 'mdiy/post/index.do', '2018-09-06 09:38:51', NULL, 0, 0, 1, '264', NULL);
INSERT INTO `model` VALUES (280, '自定义字典', '20050000', 264, 'mdiy/dict/index.do', '2018-09-06 09:38:53', NULL, 0, 0, 1, '264', NULL);
INSERT INTO `model` VALUES (281, '删除', '20050003', 280, 'mdiy:dict:del', '2018-09-06 09:38:53', NULL, 0, 0, 0, '264,280', NULL);
INSERT INTO `model` VALUES (282, '修改', '20050004', 280, 'mdiy:dict:update', '2018-09-06 09:38:53', NULL, 0, 0, 0, '264,280', NULL);
......
......@@ -99,6 +99,7 @@ public class CategoryAction extends BaseAction{
BaseEntity categoryEntity = categoryBiz.getEntity(Integer.parseInt(category.getId()));
model.addAttribute("categoryEntity",categoryEntity);
}
model.addAttribute("appId",BasicUtil.getAppId());
return "/cms/category/form";
}
......
......@@ -102,6 +102,7 @@ public class ContentAction extends BaseAction{
BaseEntity contentEntity = contentBiz.getEntity(Integer.parseInt(content.getId()));
model.addAttribute("contentEntity",contentEntity);
}
model.addAttribute("appId",BasicUtil.getAppId());
return "/cms/content/form";
}
......
......@@ -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;
......
......@@ -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
......@@ -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
package net.mingsoft.config;
import java.util.LinkedHashMap;
import java.util.Map;
import net.mingsoft.basic.security.BaseAuthRealm;
import org.apache.shiro.mgt.SecurityManager;
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
......@@ -11,9 +9,9 @@ import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreato
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import net.mingsoft.basic.security.BaseAuthRealm;
import java.util.LinkedHashMap;
import java.util.Map;
@Configuration
public class ShiroConfig {
......@@ -21,6 +19,29 @@ public class ShiroConfig {
@Value("${ms.manager.path}")
private String managerPath;
/**
* 开启Shiro的注解(如@RequiresRoles , @RequiresPermissions),需借助SspringAOP扫描使用Sshiro注解的类,并在必要时进行安全逻辑验证
* 配置以下两个bean(Defaul tAdvisorAutoProxyCreator和uthorizat ionAttributeSourceAdvisor)即可实现此功能
*/
@Bean
public DefaultAdvisorAutoProxyCreator advisorAutoProxyCreator(){
DefaultAdvisorAutoProxyCreator advisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
advisorAutoProxyCreator.setProxyTargetClass(true);
return advisorAutoProxyCreator;
}
/**
* 开启shiro aop注解支持
* 使用代理方式;所以需要开启代码支持
* @param securityManager
*/
@Bean
public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(SecurityManager securityManager){
AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor = new AuthorizationAttributeSourceAdvisor();
authorizationAttributeSourceAdvisor.setSecurityManager(securityManager);
return authorizationAttributeSourceAdvisor;
}
@Bean
public AuthorizationAttributeSourceAdvisor getAuthorizationAttributeSourceAdvisor(
DefaultWebSecurityManager securityManager) {
......
......@@ -200,7 +200,7 @@
:limit="1"
:on-exceed="categoryImghandleExceed"
:disabled="false"
:data="{uploadPath:'/cms/category','isRename':true,'appId':true}"
:data="{uploadPath:'/${appId}/cms/category','isRename':true}"
:on-success="categoryImgSuccess"
accept="image/*"
list-type="picture-card">
......@@ -232,12 +232,12 @@
<script>
var form = new Vue({
el: '#form',
data() {
data: function () {
return {
treeList: [{
id: '0',
categoryTitle: '顶级栏目',
children: [],
children: []
}],
categoryList: [],
saveDisabled: false,
......@@ -269,7 +269,13 @@
//栏目字典
categoryFlag: []
},
categoryTypeOptions: [{"value": "1", "label": "列表"}, {"value": "2", "label": "封面"}],
categoryTypeOptions: [{
"value": "1",
"label": "列表"
}, {
"value": "2",
"label": "封面"
}],
categoryListUrlOptions: [],
categoryUrlOptions: [],
mdiyModelIdOptions: [],
......@@ -279,16 +285,26 @@
categoryTitle: [{
"required": true,
"message": "请选择栏目管理名称"
}, {"pattern": /^[^[!@#$%^&*()_+-/~?!@#¥%…&*()——+—?》《:“‘’]+$/, "message": "栏目管理名称格式不匹配"}],
categoryListUrl: [{"required":true,"message":"请选择列表模板"}],
}, {
"pattern": /^[^[!@#$%^&*()_+-/~?!@#¥%…&*()——+—?》《:“‘’]+$/,
"message": "栏目管理名称格式不匹配"
}],
categoryListUrl: [{
"required": true,
"message": "请选择列表模板"
}],
// 内容模板
categoryUrl: [{"required":true,"message":"请选择内容模板"}],
},
categoryUrl: [{
"required": true,
"message": "请选择内容模板"
}]
}
};
},
watch: {
'form.categoryId': function (n, o) {
var _this = this;
if (n == this.form.id) {
this.$notify({
title: '提示',
......@@ -297,12 +313,15 @@
});
return;
}
this.categoryList.forEach(item => {
if (item.categoryParentId != null && item.categoryParentId != "" && item.categoryParentId.indexOf(this.form.id) != -1) {
this.categoryList.forEach(function (item) {
if (item.categoryParentId != null && item.categoryParentId != "" && item.categoryParentId.indexOf(_this.form.id) != -1) {
if (item.id == n) {
this.form.categoryId = null;
this.$refs.tree.clearHandle();
this.$notify({
_this.form.categoryId = null;
_this.$refs.tree.clearHandle();
_this.$notify({
title: '提示',
message: '不能选择子分类',
type: 'warning'
......@@ -314,9 +333,11 @@
},
computed: {},
methods: {
getTree() {
getTree: function () {
var that = this;
ms.http.get(ms.manager + "/cms/category/list.do", {pageSize: 9999}).then(function (res) {
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.categoryList = res.data.rows;
......@@ -326,21 +347,24 @@
console.log(err);
});
},
save() {
save: function () {
var that = this;
var url = ms.manager + "/cms/category/save.do"
var url = ms.manager + "/cms/category/save.do";
if (that.form.id > 0) {
url = ms.manager + "/cms/category/update.do";
}
this.$refs.form.validate((valid) => {
if (valid) {
this.$refs.form.validate(function (valid) {
if (valid) {
//栏目属性为封面则不需要列表模板
if (that.form.categoryType == '2') {
that.form.categoryListUrl = '';
}
that.saveDisabled = true;
var data = JSON.parse(JSON.stringify(that.form));
if (data.id && data.id == data.categoryId) {
that.$notify({
title: '提示',
......@@ -348,12 +372,14 @@
type: 'error'
});
that.saveDisabled = false;
return
return;
}
if (data.categoryId == '0') {
data.categoryId = '';
}
if(data.categoryFlag){
if (data.categoryFlag) {
data.categoryFlag = data.categoryFlag.join(',');
}
......@@ -373,44 +399,51 @@
type: 'warning'
});
}
that.saveDisabled = false;
});
} else {
return false;
}
})
});
},
//获取分类内容模型
getColumnContentModelId: function () {
var that = this;
ms.http.get(ms.manager + "/mdiy/model/list.do", {modelType: 'zdymx_wz'}).then(
function (data) {
ms.http.get(ms.manager + "/mdiy/model/list.do", {
modelType: 'zdymx_wz'
}).then(function (data) {
that.mdiyModelIdOptions = data.data.rows;
}).catch(function (err) {
console.log(err);
});
},
//获取当前分类
get(id) {
get: function (id) {
var that = this;
ms.http.get(ms.manager + "/cms/category/get.do", {"id": id}).then(function (res) {
ms.http.get(ms.manager + "/cms/category/get.do", {
"id": id
}).then(function (res) {
if (res.result && res.data) {
if(res.data.categoryFlag){
if (res.data.categoryFlag) {
res.data.categoryFlag = res.data.categoryFlag.split(',');
}
if (res.data.categoryImg) {
res.data.categoryImg = JSON.parse(res.data.categoryImg);
res.data.categoryImg.forEach(function (value) {
value.url = ms.base + value.path
})
value.url = ms.base + value.path;
});
} else {
res.data.categoryImg = []
res.data.categoryImg = [];
}
if (!res.data.categoryId) {
res.data.categoryId = '0';
}
that.form = res.data;
//判断该分类是否存在文章,存在则不能修改栏目属性
that.form = res.data; //判断该分类是否存在文章,存在则不能修改栏目属性
that.contentList(that.form.id);
}
}).catch(function (err) {
......@@ -420,7 +453,7 @@
contentList: function (id) {
var that = this;
ms.http.post(ms.manager + "/cms/content/list.do", {
contentCategoryId: id,
contentCategoryId: id
}).then(function (data) {
if (data.data.total > 0) {
that.categoryTypeDisabled = true;
......@@ -432,7 +465,7 @@
});
},
//获取categoryListUrl数据源
categoryListUrlOptionsGet() {
categoryListUrlOptionsGet: function () {
var that = this;
ms.http.get(ms.manager + "/template/queryTemplateFileForColumn.do", {}).then(function (data) {
that.categoryListUrlOptions = data.data;
......@@ -441,7 +474,7 @@
});
},
//获取categoryUrl数据源
categoryUrlOptionsGet() {
categoryUrlOptionsGet: function () {
var that = this;
ms.http.get(ms.manager + "/template/queryTemplateFileForColumn.do", {}).then(function (data) {
that.categoryUrlOptions = data.data;
......@@ -449,51 +482,53 @@
console.log(err);
});
},
//categoryImg文件上传完成回调
categoryImgSuccess: function (response, file, fileList) {
this.form.categoryImg.push({url: file.url, name: file.name, path: response, uid: file.uid});
},
categoryImghandleRemove: function (file, files) {
var index = -1;
index = this.form.categoryImg.findIndex(text => text == file);
if (index != -1) {
this.form.categoryImg.splice(index, 1);
}
},
//获取categoryFlag数据源
categoryFlagOptionsGet() {
categoryFlagOptionsGet: function () {
var that = this;
ms.http.get(ms.base+'/mdiy/dict/list.do', {dictType:'栏目属性',pageSize:99999}).then(function (res) {
ms.http.get(ms.base + '/mdiy/dict/list.do', {
dictType: '栏目属性',
pageSize: 99999
}).then(function (res) {
that.categoryFlagOptions = res.rows;
}).catch(function (err) {
console.log(err);
});
},
//categoryImg文件上传完成回调
categoryImgSuccess: function (response, file, fileList) {
this.form.categoryImg.push({url: file.url, name: file.name, path: response, uid: file.uid});
this.form.categoryImg.push({
url: file.url,
name: file.name,
path: response,
uid: file.uid
});
},
//上传超过限制
categoryImghandleExceed: function (files, fileList) {
this.$notify({title: '当前最多上传1个文件', type: 'warning'});
this.$notify({
title: '当前最多上传1个文件',
type: 'warning'
});
},
categoryImghandleRemove: function (file, files) {
var index = -1;
index = this.form.categoryImg.findIndex(text => text == file);
index = this.form.categoryImg.findIndex(function (text) {
return text == file;
});
if (index != -1) {
this.form.categoryImg.splice(index, 1);
}
}
},
},
created() {
created: function () {
this.getColumnContentModelId();
this.getTree()
this.getTree();
this.categoryListUrlOptionsGet();
this.categoryUrlOptionsGet();
this.categoryFlagOptionsGet();
this.form.id = ms.util.getParameter("id");
if (this.form.id) {
this.get(this.form.id);
} else {
......
......@@ -78,76 +78,88 @@
</html>
<script>
var indexVue = new Vue({
"use strict";
var indexVue = new Vue({
el: '#index',
data:{
dataList: [], //分类列表
selectionList:[],//分类列表选中
loading: true,//加载状态
emptyText:'',//提示文字
data: {
dataList: [],
//分类列表
selectionList: [],
//分类列表选中
loading: true,
//加载状态
emptyText: '',
//提示文字
manager: ms.manager,
loadState:false,
categoryTypeOptions:[{"value":"1","label":"列表"},{"value":"2","label":"封面"}],
loadState: false,
categoryTypeOptions: [{
"value": "1",
"label": "列表"
}, {
"value": "2",
"label": "封面"
}],
//搜索表单
form:{
form: {
// 栏目管理名称
categoryTitle:'',
categoryTitle: '',
// 所属栏目
categoryId:'',
categoryId: '',
// 栏目管理属性
categoryType:'2',
categoryType: '2',
// 自定义顺序
categorySort:0,
categorySort: 0,
// 列表模板
categoryListUrl:'',
categoryListUrl: '',
// 内容模板
categoryUrl:'',
categoryUrl: '',
// 栏目管理关键字
categoryKeyword:'',
categoryKeyword: '',
// 栏目管理描述
categoryDescrip:'',
categoryDescrip: '',
// 缩略图
categoryImg: [],
// 自定义链接
categoryDiyUrl:'',
categoryDiyUrl: '',
// 栏目管理的内容模型id
mdiyModelId:'',
},
mdiyModelId: ''
}
},
methods:{
methods: {
//查询列表
list: function() {
list: function () {
var that = this;
this.loadState = false;
this.loading = true;
ms.http.get(ms.manager+"/cms/category/list.do",{
pageSize:999,
}).then(
function(res) {
if(that.loadState){
ms.http.get(ms.manager + "/cms/category/list.do", {
pageSize: 999
}).then(function (res) {
if (that.loadState) {
that.loading = false;
}else {
that.loadState = true
} else {
that.loadState = true;
}
if (!res.result||res.data.total <= 0) {
that.emptyText = '暂无数据'
if (!res.result || res.data.total <= 0) {
that.emptyText = '暂无数据';
that.dataList = [];
} else {
that.emptyText = '';
that.dataList = ms.util.treeData(res.data.rows,'id','categoryId','children');
that.dataList = ms.util.treeData(res.data.rows, 'id', 'categoryId', 'children');
}
}).catch(function(err) {
}).catch(function (err) {
console.log(err);
});
setTimeout(()=>{
if(that.loadState){
setTimeout(function () {
if (that.loadState) {
that.loading = false;
}else {
that.loadState = true
} else {
that.loadState = true;
}
}, 500);
},
copyUrl: function(){
copyUrl: function () {
var clipboard = new ClipboardJS('.copyBtn');
var self = this;
clipboard.on('success', function (e) {
......@@ -160,31 +172,30 @@ var indexVue = new Vue({
});
},
//分类列表选中
handleSelectionChange:function(val){
handleSelectionChange: function (val) {
this.selectionList = val;
},
//删除
del: function(row){
del: function (row) {
var that = this;
that.$confirm('此操作将永久删除所选内容, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
ms.http.post(ms.manager+"/cms/category/delete.do", row.length?row:[row],{
}).then(function () {
ms.http.post(ms.manager + "/cms/category/delete.do", row.length ? row : [row], {
headers: {
'Content-Type': 'application/json'
}
}).then(
function(res){
}).then(function (res) {
if (res.result) {
that.$notify({
type: 'success',
message: '删除成功!'
});
//删除成功,刷新列表
}); //删除成功,刷新列表
that.list();
}else {
} else {
that.$notify({
title: '失败',
message: res.msg,
......@@ -192,7 +203,7 @@ var indexVue = new Vue({
});
}
});
}).catch(() => {
}).catch(function () {
that.$notify({
type: 'info',
message: '已取消删除'
......@@ -200,35 +211,38 @@ var indexVue = new Vue({
});
},
//表格数据转换
categoryTypeFormat(row, column, cellValue, index){
var value="";
if(cellValue){
var data = this.categoryTypeOptions.find(function(value){
return value.value==cellValue;
})
if(data&&data.label){
categoryTypeFormat: function (row, column, cellValue, index) {
var value = "";
if (cellValue) {
var data = this.categoryTypeOptions.find(function (value) {
return value.value == cellValue;
});
if (data && data.label) {
value = data.label;
}
}
return value;
},
//新增
save:function(id){
if(id){
location.href=this.manager+"/cms/category/form.do?id="+id;
}else {
location.href=this.manager+"/cms/category/form.do";
save: function (id) {
if (id) {
location.href = this.manager + "/cms/category/form.do?id=" + id;
} else {
location.href = this.manager + "/cms/category/form.do";
}
},
//重置表单
rest(){
rest: function () {
this.$refs.searchForm.resetFields();
}
},
},
created(){
created: function () {
/* this.categoryListUrlOptionsGet();
this.categoryUrlOptionsGet();*/
this.list();
},
})
}
});
</script>
......@@ -184,7 +184,7 @@
:limit="1"
:on-exceed="contentImghandleExceed"
:disabled="false"
:data="{uploadPath:'/cms/content','isRename':true,'appId':true}"
:data="{uploadPath:'/${appId}/cms/content','isRename':true}"
:on-success="contentImgSuccess"
accept="image/*"
list-type="picture-card">
......@@ -247,12 +247,16 @@
<script>
var form = new Vue({
el: '#form',
data() {
data: function () {
return {
saveDisabled: false,
activeName: 'form',
model:undefined,//自定义模型实例
editableTabs:[{title:'文章编辑',name:'form'}],
model: undefined,
//自定义模型实例
editableTabs: [{
title: '文章编辑',
name: 'form'
}],
editorConfig: {
imageScaleEnabled: true,
autoHeightEnabled: true,
......@@ -263,12 +267,12 @@
maximumWords: 2000,
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/cms/content/editor/%7Btime%7D\',filePathFormat:\'/upload/cms/content/editor/%7Btime%7D\',videoPathFormat:\'/upload/cms/content/editor/%7Btime%7D\'%7D",
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",
UEDITOR_HOME_URL: ms.base + '/static/plugins/ueditor/1.4.3.1/'
},
contentCategoryIdOptions: [],
returnIsShow: true,
type:'',
type: '',
//表单数据
form: {
// 文章标题
......@@ -292,74 +296,100 @@
// 关键字
contentKeyword: '',
// 文章内容
contentDetails: '',
contentDetails: ''
},
contentTypeOptions: [],
categoryIdOptions: [],
contentDisplayOptions: [{"value": "0", "label": "是"}, {"value": "1", "label": "否"}],
contentDisplayOptions: [{
"value": "0",
"label": "是"
}, {
"value": "1",
"label": "否"
}],
rules: {
// 文章标题
contentTitle: [{"required": true, "message": "请选择文章标题"}],
contentTitle: [{
"required": true,
"message": "请选择文章标题"
}],
// 发布时间
contentDatetime: [{"required": true, "message": "发布时间不能为空"}],
contentCategoryId: [{"required": true, "message": "所属栏目不能为空"}],
},
}
contentDatetime: [{
"required": true,
"message": "发布时间不能为空"
}],
contentCategoryId: [{
"required": true,
"message": "所属栏目不能为空"
}]
}
};
},
watch: {},
computed:{
currCategory(){
computed: {
currCategory: function () {
var that = this;
return this.categoryIdOptions.find(function(value){
return value.id===that.form.contentCategoryId
})
},
return this.categoryIdOptions.find(function (value) {
return value.id === that.form.contentCategoryId;
});
}
},
methods: {
save() {
var that = this;
//自定义模型需要验证
if(this.model&&!this.model.validate()){
save: function () {
var _this = this;
var that = this; //自定义模型需要验证
if (this.model && !this.model.validate()) {
this.activeName = 'custom-name';
return;
}
var url = ms.manager + "/cms/content/save.do"
var url = ms.manager + "/cms/content/save.do";
if (that.form.id > 0) {
url = ms.manager + "/cms/content/update.do";
}
this.$refs.form[0].validate((valid) => {
this.$refs.form[0].validate(function (valid) {
if (valid) {
that.saveDisabled = true;
//判断
if(that.categoryIdOptions.filter(f => f['id'] == that.form.contentCategoryId)[0].categoryType == '2' && that.returnIsShow){
that.saveDisabled = true; //判断
if (that.categoryIdOptions.filter(function (f) {
return f['id'] == that.form.contentCategoryId;
})[0].categoryType == '2' && that.returnIsShow) {
that.$notify({
title: '提示',
message: '所属栏目不能为封面',
type: 'error'
});
that.saveDisabled = false;
return
return;
}
var data = JSON.parse(JSON.stringify(that.form));
if(data.contentType !=null){
if (data.contentType != null) {
data.contentType = data.contentType.join(',');
}
data.contentImg = JSON.stringify(data.contentImg);
ms.http.post(url, data).then(function (data) {
if (data.result) {
//保存时需要赋值关联ID
if(that.model){
if (that.model) {
that.model.form.linkId = data.data.id;
that.model.save()
that.model.save();
}
that.$notify({
title: '成功',
message: '保存成功',
type: 'success'
});
if(that.returnIsShow){
javascript:history.go(-1);
if (that.returnIsShow) {
javascript: history.go(-1);
}
} else {
that.$notify({
......@@ -368,101 +398,109 @@
type: 'warning'
});
}
that.saveDisabled = false;
});
} else {
this.activeName = 'form';
_this.activeName = 'form';
return false;
}
})
});
},
removeModel(){
var that =this;
var model= document.getElementById('model1')
var custom= document.getElementById('c_model')
if(custom){
model.removeChild(custom)
removeModel: function () {
var that = this;
var model = document.getElementById('model1');
var custom = document.getElementById('c_model');
if (custom) {
model.removeChild(custom);
}
that.model = undefined;
},
categoryChange(){
categoryChange: function () {
this.changeModel();
},
changeModel(){
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
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))
if (data.data && data.data.id) {
that.rederModel(data.data, JSON.parse(data.data.modelJson));
}
})
});
}
}
},
rederModel(modelEntity,data){
var that =this;
rederModel: function (modelEntity, data) {
var that = this;
that.editableTabs.push({
title: modelEntity.modelName,
name: 'custom-name',
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;
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
},
}
})
div.appendChild(con); //初始化自定义模型并传入关联参数
})
that.model = new custom_model({
data: {
title: modelEntity.modelName,
modelId: modelEntity.id,
form: {
linkId: that.form.id
}
}
});
});
},
getValue(data) {
getValue: function (data) {
this.form.contentCategoryId = data.id;
},
//获取当前文章
get(id) {
get: function (id) {
var that = this;
ms.http.get(ms.manager + "/cms/content/get.do", {"id": id}).then(function (res) {
ms.http.get(ms.manager + "/cms/content/get.do", {
"id": id
}).then(function (res) {
if (res.result && res.data) {
if (res.data.contentType&&res.data.contentType!='') {
res.data.contentType = res.data.contentType.split(',');
}
else {
} else {
res.data.contentType = [];
}
if (res.data.contentImg) {
res.data.contentImg = JSON.parse(res.data.contentImg);
res.data.contentImg.forEach(function (value) {
value.url = ms.base + value.path
})
value.url = ms.base + value.path;
});
} else {
res.data.contentImg = []
res.data.contentImg = [];
}
that.form = res.data;
var category = that.categoryIdOptions.filter(f => f['id'] == that.form.contentCategoryId);
if(category.length == 1){
if(category[0].categoryType == '2'){
var category = that.categoryIdOptions.filter(function (f) {
return f['id'] == that.form.contentCategoryId;
});
if (category.length == 1) {
if (category[0].categoryType == '2') {
that.returnIsShow = false;
}
}
......@@ -473,9 +511,11 @@
});
},
//获取contentCategoryId数据源
contentCategoryIdOptionsGet() {
contentCategoryIdOptionsGet: function () {
var that = this;
ms.http.get(ms.manager + "/cms/category/list.do", {pageSize: 9999}).then(function (res) {
ms.http.get(ms.manager + "/cms/category/list.do", {
pageSize: 9999
}).then(function (res) {
if (res.result) {
that.contentCategoryIdOptions = ms.util.treeData(res.data.rows, 'id', 'categoryId', 'children');
that.categoryIdOptions = res.data.rows;
......@@ -486,9 +526,12 @@
});
},
//获取contentType数据源
contentTypeOptionsGet() {
contentTypeOptionsGet: function () {
var that = this;
ms.http.get(ms.base + '/mdiy/dict/list.do', {dictType: '文章属性', pageSize: 99999}).then(function (data) {
ms.http.get(ms.base + '/mdiy/dict/list.do', {
dictType: '文章属性',
pageSize: 99999
}).then(function (data) {
that.contentTypeOptions = data.rows;
}).catch(function (err) {
console.log(err);
......@@ -496,66 +539,70 @@
},
//contentImg文件上传完成回调
contentImgSuccess: function (response, file, fileList) {
this.form.contentImg.push({url: file.url, name: file.name, path: response, uid: file.uid});
this.form.contentImg.push({
url: file.url,
name: file.name,
path: response,
uid: file.uid
});
},
contentImghandleRemove: function (file, files) {
var index = -1;
index = this.form.contentImg.findIndex(text => text == file);
index = this.form.contentImg.findIndex(function (text) {
return text == file;
});
if (index != -1) {
this.form.contentImg.splice(index, 1);
}
},
//contentImg文件上传完成回调
contentImgSuccess: function (response, file, fileList) {
this.form.contentImg.push({url: file.url, name: file.name, path: response, uid: file.uid});
},
//上传超过限制
contentImghandleExceed: function (files, fileList) {
this.$notify({title: '当前最多上传1个文件', type: 'warning'});
},
contentImghandleRemove: function (file, files) {
var index = -1;
index = this.form.contentImg.findIndex(text => text == file);
if (index != -1) {
this.form.contentImg.splice(index, 1);
}
this.$notify({
title: '当前最多上传1个文件',
type: 'warning'
});
},
//查询列表
list: function (contentCategoryId) {
var that = this;
ms.http.post(ms.manager + "/cms/content/list.do", {
contentCategoryId: contentCategoryId,
contentCategoryId: contentCategoryId
}).then(function (res) {
if (res.result && res.data.total > 0) {
if (res.data.rows[0].contentType) {
res.data.rows[0].contentType = res.data.rows[0].contentType.split(',');
}
if (res.data.rows[0].contentImg) {
res.data.rows[0].contentImg = JSON.parse(res.data.rows[0].contentImg);
res.data.rows[0].contentImg.forEach(function (value) {
value.url = ms.base + value.path
})
value.url = ms.base + value.path;
});
} else {
res.data.rows[0].contentImg = []
res.data.rows[0].contentImg = [];
}
that.form = res.data.rows[0];
}
}).catch(function (err) {
console.log(err);
});
}
},
},
created() {
created: function () {
this.contentCategoryIdOptionsGet();
this.contentTypeOptionsGet();
this.form.id = ms.util.getParameter("id");
if(ms.util.getParameter("categoryId") != 'undefined' && ms.util.getParameter("categoryId") != 'null'){
if (ms.util.getParameter("categoryId") != 'undefined' && ms.util.getParameter("categoryId") != 'null') {
this.form.contentCategoryId = ms.util.getParameter("categoryId");
}
this.type = ms.util.getParameter("type");
if (this.form.id) {
this.get(this.form.id);
}
if (this.type) {
this.list(this.form.contentCategoryId);
this.returnIsShow = false;
......
......@@ -25,75 +25,78 @@
var indexVue = new Vue({
el: "#index",
data: {
action:"", //跳转页面
action: "",
//跳转页面
defaultProps: {
children: 'children',
label: 'categoryTitle'
},
treeData:[],
loading:true,
emptyText:'',
treeData: [],
loading: true,
emptyText: ''
},
methods:{
handleNodeClick: function(data){
if(data.categoryType == '1'){
this.action = ms.manager +"/cms/content/main.do?categoryId="+data.id;
} else if(data.categoryType == '2'){
this.action = ms.manager +"/cms/content/form.do?categoryId="+data.id+"&type=2";
} else{
this.action = ms.manager +"/cms/content/main.do";
methods: {
handleNodeClick: function (data) {
if (data.categoryType == '1') {
this.action = ms.manager + "/cms/content/main.do?categoryId=" + data.id;
} else if (data.categoryType == '2') {
this.action = ms.manager + "/cms/content/form.do?categoryId=" + data.id + "&type=2";
} else {
this.action = ms.manager + "/cms/content/main.do";
}
},
treeList: function(){
treeList: function () {
var that = this;
this.loadState = false;
this.loading = true;
ms.http.get(ms.manager+"/cms/category/list.do",{
pageSize:999,
}).then(
function(res) {
if(that.loadState){
ms.http.get(ms.manager + "/cms/category/list.do", {
pageSize: 999
}).then(function (res) {
if (that.loadState) {
that.loading = false;
}else {
that.loadState = true
} else {
that.loadState = true;
}
if (!res.result||res.data.total <= 0) {
if (!res.result || res.data.total <= 0) {
that.emptyText = '暂无数据';
that.treeData = [];
} else {
that.emptyText = '';
that.treeData = ms.util.treeData(res.data.rows,'id','categoryId','children');
that.treeData = ms.util.treeData(res.data.rows, 'id', 'categoryId', 'children');
that.treeData = [{
id:0,
categoryTitle:'全部',
children: that.treeData,
}]
id: 0,
categoryTitle: '全部',
children: that.treeData
}];
}
}).catch(function(err) {
}).catch(function (err) {
console.log(err);
});
setTimeout(()=>{
if(that.loadState){
setTimeout(function () {
if (that.loadState) {
that.loading = false;
}else {
that.loadState = true
} else {
that.loadState = true;
}
}, 500);
}
},
},
mounted(){
this.action = ms.manager +"/cms/content/main.do";
mounted: function () {
this.action = ms.manager + "/cms/content/main.do";
this.treeList();
}
})
});
</script>
<style>
#index .index-menu {
height: 100vh;
min-height: 100vh;
min-width: 140px;
}
#index .ms-iframe-style {
width: 100%;
height: 100%;
border: 0;
}
......
......@@ -49,7 +49,7 @@
<el-col :span="8" style="text-align: right;padding-right: 10px;">
<el-button type="primary" icon="el-icon-search" size="mini" @click="form.sqlWhere=null;currentPage=1;list()">查询</el-button>
<el-button @click="rest" icon="el-icon-refresh" size="mini">重置</el-button>
<el-button type="primary"size="mini" @click="$refs.search.open()"><i class="iconfont icon-shaixuan"></i>筛选</el-button>
<el-button type="primary" size="mini" @click="$refs.search.open()"><i class="iconfont icon-shaixuan"></i>筛选</el-button>
</el-col>
</el-row>
</el-form>
......@@ -122,81 +122,195 @@
<script>
var indexVue = new Vue({
el: '#main',
data:{
conditionList:[
{action:'and', field: 'content_title', el: 'eq', model: 'contentTitle', name: '文章标题', type: 'input'},
{action:'and', field: 'content_category_id', el: 'eq', model: 'contentCategoryId', name: '所属栏目', key:'id',title:'categoryTitle', type: 'cascader', multiple: false},
{action:'and', field: 'content_type', el: 'eq', model: 'contentType', name: '文章类型', key:'dictValue',title:'dictLabel', type: 'checkbox', label: false, multiple: true},
{action:'and', field: 'content_display', el: 'eq', model: 'contentDisplay', name: '是否显示', type: 'radio', label: true, multiple: false},
{action:'and', field: 'content_author', el: 'eq', model: 'contentAuthor', name: '文章作者', type: 'input'},
{action:'and', field: 'content_source', el: 'eq', model: 'contentSource', name: '文章来源', type: 'input'},
{action:'and', field: 'content_datetime', model: 'contentDatetime', el: 'gt', name: '发布时间', type: 'date'},
{action:'and', field: 'content_sort', el: 'eq', model: 'contentSort', name: '自定义顺序', type: 'number'},
{action:'and', field: 'content_description', el: 'eq', model: 'contentDescription', name: '描述', type: 'textarea'},
{action:'and', field: 'content_keyword', el: 'eq', model: 'contentKeyword', name: '关键字', type: 'textarea'},
{action:'and', field: 'content_details', el: 'like', model: 'contentDetails', name: '文章内容', type: 'input'},
{action:'and', field: 'content_url', el: 'eq', model: 'contentUrl', name: '文章跳转链接地址', type: 'input'},
{action:'and', field: 'appid', el: 'eq', model: 'appid', name: '文章管理的应用id', type: 'number'},
{action:'and', field: 'create_date', el: 'eq', model: 'createDate', name: '创建时间', type: 'date'},
{action:'and', field: 'update_date', el: 'eq', model: 'updateDate', name: '修改时间', type: 'date'},
],
conditions:[],
contentCategoryIdOptions:[],
dataList: [], //文章列表
selectionList:[],//文章列表选中
total: 0, //总记录数量
pageSize: 10, //页面数量
currentPage:1, //初始页
data: {
conditionList: [{
action: 'and',
field: 'content_title',
el: 'eq',
model: 'contentTitle',
name: '文章标题',
type: 'input'
}, {
action: 'and',
field: 'content_category_id',
el: 'eq',
model: 'contentCategoryId',
name: '所属栏目',
key: 'id',
title: 'categoryTitle',
type: 'cascader',
multiple: false
}, {
action: 'and',
field: 'content_type',
el: 'eq',
model: 'contentType',
name: '文章类型',
key: 'dictValue',
title: 'dictLabel',
type: 'checkbox',
label: false,
multiple: true
}, {
action: 'and',
field: 'content_display',
el: 'eq',
model: 'contentDisplay',
name: '是否显示',
type: 'radio',
label: true,
multiple: false
}, {
action: 'and',
field: 'content_author',
el: 'eq',
model: 'contentAuthor',
name: '文章作者',
type: 'input'
}, {
action: 'and',
field: 'content_source',
el: 'eq',
model: 'contentSource',
name: '文章来源',
type: 'input'
}, {
action: 'and',
field: 'content_datetime',
model: 'contentDatetime',
el: 'gt',
name: '发布时间',
type: 'date'
}, {
action: 'and',
field: 'content_sort',
el: 'eq',
model: 'contentSort',
name: '自定义顺序',
type: 'number'
}, {
action: 'and',
field: 'content_description',
el: 'eq',
model: 'contentDescription',
name: '描述',
type: 'textarea'
}, {
action: 'and',
field: 'content_keyword',
el: 'eq',
model: 'contentKeyword',
name: '关键字',
type: 'textarea'
}, {
action: 'and',
field: 'content_details',
el: 'like',
model: 'contentDetails',
name: '文章内容',
type: 'input'
}, {
action: 'and',
field: 'content_url',
el: 'eq',
model: 'contentUrl',
name: '文章跳转链接地址',
type: 'input'
}, {
action: 'and',
field: 'appid',
el: 'eq',
model: 'appid',
name: '文章管理的应用id',
type: 'number'
}, {
action: 'and',
field: 'create_date',
el: 'eq',
model: 'createDate',
name: '创建时间',
type: 'date'
}, {
action: 'and',
field: 'update_date',
el: 'eq',
model: 'updateDate',
name: '修改时间',
type: 'date'
}],
conditions: [],
contentCategoryIdOptions: [],
dataList: [],
//文章列表
selectionList: [],
//文章列表选中
total: 0,
//总记录数量
pageSize: 10,
//页面数量
currentPage: 1,
//初始页
manager: ms.manager,
loadState:false,
loading: true,//加载状态
emptyText:'',//提示文字
contentTypeOptions:[],
contentDisplayOptions:[{"value":"0","label":"是"},{"value":"1","label":"否"}],
loadState: false,
loading: true,
//加载状态
emptyText: '',
//提示文字
contentTypeOptions: [],
contentDisplayOptions: [{
"value": "0",
"label": "是"
}, {
"value": "1",
"label": "否"
}],
//搜索表单
form:{
sqlWhere:null,
form: {
sqlWhere: null,
// 文章标题
contentTitle:null,
contentTitle: null,
// 文章类型
contentType:null,
contentCategoryId:'',
},
contentType: null,
contentCategoryId: ''
}
},
methods:{
methods: {
//查询列表
list: function() {
list: function () {
var that = this;
that.loading = true;
that.loadState = false;
var page={
var page = {
pageNo: that.currentPage,
pageSize : that.pageSize
}
var form = JSON.parse(JSON.stringify(that.form))
if(form.contentType.length > 0){
pageSize: that.pageSize
};
var form = JSON.parse(JSON.stringify(that.form));
if (form.contentType.length > 0) {
form.contentType = form.contentType.join(',');
}
for (key in form){
if(!form[key]){
delete form[key]
for (var key in form) {
if (!form[key]) {
delete form[key];
}
}
history.replaceState({form:form,page:page},"");
ms.http.post(ms.manager+"/cms/content/list.do",form.sqlWhere?{
sqlWhere:form.sqlWhere,
...page
}:{...form,
...page
}).then(
function(res) {
if(that.loadState){
history.replaceState({
form: form,
page: page
}, "");
ms.http.post(ms.manager + "/cms/content/list.do", form.sqlWhere ? Object.assign({}, {
sqlWhere: form.sqlWhere
}, page) : Object.assign({}, that.form, page)).then(function (res) {
if (that.loadState) {
that.loading = false;
}else {
that.loadState = true
} else {
that.loadState = true;
}
if (!res.result||res.data.total <= 0) {
that.emptyText = '暂无数据'
if (!res.result || res.data.total <= 0) {
that.emptyText = '暂无数据';
that.dataList = [];
that.total = 0;
} else {
......@@ -204,44 +318,43 @@
that.total = res.data.total;
that.dataList = res.data.rows;
}
}).catch(function(err) {
}).catch(function (err) {
that.loading = false;
console.log(err);
});
setTimeout(()=>{
if(that.loadState){
setTimeout(function () {
if (that.loadState) {
that.loading = false;
}else {
that.loadState = true
} else {
that.loadState = true;
}
}, 500);
},
//文章列表选中
handleSelectionChange:function(val){
handleSelectionChange: function (val) {
this.selectionList = val;
},
//删除
del: function(row){
del: function (row) {
var that = this;
that.$confirm('此操作将永久删除所选内容, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
ms.http.post(ms.manager+"/cms/content/delete.do", row.length?row:[row],{
}).then(function () {
ms.http.post(ms.manager + "/cms/content/delete.do", row.length ? row : [row], {
headers: {
'Content-Type': 'application/json'
}
}).then(
function(res){
}).then(function (res) {
if (res.result) {
that.$notify({
type: 'success',
message: '删除成功!'
});
//删除成功,刷新列表
}); //删除成功,刷新列表
that.list();
}else {
} else {
that.$notify({
title: '失败',
message: res.msg,
......@@ -249,7 +362,7 @@
});
}
});
}).catch(() => {
}).catch(function () {
that.$notify({
type: 'info',
message: '已取消删除'
......@@ -257,100 +370,112 @@
});
},
//新增
save:function(id){
if(id){
location.href=this.manager+"/cms/content/form.do?id="+id;
}else {
location.href=this.manager+"/cms/content/form.do?categoryId="+this.form.contentCategoryId;
save: function (id) {
if (id) {
location.href = this.manager + "/cms/content/form.do?id=" + id;
} else {
location.href = this.manager + "/cms/content/form.do?categoryId=" + this.form.contentCategoryId;
}
},
//表格数据转换
contentCategoryIdFormat(row, column, cellValue, index){
var value="";
if(cellValue){
var data = this.contentCategoryIdOptions.find(function(value){
return value.id==cellValue;
})
if(data&&data.categoryTitle){
contentCategoryIdFormat: function (row, column, cellValue, index) {
var value = "";
if (cellValue) {
var data = this.contentCategoryIdOptions.find(function (value) {
return value.id == cellValue;
});
if (data && data.categoryTitle) {
value = data.categoryTitle;
}
}
return value;
},
dateFormat: function(row, column, cellValue, index){
if(cellValue){
return ms.util.date.fmt(cellValue,'yyyy-MM-dd');
dateFormat: function (row, column, cellValue, index) {
if (cellValue) {
return ms.util.date.fmt(cellValue, 'yyyy-MM-dd');
} else {
return ''
return '';
}
},
contentDisplayFormat(row, column, cellValue, index){
var value="";
if(cellValue){
var data = this.contentDisplayOptions.find(function(value){
return value.value==cellValue;
})
if(data&&data.label){
contentDisplayFormat: function (row, column, cellValue, index) {
var value = "";
if (cellValue) {
var data = this.contentDisplayOptions.find(function (value) {
return value.value == cellValue;
});
if (data && data.label) {
value = data.label;
}
}
return value;
},
//pageSize改变时会触发
sizeChange:function(pagesize) {
sizeChange: function (pagesize) {
this.loading = true;
this.pageSize = pagesize;
this.list();
},
//currentPage改变时会触发
currentChange:function(currentPage) {
currentChange: function (currentPage) {
this.loading = true;
this.currentPage = currentPage;
this.list();
},
search(data){
search: function (data) {
this.form.sqlWhere = JSON.stringify(data);
this.list();
},
//重置表单
rest(){
rest: function () {
this.form.sqlWhere = null;
this.$refs.searchForm.resetFields();
this.list();
},
//获取contentCategoryId数据源
contentCategoryIdOptionsGet() {
contentCategoryIdOptionsGet: function () {
var that = this;
ms.http.get(ms.manager+"/cms/category/list.do",{pageSize:9999}).then(function(res){
if(res.result){
ms.http.get(ms.manager + "/cms/category/list.do", {
pageSize: 9999
}).then(function (res) {
if (res.result) {
that.contentCategoryIdOptions = res.data.rows;
}
that.list();
}).catch(function(err){
}).catch(function (err) {
console.log(err);
});
},
//获取contentType数据源
contentTypeOptionsGet() {
contentTypeOptionsGet: function () {
var that = this;
ms.http.get(ms.base+'/mdiy/dict/list.do', {dictType:'文章属性',pageSize:99999}).then(function (data) {
ms.http.get(ms.base + '/mdiy/dict/list.do', {
dictType: '文章属性',
pageSize: 99999
}).then(function (data) {
that.contentTypeOptions = data.rows;
}).catch(function (err) {
console.log(err);
});
}
},
},
mounted(){
mounted: function () {
this.contentCategoryIdOptionsGet();
this.contentTypeOptionsGet();
this.form.contentCategoryId = ms.util.getParameter("categoryId")
if(history.state){
this.form.contentCategoryId = ms.util.getParameter("categoryId");
if (history.hasOwnProperty("state")) {
this.form = history.state.form;
this.currentPage = history.state.page.pageNo;
this.pageSize = history.state.page.pageSize;
}
},
})
}
});
</script>
<style>
#main .ms-search {
......
......@@ -119,113 +119,163 @@
</body>
</html>
<script>
"use strict";
var app = new Vue({
el: '#app',
watch:{
},
watch: {},
data: {
homeLoading:false,
articleLoading:false,
columnLoading:false,
template:'index.htm',//主题模板
templateOptions:[],
position:'index', //位置
contentSection:'0', //文章栏目
section:'0', //栏目
time:ms.util.date.fmt(new Date(),"yyyy-MM-dd"),
treeList:[{
id:'0',
categoryTitle:'顶级栏目',
children:[],
}],
homeLoading: false,
articleLoading: false,
columnLoading: false,
template: '',
//主题模板
templateOptions: [],
position: 'index',
//位置
contentSection: '0',
//文章栏目
section: '0',
//栏目
time: ms.util.date.fmt(new Date(), "yyyy-MM-dd"),
treeList: [{
id: '0',
categoryTitle: '顶级栏目',
children: []
}]
},
methods: {
//更新主页
updataIndex(){
updataIndex: function () {
var that = this;
if(!that.position || that.position == ''){
this.$notify({ title: '请输入主页位置!', type: 'warning' });
if (!that.position || that.position == '') {
this.$notify({
title: '请输入主页位置!',
type: 'warning'
});
return;
}
that.homeLoading = true;
ms.http.post(ms.manager+'/cms/generate//generateIndex.do', {url:that.template,position:that.position}).then(function (data) {
if(data.result){
that.$notify({ title: '更新成功!', type: 'success' });
}else {
that.$notify({ title: '更新失败!',message: "错误", type: 'error' });
ms.http.post(ms.manager + '/cms/generate//generateIndex.do', {
url: that.template,
position: that.position
}).then(function (data) {
if (data.result) {
that.$notify({
title: '更新成功!',
type: 'success'
});
} else {
that.$notify({
title: '更新失败!',
message: "错误",
type: 'error'
});
}
}).catch(function (err) {
that.$notify({ title: '更新失败!',message: err, type: 'error' });
that.$notify({
title: '更新失败!',
message: err,
type: 'error'
});
console.log(err);
}).finally(()=>{
}).finally(function () {
that.homeLoading = false;
});
},
//预览主页
viewIndex(){
if(!this.position || this.position == ''){
this.$notify({ title: '请输入主页位置!', type: 'warning' });
viewIndex: function () {
if (!this.position || this.position == '') {
this.$notify({
title: '请输入主页位置!',
type: 'warning'
});
return;
}
window.open(ms.manager+"/cms/generate/"+this.position+"/viewIndex.do");
window.open(ms.manager + "/cms/generate/" + this.position + "/viewIndex.do");
},
//更新栏目
updateColumn(){
updateColumn: function () {
var that = this;
that.columnLoading = true;
ms.http.get(ms.manager+'/cms/generate/'+(that.section?that.section:0)+'/genernateColumn.do').then(function (data) {
if(data.result){
that.$notify({ title: '更新成功!', type: 'success' });
ms.http.get(ms.manager + '/cms/generate/' + (that.section ? that.section : 0) + '/genernateColumn.do').then(function (data) {
if (data.result) {
that.$notify({
title: '更新成功!',
type: 'success'
});
}
}).catch(function (err) {
that.$notify({ title: '更新失败!',message: err, type: 'error' });
that.$notify({
title: '更新失败!',
message: err,
type: 'error'
});
console.log(err);
}).finally(()=>{
}).finally(function () {
that.columnLoading = false;
});
},
//生成文章栏目
updateArticle(){
updateArticle: function () {
var that = this;
that.articleLoading = true;
ms.http.post(ms.manager+'/cms/generate/'+(that.contentSection?that.contentSection:0)+'/generateArticle.do', {dateTime:that.time}).then(function (data) {
if(data.result){
that.$notify({ title: '更新成功!', type: 'success' });
ms.http.post(ms.manager + '/cms/generate/' + (that.contentSection ? that.contentSection : 0) + '/generateArticle.do', {
dateTime: that.time
}).then(function (data) {
if (data.result) {
that.$notify({
title: '更新成功!',
type: 'success'
});
}
}).catch(function (err) {
that.$notify({ title: '更新失败!',message: err, type: 'error' });
that.$notify({
title: '更新失败!',
message: err,
type: 'error'
});
console.log(err);
}).finally(()=>{
}).finally(function () {
that.articleLoading = false;
});
},
//获取主题模板数据源
templateOptionsGet() {
templateOptionsGet: function () {
var that = this;
ms.http.get(ms.manager+'/template/queryTemplateFileForColumn.do', {pageSize:99999}).then(function (data) {
that.templateOptions = data.data;
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);
});
},
getTree(){
getTree: function () {
var that = this;
ms.http.get(ms.manager+"/cms/category/list.do",{pageSize:9999}).then(function(res){
if(res.result){
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[0].children = ms.util.treeData(res.data.rows,'id','categoryId','children');
that.treeList[0].children = ms.util.treeData(res.data.rows, 'id', 'categoryId', 'children');
}
}).catch(function(err){
}).catch(function (err) {
console.log(err);
});
}
},
},
created(){
created: function () {
this.getTree();
this.templateOptionsGet();
}
})
});
</script>
<style>
input{
......
......@@ -427,92 +427,115 @@
<script>
var app = new Vue({
el: '#app',
watch:{
},
watch: {},
data: {
base:ms.base,
base: ms.base,
msNewsLast: '',
msNewsPath: ''
},
methods: {
jumpArtcleManager(){
window.parent.indexVue.openMenu({modelId:706,modelTitle:'文章管理',modelIcon: "icon-neirongguanli"});
jumpArtcleManager: function () {
window.parent.indexVue.openMenu({
modelId: 706,
modelTitle: '文章管理',
modelIcon: "icon-neirongguanli"
});
},
//栏目管理
jumpCategorymanager(){
window.parent.indexVue.open({"modelId":708,"modelTitle":"栏目管理","modelModelId":706,"modelUrl":"cms/category/index.do"});
jumpCategorymanager: function () {
window.parent.indexVue.open({
"modelId": 708,
"modelTitle": "栏目管理",
"modelModelId": 706,
"modelUrl": "cms/category/index.do"
});
},
//静态化
jumpStaticManager(){
window.parent.indexVue.open({"modelId":406,"modelTitle":"静态化","modelModelId":23,"modelUrl":"cms/generate/index.do"});
jumpStaticManager: function () {
window.parent.indexVue.open({"modelId":709,"modelTitle":"静态化","modelModelId":706,"modelUrl":"cms/generate/index.do"});
},
//管理员管理
jumpAdmininstatorManager(){
window.parent.indexVue.open({"modelId":411,"modelTitle":"管理员管理","modelModelId":23,"modelUrl":"basic/manager/index.do"});
jumpAdmininstatorManager: function () {
window.parent.indexVue.open({
"modelId": 411,
"modelTitle": "管理员管理",
"modelModelId": 23,
"modelUrl": "basic/manager/index.do"
});
},
//角色管理
jumpUserManager(){
window.parent.indexVue.open({"modelId":406,"modelTitle":"角色管理","modelModelId":23,"modelUrl":"basic/role/index.do"});
jumpUserManager: function () {
window.parent.indexVue.open({
"modelId": 406,
"modelTitle": "角色管理",
"modelModelId": 23,
"modelUrl": "basic/role/index.do"
});
},
//菜单管理
jumpMenuManager(){
window.parent.indexVue.open({"modelId":183,"modelTitle":"菜单管理","modelModelId":23,"modelUrl":"model/index.do"});
jumpMenuManager: function () {
window.parent.indexVue.open({
"modelId": 183,
"modelTitle": "菜单管理",
"modelModelId": 23,
"modelUrl": "model/index.do"
});
},
//模板管理
jumpTemplateManager(){
window.parent.indexVue.open({"modelId":87,"modelTitle":"模板管理","modelModelId":84,"modelUrl":"template/index.do"});
jumpTemplateManager: function () {
window.parent.indexVue.open({
"modelId": 87,
"modelTitle": "模板管理",
"modelModelId": 84,
"modelUrl": "template/index.do"
});
},
//应用管理
jumpApplicationManager(){
window.parent.indexVue.open({"modelId":86,"modelTitle":"应用管理","modelModelId":84,"modelUrl":"app/-1/edit.do"});
jumpApplicationManager: function () {
window.parent.indexVue.open({
"modelId": 86,
"modelTitle": "应用管理",
"modelModelId": 84,
"modelUrl": "app/-1/edit.do"
});
},
//铭飞开发文档
jumpMCMSDocument(){
jumpMCMSDocument: function () {
window.open("http://doc.ms.mingsoft.net/plugs-cms/");
},
enterQQOneGroup(){
enterQQOneGroup: function () {
window.open("https://shang.qq.com/wpa/qunwpa?idkey=ebf251dc9758de6b9c78c499956431cba73e28b3f0b72c0fc28242e98b20fca2");
},
enterQQTwoGroup(){
enterQQTwoGroup: function () {
window.open("http://shang.qq.com/wpa/qunwpa?idkey=cfb32b0f47d89d7ef1c3a9493984d4ffbdfe14049fdedd90c517a072e90d68b9");
},
enterQQThreeGroup(){
enterQQThreeGroup: function () {
window.open("http://shang.qq.com/wpa/qunwpa?idkey=5dd11fdb492c4ded090fa1f78a166583978e33c4a61301b136d31e9e3eb7df72");
},
enterQQFourGroup(){
enterQQFourGroup: function () {
window.open("http://shang.qq.com/wpa/qunwpa?idkey=565f1e4c4fabeee42947f6c6b96ac7ca4853dece16559d3d78e944ca2931b7f5");
},
addBusinessQQ(){
addBusinessQQ: function () {
window.open("http://wpa.qq.com/msgrd?v=3&uin=3336073455&site=qq&menu=yes");
},
//打开铭飞消息页面
openMCMSNews(){
openMCMSNews: function () {
window.open(this.msNewsPath);
},
getNewsLast(){
getNewsLast: function () {
var that = this;
axios.create({
withCredentials: true
}).get("https://ms.mingsoft.net/cms/content/list.do?contentCategoryId=202").then(function (res){
}).get("https://ms.mingsoft.net/cms/content/list.do?contentCategoryId=202").then(function (res) {
that.msNewsLast = res.data.data.rows[0].contentTitle.toString();
that.msNewsPath = 'https://ms.mingsoft.net/html/1/203/202/'+res.data.data.rows[0].id+'.html'
})
that.msNewsPath = 'https://ms.mingsoft.net/html/1/203/202/' + res.data.data.rows[0].id + '.html';
});
}
},
created(){
this.getNewsLast()
created: function () {
this.getNewsLast();
}
})
});
</script>
<style>
.custom-body {
......
//ie的兼容
//Object.assign 对ie对支持
if (typeof Object.assign != 'function') {
Object.assign = function(target) {
'use strict';
......
......@@ -9,6 +9,8 @@
function(config) {
config.headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'Cache-Control': 'no-cache',
'Pragma': 'no-cache',
'X-Requested-With': 'XMLHttpRequest'
}
if (config.method === 'post' && config.headers["Content-Type"] === "application/x-www-form-urlencoded") {
......
......@@ -20,23 +20,38 @@
log(e.message);
}
}
//树形数据组织
function treeData (source, id, parentId, children) {
let cloneData = JSON.parse(JSON.stringify(source))
return cloneData.filter(father => {
let branchArr = cloneData.filter(child => father[id] == child[parentId]);
branchArr.length > 0 ? father[children] = branchArr : ''
return !father[parentId]||father[parentId]=='0' // 如果第一层不是parentId=0,请自行修改
})
/**
* 列表数据转化为树形结构的列表
* @param source 数据源list
* @param id 编号
* @param parentId 父级编号
* @param children 树形子集变量
* @returns {*}
* 支持父级编号为 0或null
* 原始数据[{id:1,titile:"标题",pid:0},{id:2,titile:"标题",pid:1}]
* 转化树形数据:[{id:1,titile:"标题",pid:0,children:[{id:2,titile:"标题",pid:1}]}]
*/
function treeData(source, id, parentId, children) {
var cloneData = JSON.parse(JSON.stringify(source));
return cloneData.filter(function (father) {
var branchArr = cloneData.filter(function (child) {
return father[id] == child[parentId];
});
branchArr.length > 0 ? father[children] = branchArr : '';
return !father[parentId] || father[parentId] == '0' || father[parentId] == null ;
});
}
//验证是否为子集
function childValidate (sourceList,id,parentId,key,parentKey){
var data=sourceList.find(x=>x[key]==parentId);
if(data&&data[parentKey]!='0'&&data[parentKey]){
if(id==data[parentKey]){
return false
function childValidate(sourceList, id, parentId, key, parentKey) {
var data = sourceList.find(function (x) {
return x[key] == parentId;
});
if (data && data[parentKey] != '0' && data[parentKey]) {
if (id == data[parentKey]) {
return false;
}
return childValidate(sourceList,id,data[parentKey],key,parentKey)
return childValidate(sourceList, id, data[parentKey], key, parentKey);
}
return true;
}
......@@ -44,9 +59,8 @@
//日期处理
var date = {
//格式化时间
fmt: function(date, fmt) {
var date = new Date(date);
log(fmt);
fmt: function(de, fmt) {
var date = new Date(typeof de == "string"?de.replace(/-/g, "/"):de);
if (!fmt) {
fmt = "yyyy-mm-dd";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment